[gimp] app: add an edit button the the tool options' brush etc. selectors
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add an edit button the the tool options' brush etc. selectors
- Date: Thu, 7 Apr 2011 21:49:17 +0000 (UTC)
commit fcbc5eebebbf433ed005297aca3219d40ef58e97
Author: Michael Natterer <mitch gimp org>
Date: Thu Apr 7 23:48:08 2011 +0200
app: add an edit button the the tool options' brush etc. selectors
which makes getting to the editor dialogs much easier.
app/tools/gimpblendoptions.c | 3 +-
app/tools/gimppaintoptions-gui.c | 9 ++-
app/widgets/gimpviewablebox.c | 126 ++++++++++++++++++++++++++++++--------
app/widgets/gimpviewablebox.h | 12 +++-
4 files changed, 117 insertions(+), 33 deletions(-)
---
diff --git a/app/tools/gimpblendoptions.c b/app/tools/gimpblendoptions.c
index 91708db..a29a574 100644
--- a/app/tools/gimpblendoptions.c
+++ b/app/tools/gimpblendoptions.c
@@ -211,7 +211,8 @@ gimp_blend_options_gui (GimpToolOptions *tool_options)
_("Gradient"), 2,
"gradient-view-type",
"gradient-view-size",
- "gradient-reverse");
+ "gradient-reverse",
+ "gimp-gradient-editor");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
diff --git a/app/tools/gimppaintoptions-gui.c b/app/tools/gimppaintoptions-gui.c
index 1a486a5..88f2b76 100644
--- a/app/tools/gimppaintoptions-gui.c
+++ b/app/tools/gimppaintoptions-gui.c
@@ -121,7 +121,8 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
button = gimp_prop_brush_box_new (NULL, GIMP_CONTEXT (tool_options),
_("Brush"), 2,
- "brush-view-type", "brush-view-size");
+ "brush-view-type", "brush-view-size",
+ "gimp-brush-editor");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
@@ -200,7 +201,8 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
button = gimp_prop_dynamics_box_new (NULL, GIMP_CONTEXT (tool_options),
_("Dynamics"), 2,
"dynamics-view-type",
- "dynamics-view-size");
+ "dynamics-view-size",
+ "gimp-dynamics-editor");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
@@ -335,7 +337,8 @@ dynamics_options_gui (GimpPaintOptions *paint_options,
_("Gradient"), 2,
"gradient-view-type",
"gradient-view-size",
- "gradient-reverse");
+ "gradient-reverse",
+ "gimp-gradient-editor");
gtk_container_add (GTK_CONTAINER (inner_frame), box);
gtk_widget_show (box);
}
diff --git a/app/widgets/gimpviewablebox.c b/app/widgets/gimpviewablebox.c
index 54c943d..13eadca 100644
--- a/app/widgets/gimpviewablebox.c
+++ b/app/widgets/gimpviewablebox.c
@@ -52,11 +52,14 @@ static GtkWidget * gimp_viewable_box_new (GimpContainer *container,
GimpViewSize view_size,
const gchar *dialog_identifier,
const gchar *dialog_stock_id,
- const gchar *dialog_tooltip);
+ const gchar *dialog_tooltip,
+ const gchar *editor_id);
static GtkWidget * view_props_connect (GtkWidget *box,
GimpContext *context,
const gchar *view_type_prop,
const gchar *view_size_prop);
+static void gimp_viewable_box_edit_clicked (GtkWidget *widget,
+ GimpViewableButton *button);
static void gimp_gradient_box_reverse_notify (GObject *object,
GParamSpec *pspec,
GimpView *view);
@@ -70,7 +73,8 @@ brush_box_new (GimpContainer *container,
const gchar *label,
gint spacing,
GimpViewType view_type,
- GimpViewSize view_size)
+ GimpViewSize view_size,
+ const gchar *editor_id)
{
if (! container)
container = gimp_data_factory_get_container (context->gimp->brush_factory);
@@ -79,7 +83,8 @@ brush_box_new (GimpContainer *container,
view_type, GIMP_VIEW_SIZE_SMALL, view_size,
"gimp-brush-grid|gimp-brush-list",
GIMP_STOCK_BRUSH,
- _("Open the brush selection dialog"));
+ _("Open the brush selection dialog"),
+ editor_id);
}
GtkWidget *
@@ -93,7 +98,8 @@ gimp_brush_box_new (GimpContainer *container,
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
return brush_box_new (container, context, label, spacing,
- GIMP_VIEW_TYPE_GRID, GIMP_VIEW_SIZE_SMALL);
+ GIMP_VIEW_TYPE_GRID, GIMP_VIEW_SIZE_SMALL,
+ NULL);
}
GtkWidget *
@@ -102,7 +108,8 @@ gimp_prop_brush_box_new (GimpContainer *container,
const gchar *label,
gint spacing,
const gchar *view_type_prop,
- const gchar *view_size_prop)
+ const gchar *view_size_prop,
+ const gchar *editor_id)
{
GimpViewType view_type;
GimpViewSize view_size;
@@ -117,7 +124,8 @@ gimp_prop_brush_box_new (GimpContainer *container,
NULL);
return view_props_connect (brush_box_new (container, context, label, spacing,
- view_type, view_size),
+ view_type, view_size,
+ editor_id),
context,
view_type_prop, view_size_prop);
}
@@ -129,7 +137,8 @@ dynamics_box_new (GimpContainer *container,
GimpContext *context,
const gchar *label,
gint spacing,
- GimpViewSize view_size)
+ GimpViewSize view_size,
+ const gchar *editor_id)
{
if (! container)
container = gimp_data_factory_get_container (context->gimp->dynamics_factory);
@@ -138,7 +147,8 @@ dynamics_box_new (GimpContainer *container,
GIMP_VIEW_TYPE_LIST, GIMP_VIEW_SIZE_SMALL, view_size,
"gimp-dynamics-list",
GIMP_STOCK_DYNAMICS,
- _("Open the dynamics selection dialog"));
+ _("Open the dynamics selection dialog"),
+ editor_id);
}
GtkWidget *
@@ -152,7 +162,8 @@ gimp_dynamics_box_new (GimpContainer *container,
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
return dynamics_box_new (container, context, label, spacing,
- GIMP_VIEW_SIZE_SMALL);
+ GIMP_VIEW_SIZE_SMALL,
+ NULL);
}
GtkWidget *
@@ -161,7 +172,8 @@ gimp_prop_dynamics_box_new (GimpContainer *container,
const gchar *label,
gint spacing,
const gchar *view_type_prop,
- const gchar *view_size_prop)
+ const gchar *view_size_prop,
+ const gchar *editor_id)
{
GimpViewType view_type;
GimpViewSize view_size;
@@ -176,7 +188,8 @@ gimp_prop_dynamics_box_new (GimpContainer *container,
NULL);
return view_props_connect (dynamics_box_new (container, context, label,
- spacing, view_size),
+ spacing, view_size,
+ editor_id),
context,
view_type_prop, view_size_prop);
}
@@ -199,7 +212,8 @@ pattern_box_new (GimpContainer *container,
view_type, GIMP_VIEW_SIZE_SMALL, view_size,
"gimp-pattern-grid|gimp-pattern-list",
GIMP_STOCK_PATTERN,
- _("Open the pattern selection dialog"));
+ _("Open the pattern selection dialog"),
+ NULL);
}
GtkWidget *
@@ -252,7 +266,8 @@ gradient_box_new (GimpContainer *container,
gint spacing,
GimpViewType view_type,
GimpViewSize view_size,
- const gchar *reverse_prop)
+ const gchar *reverse_prop,
+ const gchar *editor_id)
{
GtkWidget *hbox;
GtkWidget *button;
@@ -265,7 +280,8 @@ gradient_box_new (GimpContainer *container,
view_type, GIMP_VIEW_SIZE_LARGE, view_size,
"gimp-gradient-list|gimp-gradient-grid",
GIMP_STOCK_GRADIENT,
- _("Open the gradient selection dialog"));
+ _("Open the gradient selection dialog"),
+ editor_id);
children = gtk_container_get_children (GTK_CONTAINER (hbox));
button = children->data;
@@ -275,20 +291,27 @@ gradient_box_new (GimpContainer *container,
if (reverse_prop)
{
+ GtkWidget *vbox;
GtkWidget *toggle;
GtkWidget *view;
GtkWidget *image;
gchar *signal_name;
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
+ gtk_widget_show (vbox);
+
toggle = gimp_prop_check_button_new (G_OBJECT (context), reverse_prop,
NULL);
- gtk_box_pack_start (GTK_BOX (hbox), toggle, FALSE, FALSE, 0);
+ gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (toggle), FALSE);
+ gtk_box_pack_end (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
gimp_help_set_help_data (toggle, _("Reverse"), NULL);
image = gtk_image_new_from_stock (GIMP_STOCK_FLIP_HORIZONTAL,
GTK_ICON_SIZE_MENU);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5, 1.0);
gtk_container_add (GTK_CONTAINER (toggle), image);
gtk_widget_show (image);
@@ -321,7 +344,8 @@ gimp_gradient_box_new (GimpContainer *container,
return gradient_box_new (container, context, label, spacing,
GIMP_VIEW_TYPE_LIST, GIMP_VIEW_SIZE_LARGE,
- reverse_prop);
+ reverse_prop,
+ NULL);
}
GtkWidget *
@@ -331,7 +355,8 @@ gimp_prop_gradient_box_new (GimpContainer *container,
gint spacing,
const gchar *view_type_prop,
const gchar *view_size_prop,
- const gchar *reverse_prop)
+ const gchar *reverse_prop,
+ const gchar *editor_id)
{
GimpViewType view_type;
GimpViewSize view_size;
@@ -347,7 +372,8 @@ gimp_prop_gradient_box_new (GimpContainer *container,
return view_props_connect (gradient_box_new (container, context, label, spacing,
view_type, view_size,
- reverse_prop),
+ reverse_prop,
+ editor_id),
context,
view_type_prop, view_size_prop);
}
@@ -361,7 +387,8 @@ palette_box_new (GimpContainer *container,
const gchar *label,
gint spacing,
GimpViewType view_type,
- GimpViewSize view_size)
+ GimpViewSize view_size,
+ const gchar *editor_id)
{
if (! container)
container = gimp_data_factory_get_container (context->gimp->palette_factory);
@@ -370,7 +397,8 @@ palette_box_new (GimpContainer *container,
view_type, GIMP_VIEW_SIZE_MEDIUM, view_size,
"gimp-palette-list|gimp-palette-grid",
GIMP_STOCK_PALETTE,
- _("Open the palette selection dialog"));
+ _("Open the palette selection dialog"),
+ editor_id);
}
GtkWidget *
@@ -384,7 +412,8 @@ gimp_palette_box_new (GimpContainer *container,
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
return palette_box_new (container, context, label, spacing,
- GIMP_VIEW_TYPE_LIST, GIMP_VIEW_SIZE_MEDIUM);
+ GIMP_VIEW_TYPE_LIST, GIMP_VIEW_SIZE_MEDIUM,
+ NULL);
}
GtkWidget *
@@ -393,7 +422,8 @@ gimp_prop_palette_box_new (GimpContainer *container,
const gchar *label,
gint spacing,
const gchar *view_type_prop,
- const gchar *view_size_prop)
+ const gchar *view_size_prop,
+ const gchar *editor_id)
{
GimpViewType view_type;
GimpViewSize view_size;
@@ -408,7 +438,8 @@ gimp_prop_palette_box_new (GimpContainer *container,
NULL);
return view_props_connect (palette_box_new (container, context, label, spacing,
- view_type, view_size),
+ view_type, view_size,
+ editor_id),
context,
view_type_prop, view_size_prop);
}
@@ -431,7 +462,8 @@ font_box_new (GimpContainer *container,
view_type, GIMP_VIEW_SIZE_SMALL, view_size,
"gimp-font-list|gimp-font-grid",
GIMP_STOCK_FONT,
- _("Open the font selection dialog"));
+ _("Open the font selection dialog"),
+ NULL);
}
GtkWidget *
@@ -487,7 +519,8 @@ gimp_viewable_box_new (GimpContainer *container,
GimpViewSize view_size,
const gchar *dialog_identifier,
const gchar *dialog_stock_id,
- const gchar *dialog_tooltip)
+ const gchar *dialog_tooltip,
+ const gchar *editor_id)
{
GtkWidget *hbox;
GtkWidget *button;
@@ -530,6 +563,37 @@ gimp_viewable_box_new (GimpContainer *container,
gtk_box_pack_start (GTK_BOX (vbox), entry, label ? FALSE: TRUE, FALSE, 0);
gtk_widget_show (entry);
+ if (editor_id)
+ {
+ GtkWidget *edit_vbox;
+ GtkWidget *edit_button;
+ GtkWidget *image;
+
+ edit_vbox = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (hbox), edit_vbox, FALSE, FALSE, 0);
+ gtk_widget_show (edit_vbox);
+
+ edit_button = gtk_button_new ();
+ gtk_button_set_relief (GTK_BUTTON (edit_button), GTK_RELIEF_NONE);
+ gtk_box_pack_end (GTK_BOX (edit_vbox), edit_button, FALSE, FALSE, 0);
+ gtk_widget_show (edit_button);
+
+ image = gtk_image_new_from_stock (GIMP_STOCK_EDIT,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5, 1.0);
+ gtk_container_add (GTK_CONTAINER (edit_button), image);
+ gtk_widget_show (image);
+
+ g_object_set_data_full (G_OBJECT (button),
+ "gimp-viewable-box-editor",
+ g_strdup (editor_id),
+ (GDestroyNotify) g_free);
+
+ g_signal_connect (edit_button, "clicked",
+ G_CALLBACK (gimp_viewable_box_edit_clicked),
+ button);
+ }
+
return hbox;
}
@@ -550,6 +614,18 @@ view_props_connect (GtkWidget *box,
}
static void
+gimp_viewable_box_edit_clicked (GtkWidget *widget,
+ GimpViewableButton *button)
+{
+ const gchar *editor_id = g_object_get_data (G_OBJECT (button),
+ "gimp-viewable-box-editor");
+
+ gimp_dialog_factory_dialog_raise (button->dialog_factory,
+ gtk_widget_get_screen (widget),
+ editor_id, -1);
+}
+
+static void
gimp_gradient_box_reverse_notify (GObject *object,
GParamSpec *pspec,
GimpView *view)
diff --git a/app/widgets/gimpviewablebox.h b/app/widgets/gimpviewablebox.h
index 42d479d..a3838fc 100644
--- a/app/widgets/gimpviewablebox.h
+++ b/app/widgets/gimpviewablebox.h
@@ -28,7 +28,8 @@ GtkWidget * gimp_prop_brush_box_new (GimpContainer *container,
const gchar *label,
gint spacing,
const gchar *view_type_prop,
- const gchar *view_size_prop);
+ const gchar *view_size_prop,
+ const gchar *editor_id);
GtkWidget * gimp_dynamics_box_new (GimpContainer *container,
GimpContext *context,
const gchar *label,
@@ -38,7 +39,8 @@ GtkWidget * gimp_prop_dynamics_box_new (GimpContainer *container,
const gchar *label,
gint spacing,
const gchar *view_type_prop,
- const gchar *view_size_prop);
+ const gchar *view_size_prop,
+ const gchar *editor_id);
GtkWidget * gimp_pattern_box_new (GimpContainer *container,
GimpContext *context,
@@ -62,7 +64,8 @@ GtkWidget * gimp_prop_gradient_box_new (GimpContainer *container,
gint scacing,
const gchar *view_type_prop,
const gchar *view_size_prop,
- const gchar *reverse_prop);
+ const gchar *reverse_prop,
+ const gchar *editor_id);
GtkWidget * gimp_palette_box_new (GimpContainer *container,
GimpContext *context,
@@ -73,7 +76,8 @@ GtkWidget * gimp_prop_palette_box_new (GimpContainer *container,
const gchar *label,
gint spacing,
const gchar *view_type_prop,
- const gchar *view_size_prop);
+ const gchar *view_size_prop,
+ const gchar *editor_id);
GtkWidget * gimp_font_box_new (GimpContainer *container,
GimpContext *context,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]