From bfe98456e40e1ea3580b39fabcb9337c45072ece Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Tue, 8 Apr 2003 20:08:37 +0000 Subject: [PATCH] removed the pattern preview... 2003-04-08 Michael Natterer * app/tools/gimpbucketfilloptions.c: removed the pattern preview... * app/tools/paint_options.c: ...and added it here so all paint tools can use it if needed. Added a pattern preview to the clone tool options. --- ChangeLog | 8 +++++ app/tools/gimpbucketfilloptions.c | 44 ++------------------------- app/tools/gimppaintoptions-gui.c | 50 ++++++++++++++++++++++++++++--- app/tools/paint_options.c | 50 ++++++++++++++++++++++++++++--- 4 files changed, 102 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48074c71e3..7f20438663 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-04-08 Michael Natterer + + * app/tools/gimpbucketfilloptions.c: removed the pattern preview... + + * app/tools/paint_options.c: ...and added it here so all paint + tools can use it if needed. Added a pattern preview to the clone + tool options. + 2003-04-08 Michael Natterer * app/widgets/gimpdockable.[ch]: Added "gpointer get_tab_data" to diff --git a/app/tools/gimpbucketfilloptions.c b/app/tools/gimpbucketfilloptions.c index 69b04e6d87..76ffcc5a58 100644 --- a/app/tools/gimpbucketfilloptions.c +++ b/app/tools/gimpbucketfilloptions.c @@ -33,8 +33,6 @@ #include "display/gimpdisplay.h" -#include "widgets/gimpcontainerpopup.h" -#include "widgets/gimpdock.h" #include "widgets/gimppropwidgets.h" #include "widgets/gimpwidgets-utils.h" @@ -68,9 +66,6 @@ static void gimp_bucket_fill_options_get_property (GObject *object, static void gimp_bucket_fill_options_reset (GimpToolOptions *tool_options); -static void bucket_options_pattern_clicked (GtkWidget *widget, - GimpContext *context); - static GimpPaintOptionsClass *parent_class = NULL; @@ -228,33 +223,16 @@ gimp_bucket_fill_options_gui (GimpToolOptions *tool_options) { GObject *config; GtkWidget *vbox; - GtkWidget *table; - GtkWidget *button; - GtkWidget *preview; GtkWidget *vbox2; + GtkWidget *table; GtkWidget *frame; + GtkWidget *button; gchar *str; config = G_OBJECT (tool_options); vbox = gimp_paint_options_gui (tool_options); - table = g_object_get_data (G_OBJECT (vbox), GIMP_PAINT_OPTIONS_TABLE_KEY); - - /* the brush preview */ - button = gtk_button_new (); - preview = gimp_prop_preview_new (config, "pattern", 24); - gtk_container_add (GTK_CONTAINER (button), preview); - gtk_widget_show (preview); - - gimp_table_attach_aligned (GTK_TABLE (table), 0, 2, - _("Pattern:"), 1.0, 0.5, - button, 2, TRUE); - - g_signal_connect (button, "clicked", - G_CALLBACK (bucket_options_pattern_clicked), - tool_options); - /* fill type */ str = g_strdup_printf (_("Fill Type %s"), gimp_get_mod_name_control ()); frame = gimp_prop_enum_radio_frame_new (config, "fill-mode", str, 0, 0); @@ -300,21 +278,3 @@ gimp_bucket_fill_options_gui (GimpToolOptions *tool_options) return vbox; } - -static void -bucket_options_pattern_clicked (GtkWidget *widget, - GimpContext *context) -{ - GtkWidget *toplevel; - GtkWidget *popup; - - toplevel = gtk_widget_get_toplevel (widget); - - popup = gimp_container_popup_new (context->gimp->pattern_factory->container, - context, - GIMP_DOCK (toplevel)->dialog_factory, - "gimp-pattern-grid", - GIMP_STOCK_TOOL_BUCKET_FILL, - _("Open the pattern selection dialog")); - gimp_container_popup_show (GIMP_CONTAINER_POPUP (popup), widget); -} diff --git a/app/tools/gimppaintoptions-gui.c b/app/tools/gimppaintoptions-gui.c index 8f9dd91166..5ddd516a19 100644 --- a/app/tools/gimppaintoptions-gui.c +++ b/app/tools/gimppaintoptions-gui.c @@ -67,7 +67,9 @@ static GtkWidget * gradient_options_gui (GimpGradientOptions *gradient, GType tool_type, GtkWidget *incremental_toggle); -static void paint_options_brush_clicked (GtkWidget *widget, +static void paint_options_brush_clicked (GtkWidget *widget, + GimpContext *context); +static void paint_options_pattern_clicked (GtkWidget *widget, GimpContext *context); @@ -83,6 +85,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options) GtkWidget *optionmenu; GtkWidget *mode_label; GtkWidget *incremental_toggle = NULL; + gint table_row = 0; options = GIMP_PAINT_OPTIONS (tool_options); context = GIMP_CONTEXT (tool_options); @@ -101,12 +104,12 @@ gimp_paint_options_gui (GimpToolOptions *tool_options) /* the opacity scale */ gimp_prop_opacity_entry_new (config, "opacity", - GTK_TABLE (table), 0, 0, + GTK_TABLE (table), 0, table_row++, _("Opacity:")); /* the paint mode menu */ optionmenu = gimp_prop_paint_mode_menu_new (config, "paint-mode", TRUE); - mode_label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, + mode_label = gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++, _("Mode:"), 1.0, 0.5, optionmenu, 2, TRUE); @@ -132,7 +135,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options) gtk_container_add (GTK_CONTAINER (button), preview); gtk_widget_show (preview); - gimp_table_attach_aligned (GTK_TABLE (table), 0, 2, + gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++, _("Brush:"), 1.0, 0.5, button, 2, TRUE); @@ -141,6 +144,27 @@ gimp_paint_options_gui (GimpToolOptions *tool_options) context); } + /* the pattern preview */ + if (tool_options->tool_info->tool_type == GIMP_TYPE_BUCKET_FILL_TOOL || + tool_options->tool_info->tool_type == GIMP_TYPE_CLONE_TOOL) + { + GtkWidget *button; + GtkWidget *preview; + + button = gtk_button_new (); + preview = gimp_prop_preview_new (config, "pattern", 24); + gtk_container_add (GTK_CONTAINER (button), preview); + gtk_widget_show (preview); + + gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++, + _("Pattern:"), 1.0, 0.5, + button, 2, TRUE); + + g_signal_connect (button, "clicked", + G_CALLBACK (paint_options_pattern_clicked), + context); + } + /* the "incremental" toggle */ if (tool_options->tool_info->tool_type == GIMP_TYPE_AIRBRUSH_TOOL || tool_options->tool_info->tool_type == GIMP_TYPE_ERASER_TOOL || @@ -424,3 +448,21 @@ paint_options_brush_clicked (GtkWidget *widget, _("Open the brush selection dialog")); gimp_container_popup_show (GIMP_CONTAINER_POPUP (popup), widget); } + +static void +paint_options_pattern_clicked (GtkWidget *widget, + GimpContext *context) +{ + GtkWidget *toplevel; + GtkWidget *popup; + + toplevel = gtk_widget_get_toplevel (widget); + + popup = gimp_container_popup_new (context->gimp->pattern_factory->container, + context, + GIMP_DOCK (toplevel)->dialog_factory, + "gimp-pattern-grid", + GIMP_STOCK_TOOL_BUCKET_FILL, + _("Open the pattern selection dialog")); + gimp_container_popup_show (GIMP_CONTAINER_POPUP (popup), widget); +} diff --git a/app/tools/paint_options.c b/app/tools/paint_options.c index 8f9dd91166..5ddd516a19 100644 --- a/app/tools/paint_options.c +++ b/app/tools/paint_options.c @@ -67,7 +67,9 @@ static GtkWidget * gradient_options_gui (GimpGradientOptions *gradient, GType tool_type, GtkWidget *incremental_toggle); -static void paint_options_brush_clicked (GtkWidget *widget, +static void paint_options_brush_clicked (GtkWidget *widget, + GimpContext *context); +static void paint_options_pattern_clicked (GtkWidget *widget, GimpContext *context); @@ -83,6 +85,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options) GtkWidget *optionmenu; GtkWidget *mode_label; GtkWidget *incremental_toggle = NULL; + gint table_row = 0; options = GIMP_PAINT_OPTIONS (tool_options); context = GIMP_CONTEXT (tool_options); @@ -101,12 +104,12 @@ gimp_paint_options_gui (GimpToolOptions *tool_options) /* the opacity scale */ gimp_prop_opacity_entry_new (config, "opacity", - GTK_TABLE (table), 0, 0, + GTK_TABLE (table), 0, table_row++, _("Opacity:")); /* the paint mode menu */ optionmenu = gimp_prop_paint_mode_menu_new (config, "paint-mode", TRUE); - mode_label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, + mode_label = gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++, _("Mode:"), 1.0, 0.5, optionmenu, 2, TRUE); @@ -132,7 +135,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options) gtk_container_add (GTK_CONTAINER (button), preview); gtk_widget_show (preview); - gimp_table_attach_aligned (GTK_TABLE (table), 0, 2, + gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++, _("Brush:"), 1.0, 0.5, button, 2, TRUE); @@ -141,6 +144,27 @@ gimp_paint_options_gui (GimpToolOptions *tool_options) context); } + /* the pattern preview */ + if (tool_options->tool_info->tool_type == GIMP_TYPE_BUCKET_FILL_TOOL || + tool_options->tool_info->tool_type == GIMP_TYPE_CLONE_TOOL) + { + GtkWidget *button; + GtkWidget *preview; + + button = gtk_button_new (); + preview = gimp_prop_preview_new (config, "pattern", 24); + gtk_container_add (GTK_CONTAINER (button), preview); + gtk_widget_show (preview); + + gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++, + _("Pattern:"), 1.0, 0.5, + button, 2, TRUE); + + g_signal_connect (button, "clicked", + G_CALLBACK (paint_options_pattern_clicked), + context); + } + /* the "incremental" toggle */ if (tool_options->tool_info->tool_type == GIMP_TYPE_AIRBRUSH_TOOL || tool_options->tool_info->tool_type == GIMP_TYPE_ERASER_TOOL || @@ -424,3 +448,21 @@ paint_options_brush_clicked (GtkWidget *widget, _("Open the brush selection dialog")); gimp_container_popup_show (GIMP_CONTAINER_POPUP (popup), widget); } + +static void +paint_options_pattern_clicked (GtkWidget *widget, + GimpContext *context) +{ + GtkWidget *toplevel; + GtkWidget *popup; + + toplevel = gtk_widget_get_toplevel (widget); + + popup = gimp_container_popup_new (context->gimp->pattern_factory->container, + context, + GIMP_DOCK (toplevel)->dialog_factory, + "gimp-pattern-grid", + GIMP_STOCK_TOOL_BUCKET_FILL, + _("Open the pattern selection dialog")); + gimp_container_popup_show (GIMP_CONTAINER_POPUP (popup), widget); +}