mirror of https://github.com/GNOME/gimp.git
Added functions to shift the dash pattern to the left or right.
2003-12-28 Simon Budig <simon@gimp.org> * app/widgets/gimpdasheditor.[ch]: Added functions to shift the dash pattern to the left or right. * app/widgets/gimpstrokeeditor.c: Improve the appearance of the widget and add left/right buttons.
This commit is contained in:
parent
266934dcdf
commit
3955690e31
|
@ -1,3 +1,11 @@
|
|||
2003-12-28 Simon Budig <simon@gimp.org>
|
||||
|
||||
* app/widgets/gimpdasheditor.[ch]: Added functions to shift the
|
||||
dash pattern to the left or right.
|
||||
|
||||
* app/widgets/gimpstrokeeditor.c: Improve the appearance of the
|
||||
widget and add left/right buttons.
|
||||
|
||||
2003-12-27 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/widgets/gimpdasheditor.c: some minor cleanups.
|
||||
|
|
|
@ -338,13 +338,6 @@ gimp_dash_editor_expose (GtkWidget *widget,
|
|||
editor->x0 - 1, editor->y0 - 1,
|
||||
editor->x0 - 1, editor->y0 + h);
|
||||
|
||||
gtk_paint_shadow (widget->style, widget->window,
|
||||
GTK_STATE_NORMAL, GTK_SHADOW_IN,
|
||||
NULL, widget, NULL,
|
||||
0, 0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -434,6 +427,38 @@ gimp_dash_editor_new (GimpStrokeOptions *stroke_options)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
gimp_dash_editor_shift_right (GimpDashEditor *editor)
|
||||
{
|
||||
gint i;
|
||||
gboolean swap;
|
||||
|
||||
g_return_if_fail (editor->n_segments > 0);
|
||||
|
||||
swap = editor->segments[editor->n_segments - 1];
|
||||
for (i = editor->n_segments - 1; i > 0; i--)
|
||||
editor->segments[i] = editor->segments[i-1];
|
||||
editor->segments[0] = swap;
|
||||
|
||||
update_options_from_segments (editor);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_dash_editor_shift_left (GimpDashEditor *editor)
|
||||
{
|
||||
gint i;
|
||||
gboolean swap;
|
||||
|
||||
g_return_if_fail (editor->n_segments > 0);
|
||||
|
||||
swap = editor->segments[0];
|
||||
for (i = 1; i < editor->n_segments; i++)
|
||||
editor->segments[i-1] = editor->segments[i];
|
||||
editor->segments[editor->n_segments - 1] = swap;
|
||||
|
||||
update_options_from_segments (editor);
|
||||
}
|
||||
|
||||
static void
|
||||
update_segments_from_options (GimpDashEditor *editor)
|
||||
{
|
||||
|
|
|
@ -66,8 +66,12 @@ struct _GimpDashEditorClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_dash_editor_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_dash_editor_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_dash_editor_new (GimpStrokeOptions *stroke_options);
|
||||
|
||||
void gimp_dash_editor_shift_left (GimpDashEditor *editor);
|
||||
void gimp_dash_editor_shift_right (GimpDashEditor *editor);
|
||||
|
||||
GtkWidget * gimp_dash_editor_new (GimpStrokeOptions *stroke_options);
|
||||
|
||||
#endif /* __GIMP_DASH_EDITOR_H__ */
|
||||
|
|
|
@ -54,6 +54,9 @@ static void gimp_stroke_editor_get_property (GObject *object,
|
|||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_stroke_editor_finalize (GObject *object);
|
||||
static gboolean gimp_stroke_editor_paint_button (GtkWidget *widget,
|
||||
GdkEventExpose *event,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
static GtkVBoxClass *parent_class = NULL;
|
||||
|
@ -167,6 +170,7 @@ gimp_stroke_editor_constructor (GType type,
|
|||
GimpStrokeEditor *editor;
|
||||
GtkWidget *table;
|
||||
GtkWidget *box;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *size;
|
||||
GtkWidget *dash_editor;
|
||||
GtkWidget *button;
|
||||
|
@ -212,11 +216,46 @@ gimp_stroke_editor_constructor (GType type,
|
|||
1.0, 1.0, 1,
|
||||
FALSE, 0.0, 0.0);
|
||||
|
||||
box = gtk_hbox_new (FALSE, 0);
|
||||
dash_editor = gimp_dash_editor_new (editor->options);
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
|
||||
_("Dash Pattern:"), 1.0, 0.5, dash_editor, 1, FALSE);
|
||||
gtk_widget_show (dash_editor);
|
||||
|
||||
button = g_object_new (GTK_TYPE_BUTTON,
|
||||
"width-request", 14,
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE, 0);
|
||||
g_signal_connect_object (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gimp_dash_editor_shift_left),
|
||||
dash_editor, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_after (G_OBJECT (button), "expose-event",
|
||||
G_CALLBACK (gimp_stroke_editor_paint_button),
|
||||
button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (box), dash_editor, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show (dash_editor);
|
||||
|
||||
button = g_object_new (GTK_TYPE_BUTTON,
|
||||
"width-request", 14,
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE, 0);
|
||||
g_signal_connect_object (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gimp_dash_editor_shift_right),
|
||||
dash_editor, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_after (G_OBJECT (button), "expose-event",
|
||||
G_CALLBACK (gimp_stroke_editor_paint_button),
|
||||
NULL);
|
||||
gtk_widget_show (button);
|
||||
gtk_widget_show (box);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
gtk_container_add (GTK_CONTAINER (frame), box);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
|
||||
_("Dash Pattern:"), 1.0, 0.5, frame, 2, FALSE);
|
||||
|
||||
button = gimp_prop_check_button_new (G_OBJECT (editor->options), "antialias",
|
||||
_("_Antialiasing"));
|
||||
gtk_table_attach (GTK_TABLE (table), button, 0, 2, row, row + 1,
|
||||
|
@ -259,3 +298,25 @@ gimp_stroke_editor_new (GimpStrokeOptions *options,
|
|||
"resolution", resolution,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_stroke_editor_paint_button (GtkWidget *widget,
|
||||
GdkEventExpose *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkAllocation *alloc;
|
||||
gint w;
|
||||
|
||||
alloc = &widget->allocation;
|
||||
|
||||
w = MIN (alloc->width, alloc->height) * 2 / 3;
|
||||
|
||||
gtk_paint_arrow (widget->style, widget->window,
|
||||
widget->state, GTK_SHADOW_IN,
|
||||
&event->area, widget, NULL,
|
||||
user_data ? GTK_ARROW_LEFT : GTK_ARROW_RIGHT, TRUE,
|
||||
alloc->x + (alloc->width - w) / 2,
|
||||
alloc->y + (alloc->height - w) / 2,
|
||||
w, w);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue