diff --git a/ChangeLog b/ChangeLog index c7ee6b0323..a1552c7938 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2003-11-15 Simon Budig + + * app/tools/gimpvectoroptions.[ch]: Since GimpVectorTool is no + GimpSelectionTool, it does not make sense to have + GimpSelectionOptions for it. + + * app/tools/gimpvectoroptions.c + * app/tools/gimpvectortool.c: Connect the Buttons to the + Help system and make the to-selection Button modifier + aware. + 2003-11-14 Sven Neumann * libgimpwidgets/gimpwidgets.[ch]: guard old functions using @@ -239,7 +250,7 @@ * app/widgets/gimpsessioninfo.c (gimp_session_info_deserialize): replaced a misleading comment. -2003-11-14 Simon Budig +2003-11-14 Simon Budig * app/tools/gimpvectoroptions.c: Add two buttons to the Tool Options @@ -360,7 +371,7 @@ Changed "drawable" to "layer" in all user visible warnings about indexed or non-RGB drawables. Cleanup. -2003-11-13 Simon Budig +2003-11-13 Simon Budig * app/core/gimpdrawable-stroke.c: removed erraneous offset by 0.5 pixels. @@ -664,7 +675,7 @@ * app/widgets/gimpdialogfactory.c * app/widgets/gimptooldialog.c: updated gtk-doc comments. -2003-11-11 Simon Budig +2003-11-11 Simon Budig * app/vectors/gimpvectors.c: New vectors now are invisible by default. A quick poll on #gimp revealed that this is more @@ -1137,7 +1148,7 @@ * libgimpwidgets/gimpquerybox.c: cleanups and fixes. -2003-11-07 Simon Budig +2003-11-07 Simon Budig * app/vectors/gimpvectors.[ch]: New function that appends a duplicate of the source vectors strokes to the list of strokes @@ -1821,7 +1832,7 @@ * app/tools/gimptextoptions.c: made all length properties in GimpText depend on a single unit. -2003-10-26 Simon Budig +2003-10-26 Simon Budig * tools/authorsgen/contributors: Fixed/Added some UTF-8 encoded names. Please speak up if I did mess up your name. @@ -2099,7 +2110,7 @@ * app/widgets/gimptooldialog.c (gimp_tool_dialog_new): fixed inline documentation. -2003-10-22 Simon Budig +2003-10-22 Simon Budig * app/tools/gimpvectortool.c: Changed the priority of ALT vs. CTRL. Resolves an small issue with (broken) @@ -3473,7 +3484,7 @@ * app/gui/dialogs-commands.c (dialogs_detach_tab_cmd_callback): implement it using gimp_dockable_detach(). -2003-10-07 Simon Budig +2003-10-07 Simon Budig * docs/Wilber.svg: Debugged winding rule issue, removed redundant paths, added IDs. Indentation madness. diff --git a/app/tools/gimpvectoroptions.c b/app/tools/gimpvectoroptions.c index 9211694dcc..a6a7bdf0ea 100644 --- a/app/tools/gimpvectoroptions.c +++ b/app/tools/gimpvectoroptions.c @@ -31,6 +31,7 @@ #include "core/gimptoolinfo.h" +#include "widgets/gimphelp-ids.h" #include "widgets/gimppropwidgets.h" #include "widgets/gimpwidgets-utils.h" @@ -81,7 +82,7 @@ gimp_vector_options_get_type (void) (GInstanceInitFunc) gimp_vector_options_init, }; - type = g_type_register_static (GIMP_TYPE_SELECTION_OPTIONS, + type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS, "GimpVectorOptions", &info, 0); } @@ -176,6 +177,7 @@ gimp_vector_options_gui (GimpToolOptions *tool_options) GtkWidget *vbox; GtkWidget *frame; GtkWidget *button; + gchar *str; config = G_OBJECT (tool_options); @@ -192,17 +194,32 @@ gimp_vector_options_gui (GimpToolOptions *tool_options) gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button); - button = gtk_button_new_with_label (_("Create Selection from Path")); + str = g_strdup_printf (_("Path to Selection\n" + "%s Add\n" + "%s Subtract\n" + "%s%s%s Intersect"), + gimp_get_mod_name_shift (), + gimp_get_mod_name_control (), + gimp_get_mod_name_shift (), + gimp_get_mod_separator (), + gimp_get_mod_name_control ()); + + button = gimp_button_new (); + gtk_button_set_label (GTK_BUTTON (button), _("Create Selection from Path")); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_set_sensitive (button, FALSE); + gimp_help_set_help_data (button, str, GIMP_HELP_PATH_SELECTION_REPLACE); gtk_widget_show (button); + g_free (str); + g_object_set_data (G_OBJECT (tool_options), "gimp-vectors-to-selection", button); button = gtk_button_new_with_label (_("Stroke Path")); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_set_sensitive (button, FALSE); + gimp_help_set_help_data (button, NULL, GIMP_HELP_PATH_STROKE); gtk_widget_show (button); g_object_set_data (G_OBJECT (tool_options), diff --git a/app/tools/gimpvectoroptions.h b/app/tools/gimpvectoroptions.h index c0aafbec19..a7177a6fb9 100644 --- a/app/tools/gimpvectoroptions.h +++ b/app/tools/gimpvectoroptions.h @@ -20,7 +20,7 @@ #define __GIMP_VECTOR_OPTIONS_H__ -#include "gimpselectionoptions.h" +#include "core/gimptooloptions.h" #define GIMP_TYPE_VECTOR_OPTIONS (gimp_vector_options_get_type ()) @@ -36,10 +36,10 @@ typedef struct _GimpToolOptionsClass GimpVectorOptionsClass; struct _GimpVectorOptions { - GimpSelectionOptions parent_instance; + GimpToolOptions parent_instance; - GimpVectorMode edit_mode; - gboolean polygonal; + GimpVectorMode edit_mode; + gboolean polygonal; }; diff --git a/app/tools/gimpvectortool.c b/app/tools/gimpvectortool.c index 10236605a7..82553fed75 100644 --- a/app/tools/gimpvectortool.c +++ b/app/tools/gimpvectortool.c @@ -136,6 +136,9 @@ static void gimp_vector_tool_undo_push (GimpVectorTool *vector_tool, const gchar *desc); static void gimp_vector_tool_to_selection (GimpVectorTool *vector_tool); +static void gimp_vector_tool_to_selection_extended + (GimpVectorTool *vector_tool, + gint state); static void gimp_vector_tool_stroke_vectors (GimpVectorTool *vector_tool, GtkWidget *button); @@ -1503,6 +1506,9 @@ gimp_vector_tool_set_vectors (GimpVectorTool *vector_tool, g_signal_handlers_disconnect_by_func (sel_button, gimp_vector_tool_to_selection, tool); + g_signal_handlers_disconnect_by_func (sel_button, + gimp_vector_tool_to_selection_extended, + tool); } if (stroke_button) @@ -1553,6 +1559,9 @@ gimp_vector_tool_set_vectors (GimpVectorTool *vector_tool, g_signal_connect_swapped (sel_button, "clicked", G_CALLBACK (gimp_vector_tool_to_selection), tool); + g_signal_connect_swapped (sel_button, "extended_clicked", + G_CALLBACK (gimp_vector_tool_to_selection_extended), + tool); gtk_widget_set_sensitive (sel_button, TRUE); } @@ -1740,19 +1749,41 @@ gimp_vector_tool_undo_push (GimpVectorTool *vector_tool, const gchar *desc) static void gimp_vector_tool_to_selection (GimpVectorTool *vector_tool) +{ + gimp_vector_tool_to_selection_extended (vector_tool, 0); +} + + +static void +gimp_vector_tool_to_selection_extended (GimpVectorTool *vector_tool, + gint state) { GimpImage *gimage; + GimpChannelOps operation = GIMP_CHANNEL_OP_REPLACE; if (! vector_tool->vectors) return; gimage = gimp_item_get_image (GIMP_ITEM (vector_tool->vectors)); + if (state & GDK_SHIFT_MASK) + { + if (state & GDK_CONTROL_MASK) + operation = GIMP_CHANNEL_OP_INTERSECT; + else + operation = GIMP_CHANNEL_OP_ADD; + } + else if (state & GDK_CONTROL_MASK) + { + operation = GIMP_CHANNEL_OP_SUBTRACT; + } + gimp_channel_select_vectors (gimp_image_get_mask (gimage), _("Path to Selection"), vector_tool->vectors, - GIMP_CHANNEL_OP_REPLACE, + operation, TRUE, FALSE, 0, 0); + gimp_image_flush (gimage); }