gimp r27392 - in trunk: . app/core app/dialogs app/widgets
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27392 - in trunk: . app/core app/dialogs app/widgets
- Date: Fri, 24 Oct 2008 22:34:24 +0000 (UTC)
Author: mitch
Date: Fri Oct 24 22:34:24 2008
New Revision: 27392
URL: http://svn.gnome.org/viewvc/gimp?rev=27392&view=rev
Log:
2008-10-25 Michael Natterer <mitch gimp org>
* app/core/gimpfilloptions.[ch]: add non-serializable properties
pattern-view-type and pattern-view-size which are used only by the
new UI below.
* app/widgets/gimpfilleditor.[ch]: added boolean edit-context
property. If TRUE, add widgets to edit the context's foreground and
pattern. Add "edit_context" parameter to gimp_fill_editor_new().
* app/widgets/gimpstrokeeditor.[ch]: add the same parameter here.
* app/widgets/gimpwidgets-utils.[ch]: add gimp_enum_radio_box_add()
which does the same as the existing gimp_enum_radio_frame_add().
* app/dialogs/stroke-dialog.c: pass FALSE for "edit_context"
because this dialog takes its foreground and pattern from the user
context and doesn't need it's own GUI for them.
Modified:
trunk/ChangeLog
trunk/app/core/gimpfilloptions.c
trunk/app/core/gimpfilloptions.h
trunk/app/dialogs/stroke-dialog.c
trunk/app/widgets/gimpfilleditor.c
trunk/app/widgets/gimpfilleditor.h
trunk/app/widgets/gimpstrokeeditor.c
trunk/app/widgets/gimpstrokeeditor.h
trunk/app/widgets/gimpwidgets-utils.c
trunk/app/widgets/gimpwidgets-utils.h
Modified: trunk/app/core/gimpfilloptions.c
==============================================================================
--- trunk/app/core/gimpfilloptions.c (original)
+++ trunk/app/core/gimpfilloptions.c Fri Oct 24 22:34:24 2008
@@ -29,13 +29,16 @@
#include "core-types.h"
#include "gimpfilloptions.h"
+#include "gimpviewable.h"
enum
{
PROP_0,
PROP_STYLE,
- PROP_ANTIALIAS
+ PROP_ANTIALIAS,
+ PROP_PATTERN_VIEW_TYPE,
+ PROP_PATTERN_VIEW_SIZE
};
@@ -70,6 +73,23 @@
"antialias", NULL,
TRUE,
GIMP_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_property (object_class, PROP_PATTERN_VIEW_TYPE,
+ g_param_spec_enum ("pattern-view-type",
+ NULL, NULL,
+ GIMP_TYPE_VIEW_TYPE,
+ GIMP_VIEW_TYPE_GRID,
+ G_PARAM_CONSTRUCT |
+ GIMP_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_PATTERN_VIEW_SIZE,
+ g_param_spec_int ("pattern-view-size",
+ NULL, NULL,
+ GIMP_VIEW_SIZE_TINY,
+ GIMP_VIEWABLE_MAX_BUTTON_SIZE,
+ GIMP_VIEW_SIZE_SMALL,
+ G_PARAM_CONSTRUCT |
+ GIMP_PARAM_READWRITE));
}
static void
@@ -94,6 +114,13 @@
options->antialias = g_value_get_boolean (value);
break;
+ case PROP_PATTERN_VIEW_TYPE:
+ options->pattern_view_type = g_value_get_enum (value);
+ break;
+ case PROP_PATTERN_VIEW_SIZE:
+ options->pattern_view_size = g_value_get_int (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -117,6 +144,13 @@
g_value_set_boolean (value, options->antialias);
break;
+ case PROP_PATTERN_VIEW_TYPE:
+ g_value_set_enum (value, options->pattern_view_type);
+ break;
+ case PROP_PATTERN_VIEW_SIZE:
+ g_value_set_int (value, options->pattern_view_size);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
Modified: trunk/app/core/gimpfilloptions.h
==============================================================================
--- trunk/app/core/gimpfilloptions.h (original)
+++ trunk/app/core/gimpfilloptions.h Fri Oct 24 22:34:24 2008
@@ -43,6 +43,9 @@
GimpFillStyle style;
gboolean antialias;
+
+ GimpViewType pattern_view_type;
+ GimpViewSize pattern_view_size;
};
struct _GimpFillOptionsClass
Modified: trunk/app/dialogs/stroke-dialog.c
==============================================================================
--- trunk/app/dialogs/stroke-dialog.c (original)
+++ trunk/app/dialogs/stroke-dialog.c Fri Oct 24 22:34:24 2008
@@ -181,7 +181,7 @@
gimp_image_get_resolution (image, &xres, &yres);
- stroke_editor = gimp_stroke_editor_new (options, yres);
+ stroke_editor = gimp_stroke_editor_new (options, yres, FALSE);
gtk_container_add (GTK_CONTAINER (frame), stroke_editor);
gtk_widget_show (stroke_editor);
Modified: trunk/app/widgets/gimpfilleditor.c
==============================================================================
--- trunk/app/widgets/gimpfilleditor.c (original)
+++ trunk/app/widgets/gimpfilleditor.c Fri Oct 24 22:34:24 2008
@@ -30,7 +30,11 @@
#include "core/gimpfilloptions.h"
+#include "gimpcolorpanel.h"
#include "gimpfilleditor.h"
+#include "gimppropwidgets.h"
+#include "gimpviewablebox.h"
+#include "gimpwidgets-utils.h"
#include "gimp-intl.h"
@@ -39,7 +43,7 @@
{
PROP_0,
PROP_OPTIONS,
- PROP_RESOLUTION
+ PROP_EDIT_CONTEXT
};
@@ -73,10 +77,18 @@
object_class->get_property = gimp_fill_editor_get_property;
g_object_class_install_property (object_class, PROP_OPTIONS,
- g_param_spec_object ("options", NULL, NULL,
+ g_param_spec_object ("options",
+ NULL, NULL,
GIMP_TYPE_FILL_OPTIONS,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (object_class, PROP_EDIT_CONTEXT,
+ g_param_spec_boolean ("edit-context",
+ NULL, NULL,
+ FALSE,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
}
static void
@@ -106,6 +118,29 @@
gtk_box_pack_start (GTK_BOX (editor), box, FALSE, FALSE, 0);
gtk_widget_show (box);
+ if (editor->edit_context)
+ {
+ GtkWidget *color_button;
+ GtkWidget *pattern_box;
+
+ color_button = gimp_prop_color_button_new (G_OBJECT (editor->options),
+ "foreground",
+ _("Fill Color"),
+ -1, 24,
+ GIMP_COLOR_AREA_SMALL_CHECKS);
+ gimp_color_panel_set_context (GIMP_COLOR_PANEL (color_button),
+ GIMP_CONTEXT (editor->options));
+ gimp_enum_radio_box_add (GTK_BOX (box), color_button,
+ GIMP_FILL_STYLE_SOLID);
+
+ pattern_box = gimp_prop_pattern_box_new (NULL,
+ GIMP_CONTEXT (editor->options), 2,
+ "pattern-view-type",
+ "pattern-view-size");
+ gimp_enum_radio_box_add (GTK_BOX (box), pattern_box,
+ GIMP_FILL_STYLE_PATTERN);
+ }
+
return object;
}
@@ -139,6 +174,10 @@
editor->options = g_value_dup_object (value);
break;
+ case PROP_EDIT_CONTEXT:
+ editor->edit_context = g_value_get_boolean (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -159,6 +198,10 @@
g_value_set_object (value, editor->options);
break;
+ case PROP_EDIT_CONTEXT:
+ g_value_set_boolean (value, editor->edit_context);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -166,11 +209,13 @@
}
GtkWidget *
-gimp_fill_editor_new (GimpFillOptions *options)
+gimp_fill_editor_new (GimpFillOptions *options,
+ gboolean edit_context)
{
g_return_val_if_fail (GIMP_IS_FILL_OPTIONS (options), NULL);
return g_object_new (GIMP_TYPE_FILL_EDITOR,
- "options", options,
+ "options", options,
+ "edit-context", edit_context ? TRUE : FALSE,
NULL);
}
Modified: trunk/app/widgets/gimpfilleditor.h
==============================================================================
--- trunk/app/widgets/gimpfilleditor.h (original)
+++ trunk/app/widgets/gimpfilleditor.h Fri Oct 24 22:34:24 2008
@@ -38,6 +38,7 @@
GtkVBox parent_instance;
GimpFillOptions *options;
+ gboolean edit_context;
};
struct _GimpFillEditorClass
@@ -48,7 +49,8 @@
GType gimp_fill_editor_get_type (void) G_GNUC_CONST;
-GtkWidget * gimp_fill_editor_new (GimpFillOptions *options);
+GtkWidget * gimp_fill_editor_new (GimpFillOptions *options,
+ gboolean edit_context);
#endif /* __GIMP_FILL_EDITOR_H__ */
Modified: trunk/app/widgets/gimpstrokeeditor.c
==============================================================================
--- trunk/app/widgets/gimpstrokeeditor.c (original)
+++ trunk/app/widgets/gimpstrokeeditor.c Fri Oct 24 22:34:24 2008
@@ -330,13 +330,15 @@
GtkWidget *
gimp_stroke_editor_new (GimpStrokeOptions *options,
- gdouble resolution)
+ gdouble resolution,
+ gboolean edit_context)
{
g_return_val_if_fail (GIMP_IS_STROKE_OPTIONS (options), NULL);
return g_object_new (GIMP_TYPE_STROKE_EDITOR,
- "options", options,
- "resolution", resolution,
+ "options", options,
+ "resolution", resolution,
+ "edit-context", edit_context ? TRUE : FALSE,
NULL);
}
Modified: trunk/app/widgets/gimpstrokeeditor.h
==============================================================================
--- trunk/app/widgets/gimpstrokeeditor.h (original)
+++ trunk/app/widgets/gimpstrokeeditor.h Fri Oct 24 22:34:24 2008
@@ -52,7 +52,8 @@
GType gimp_stroke_editor_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_stroke_editor_new (GimpStrokeOptions *options,
- gdouble resolution);
+ gdouble resolution,
+ gboolean edit_context);
#endif /* __GIMP_STROKE_EDITOR_H__ */
Modified: trunk/app/widgets/gimpwidgets-utils.c
==============================================================================
--- trunk/app/widgets/gimpwidgets-utils.c (original)
+++ trunk/app/widgets/gimpwidgets-utils.c Fri Oct 24 22:34:24 2008
@@ -244,23 +244,18 @@
}
void
-gimp_enum_radio_frame_add (GtkFrame *frame,
- GtkWidget *widget,
- gint enum_value)
-{
- GtkWidget *vbox;
- GList *children;
- GList *list;
- gint pos;
+gimp_enum_radio_box_add (GtkBox *box,
+ GtkWidget *widget,
+ gint enum_value)
+{
+ GList *children;
+ GList *list;
+ gint pos;
- g_return_if_fail (GTK_IS_FRAME (frame));
+ g_return_if_fail (GTK_IS_BOX (box));
g_return_if_fail (GTK_IS_WIDGET (widget));
- vbox = gtk_bin_get_child (GTK_BIN (frame));
-
- g_return_if_fail (GTK_IS_VBOX (vbox));
-
- children = gtk_container_get_children (GTK_CONTAINER (vbox));
+ children = gtk_container_get_children (GTK_CONTAINER (box));
for (list = children, pos = 1;
list;
@@ -312,8 +307,8 @@
gtk_widget_set_sensitive (hbox,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (list->data)));
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- gtk_box_reorder_child (GTK_BOX (vbox), hbox, pos);
+ gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0);
+ gtk_box_reorder_child (GTK_BOX (box), hbox, pos);
gtk_widget_show (hbox);
break;
@@ -323,6 +318,23 @@
g_list_free (children);
}
+void
+gimp_enum_radio_frame_add (GtkFrame *frame,
+ GtkWidget *widget,
+ gint enum_value)
+{
+ GtkWidget *vbox;
+
+ g_return_if_fail (GTK_IS_FRAME (frame));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ vbox = gtk_bin_get_child (GTK_BIN (frame));
+
+ g_return_if_fail (GTK_IS_VBOX (vbox));
+
+ gimp_enum_radio_box_add (GTK_BOX (vbox), widget, enum_value);
+}
+
GtkIconSize
gimp_get_icon_size (GtkWidget *widget,
const gchar *stock_id,
Modified: trunk/app/widgets/gimpwidgets-utils.h
==============================================================================
--- trunk/app/widgets/gimpwidgets-utils.h (original)
+++ trunk/app/widgets/gimpwidgets-utils.h Fri Oct 24 22:34:24 2008
@@ -38,6 +38,9 @@
GtkWidget *widget,
gint colspan,
gboolean left_align);
+void gimp_enum_radio_box_add (GtkBox *box,
+ GtkWidget *widget,
+ gint enum_value);
void gimp_enum_radio_frame_add (GtkFrame *frame,
GtkWidget *widget,
gint enum_value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]