2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2004-03-17 22:14:18 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* gimppatternfactoryview.c
|
|
|
|
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2004-03-17 22:14:18 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2004-03-17 22:14:18 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2004-03-17 22:14:18 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
|
|
|
#include "widgets-types.h"
|
|
|
|
|
|
|
|
#include "core/gimpcontainer.h"
|
|
|
|
#include "core/gimpdatafactory.h"
|
2004-03-18 02:49:44 +08:00
|
|
|
#include "core/gimpviewable.h"
|
2004-03-17 22:14:18 +08:00
|
|
|
|
|
|
|
#include "gimpcontainerview.h"
|
2007-01-23 00:55:39 +08:00
|
|
|
#include "gimpeditor.h"
|
2004-03-17 22:14:18 +08:00
|
|
|
#include "gimppatternfactoryview.h"
|
2004-08-26 06:31:44 +08:00
|
|
|
#include "gimpviewrenderer.h"
|
2004-03-17 22:14:18 +08:00
|
|
|
|
|
|
|
|
2005-12-20 06:37:49 +08:00
|
|
|
G_DEFINE_TYPE (GimpPatternFactoryView, gimp_pattern_factory_view,
|
2006-05-15 17:46:31 +08:00
|
|
|
GIMP_TYPE_DATA_FACTORY_VIEW)
|
2004-03-17 22:14:18 +08:00
|
|
|
|
|
|
|
|
2005-12-20 06:37:49 +08:00
|
|
|
static void
|
|
|
|
gimp_pattern_factory_view_class_init (GimpPatternFactoryViewClass *klass)
|
|
|
|
{
|
|
|
|
}
|
2004-03-17 22:14:18 +08:00
|
|
|
|
2005-12-20 06:37:49 +08:00
|
|
|
static void
|
|
|
|
gimp_pattern_factory_view_init (GimpPatternFactoryView *view)
|
|
|
|
{
|
2004-03-17 22:14:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget *
|
|
|
|
gimp_pattern_factory_view_new (GimpViewType view_type,
|
2004-08-26 06:31:44 +08:00
|
|
|
GimpDataFactory *factory,
|
|
|
|
GimpContext *context,
|
2006-01-17 18:08:50 +08:00
|
|
|
gint view_size,
|
|
|
|
gint view_border_width,
|
2004-08-26 06:31:44 +08:00
|
|
|
GimpMenuFactory *menu_factory)
|
2004-03-17 22:14:18 +08:00
|
|
|
{
|
|
|
|
GimpPatternFactoryView *factory_view;
|
2007-01-23 00:55:39 +08:00
|
|
|
GimpContainerEditor *editor;
|
2004-03-17 22:14:18 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
|
2006-01-17 18:08:50 +08:00
|
|
|
g_return_val_if_fail (view_size > 0 &&
|
|
|
|
view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, NULL);
|
|
|
|
g_return_val_if_fail (view_border_width >= 0 &&
|
|
|
|
view_border_width <= GIMP_VIEW_MAX_BORDER_WIDTH,
|
2004-03-17 22:14:18 +08:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
factory_view = g_object_new (GIMP_TYPE_PATTERN_FACTORY_VIEW, NULL);
|
|
|
|
|
|
|
|
if (! gimp_data_factory_view_construct (GIMP_DATA_FACTORY_VIEW (factory_view),
|
2004-08-26 06:31:44 +08:00
|
|
|
view_type,
|
|
|
|
factory,
|
|
|
|
context,
|
2006-01-17 18:08:50 +08:00
|
|
|
view_size, view_border_width,
|
2004-08-26 06:31:44 +08:00
|
|
|
menu_factory, "<Patterns>",
|
2004-05-12 00:05:21 +08:00
|
|
|
"/patterns-popup",
|
|
|
|
"patterns"))
|
2004-03-17 22:14:18 +08:00
|
|
|
{
|
|
|
|
g_object_unref (factory_view);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2007-01-23 00:55:39 +08:00
|
|
|
editor = GIMP_CONTAINER_EDITOR (factory_view);
|
|
|
|
|
|
|
|
gimp_editor_add_action_button (GIMP_EDITOR (editor->view),
|
|
|
|
"patterns", "patterns-open-as-image",
|
|
|
|
NULL);
|
|
|
|
|
2008-12-20 20:08:28 +08:00
|
|
|
gtk_widget_hide (gimp_data_factory_view_get_edit_button (GIMP_DATA_FACTORY_VIEW (factory_view)));
|
|
|
|
gtk_widget_hide (gimp_data_factory_view_get_duplicate_button (GIMP_DATA_FACTORY_VIEW (factory_view)));
|
2004-03-17 22:14:18 +08:00
|
|
|
|
|
|
|
return GTK_WIDGET (factory_view);
|
|
|
|
}
|