Commit 17c27e5e authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added a "item_activate_func" to the struct and the constructor so we can

2002-02-26  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpitemlistview.[ch]: added a "item_activate_func"
	to the struct and the constructor so we can distinguish double
	click from right click in the callbacks.

	* app/widgets/gimpvectorslistview.[ch]: added a "item_stroke_func".

	* app/widgets/gimpchannellistview.c: reorder the "To Selection" button.

	* app/gui/dialogs-constructors.c: changed accordingly.

	* app/gui/menus.c: added separators and some new items to the
	vectors menu. Use the SELECTION_REPLACE, _ADD, ... icons for
	the resp. menu items.

	* app/gui/vectors-commands.[ch]: added empty callbacks for the new
	menu items, put the stroke stuff to an own function which is used
	as "item_stroke_func" when creating GimpVectorsListViews.
parent 52d07c96
2002-02-26 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpitemlistview.[ch]: added a "item_activate_func"
to the struct and the constructor so we can distinguish double
click from right click in the callbacks.
* app/widgets/gimpvectorslistview.[ch]: added a "item_stroke_func".
* app/widgets/gimpchannellistview.c: reorder the "To Selection" button.
* app/gui/dialogs-constructors.c: changed accordingly.
* app/gui/menus.c: added separators and some new items to the
vectors menu. Use the SELECTION_REPLACE, _ADD, ... icons for
the resp. menu items.
* app/gui/vectors-commands.[ch]: added empty callbacks for the new
menu items, put the stroke stuff to an own function which is used
as "item_stroke_func" when creating GimpVectorsListViews.
2002-02-26 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage-mask-select.[ch]: implemented
......
......@@ -229,16 +229,148 @@ void
vectors_stroke_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
GimpDrawable *active_drawable;
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
vectors_stroke_vectors (active_vectors);
}
}
void
vectors_copy_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
}
}
void
vectors_paste_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
}
}
void
vectors_import_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
}
}
void
vectors_export_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
}
}
void
vectors_vectors_tool_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
vectors_vectors_tool (active_vectors);
}
}
void
vectors_edit_vectors_attributes_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
vectors_edit_vectors_query (active_vectors);
}
}
void
vectors_stroke_vectors (GimpVectors *vectors)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
g_return_if_fail (GIMP_IS_VECTORS (vectors));
gimage = gimp_item_get_image (GIMP_ITEM (vectors));
active_drawable = gimp_image_active_drawable (gimage);
if (! active_drawable)
......@@ -247,7 +379,7 @@ vectors_stroke_vectors_cmd_callback (GtkWidget *widget,
return;
}
if (active_vectors && active_vectors->strokes)
if (vectors && vectors->strokes)
{
GimpTool *active_tool;
GimpPaintCore *core;
......@@ -284,7 +416,7 @@ vectors_stroke_vectors_cmd_callback (GtkWidget *widget,
gimp_paint_core_stroke_vectors (core,
active_drawable,
paint_options,
active_vectors);
vectors);
tool_manager_control_active (gimage->gimp, RESUME, gdisp);
......@@ -295,25 +427,33 @@ vectors_stroke_vectors_cmd_callback (GtkWidget *widget,
}
void
vectors_edit_vectors_attributes_cmd_callback (GtkWidget *widget,
gpointer data)
vectors_vectors_tool (GimpVectors *vectors)
{
GimpImage *gimage;
GimpVectors *active_vectors;
GimpImage *gimage;
GimpTool *active_tool;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
g_return_if_fail (GIMP_IS_VECTORS (vectors));
if (! gimage)
return;
gimage = gimp_item_get_image (GIMP_ITEM (vectors));
active_vectors = gimp_image_get_active_vectors (gimage);
active_tool = tool_manager_get_active (gimage->gimp);
if (active_vectors)
if (! GIMP_IS_VECTOR_TOOL (active_tool))
{
vectors_edit_vectors_query (active_vectors);
GimpToolInfo *tool_info;
tool_info = tool_manager_get_info_by_type (gimage->gimp,
GIMP_TYPE_VECTOR_TOOL);
gimp_context_set_tool (gimp_get_current_context (gimage->gimp),
tool_info);
active_tool = tool_manager_get_active (gimage->gimp);
}
}
gimp_vector_tool_set_vectors (GIMP_VECTOR_TOOL (active_tool),
vectors);
}
/**********************************/
/* The new vectors query dialog */
......@@ -501,29 +641,7 @@ vectors_edit_vectors_query (GimpVectors *vectors)
GtkWidget *table;
GtkWidget *label;
{
Gimp *gimp;
GimpTool *active_tool;
gimp = GIMP_ITEM (vectors)->gimage->gimp;
active_tool = tool_manager_get_active (gimp);
if (! GIMP_IS_VECTOR_TOOL (active_tool))
{
GimpToolInfo *tool_info;
tool_info = tool_manager_get_info_by_type (gimp, GIMP_TYPE_VECTOR_TOOL);
gimp_context_set_tool (gimp_get_current_context (gimp), tool_info);
active_tool = tool_manager_get_active (gimp);
}
gimp_vector_tool_set_vectors (GIMP_VECTOR_TOOL (active_tool), vectors);
return;
}
g_return_if_fail (GIMP_IS_VECTORS (vectors));
options = g_new0 (EditVectorsOptions, 1);
......@@ -599,6 +717,7 @@ vectors_menu_update (GtkItemFactory *factory,
GimpImage *gimage;
GimpVectors *vectors;
gboolean mask_empty;
gboolean global_buf;
GList *list;
GList *next = NULL;
GList *prev = NULL;
......@@ -609,6 +728,8 @@ vectors_menu_update (GtkItemFactory *factory,
mask_empty = gimp_image_mask_is_empty (gimage);
global_buf = FALSE;
for (list = GIMP_LIST (gimage->vectors)->list;
list;
list = g_list_next (list))
......@@ -635,6 +756,11 @@ vectors_menu_update (GtkItemFactory *factory,
SET_SENSITIVE ("/Selection to Path", ! mask_empty);
SET_SENSITIVE ("/Stroke Path", vectors);
SET_SENSITIVE ("/Delete Path", vectors);
SET_SENSITIVE ("/Copy Path", vectors);
SET_SENSITIVE ("/Paste Path", global_buf);
SET_SENSITIVE ("/Import Path...", TRUE);
SET_SENSITIVE ("/Export Path...", vectors);
SET_SENSITIVE ("/Path Tool", vectors);
SET_SENSITIVE ("/Edit Path Attributes...", vectors);
#undef SET_SENSITIVE
......
......@@ -42,9 +42,21 @@ void vectors_sel_to_vectors_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_stroke_vectors_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_copy_vectors_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_paste_vectors_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_import_vectors_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_export_vectors_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_vectors_tool_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_edit_vectors_attributes_cmd_callback (GtkWidget *widget,
gpointer data);
void vectors_stroke_vectors (GimpVectors *vectors);
void vectors_vectors_tool (GimpVectors *vectors);
void vectors_new_vectors_query (GimpImage *gimage,
GimpVectors *template);
void vectors_edit_vectors_query (GimpVectors *vectors);
......
......@@ -51,6 +51,7 @@
#include "widgets/gimpdocumentview.h"
#include "widgets/gimplistitem.h"
#include "widgets/gimppreview.h"
#include "widgets/gimpvectorslistview.h"
#include "about-dialog.h"
#include "brush-editor.h"
......@@ -735,6 +736,7 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
(GimpConvertItemFunc) gimp_layer_new_from_drawable,
(GimpNewItemFunc) layers_new_layer_query,
(GimpEditItemFunc) layers_edit_layer_query,
(GimpActivateItemFunc) layers_edit_layer_query,
gimp_item_factory_from_path ("<Layers>"));
dockable = dialogs_dockable_new (view,
......@@ -773,6 +775,7 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
(GimpConvertItemFunc) NULL,
(GimpNewItemFunc) channels_new_channel_query,
(GimpEditItemFunc) channels_edit_channel_query,
(GimpActivateItemFunc) channels_edit_channel_query,
gimp_item_factory_from_path ("<Channels>"));
dockable = dialogs_dockable_new (view,
......@@ -801,9 +804,10 @@ dialogs_vectors_list_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GimpImage *gimage;
GtkWidget *view;
GtkWidget *dockable;
GimpImage *gimage;
GimpVectorsListView *vectors_view;
GtkWidget *view;
GtkWidget *dockable;
gimage = gimp_context_get_image (context);
......@@ -822,8 +826,13 @@ dialogs_vectors_list_view_new (GimpDialogFactory *factory,
(GimpConvertItemFunc) NULL,
(GimpNewItemFunc) vectors_new_vectors_query,
(GimpEditItemFunc) vectors_edit_vectors_query,
(GimpActivateItemFunc) vectors_vectors_tool,
gimp_item_factory_from_path ("<Vectors>"));
vectors_view = GIMP_VECTORS_LIST_VIEW (view);
vectors_view->stroke_item_func = vectors_stroke_vectors;
dockable = dialogs_dockable_new (view,
"Paths List", "Paths",
NULL,
......
......@@ -51,6 +51,7 @@
#include "widgets/gimpdocumentview.h"
#include "widgets/gimplistitem.h"
#include "widgets/gimppreview.h"
#include "widgets/gimpvectorslistview.h"
#include "about-dialog.h"
#include "brush-editor.h"
......@@ -735,6 +736,7 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
(GimpConvertItemFunc) gimp_layer_new_from_drawable,
(GimpNewItemFunc) layers_new_layer_query,
(GimpEditItemFunc) layers_edit_layer_query,
(GimpActivateItemFunc) layers_edit_layer_query,
gimp_item_factory_from_path ("<Layers>"));
dockable = dialogs_dockable_new (view,
......@@ -773,6 +775,7 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
(GimpConvertItemFunc) NULL,
(GimpNewItemFunc) channels_new_channel_query,
(GimpEditItemFunc) channels_edit_channel_query,
(GimpActivateItemFunc) channels_edit_channel_query,
gimp_item_factory_from_path ("<Channels>"));
dockable = dialogs_dockable_new (view,
......@@ -801,9 +804,10 @@ dialogs_vectors_list_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GimpImage *gimage;
GtkWidget *view;
GtkWidget *dockable;
GimpImage *gimage;
GimpVectorsListView *vectors_view;
GtkWidget *view;
GtkWidget *dockable;
gimage = gimp_context_get_image (context);
......@@ -822,8 +826,13 @@ dialogs_vectors_list_view_new (GimpDialogFactory *factory,
(GimpConvertItemFunc) NULL,
(GimpNewItemFunc) vectors_new_vectors_query,
(GimpEditItemFunc) vectors_edit_vectors_query,
(GimpActivateItemFunc) vectors_vectors_tool,
gimp_item_factory_from_path ("<Vectors>"));
vectors_view = GIMP_VECTORS_LIST_VIEW (view);
vectors_view->stroke_item_func = vectors_stroke_vectors;
dockable = dialogs_dockable_new (view,
"Paths List", "Paths",
NULL,
......
......@@ -1130,22 +1130,22 @@ static GimpItemFactoryEntry channels_entries[] =
{ { N_("/Channel to Selection"), "<control>S",
channels_channel_to_sel_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TO_SELECTION },
"<StockItem>", GIMP_STOCK_SELECTION_REPLACE },
NULL,
"channel_to_selection.html", NULL },
{ { N_("/Add to Selection"), NULL,
channels_add_channel_to_sel_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TO_SELECTION },
"<StockItem>", GIMP_STOCK_SELECTION_ADD },
NULL,
"channel_to_selection.html#add", NULL },
{ { N_("/Subtract from Selection"), NULL,
channels_sub_channel_from_sel_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TO_SELECTION },
"<StockItem>", GIMP_STOCK_SELECTION_SUBTRACT },
NULL,
"channel_to_selection.html#subtract", NULL },
{ { N_("/Intersect with Selection"), NULL,
channels_intersect_channel_with_sel_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TO_SELECTION },
"<StockItem>", GIMP_STOCK_SELECTION_INTERSECT },
NULL,
"channel_to_selection.html#intersect", NULL },
......@@ -1191,24 +1191,27 @@ static GimpItemFactoryEntry vectors_entries[] =
"<StockItem>", GIMP_STOCK_DUPLICATE },
NULL,
"duplicate_path.html", NULL },
SEPARATOR ("/---"),
{ { N_("/Path to Selection"), "<control>S",
vectors_vectors_to_sel_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TO_SELECTION },
"<StockItem>", GIMP_STOCK_SELECTION_REPLACE },
NULL,
"path_to_selection.html", NULL },
{ { N_("/Add to Selection"), NULL,
vectors_add_vectors_to_sel_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TO_SELECTION },
"<StockItem>", GIMP_STOCK_SELECTION_ADD },
NULL,
"path_to_selection.html#add", NULL },
{ { N_("/Subtract from Selection"), NULL,
vectors_sub_vectors_from_sel_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TO_SELECTION },
"<StockItem>", GIMP_STOCK_SELECTION_SUBTRACT },
NULL,
"path_to_selection.html#subtract", NULL },
{ { N_("/Intersect with Selection"), NULL,
vectors_intersect_vectors_with_sel_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TO_SELECTION },
"<StockItem>", GIMP_STOCK_SELECTION_INTERSECT },
NULL,
"path_to_selection.html#intersect", NULL },
......@@ -1222,6 +1225,32 @@ static GimpItemFactoryEntry vectors_entries[] =
"<StockItem>", GIMP_STOCK_STROKE },
NULL,
"stroke_path.html", NULL },
SEPARATOR ("/---"),
{ { N_("/Copy Path"), "<control>C",
vectors_copy_vectors_cmd_callback, 0,
"<StockItem>", GTK_STOCK_COPY },
NULL,
"copy_path.html", NULL },
{ { N_("/Paste Path"), "<control>V",
vectors_paste_vectors_cmd_callback, 0,
"<StockItem>", GTK_STOCK_PASTE },
NULL,
"paste_path.html", NULL },
{ { N_("/Import Path..."), "<control>I",
vectors_import_vectors_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
NULL,
"dialogs/import_path.html", NULL },
{ { N_("/Export Path..."), "<control>E",
vectors_export_vectors_cmd_callback, 0,
"<StockItem>", GTK_STOCK_SAVE },
NULL,
"dialogs/export_path.html", NULL },
SEPARATOR ("/---"),
{ { N_("/Delete Path"), "<control>X",
vectors_delete_vectors_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
......@@ -1230,6 +1259,11 @@ static GimpItemFactoryEntry vectors_entries[] =
SEPARATOR ("/---"),
{ { N_("/Path Tool"), NULL,
vectors_vectors_tool_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_PATH },
NULL,
"tools/path_tool.html", NULL },
{ { N_("/Edit Path Attributes..."), NULL,
vectors_edit_vectors_attributes_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_EDIT },
......
......@@ -229,16 +229,148 @@ void
vectors_stroke_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
GimpDrawable *active_drawable;
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
vectors_stroke_vectors (active_vectors);
}
}
void
vectors_copy_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
}
}
void
vectors_paste_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
}
}
void
vectors_import_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
}
}
void
vectors_export_vectors_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
}
}
void
vectors_vectors_tool_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
vectors_vectors_tool (active_vectors);
}
}
void
vectors_edit_vectors_attributes_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpVectors *active_vectors;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
if (! gimage)
return;
active_vectors = gimp_image_get_active_vectors (gimage);
if (active_vectors)
{
vectors_edit_vectors_query (active_vectors);
}
}
void
vectors_stroke_vectors (GimpVectors *vectors)
{
GimpImage *gimage;
GimpDrawable *active_drawable;
g_return_if_fail (GIMP_IS_VECTORS (vectors));
gimage = gimp_item_get_image (GIMP_ITEM (vectors));
active_drawable = gimp_image_active_drawable (gimage);
if (! active_drawable)
......@@ -247,7 +379,7 @@ vectors_stroke_vectors_cmd_callback (GtkWidget *widget,
return;
}
if (active_vectors && active_vectors->strokes)
if (vectors && vectors->strokes)
{
GimpTool *active_tool;
GimpPaintCore *core;
......@@ -284,7 +416,7 @@ vectors_stroke_vectors_cmd_callback (GtkWidget *widget,
gimp_paint_core_stroke_vectors (core,
active_drawable,
paint_options,
active_vectors);
vectors);
tool_manager_control_active (gimage->gimp, RESUME, gdisp);
......@@ -295,25 +427,33 @@ vectors_stroke_vectors_cmd_callback (GtkWidget *widget,
}
void
vectors_edit_vectors_attributes_cmd_callback (GtkWidget *widget,
gpointer data)
vectors_vectors_tool (GimpVectors *vectors)
{
GimpImage *gimage;
GimpVectors *active_vectors;
GimpImage *gimage;
GimpTool *active_tool;
gimage = (GimpImage *) gimp_widget_get_callback_context (widget);
g_return_if_fail (GIMP_IS_VECTORS (vectors));
if (! gimage)
return;
gimage = gimp_item_get_image (GIMP_ITEM (vectors));
active_vectors = gimp_image_get_active_vectors (gimage);
active_tool = tool_manager_get_active (gimage->gimp);
if (active_vectors)
if (! GIMP_IS_VECTOR_TOOL (active_tool))
{
vectors_edit_vectors_query (active_vectors);
GimpToolInfo *tool_info;
tool_info = tool_manager_get_info_by_type (gimage->gimp,
GIMP_TYPE_VECTOR_TOOL);
gimp_context_set_tool (gimp_get_current_context (gimage