diff --git a/ChangeLog b/ChangeLog index 83295fce3f..43e7c4d215 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,56 @@ +2004-04-19 Michael Natterer + + More GtkAction stuff (still unused): + + * configure.in: added new directories menus/ and app/actions/ + + * Makefile.am: build menus/ + + * menus/.cvsignore + * menus/Makefile.am + * menus/*-menu.xml: new files: XML menu descriptions for each menu + which is now defined in gui/*-menu.c. + + * app/widgets/widgets-types.h: some typedefs for GimpActionGroup. + + * app/widgets/gimpactiongroup.[ch]: added a "Gimp" construct-only + property. Added APIs to set actions visible/sensitive/active + and an unimplemented stub for setting the action's color. + + * app/Makefile.am: build actions/ and link libappactions.a + + * app/actions/.cvsignore + * app/actions/Makefile.am + * app/actions/*-actions.[ch]: new files: GtkActions for each + *-commands.c file in gui/. Ported all "update" functions from the + *-menu.c files. + (everything completely unused, untested and partly #if 0'ed) + + * app/core/gimpimage.[ch]: for reasons of (action-) symmetry, added + API to raise/lower channels/vectors to top/bottom. + + * app/gui/channels-commands.[ch] + * app/gui/vectors-commands.[ch]: added callbacks for the new + to top/bottom functions. + + * app/gui/Makefile.am + * app/gui/dockable-commands.[ch]: new files split out of + dialogs-commands.[ch]. + + * app/gui/dialogs-commands.[ch] + * app/gui/dialogs-menu.c: changed accordingly. + + * app/gui/edit-commands.[ch]: added edit_paste_into_cmd_callback() + and remove usage of "guint action". + + * app/gui/image-menu.c: changed accordingly. + + * app/gui/palette-editor-commands.[ch]: split + +palette_editor_new_color_cmd_callback() into separate callbacks + for adding from FG and BG. + + * app/gui/palette-editor-menu.c: changed accordingly. + 2004-04-19 Henrik Brix Andersen * plug-ins/script-fu/scripts/gimp-headers.scm diff --git a/Makefile.am b/Makefile.am index b3627461b4..bf86f0e980 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,6 +11,7 @@ SUBDIRS = \ po-plug-ins \ po-script-fu \ data \ + menus \ tips \ libgimpbase \ libgimpcolor \ diff --git a/app/Makefile.am b/app/Makefile.am index c203969ac2..8376ef1d91 100644 --- a/app/Makefile.am +++ b/app/Makefile.am @@ -22,6 +22,7 @@ SUBDIRS = \ tools \ widgets \ display \ + actions \ gui \ pdb @@ -83,6 +84,7 @@ gimp_2_1_LDFLAGS = \ gimp_2_1_LDADD = \ config/libappconfig.a \ gui/libappgui.a \ + actions/libappactions.a \ display/libappdisplay.a \ tools/libapptools.a \ widgets/libappwidgets.a \ diff --git a/app/actions/.cvsignore b/app/actions/.cvsignore new file mode 100644 index 0000000000..ba379316ff --- /dev/null +++ b/app/actions/.cvsignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.deps +.libs +*.lo +libappactions.la diff --git a/app/actions/Makefile.am b/app/actions/Makefile.am new file mode 100644 index 0000000000..68d7962c2f --- /dev/null +++ b/app/actions/Makefile.am @@ -0,0 +1,77 @@ +## Process this file with automake to produce Makefile.in + +noinst_LIBRARIES = libappactions.a + +libappactions_a_SOURCES = \ + brushes-actions.c \ + brushes-actions.h \ + buffers-actions.c \ + buffers-actions.h \ + channels-actions.c \ + channels-actions.h \ + colormap-editor-actions.c \ + colormap-editor-actions.h \ + debug-actions.c \ + debug-actions.h \ + dialogs-actions.c \ + dialogs-actions.h \ + dockable-actions.c \ + dockable-actions.h \ + documents-actions.c \ + documents-actions.h \ + drawable-actions.c \ + drawable-actions.h \ + edit-actions.c \ + edit-actions.h \ + error-console-actions.c \ + error-console-actions.h \ + file-actions.c \ + file-actions.h \ + fonts-actions.c \ + fonts-actions.h \ + gradient-editor-actions.c \ + gradient-editor-actions.h \ + gradients-actions.c \ + gradients-actions.h \ + help-actions.c \ + help-actions.h \ + image-actions.c \ + image-actions.h \ + images-actions.c \ + images-actions.h \ + layers-actions.c \ + layers-actions.h \ + palette-editor-actions.c \ + palette-editor-actions.h \ + palettes-actions.c \ + palettes-actions.h \ + patterns-actions.c \ + patterns-actions.h \ + qmask-actions.c \ + qmask-actions.h \ + select-actions.c \ + select-actions.h \ + templates-actions.c \ + templates-actions.h \ + tool-options-actions.c \ + tool-options-actions.h \ + vectors-actions.c \ + vectors-actions.h \ + view-actions.c \ + view-actions.h + + +EXTRA_DIST = makefile.msc + +AM_CPPFLAGS = \ + -DG_LOG_DOMAIN=\"Gimp-Actions\" \ + @GIMP_THREAD_FLAGS@ \ + @GIMP_MP_FLAGS@ + +INCLUDES = \ + -I$(top_builddir) \ + -I$(top_srcdir) \ + -I$(top_builddir)/app \ + -I$(top_srcdir)/app \ + $(GTK_CFLAGS) \ + -I$(includedir) diff --git a/app/actions/brushes-actions.c b/app/actions/brushes-actions.c new file mode 100644 index 0000000000..6e27c5f9a3 --- /dev/null +++ b/app/actions/brushes-actions.c @@ -0,0 +1,107 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimpcontext.h" +#include "core/gimpdata.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpcontainereditor.h" +#include "widgets/gimpcontainerview.h" +#include "widgets/gimpdatafactoryview.h" +#include "widgets/gimphelp-ids.h" + +#include "brushes-actions.h" +#include "gui/data-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry brushes_actions[] = +{ + { "brushes-edit", GIMP_STOCK_EDIT, + N_("_Edit Brush..."), NULL, NULL, + G_CALLBACK (data_edit_data_cmd_callback), + GIMP_HELP_BRUSH_EDIT }, + + { "brushes-new", GTK_STOCK_NEW, + N_("/New Brush"), "", NULL, + G_CALLBACK (data_new_data_cmd_callback), + GIMP_HELP_BRUSH_NEW }, + + { "brushes-duplicate", GIMP_STOCK_DUPLICATE, + N_("/D_uplicate Brush"), NULL, NULL, + G_CALLBACK (data_duplicate_data_cmd_callback), + GIMP_HELP_BRUSH_DUPLICATE }, + + { "brushes-delete", GTK_STOCK_DELETE, + N_("_Delete Brush"), "", NULL, + G_CALLBACK (data_delete_data_cmd_callback), + GIMP_HELP_BRUSH_DELETE }, + + { "brushes-refresh", GTK_STOCK_REFRESH, + N_("_Refresh Brushes"), "", NULL, + G_CALLBACK (data_refresh_data_cmd_callback), + GIMP_HELP_BRUSH_REFRESH } +}; + + +void +brushes_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + brushes_actions, + G_N_ELEMENTS (brushes_actions), + data); +} + +void +brushes_actions_update (GimpActionGroup *group, + gpointer user_data) +{ + GimpContainerEditor *editor; + GimpBrush *brush; + GimpData *data = NULL; + + editor = GIMP_CONTAINER_EDITOR (user_data); + + brush = gimp_context_get_brush (editor->view->context); + + if (brush) + data = GIMP_DATA (brush); + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("brushes-edit", + brush && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func); + SET_SENSITIVE ("brushes-duplicate", + brush && GIMP_DATA_GET_CLASS (data)->duplicate); + SET_SENSITIVE ("brushes-delete", + brush && data->deletable); + +#undef SET_SENSITIVE +} diff --git a/app/actions/brushes-actions.h b/app/actions/brushes-actions.h new file mode 100644 index 0000000000..a920aa448a --- /dev/null +++ b/app/actions/brushes-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __BRUSHES_ACTIONS_H__ +#define __BRUSHES_ACTIONS_H__ + + +void brushes_actions_setup (GimpActionGroup *group, + gpointer data); +void brushes_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __BRUSHES_ACTIONS_H__ */ diff --git a/app/actions/buffers-actions.c b/app/actions/buffers-actions.c new file mode 100644 index 0000000000..c940500a4e --- /dev/null +++ b/app/actions/buffers-actions.c @@ -0,0 +1,94 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimpcontext.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpcontainereditor.h" +#include "widgets/gimpcontainerview.h" +#include "widgets/gimphelp-ids.h" + +#include "buffers-actions.h" +#include "gui/buffers-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry buffers_actions[] = +{ + { "buffers-paste", GTK_STOCK_PASTE, + N_("_Paste Buffer"), "", NULL, + G_CALLBACK (buffers_paste_buffer_cmd_callback), + GIMP_HELP_BUFFER_PASTE }, + + { "buffers-paste-info", GIMP_STOCK_PASTE_INTO, + N_("Paste Buffer _Into"), NULL, NULL, + G_CALLBACK (buffers_paste_buffer_into_cmd_callback), + GIMP_HELP_BUFFER_PASTE_INTO }, + + { "buffers-paste-as-new", GIMP_STOCK_PASTE_AS_NEW, + N_("Paste Buffer as _New"), NULL, NULL, + G_CALLBACK (buffers_paste_buffer_as_new_cmd_callback), + GIMP_HELP_BUFFER_PASTE_AS_NEW }, + + { "buffers-delete", GTK_STOCK_DELETE, + N_("_Delete Buffer"), "", NULL, + G_CALLBACK (buffers_delete_buffer_cmd_callback), + GIMP_HELP_BUFFER_DELETE } +}; + + +void +buffers_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + buffers_actions, + G_N_ELEMENTS (buffers_actions), + data); +} + +void +buffers_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpContainerEditor *editor; + GimpBuffer *buffer; + + editor = GIMP_CONTAINER_EDITOR (data); + + buffer = gimp_context_get_buffer (editor->view->context); + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("buffers-paste", buffer); + SET_SENSITIVE ("buffers-paste-into", buffer); + SET_SENSITIVE ("buffers-paste-as-new", buffer); + SET_SENSITIVE ("buffers-delete", buffer); + +#undef SET_SENSITIVE +} diff --git a/app/actions/buffers-actions.h b/app/actions/buffers-actions.h new file mode 100644 index 0000000000..84e0bf9eea --- /dev/null +++ b/app/actions/buffers-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __BUFFERS_ACTIONS_H__ +#define __BUFFERS_ACTIONS_H__ + + +void buffers_actions_setup (GimpActionGroup *group, + gpointer data); +void buffers_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __BUFFERS_ACTIONS_H__ */ diff --git a/app/actions/channels-actions.c b/app/actions/channels-actions.c new file mode 100644 index 0000000000..64f9198982 --- /dev/null +++ b/app/actions/channels-actions.c @@ -0,0 +1,192 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimpimage.h" +#include "core/gimplist.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpcomponenteditor.h" +#include "widgets/gimphelp-ids.h" +#include "widgets/gimpitemtreeview.h" + +#include "channels-actions.h" +#include "gui/channels-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry channels_actions[] = +{ + { "channels-edit-attributes", GIMP_STOCK_EDIT, + N_("_Edit Channel Attributes..."), NULL, NULL, + G_CALLBACK (channels_edit_attributes_cmd_callback), + GIMP_HELP_CHANNEL_EDIT }, + + { "channels-new", GTK_STOCK_NEW, + N_("/_New Channel..."), "", NULL, + G_CALLBACK (channels_new_cmd_callback), + GIMP_HELP_CHANNEL_NEW }, + + { "channels-duplicate", GIMP_STOCK_DUPLICATE, + N_("D_uplicate Channel"), NULL, NULL, + G_CALLBACK (channels_duplicate_cmd_callback), + GIMP_HELP_CHANNEL_DUPLICATE }, + + { "channels-delete", GTK_STOCK_DELETE, + N_("_Delete Channel"), "", NULL, + G_CALLBACK (channels_delete_cmd_callback), + GIMP_HELP_CHANNEL_DELETE }, + + { "channels-raise", GTK_STOCK_GO_UP, + N_("_Raise Channel"), "", NULL, + G_CALLBACK (channels_raise_cmd_callback), + GIMP_HELP_CHANNEL_RAISE }, + + { "channels-raise-to-top", GTK_STOCK_GOTO_TOP, + N_("Raise Channel to _Top"), "", NULL, + G_CALLBACK (channels_raise_to_top_cmd_callback), + GIMP_HELP_CHANNEL_RAISE_TO_TOP }, + + { "channels-lower", GTK_STOCK_GO_DOWN, + N_("_Lower Channel"), "", NULL, + G_CALLBACK (channels_lower_cmd_callback), + GIMP_HELP_CHANNEL_LOWER }, + + { "channels-lower-to-bottom", GTK_STOCK_GOTO_BOTTOM, + N_("Lower Channel to _Bottom"), "", NULL, + G_CALLBACK (channels_lower_to_bottom_cmd_callback), + GIMP_HELP_CHANNEL_LOWER_TO_BOTTOM } +}; + +static GimpEnumActionEntry channels_to_selection_actions[] = +{ + { "channels-selection-replace", GIMP_STOCK_SELECTION_REPLACE, + N_("Channel to Sele_ction"), NULL, NULL, + GIMP_CHANNEL_OP_REPLACE, + GIMP_HELP_CHANNEL_SELECTION_REPLACE }, + + { "channels-selection-add", GIMP_STOCK_SELECTION_ADD, + N_("_Add to Selection"), NULL, NULL, + GIMP_CHANNEL_OP_ADD, + GIMP_HELP_CHANNEL_SELECTION_ADD }, + + { "channels-selection-subtract", GIMP_STOCK_SELECTION_SUBTRACT, + N_("_Subtract from Selection"), NULL, NULL, + GIMP_CHANNEL_OP_SUBTRACT, + GIMP_HELP_CHANNEL_SELECTION_SUBTRACT }, + + { "channels-selection-intersect", GIMP_STOCK_SELECTION_INTERSECT, + N_("_Intersect with Selection"), NULL, NULL, + GIMP_CHANNEL_OP_INTERSECT, + GIMP_HELP_CHANNEL_SELECTION_INTERSECT } +}; + + +void +channels_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + channels_actions, + G_N_ELEMENTS (channels_actions), + data); + + gimp_action_group_add_enum_actions (group, + channels_to_selection_actions, + G_N_ELEMENTS (channels_to_selection_actions), + G_CALLBACK (channels_to_selection_cmd_callback), + data); +} + +void +channels_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpImage *gimage = NULL; + GimpChannel *channel = NULL; + gboolean fs = FALSE; + gboolean component = FALSE; + GList *next = NULL; + GList *prev = NULL; + + if (GIMP_IS_COMPONENT_EDITOR (data)) + { + gimage = GIMP_IMAGE_EDITOR (data)->gimage; + + if (gimage) + { + if (GIMP_COMPONENT_EDITOR (data)->clicked_component != -1) + component = TRUE; + } + } + else + { + gimage = GIMP_ITEM_TREE_VIEW (data)->gimage; + + if (gimage) + { + GList *list; + + channel = gimp_image_get_active_channel (gimage); + + for (list = GIMP_LIST (gimage->channels)->list; + list; + list = g_list_next (list)) + { + if (channel == (GimpChannel *) list->data) + { + prev = g_list_previous (list); + next = g_list_next (list); + break; + } + } + } + } + + if (gimage) + fs = (gimp_image_floating_sel (gimage) != NULL); + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("channels-edit-attributes", !fs && channel); + + SET_SENSITIVE ("channels-new", !fs && gimage); + SET_SENSITIVE ("channels-duplicate", !fs && (channel || component)); + SET_SENSITIVE ("channels-delete", !fs && channel); + + SET_SENSITIVE ("channels-raise", !fs && channel && prev); + SET_SENSITIVE ("channels-raise-to-top", !fs && channel && prev); + SET_SENSITIVE ("channels-lower", !fs && channel && next); + SET_SENSITIVE ("channels-lower-to-bottom", !fs && channel && next); + + SET_SENSITIVE ("channels-selection-replace", !fs && (channel || component)); + SET_SENSITIVE ("channels-selection-add", !fs && (channel || component)); + SET_SENSITIVE ("channels-selection-subtract", !fs && (channel || component)); + SET_SENSITIVE ("channels-selection-intersect", !fs && (channel || component)); + +#undef SET_SENSITIVE +} diff --git a/app/actions/channels-actions.h b/app/actions/channels-actions.h new file mode 100644 index 0000000000..39f332bb91 --- /dev/null +++ b/app/actions/channels-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __CHANNELS_ACTIONS_H__ +#define __CHANNELS_ACTIONS_H__ + + +void channels_actions_setup (GimpActionGroup *group, + gpointer data); +void channels_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __CHANNELS_ACTIONS_H__ */ diff --git a/app/actions/channels-commands.c b/app/actions/channels-commands.c index de25867573..a1481b6168 100644 --- a/app/actions/channels-commands.c +++ b/app/actions/channels-commands.c @@ -104,6 +104,18 @@ channels_raise_cmd_callback (GtkWidget *widget, gimp_image_flush (gimage); } +void +channels_raise_to_top_cmd_callback (GtkWidget *widget, + gpointer data) +{ + GimpImage *gimage; + GimpChannel *active_channel; + return_if_no_channel (gimage, active_channel, data); + + gimp_image_raise_channel_to_top (gimage, active_channel); + gimp_image_flush (gimage); +} + void channels_lower_cmd_callback (GtkWidget *widget, gpointer data) @@ -116,6 +128,18 @@ channels_lower_cmd_callback (GtkWidget *widget, gimp_image_flush (gimage); } +void +channels_lower_to_bottom_cmd_callback (GtkWidget *widget, + gpointer data) +{ + GimpImage *gimage; + GimpChannel *active_channel; + return_if_no_channel (gimage, active_channel, data); + + gimp_image_lower_channel_to_bottom (gimage, active_channel); + gimp_image_flush (gimage); +} + void channels_duplicate_cmd_callback (GtkWidget *widget, gpointer data) diff --git a/app/actions/channels-commands.h b/app/actions/channels-commands.h index 370ed9981f..43def974a1 100644 --- a/app/actions/channels-commands.h +++ b/app/actions/channels-commands.h @@ -24,8 +24,12 @@ void channels_new_cmd_callback (GtkWidget *widget, gpointer data); void channels_raise_cmd_callback (GtkWidget *widget, gpointer data); +void channels_raise_to_top_cmd_callback (GtkWidget *widget, + gpointer data); void channels_lower_cmd_callback (GtkWidget *widget, gpointer data); +void channels_lower_to_bottom_cmd_callback (GtkWidget *widget, + gpointer data); void channels_duplicate_cmd_callback (GtkWidget *widget, gpointer data); void channels_delete_cmd_callback (GtkWidget *widget, diff --git a/app/actions/colormap-actions.c b/app/actions/colormap-actions.c new file mode 100644 index 0000000000..2a7f8e2eb0 --- /dev/null +++ b/app/actions/colormap-actions.c @@ -0,0 +1,106 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimpimage.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpcolormapeditor.h" +#include "widgets/gimphelp-ids.h" + +#include "colormap-editor-actions.h" +#include "gui/colormap-editor-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry colormap_editor_actions[] = +{ + { "colormap-editor-edit-color", GIMP_STOCK_EDIT, + N_("_Edit Color..."), NULL, NULL, + G_CALLBACK (colormap_editor_edit_color_cmd_callback), + GIMP_HELP_INDEXED_PALETTE_EDIT } +}; + +static GimpEnumActionEntry colormap_editor_add_color_actions[] = +{ + { "colormap-editor-add-color-from-fg", GTK_STOCK_ADD, + N_("_Add Color from FG"), "", NULL, + FALSE, + GIMP_HELP_INDEXED_PALETTE_ADD }, + + { "colormap-editor-add-color-from-bg", GTK_STOCK_ADD, + N_("_Add Color from BG"), "", NULL, + TRUE, + GIMP_HELP_INDEXED_PALETTE_ADD } +}; + + +void +colormap_editor_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + colormap_editor_actions, + G_N_ELEMENTS (colormap_editor_actions), + data); + + gimp_action_group_add_enum_actions (group, + colormap_editor_add_color_actions, + G_N_ELEMENTS (colormap_editor_add_color_actions), + G_CALLBACK (colormap_editor_add_color_cmd_callback), + data); +} + +void +colormap_editor_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpColormapEditor *editor; + GimpImage *gimage; + gboolean indexed = FALSE; + gint num_colors = 0; + + editor = GIMP_COLORMAP_EDITOR (data); + gimage = GIMP_IMAGE_EDITOR (editor)->gimage; + + if (gimage) + { + indexed = gimp_image_base_type (gimage) == GIMP_INDEXED; + num_colors = gimage->num_cols; + } + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("colormap-editor-edit-color", + gimage && indexed); + SET_SENSITIVE ("colormap-editor-add-color-from-fg", + gimage && indexed && num_colors < 256); + SET_SENSITIVE ("colormap-editor-add-color-from-bg", + gimage && indexed && num_colors < 256); + +#undef SET_SENSITIVE +} diff --git a/app/actions/colormap-actions.h b/app/actions/colormap-actions.h new file mode 100644 index 0000000000..15a494d6aa --- /dev/null +++ b/app/actions/colormap-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __COLORMAP_EDITOR_ACTIONS_H__ +#define __COLORMAP_EDITOR_ACTIONS_H__ + + +void colormap_editor_actions_setup (GimpActionGroup *group, + gpointer data); +void colormap_editor_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __COLORMAP_EDITOR_ACTIONS_H__ */ diff --git a/app/actions/colormap-editor-actions.c b/app/actions/colormap-editor-actions.c new file mode 100644 index 0000000000..2a7f8e2eb0 --- /dev/null +++ b/app/actions/colormap-editor-actions.c @@ -0,0 +1,106 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimpimage.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpcolormapeditor.h" +#include "widgets/gimphelp-ids.h" + +#include "colormap-editor-actions.h" +#include "gui/colormap-editor-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry colormap_editor_actions[] = +{ + { "colormap-editor-edit-color", GIMP_STOCK_EDIT, + N_("_Edit Color..."), NULL, NULL, + G_CALLBACK (colormap_editor_edit_color_cmd_callback), + GIMP_HELP_INDEXED_PALETTE_EDIT } +}; + +static GimpEnumActionEntry colormap_editor_add_color_actions[] = +{ + { "colormap-editor-add-color-from-fg", GTK_STOCK_ADD, + N_("_Add Color from FG"), "", NULL, + FALSE, + GIMP_HELP_INDEXED_PALETTE_ADD }, + + { "colormap-editor-add-color-from-bg", GTK_STOCK_ADD, + N_("_Add Color from BG"), "", NULL, + TRUE, + GIMP_HELP_INDEXED_PALETTE_ADD } +}; + + +void +colormap_editor_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + colormap_editor_actions, + G_N_ELEMENTS (colormap_editor_actions), + data); + + gimp_action_group_add_enum_actions (group, + colormap_editor_add_color_actions, + G_N_ELEMENTS (colormap_editor_add_color_actions), + G_CALLBACK (colormap_editor_add_color_cmd_callback), + data); +} + +void +colormap_editor_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpColormapEditor *editor; + GimpImage *gimage; + gboolean indexed = FALSE; + gint num_colors = 0; + + editor = GIMP_COLORMAP_EDITOR (data); + gimage = GIMP_IMAGE_EDITOR (editor)->gimage; + + if (gimage) + { + indexed = gimp_image_base_type (gimage) == GIMP_INDEXED; + num_colors = gimage->num_cols; + } + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("colormap-editor-edit-color", + gimage && indexed); + SET_SENSITIVE ("colormap-editor-add-color-from-fg", + gimage && indexed && num_colors < 256); + SET_SENSITIVE ("colormap-editor-add-color-from-bg", + gimage && indexed && num_colors < 256); + +#undef SET_SENSITIVE +} diff --git a/app/actions/colormap-editor-actions.h b/app/actions/colormap-editor-actions.h new file mode 100644 index 0000000000..15a494d6aa --- /dev/null +++ b/app/actions/colormap-editor-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __COLORMAP_EDITOR_ACTIONS_H__ +#define __COLORMAP_EDITOR_ACTIONS_H__ + + +void colormap_editor_actions_setup (GimpActionGroup *group, + gpointer data); +void colormap_editor_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __COLORMAP_EDITOR_ACTIONS_H__ */ diff --git a/app/actions/debug-actions.c b/app/actions/debug-actions.c new file mode 100644 index 0000000000..7fc158f716 --- /dev/null +++ b/app/actions/debug-actions.c @@ -0,0 +1,64 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "widgets/gimpactiongroup.h" + +#include "debug-actions.h" +#include "gui/debug-commands.h" + + +static GimpActionEntry debug_actions[] = +{ + { "debug-menu", NULL, + "/File/D_ebug" }, + + { "debug-mem-profile", NULL, + "_Mem Profile", NULL, NULL, + G_CALLBACK (debug_mem_profile_cmd_callback), + NULL }, + + { "debug-dump-items", NULL, + "_Dump Items", NULL, NULL, + G_CALLBACK (debug_dump_menus_cmd_callback), + NULL } +}; + + +void +debug_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + debug_actions, + G_N_ELEMENTS (debug_actions), + data); +} + +void +debug_actions_update (GimpActionGroup *group, + gpointer data) +{ +} diff --git a/app/actions/debug-actions.h b/app/actions/debug-actions.h new file mode 100644 index 0000000000..c39b251bb7 --- /dev/null +++ b/app/actions/debug-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __DEBUG_ACTIONS_H__ +#define __DEBUG_ACTIONS_H__ + + +void debug_actions_setup (GimpActionGroup *group, + gpointer data); +void debug_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __DEBUG_ACTIONS_H__ */ diff --git a/app/actions/dialogs-actions.c b/app/actions/dialogs-actions.c new file mode 100644 index 0000000000..2f5cb8599f --- /dev/null +++ b/app/actions/dialogs-actions.c @@ -0,0 +1,230 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" + +#include "dialogs-actions.h" +#include "gui/dialogs-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry dialogs_actions[] = +{ + { "dialogs-menu", NULL, + N_("_Dialogs") }, + + { "dialogs-new-dock-menu", NULL, + N_("Create New Doc_k") }, + + { "dialogs-new-dock-lcp", NULL, + N_("_Layers, Channels & Paths"), NULL, NULL, + G_CALLBACK (dialogs_create_lc_cmd_callback), + NULL }, + + { "dialogs-new-dock-data", NULL, + N_("_Brushes, Patterns & Gradients"), NULL, NULL, + G_CALLBACK (dialogs_create_data_cmd_callback), + NULL }, + + { "dialogs-new-dock-stuff", NULL, + N_("_Misc. Stuff"), NULL, NULL, + G_CALLBACK (dialogs_create_stuff_cmd_callback), + NULL }, + + { "dialogs-toolbox", NULL, + N_("Tool_box"), NULL, NULL, + G_CALLBACK (dialogs_show_toolbox_cmd_callback), + GIMP_HELP_TOOLBOX } +}; + +GimpStringActionEntry dialogs_dockable_actions[] = +{ + { "dialogs-tool-options", GIMP_STOCK_TOOL_OPTIONS, + N_("Tool _Options"), "T", NULL, + "gimp-tool-options", + GIMP_HELP_TOOL_OPTIONS_DIALOG }, + + { "dialogs-device-status", GIMP_STOCK_DEVICE_STATUS, + N_("_Device Status"), NULL, NULL, + "gimp-device-status", + GIMP_HELP_DEVICE_STATUS_DIALOG }, + + { "dialogs-layers", GIMP_STOCK_LAYERS, + N_("_Layers"), "L", NULL, + "gimp-layer-list", + GIMP_HELP_LAYER_DIALOG }, + + { "dialogs-channels", GIMP_STOCK_CHANNELS, + N_("_Channels"), NULL, NULL, + "gimp-channel-list", + GIMP_HELP_CHANNEL_DIALOG }, + + { "dialogs-vectors", GIMP_STOCK_PATHS, + N_("_Paths"), NULL, NULL, + "gimp-vectors-list", + GIMP_HELP_PATH_DIALOG }, + + { "dialogs-indexed-palette", GIMP_STOCK_INDEXED_PALETTE, + N_("Inde_xed Palette"), NULL, NULL, + "gimp-indexed-palette", + GIMP_HELP_INDEXED_PALETTE_DIALOG }, + + { "dialogs-histogram", GIMP_STOCK_HISTOGRAM, + N_("Histogra_m"), NULL, NULL, + "gimp-histogram-editor", + GIMP_HELP_HISTOGRAM_DIALOG }, + + { "dialogs-selection-editor", GIMP_STOCK_TOOL_RECT_SELECT, + N_("_Selection Editor"), NULL, NULL, + "gimp-selection-editor", + GIMP_HELP_SELECTION_DIALOG }, + + { "dialogs-navigations", GIMP_STOCK_NAVIGATION, + N_("Na_vigation"), NULL, NULL, + "gimp-navigation-view", + GIMP_HELP_NAVIGATION_DIALOG }, + + { "dialogs-undo-history", GIMP_STOCK_UNDO_HISTORY, + N_("_Undo History"), NULL, NULL, + "gimp-undo-history", + GIMP_HELP_UNDO_DIALOG }, + + { "dialogs-colors", GIMP_STOCK_DEFAULT_COLORS, + N_("Colo_rs"), NULL, NULL, + "gimp-color-editor", + GIMP_HELP_COLOR_DIALOG }, + + { "dialogs-brushes", GIMP_STOCK_BRUSH, + N_("Brus_hes"), "B", NULL, + "gimp-brush-grid|gimp-brush-list", + GIMP_HELP_BRUSH_DIALOG }, + + { "dialogs-patterns", GIMP_STOCK_PATTERN, + N_("P_atterns"), "P", NULL, + "gimp-pattern-grid|gimp-pattern-list", + GIMP_HELP_PATTERN_DIALOG }, + + { "dialogs-gradients", GIMP_STOCK_GRADIENT, + N_("_Gradients"), "G", NULL, + "gimp-gradient-list|gimp-gradient-grid", + GIMP_HELP_GRADIENT_DIALOG }, + + { "dialogs-palettes", GIMP_STOCK_PALETTE, + N_("Pal_ettes"), "P", NULL, + "gimp-palette-list|gimp-palette-list", + GIMP_HELP_PALETTE_DIALOG }, + + { "dialogs-fonts", GIMP_STOCK_FONT, + N_("_Fonts"), NULL, NULL, + "gimp-font-list|gimp-font-grid", + GIMP_HELP_FONT_DIALOG }, + + { "dialogs-buffers", GIMP_STOCK_BUFFER, + N_("_Buffers"), "", NULL, + "gimp-buffer-list|gimp-buffer-grid", + GIMP_HELP_BUFFER_DIALOG }, + + { "dialogs-images", GIMP_STOCK_IMAGES, + N_("_Images"), NULL, NULL, + "gimp-image-list|gimp-image-grid", + GIMP_HELP_IMAGE_DIALOG }, + + { "dialogs-document-history", GTK_STOCK_OPEN, + N_("Document Histor_y"), "", NULL, + "gimp-document-list|gimp-document-grid", + GIMP_HELP_DOCUMENT_DIALOG }, + + { "dialogs-templates", GIMP_STOCK_TEMPLATE, + N_("_Templates"), "", NULL, + "gimp-template-list|gimp-template-grid", + GIMP_HELP_TEMPLATE_DIALOG }, + + { "dialogs-tools", GIMP_STOCK_TOOLS, + N_("T_ools"), NULL, NULL, + "gimp-tool-list|gimp-tool-grid", + GIMP_HELP_TOOLS_DIALOG }, + + { "dialogs-error-console", GIMP_STOCK_WARNING, + N_("Error Co_nsole"), NULL, NULL, + "gimp-error-console", + GIMP_HELP_ERRORS_DIALOG } +}; + +gint n_dialogs_dockable_actions = G_N_ELEMENTS (dialogs_dockable_actions); + +static GimpStringActionEntry dialogs_toplevel_actions[] = +{ + { "dialogs-preferences", GTK_STOCK_PREFERENCES, + N_("_Preferences"), NULL, NULL, + "gimp-preferences-dialog", + GIMP_HELP_PREFS_DIALOG }, + + { "dialogs-module-manager", NULL, + N_("_Module Manager"), NULL, NULL, + "gimp-module-manager-dialog", + GIMP_HELP_MODULE_DIALOG }, + + { "dialogs-tips", GIMP_STOCK_INFO, + N_("_Tip of the Day"), NULL, NULL, + "gimp-tips-dialog", + GIMP_HELP_TIPS_DIALOG }, + + { "dialogs-about", GIMP_STOCK_WILBER, + N_("_About"), NULL, NULL, + "gimp-about-dialog", + GIMP_HELP_ABOUT_DIALOG } +}; + + +void +dialogs_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + dialogs_actions, + G_N_ELEMENTS (dialogs_actions), + data); + + gimp_action_group_add_string_actions (group, + dialogs_dockable_actions, + G_N_ELEMENTS (dialogs_dockable_actions), + G_CALLBACK (dialogs_create_dockable_cmd_callback), + data); + + gimp_action_group_add_string_actions (group, + dialogs_toplevel_actions, + G_N_ELEMENTS (dialogs_toplevel_actions), + G_CALLBACK (dialogs_create_toplevel_cmd_callback), + data); +} + +void +dialogs_actions_update (GimpActionGroup *group, + gpointer data) +{ +} diff --git a/app/actions/dialogs-actions.h b/app/actions/dialogs-actions.h new file mode 100644 index 0000000000..3b6c8b09c0 --- /dev/null +++ b/app/actions/dialogs-actions.h @@ -0,0 +1,33 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __DIALOGS_ACTIONS_H__ +#define __DIALOGS_ACTIONS_H__ + + +extern GimpStringActionEntry dialogs_dockable_actions[]; +extern gint n_dialogs_dockable_actions; + + +void dialogs_actions_setup (GimpActionGroup *group, + gpointer data); +void dialogs_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __DIALOGS_ACTIONS_H__ */ diff --git a/app/actions/dialogs-commands.c b/app/actions/dialogs-commands.c index fb8fa5ab80..9d8cbc491f 100644 --- a/app/actions/dialogs-commands.c +++ b/app/actions/dialogs-commands.c @@ -26,13 +26,10 @@ #include "gui-types.h" -#include "widgets/gimpcontainerview.h" -#include "widgets/gimpcontainerview-utils.h" #include "widgets/gimpdialogfactory.h" #include "widgets/gimpdockable.h" #include "widgets/gimpdockbook.h" #include "widgets/gimpimagedock.h" -#include "widgets/gimpsessioninfo.h" #include "dialogs.h" #include "dialogs-commands.h" @@ -50,8 +47,7 @@ static void dialogs_create_dock (GdkScreen *screen, void dialogs_show_toolbox_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { dialogs_show_toolbox (); } @@ -90,325 +86,9 @@ dialogs_create_dockable_cmd_callback (GtkWidget *widget, } } -void -dialogs_add_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - - if (action) - { - GtkWidget *dockable; - const gchar *identifier; - - identifier = g_quark_to_string ((GQuark) action); - - if (identifier) - { - dockable = - gimp_dialog_factory_dockable_new (dockbook->dock->dialog_factory, - dockbook->dock, - identifier, - -1); - - /* Maybe gimp_dialog_factory_dockable_new() returned an already - * existing singleton dockable, so check if it already is - * attached to a dockbook. - */ - if (dockable && ! GIMP_DOCKABLE (dockable)->dockbook) - gimp_dockbook_add (dockbook, GIMP_DOCKABLE (dockable), -1); - } - } -} - -void -dialogs_close_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - GimpDockable *dockable; - gint page_num; - - page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); - - dockable = (GimpDockable *) - gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); - - if (dockable) - gimp_dockbook_remove (dockbook, dockable); -} - -void -dialogs_detach_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - GimpDockable *dockable; - gint page_num; - - page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); - - dockable = (GimpDockable *) - gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); - - if (dockable) - gimp_dockable_detach (dockable); -} - -void -dialogs_toggle_view_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - GimpDockable *dockable; - GimpViewType view_type; - gint page_num; - - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - view_type = (GimpViewType) action; - - page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); - - dockable = (GimpDockable *) - gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); - - if (dockable) - { - GimpDialogFactoryEntry *entry; - - gimp_dialog_factory_from_widget (GTK_WIDGET (dockable), &entry); - - if (entry) - { - gchar *identifier; - gchar *substring = NULL; - - identifier = g_strdup (entry->identifier); - - substring = strstr (identifier, "grid"); - - if (substring && view_type == GIMP_VIEW_TYPE_GRID) - return; - - if (! substring) - { - substring = strstr (identifier, "list"); - - if (substring && view_type == GIMP_VIEW_TYPE_LIST) - return; - } - - if (substring) - { - GimpContainerView *old_view; - GtkWidget *new_dockable; - gint preview_size = -1; - - if (view_type == GIMP_VIEW_TYPE_LIST) - memcpy (substring, "list", 4); - else if (view_type == GIMP_VIEW_TYPE_GRID) - memcpy (substring, "grid", 4); - - old_view = gimp_container_view_get_by_dockable (dockable); - - if (old_view) - preview_size = old_view->preview_size; - - new_dockable = - gimp_dialog_factory_dockable_new (dockbook->dock->dialog_factory, - dockbook->dock, - identifier, - preview_size); - - /* Maybe gimp_dialog_factory_dockable_new() returned - * an already existing singleton dockable, so check - * if it already is attached to a dockbook. - */ - if (new_dockable && ! GIMP_DOCKABLE (new_dockable)->dockbook) - { - gimp_dockbook_add (dockbook, GIMP_DOCKABLE (new_dockable), - page_num); - - gimp_dockbook_remove (dockbook, dockable); - - gtk_notebook_set_current_page (GTK_NOTEBOOK (dockbook), - page_num); - } - } - - g_free (identifier); - } - } -} - -void -dialogs_preview_size_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - GimpDockable *dockable; - gint preview_size; - gint page_num; - - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - preview_size = (gint) action; - - page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); - - dockable = (GimpDockable *) - gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); - - if (dockable) - { - GimpContainerView *view; - - view = gimp_container_view_get_by_dockable (dockable); - - if (view && view->preview_size != preview_size) - gimp_container_view_set_preview_size (view, preview_size, - view->preview_border_width); - } -} - -void -dialogs_tab_style_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - GimpDockable *dockable; - GimpTabStyle tab_style; - gint page_num; - - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - tab_style = (gint) action; - - page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); - - dockable = (GimpDockable *) - gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); - - if (dockable && dockable->tab_style != tab_style) - { - GtkWidget *tab_widget; - - dockable->tab_style = tab_style; - - tab_widget = gimp_dockbook_get_tab_widget (dockbook, dockable); - - gtk_notebook_set_tab_label (GTK_NOTEBOOK (dockbook), - GTK_WIDGET (dockable), - tab_widget); - } -} - -void -dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - - if (GIMP_IS_IMAGE_DOCK (dockbook->dock)) - gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dockbook->dock), - GTK_CHECK_MENU_ITEM (widget)->active); -} - -void -dialogs_toggle_auto_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - - if (GIMP_IS_IMAGE_DOCK (dockbook->dock)) - gimp_image_dock_set_auto_follow_active (GIMP_IMAGE_DOCK (dockbook->dock), - GTK_CHECK_MENU_ITEM (widget)->active); -} - -static void -dialogs_change_screen_confirm_callback (GtkWidget *query_box, - gint value, - gpointer data) -{ - GdkScreen *screen; - - screen = gdk_display_get_screen (gtk_widget_get_display (GTK_WIDGET (data)), - value); - - if (screen) - gtk_window_set_screen (GTK_WINDOW (data), screen); -} - -static void -dialogs_change_screen_destroy_callback (GtkWidget *query_box, - GtkWidget *dock) -{ - g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", NULL); -} - -void -dialogs_change_screen_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - GtkWidget *dock; - GdkScreen *screen; - GdkDisplay *display; - gint cur_screen; - gint num_screens; - GtkWidget *qbox; - - dock = GTK_WIDGET (dockbook->dock); - - qbox = g_object_get_data (G_OBJECT (dock), "gimp-change-screen-dialog"); - - if (qbox) - { - gtk_window_present (GTK_WINDOW (qbox)); - return; - } - - screen = gtk_widget_get_screen (dock); - display = gtk_widget_get_display (dock); - - cur_screen = gdk_screen_get_number (screen); - num_screens = gdk_display_get_n_screens (display); - - qbox = gimp_query_int_box ("Move Dock to Screen", - dock, - NULL, 0, - "Enter destination screen", - cur_screen, 0, num_screens - 1, - G_OBJECT (dock), "destroy", - dialogs_change_screen_confirm_callback, - dock); - - g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", qbox); - - g_signal_connect (qbox, "destroy", - G_CALLBACK (dialogs_change_screen_destroy_callback), - dock); - - gtk_widget_show (qbox); -} - void dialogs_create_lc_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { static const gchar *tabs[] = { @@ -424,8 +104,7 @@ dialogs_create_lc_cmd_callback (GtkWidget *widget, void dialogs_create_data_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { static const gchar *tabs[] = { @@ -442,8 +121,7 @@ dialogs_create_data_cmd_callback (GtkWidget *widget, void dialogs_create_stuff_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { static const gchar *tabs[] = { diff --git a/app/actions/dialogs-commands.h b/app/actions/dialogs-commands.h index 1fd4548cc0..039435b0d9 100644 --- a/app/actions/dialogs-commands.h +++ b/app/actions/dialogs-commands.h @@ -21,8 +21,7 @@ void dialogs_show_toolbox_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); void dialogs_create_toplevel_cmd_callback (GtkWidget *widget, gpointer data, guint action); @@ -30,45 +29,12 @@ void dialogs_create_dockable_cmd_callback (GtkWidget *widget, gpointer data, guint action); -void dialogs_add_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dialogs_close_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dialogs_detach_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - -void dialogs_toggle_view_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dialogs_preview_size_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dialogs_tab_style_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - -void dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dialogs_toggle_auto_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dialogs_change_screen_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - void dialogs_create_lc_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); void dialogs_create_data_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); void dialogs_create_stuff_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); void dialogs_show_toolbox (void); diff --git a/app/actions/dockable-actions.c b/app/actions/dockable-actions.c new file mode 100644 index 0000000000..c7574f4ea7 --- /dev/null +++ b/app/actions/dockable-actions.c @@ -0,0 +1,370 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpcontainerview.h" +#include "widgets/gimpcontainerview-utils.h" +#include "widgets/gimpdialogfactory.h" +#include "widgets/gimpdockable.h" +#include "widgets/gimpdockbook.h" +#include "widgets/gimpdocked.h" +#include "widgets/gimphelp-ids.h" +#include "widgets/gimpimagedock.h" + +#include "dialogs-actions.h" +#include "dockable-actions.h" +#include "gui/dockable-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry dockable_actions[] = +{ + { "dockable-menu", GTK_STOCK_MISSING_IMAGE, NULL }, + + { "dockable-add-tab-menu", NULL, + N_("_Add Tab") }, + + { "dockable-preview-size-menu", NULL, + N_("Preview Si_ze") }, + + { "dockable-tab-style-menu", NULL, + N_("/_Tab Style") }, + + { "dockable-close-tab", GTK_STOCK_CLOSE, + N_("_Close Tab"), "", NULL, + G_CALLBACK (dockable_close_tab_cmd_callback), + GIMP_HELP_DOCK_TAB_CLOSE }, + + { "dockable-detach-tab", GTK_STOCK_CONVERT, + N_("_Detach Tab"), "", NULL, + G_CALLBACK (dockable_detach_tab_cmd_callback), + GIMP_HELP_DOCK_TAB_DETACH }, + + { "dockable-move-to-screen", GIMP_STOCK_MOVE_TO_SCREEN, + N_("Move to Screen..."), NULL, NULL, + G_CALLBACK (dockable_change_screen_cmd_callback), + GIMP_HELP_DOCK_CHANGE_SCREEN } +}; + +static GimpToggleActionEntry dockable_toggle_actions[] = +{ + { "dockable-show-image-menu", NULL, + N_("Show Image _Menu"), NULL, NULL, + G_CALLBACK (dockable_toggle_image_menu_cmd_callback), + TRUE, + GIMP_HELP_DOCK_IMAGE_MENU }, + + { "dockable-auto-follow-active", NULL, + N_("Auto Follow Active _Image"), NULL, NULL, + G_CALLBACK (dockable_toggle_auto_cmd_callback), + TRUE, + GIMP_HELP_DOCK_AUTO_BUTTON } +}; + +#define PREVIEW_SIZE(action,label,size) \ + { "dockable-preview-size-" action, NULL, \ + (label), NULL, NULL, \ + (size), \ + GIMP_HELP_DOCK_PREVIEW_SIZE } +#define TAB_STYLE(action,label,style) \ + { "dockable-tab-style-" action, NULL, \ + (label), NULL, NULL, \ + (style), \ + GIMP_HELP_DOCK_TAB_STYLE } + +static GimpRadioActionEntry dockable_preview_size_actions[] = +{ + PREVIEW_SIZE ("tiny", N_("_Tiny"), GIMP_PREVIEW_SIZE_TINY), + PREVIEW_SIZE ("extra-small", N_("E_xtra Small"), GIMP_PREVIEW_SIZE_EXTRA_SMALL), + PREVIEW_SIZE ("small", N_("_Small"), GIMP_PREVIEW_SIZE_SMALL), + PREVIEW_SIZE ("medium", N_("_Medium"), GIMP_PREVIEW_SIZE_MEDIUM), + PREVIEW_SIZE ("large", N_("_Large"), GIMP_PREVIEW_SIZE_LARGE), + PREVIEW_SIZE ("extra-large", N_("Ex_tra Large"), GIMP_PREVIEW_SIZE_EXTRA_LARGE), + PREVIEW_SIZE ("huge", N_("_Huge"), GIMP_PREVIEW_SIZE_HUGE), + PREVIEW_SIZE ("enormous", N_("_Enormous"), GIMP_PREVIEW_SIZE_ENORMOUS), + PREVIEW_SIZE ("gigantic", N_("_Gigantic"), GIMP_PREVIEW_SIZE_GIGANTIC) +}; + +static GimpRadioActionEntry dockable_tab_style_actions[] = +{ + TAB_STYLE ("icon", N_("_Icon"), GIMP_TAB_STYLE_ICON), + TAB_STYLE ("status", N_("Current _Status"), GIMP_TAB_STYLE_PREVIEW), + TAB_STYLE ("text", N_("_Text"), GIMP_TAB_STYLE_NAME), + TAB_STYLE ("icon-text", N_("I_con & Text"), GIMP_TAB_STYLE_ICON_NAME), + TAB_STYLE ("status-text", N_("St_atus & Text"), GIMP_TAB_STYLE_PREVIEW_NAME) +}; + +#undef PREVIEW_SIZE +#undef TAB_STYLE + +static GimpRadioActionEntry dockable_view_type_actions[] = +{ + { "dockable-view-type-list", NULL, + N_("View as _List"), NULL, NULL, + GIMP_VIEW_TYPE_LIST, + GIMP_HELP_DOCK_VIEW_AS_LIST }, + + { "dockable-view-type-grid", NULL, + N_("View as _Grid"), NULL, NULL, + GIMP_VIEW_TYPE_GRID, + GIMP_HELP_DOCK_VIEW_AS_GRID } +}; + + +void +dockable_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + dockable_actions, + G_N_ELEMENTS (dockable_actions), + data); + + gimp_action_group_add_toggle_actions (group, + dockable_toggle_actions, + G_N_ELEMENTS (dockable_toggle_actions), + data); + + gimp_action_group_add_string_actions (group, + dialogs_dockable_actions, + n_dialogs_dockable_actions, + G_CALLBACK (dockable_add_tab_cmd_callback), + data); + + gimp_action_group_add_radio_actions (group, + dockable_preview_size_actions, + G_N_ELEMENTS (dockable_preview_size_actions), + GIMP_PREVIEW_SIZE_MEDIUM, + G_CALLBACK (dockable_preview_size_cmd_callback), + data); + + gimp_action_group_add_radio_actions (group, + dockable_tab_style_actions, + G_N_ELEMENTS (dockable_tab_style_actions), + GIMP_TAB_STYLE_PREVIEW, + G_CALLBACK (dockable_tab_style_cmd_callback), + data); + + gimp_action_group_add_radio_actions (group, + dockable_view_type_actions, + G_N_ELEMENTS (dockable_view_type_actions), + GIMP_VIEW_TYPE_LIST, + G_CALLBACK (dockable_toggle_view_cmd_callback), + data); +} + +void +dockable_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpDockable *dockable; + GimpDockbook *dockbook; + GimpDialogFactoryEntry *entry; + GimpContainerView *view; + GimpViewType view_type = -1; + gboolean list_view_available = FALSE; + gboolean grid_view_available = FALSE; + GimpPreviewSize preview_size = -1; + GimpTabStyle tab_style = -1; + gint n_pages = 0; + gint n_screens = 1; + + if (GIMP_IS_DOCKBOOK (data)) + { + gint page_num; + + dockbook = GIMP_DOCKBOOK (data); + + page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); + + dockable = (GimpDockable *) + gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); + } + else if (GIMP_IS_DOCKABLE (data)) + { + dockable = GIMP_DOCKABLE (data); + dockbook = dockable->dockbook; + } + else + { + return; + } + + gimp_dialog_factory_from_widget (GTK_WIDGET (dockable), &entry); + + if (entry) + { + gchar *identifier; + gchar *substring = NULL; + + identifier = g_strdup (entry->identifier); + + if ((substring = strstr (identifier, "grid"))) + view_type = GIMP_VIEW_TYPE_GRID; + else if ((substring = strstr (identifier, "list"))) + view_type = GIMP_VIEW_TYPE_LIST; + + if (substring) + { + memcpy (substring, "list", 4); + if (gimp_dialog_factory_find_entry (dockbook->dock->dialog_factory, + identifier)) + list_view_available = TRUE; + + memcpy (substring, "grid", 4); + if (gimp_dialog_factory_find_entry (dockbook->dock->dialog_factory, + identifier)) + grid_view_available = TRUE; + } + + g_free (identifier); + } + + view = gimp_container_view_get_by_dockable (dockable); + + if (view) + preview_size = view->preview_size; + + tab_style = dockable->tab_style; + + n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (dockbook)); + +#define SET_ACTIVE(action,active) \ + gimp_action_group_set_action_active (group, action, (active) != 0) +#define SET_VISIBLE(action,active) \ + gimp_action_group_set_action_visible (group, action, (active) != 0) +#define SET_SENSITIVE(action,sensitive) \ + gimp_action_group_set_action_sensitive (group, action, (sensitive) != 0) + + SET_VISIBLE ("dockable-preview-size-menu", preview_size != -1); + + if (preview_size != -1) + { + if (preview_size >= GIMP_PREVIEW_SIZE_GIGANTIC) + { + SET_ACTIVE ("dockable-preview-size-gigantic", TRUE); + } + else if (preview_size >= GIMP_PREVIEW_SIZE_ENORMOUS) + { + SET_ACTIVE ("dockable-preview-size-enormous", TRUE); + } + else if (preview_size >= GIMP_PREVIEW_SIZE_HUGE) + { + SET_ACTIVE ("dockable-preview-size-huge", TRUE); + } + else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_LARGE) + { + SET_ACTIVE ("dockable-preview-size-extra-large", TRUE); + } + else if (preview_size >= GIMP_PREVIEW_SIZE_LARGE) + { + SET_ACTIVE ("dockable-preview-size-large", TRUE); + } + else if (preview_size >= GIMP_PREVIEW_SIZE_MEDIUM) + { + SET_ACTIVE ("dockable-preview-size-medium", TRUE); + } + else if (preview_size >= GIMP_PREVIEW_SIZE_SMALL) + { + SET_ACTIVE ("dockable-preview-size-small", TRUE); + } + else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_SMALL) + { + SET_ACTIVE ("dockable-preview-size-extra-small", TRUE); + } + else if (preview_size >= GIMP_PREVIEW_SIZE_TINY) + { + SET_ACTIVE ("dockable-preview-size-tiny", TRUE); + } + } + + SET_VISIBLE ("dockable-tab-style-menu", n_pages > 1); + + if (n_pages > 1) + { + GimpDockedInterface *docked_iface; + + docked_iface = GIMP_DOCKED_GET_INTERFACE (GTK_BIN (dockable)->child); + + if (tab_style == GIMP_TAB_STYLE_ICON) + SET_ACTIVE ("dockable-tab-style-icon", TRUE); + else if (tab_style == GIMP_TAB_STYLE_PREVIEW) + SET_ACTIVE ("dockable-tab-style-status", TRUE); + else if (tab_style == GIMP_TAB_STYLE_NAME) + SET_ACTIVE ("dockable-tab-style-text", TRUE); + else if (tab_style == GIMP_TAB_STYLE_ICON_NAME) + SET_ACTIVE ("dockable-tab-style-icon-text", TRUE); + else if (tab_style == GIMP_TAB_STYLE_PREVIEW_NAME) + SET_ACTIVE ("dockable-tab-style-status-text", TRUE); + + SET_SENSITIVE ("dockable-tab-style-status", + docked_iface->get_preview); + SET_SENSITIVE ("dockable-tab-style-status-text", + docked_iface->get_preview); + } + + SET_VISIBLE ("dockable-view-type-grid", view_type != -1); + SET_VISIBLE ("dockable-view-type-list", view_type != -1); + + if (view_type != -1) + { + if (view_type == GIMP_VIEW_TYPE_LIST) + SET_ACTIVE ("dockable-view-type-list", TRUE); + else + SET_ACTIVE ("dockable-view-type-grid", TRUE); + + SET_SENSITIVE ("dockable-view-type-grid", grid_view_available); + SET_SENSITIVE ("dockable-view-type-list", list_view_available); + } + + n_screens = gdk_display_get_n_screens + (gtk_widget_get_display (GTK_WIDGET (dockbook->dock))); + + if (GIMP_IS_IMAGE_DOCK (dockbook->dock)) + { + GimpImageDock *image_dock = GIMP_IMAGE_DOCK (dockbook->dock); + + SET_VISIBLE ("dockable-show-image-menu", TRUE); + SET_VISIBLE ("dockable-auto-follow-active", TRUE); + + SET_ACTIVE ("dockable-show-image-menu", image_dock->show_image_menu); + SET_ACTIVE ("dockable-auto-follow-active", image_dock->auto_follow_active); + } + else + { + SET_VISIBLE ("dockable-show-image-menu", FALSE); + SET_VISIBLE ("dockable-auto-follow-active", FALSE); + } + + SET_VISIBLE ("dockable-move-to-screen", n_screens > 1); + +#undef SET_ACTIVE +#undef SET_VISIBLE +#undef SET_SENSITIVE +} diff --git a/app/actions/dockable-actions.h b/app/actions/dockable-actions.h new file mode 100644 index 0000000000..1d44fb3fb2 --- /dev/null +++ b/app/actions/dockable-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __DOCKABLE_ACTIONS_H__ +#define __DOCKABLE_ACTIONS_H__ + + +void dockable_actions_setup (GimpActionGroup *group, + gpointer data); +void dockable_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __DOCKABLE_ACTIONS_H__ */ diff --git a/app/actions/dockable-commands.c b/app/actions/dockable-commands.c new file mode 100644 index 0000000000..6b1843e41a --- /dev/null +++ b/app/actions/dockable-commands.c @@ -0,0 +1,356 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "gui-types.h" + +#include "widgets/gimpcontainerview.h" +#include "widgets/gimpcontainerview-utils.h" +#include "widgets/gimpdialogfactory.h" +#include "widgets/gimpdockable.h" +#include "widgets/gimpdockbook.h" +#include "widgets/gimpimagedock.h" +#include "widgets/gimpsessioninfo.h" + +#include "dialogs.h" +#include "dockable-commands.h" + + +/* public functions */ + +void +dockable_add_tab_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + + if (action) + { + GtkWidget *dockable; + const gchar *identifier; + + identifier = g_quark_to_string ((GQuark) action); + + if (identifier) + { + dockable = + gimp_dialog_factory_dockable_new (dockbook->dock->dialog_factory, + dockbook->dock, + identifier, + -1); + + /* Maybe gimp_dialog_factory_dockable_new() returned an already + * existing singleton dockable, so check if it already is + * attached to a dockbook. + */ + if (dockable && ! GIMP_DOCKABLE (dockable)->dockbook) + gimp_dockbook_add (dockbook, GIMP_DOCKABLE (dockable), -1); + } + } +} + +void +dockable_close_tab_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + GimpDockable *dockable; + gint page_num; + + page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); + + dockable = (GimpDockable *) + gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); + + if (dockable) + gimp_dockbook_remove (dockbook, dockable); +} + +void +dockable_detach_tab_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + GimpDockable *dockable; + gint page_num; + + page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); + + dockable = (GimpDockable *) + gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); + + if (dockable) + gimp_dockable_detach (dockable); +} + +void +dockable_toggle_view_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + GimpDockable *dockable; + GimpViewType view_type; + gint page_num; + + if (! GTK_CHECK_MENU_ITEM (widget)->active) + return; + + view_type = (GimpViewType) action; + + page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); + + dockable = (GimpDockable *) + gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); + + if (dockable) + { + GimpDialogFactoryEntry *entry; + + gimp_dialog_factory_from_widget (GTK_WIDGET (dockable), &entry); + + if (entry) + { + gchar *identifier; + gchar *substring = NULL; + + identifier = g_strdup (entry->identifier); + + substring = strstr (identifier, "grid"); + + if (substring && view_type == GIMP_VIEW_TYPE_GRID) + return; + + if (! substring) + { + substring = strstr (identifier, "list"); + + if (substring && view_type == GIMP_VIEW_TYPE_LIST) + return; + } + + if (substring) + { + GimpContainerView *old_view; + GtkWidget *new_dockable; + gint preview_size = -1; + + if (view_type == GIMP_VIEW_TYPE_LIST) + memcpy (substring, "list", 4); + else if (view_type == GIMP_VIEW_TYPE_GRID) + memcpy (substring, "grid", 4); + + old_view = gimp_container_view_get_by_dockable (dockable); + + if (old_view) + preview_size = old_view->preview_size; + + new_dockable = + gimp_dialog_factory_dockable_new (dockbook->dock->dialog_factory, + dockbook->dock, + identifier, + preview_size); + + /* Maybe gimp_dialog_factory_dockable_new() returned + * an already existing singleton dockable, so check + * if it already is attached to a dockbook. + */ + if (new_dockable && ! GIMP_DOCKABLE (new_dockable)->dockbook) + { + gimp_dockbook_add (dockbook, GIMP_DOCKABLE (new_dockable), + page_num); + + gimp_dockbook_remove (dockbook, dockable); + + gtk_notebook_set_current_page (GTK_NOTEBOOK (dockbook), + page_num); + } + } + + g_free (identifier); + } + } +} + +void +dockable_preview_size_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + GimpDockable *dockable; + gint preview_size; + gint page_num; + + if (! GTK_CHECK_MENU_ITEM (widget)->active) + return; + + preview_size = (gint) action; + + page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); + + dockable = (GimpDockable *) + gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); + + if (dockable) + { + GimpContainerView *view; + + view = gimp_container_view_get_by_dockable (dockable); + + if (view && view->preview_size != preview_size) + gimp_container_view_set_preview_size (view, preview_size, + view->preview_border_width); + } +} + +void +dockable_tab_style_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + GimpDockable *dockable; + GimpTabStyle tab_style; + gint page_num; + + if (! GTK_CHECK_MENU_ITEM (widget)->active) + return; + + tab_style = (gint) action; + + page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); + + dockable = (GimpDockable *) + gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); + + if (dockable && dockable->tab_style != tab_style) + { + GtkWidget *tab_widget; + + dockable->tab_style = tab_style; + + tab_widget = gimp_dockbook_get_tab_widget (dockbook, dockable); + + gtk_notebook_set_tab_label (GTK_NOTEBOOK (dockbook), + GTK_WIDGET (dockable), + tab_widget); + } +} + +void +dockable_toggle_image_menu_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + + if (GIMP_IS_IMAGE_DOCK (dockbook->dock)) + gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dockbook->dock), + GTK_CHECK_MENU_ITEM (widget)->active); +} + +void +dockable_toggle_auto_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + + if (GIMP_IS_IMAGE_DOCK (dockbook->dock)) + gimp_image_dock_set_auto_follow_active (GIMP_IMAGE_DOCK (dockbook->dock), + GTK_CHECK_MENU_ITEM (widget)->active); +} + +static void +dockable_change_screen_confirm_callback (GtkWidget *query_box, + gint value, + gpointer data) +{ + GdkScreen *screen; + + screen = gdk_display_get_screen (gtk_widget_get_display (GTK_WIDGET (data)), + value); + + if (screen) + gtk_window_set_screen (GTK_WINDOW (data), screen); +} + +static void +dockable_change_screen_destroy_callback (GtkWidget *query_box, + GtkWidget *dock) +{ + g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", NULL); +} + +void +dockable_change_screen_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + GtkWidget *dock; + GdkScreen *screen; + GdkDisplay *display; + gint cur_screen; + gint num_screens; + GtkWidget *qbox; + + dock = GTK_WIDGET (dockbook->dock); + + qbox = g_object_get_data (G_OBJECT (dock), "gimp-change-screen-dialog"); + + if (qbox) + { + gtk_window_present (GTK_WINDOW (qbox)); + return; + } + + screen = gtk_widget_get_screen (dock); + display = gtk_widget_get_display (dock); + + cur_screen = gdk_screen_get_number (screen); + num_screens = gdk_display_get_n_screens (display); + + qbox = gimp_query_int_box ("Move Dock to Screen", + dock, + NULL, 0, + "Enter destination screen", + cur_screen, 0, num_screens - 1, + G_OBJECT (dock), "destroy", + dockable_change_screen_confirm_callback, + dock); + + g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", qbox); + + g_signal_connect (qbox, "destroy", + G_CALLBACK (dockable_change_screen_destroy_callback), + dock); + + gtk_widget_show (qbox); +} diff --git a/app/actions/dockable-commands.h b/app/actions/dockable-commands.h new file mode 100644 index 0000000000..ea6360e6f0 --- /dev/null +++ b/app/actions/dockable-commands.h @@ -0,0 +1,54 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __DOCKABLE_COMMANDS_H__ +#define __DOCKABLE_COMMANDS_H__ + + +void dockable_add_tab_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); +void dockable_close_tab_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); +void dockable_detach_tab_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); + +void dockable_toggle_view_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); +void dockable_preview_size_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); +void dockable_tab_style_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); + +void dockable_toggle_image_menu_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); +void dockable_toggle_auto_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); +void dockable_change_screen_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); + + +#endif /* __DOCKABLE_COMMANDS_H__ */ diff --git a/app/actions/documents-actions.c b/app/actions/documents-actions.c new file mode 100644 index 0000000000..d931f5338f --- /dev/null +++ b/app/actions/documents-actions.c @@ -0,0 +1,112 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimpcontext.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpcontainereditor.h" +#include "widgets/gimpcontainerview.h" +#include "widgets/gimphelp-ids.h" + +#include "documents-actions.h" +#include "gui/documents-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry documents_actions[] = +{ + { "documents-open", GTK_STOCK_OPEN, + N_("_Open Image"), "", NULL, + G_CALLBACK (documents_open_document_cmd_callback), + GIMP_HELP_DOCUMENT_OPEN }, + + { "documents-raise-or-open", GTK_STOCK_OPEN, + N_("_Raise or Open Image"), "", NULL, + G_CALLBACK (documents_raise_or_open_document_cmd_callback), + GIMP_HELP_DOCUMENT_OPEN }, + + { "documents-file-open-dialog", GTK_STOCK_OPEN, + N_("File Open _Dialog"), "", NULL, + G_CALLBACK (documents_file_open_dialog_cmd_callback), + GIMP_HELP_DOCUMENT_OPEN }, + + { "documents-remove", GTK_STOCK_REMOVE, + N_("Remove _Entry"), "", NULL, + G_CALLBACK (documents_remove_document_cmd_callback), + GIMP_HELP_DOCUMENT_REMOVE }, + + { "documents-recreate-preview", GTK_STOCK_REFRESH, + N_("Recreate _Preview"), "", NULL, + G_CALLBACK (documents_recreate_preview_cmd_callback), + GIMP_HELP_DOCUMENT_REFRESH }, + + { "documents-reload-previews", GTK_STOCK_REFRESH, + N_("Reload _all Previews"), "", NULL, + G_CALLBACK (documents_reload_previews_cmd_callback), + GIMP_HELP_DOCUMENT_REFRESH }, + + { "documents-remove-dangling", GTK_STOCK_REFRESH, + N_("Remove Dangling E_ntries"), "", NULL, + G_CALLBACK (documents_delete_dangling_documents_cmd_callback), + GIMP_HELP_DOCUMENT_REFRESH } +}; + + +void +documents_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + documents_actions, + G_N_ELEMENTS (documents_actions), + data); +} + +void +documents_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpContainerEditor *editor; + GimpImagefile *imagefile; + + editor = GIMP_CONTAINER_EDITOR (data); + + imagefile = gimp_context_get_imagefile (editor->view->context); + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("documents-open", imagefile); + SET_SENSITIVE ("documents-raise-or-open", imagefile); + SET_SENSITIVE ("documents-file-open-dialog", TRUE); + SET_SENSITIVE ("documents-remove", imagefile); + SET_SENSITIVE ("documents-recreate-preview", imagefile); + SET_SENSITIVE ("documents-reload-previews", imagefile); + SET_SENSITIVE ("documents-remove-dangling", imagefile); + +#undef SET_SENSITIVE +} diff --git a/app/actions/documents-actions.h b/app/actions/documents-actions.h new file mode 100644 index 0000000000..4d3981680c --- /dev/null +++ b/app/actions/documents-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __DOCUMENTS_ACTIONS_H__ +#define __DOCUMENTS_ACTIONS_H__ + + +void documents_actions_setup (GimpActionGroup *group, + gpointer data); +void documents_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __DOCUMENTS_ACTIONS_H__ */ diff --git a/app/actions/drawable-actions.c b/app/actions/drawable-actions.c new file mode 100644 index 0000000000..1de0dd8c5f --- /dev/null +++ b/app/actions/drawable-actions.c @@ -0,0 +1,177 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimp.h" +#include "core/gimpchannel.h" +#include "core/gimpcontext.h" +#include "core/gimpimage.h" +#include "core/gimplayer.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" + +#include "display/gimpdisplay.h" +#include "display/gimpdisplayshell.h" + +#include "drawable-actions.h" +#include "gui/drawable-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry drawable_actions[] = +{ + { "drawable-desaturate", GIMP_STOCK_CONVERT_GRAYSCALE, + N_("_Desaturate"), NULL, NULL, + G_CALLBACK (drawable_desaturate_cmd_callback), + GIMP_HELP_LAYER_DESATURATE }, + + { "drawable-invert", GIMP_STOCK_INVERT, + N_("In_vert"), NULL, NULL, + G_CALLBACK (drawable_invert_cmd_callback), + GIMP_HELP_LAYER_INVERT }, + + { "drawable-equalize", NULL, + N_("_Equalize"), NULL, NULL, + G_CALLBACK (drawable_equalize_cmd_callback), + GIMP_HELP_LAYER_EQUALIZE }, + + { "drawable-offset", NULL, + N_("_Offset..."), "O", NULL, + G_CALLBACK (drawable_offset_cmd_callback), + GIMP_HELP_LAYER_OFFSET } +}; + +static GimpEnumActionEntry drawable_flip_actions[] = +{ + { "drawable-flip-horizontal", GIMP_STOCK_FLIP_HORIZONTAL, + N_("Flip _Horizontally"), NULL, NULL, + GIMP_ORIENTATION_HORIZONTAL, + GIMP_HELP_LAYER_FLIP_HORIZONTAL }, + + { "drawable-flip-vertical", GIMP_STOCK_FLIP_VERTICAL, + N_("Flip _Vertically"), NULL, NULL, + GIMP_ORIENTATION_VERTICAL, + GIMP_HELP_LAYER_FLIP_VERTICAL } +}; + +static GimpEnumActionEntry drawable_rotate_actions[] = +{ + { "drawable-rotate-90", GIMP_STOCK_ROTATE_90, + N_("Rotate 90 degrees _CW"), NULL, NULL, + GIMP_ROTATE_90, + GIMP_HELP_LAYER_ROTATE_90 }, + + { "drawable-rotate-180", GIMP_STOCK_ROTATE_180, + N_("Rotate _180 degrees"), NULL, NULL, + GIMP_ROTATE_180, + GIMP_HELP_LAYER_ROTATE_180 }, + + { "drawable-rotate-270", GIMP_STOCK_ROTATE_270, + N_("Rotate 90 degrees CC_W"), NULL, NULL, + GIMP_ROTATE_270, + GIMP_HELP_LAYER_ROTATE_270 } +}; + + +void +drawable_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + drawable_actions, + G_N_ELEMENTS (drawable_actions), + data); + + gimp_action_group_add_enum_actions (group, + drawable_flip_actions, + G_N_ELEMENTS (drawable_flip_actions), + G_CALLBACK (drawable_flip_cmd_callback), + data); + + gimp_action_group_add_enum_actions (group, + drawable_rotate_actions, + G_N_ELEMENTS (drawable_rotate_actions), + G_CALLBACK (drawable_rotate_cmd_callback), + data); +} + +void +drawable_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpDisplay *gdisp = NULL; + GimpDisplayShell *shell = NULL; + GimpImage *gimage = NULL; + GimpDrawable *drawable = NULL; + gboolean is_rgb = FALSE; + gboolean is_gray = FALSE; + gboolean is_indexed = FALSE; + + if (GIMP_IS_DISPLAY_SHELL (data)) + { + shell = GIMP_DISPLAY_SHELL (data); + gdisp = shell->gdisp; + } + else if (GIMP_IS_DISPLAY (data)) + { + gdisp = GIMP_DISPLAY (data); + shell = GIMP_DISPLAY_SHELL (gdisp->shell); + } + + if (gdisp) + { + gimage = gdisp->gimage; + + drawable = gimp_image_active_drawable (gimage); + + if (drawable) + { + GimpImageType drawable_type = gimp_drawable_type (drawable); + + is_rgb = GIMP_IMAGE_TYPE_IS_RGB (drawable_type); + is_gray = GIMP_IMAGE_TYPE_IS_GRAY (drawable_type); + is_indexed = GIMP_IMAGE_TYPE_IS_INDEXED (drawable_type); + } + } + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("drawable-desaturate", drawable && is_rgb); + SET_SENSITIVE ("drawable-invert", drawable && ! is_indexed); + SET_SENSITIVE ("drawable-equalize", drawable && ! is_indexed); + SET_SENSITIVE ("drawable-offset", drawable); + + SET_SENSITIVE ("drawable-flip-horizontal", drawable); + SET_SENSITIVE ("drawable-flip-vertical", drawable); + + SET_SENSITIVE ("drawable-rotate-90", drawable); + SET_SENSITIVE ("drawable-rotate-180", drawable); + SET_SENSITIVE ("drawable-rotate-270", drawable); + +#undef SET_SENSITIVE +} diff --git a/app/actions/drawable-actions.h b/app/actions/drawable-actions.h new file mode 100644 index 0000000000..89a49fbdca --- /dev/null +++ b/app/actions/drawable-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __DRAWABLE_ACTIONS_H__ +#define __DRAWABLE_ACTIONS_H__ + + +void drawable_actions_setup (GimpActionGroup *group, + gpointer data); +void drawable_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __DRAWABLE_ACTIONS_H__ */ diff --git a/app/actions/edit-actions.c b/app/actions/edit-actions.c new file mode 100644 index 0000000000..fb6ede0935 --- /dev/null +++ b/app/actions/edit-actions.c @@ -0,0 +1,303 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimp.h" +#include "core/gimpchannel.h" +#include "core/gimpcontext.h" +#include "core/gimpimage.h" +#include "core/gimplayer.h" +#include "core/gimplist.h" +#include "core/gimptoolinfo.h" +#include "core/gimpundostack.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" + +#include "display/gimpdisplay.h" +#include "display/gimpdisplayshell.h" +#include "display/gimpdisplayshell-appearance.h" +#include "display/gimpdisplayshell-selection.h" + +#include "edit-actions.h" +#include "gui/edit-commands.h" + +#include "gimp-intl.h" + + +/* local function prototypes */ + +static void edit_actions_buffer_changed (Gimp *gimp, + GimpActionGroup *group); +static void edit_actions_foreground_changed (GimpContext *context, + const GimpRGB *color, + GimpActionGroup *group); +static void edit_actions_background_changed (GimpContext *context, + const GimpRGB *color, + GimpActionGroup *group); + + +static GimpActionEntry edit_actions[] = +{ + { "edit-menu", NULL, + N_("/_Edit") }, + + { "edit-undo", GTK_STOCK_UNDO, + N_("_Undo"), "Z", NULL, + G_CALLBACK (edit_undo_cmd_callback), + GIMP_HELP_EDIT_UNDO }, + + { "edit-redo", GTK_STOCK_REDO, + N_("_Redo"), "Y", NULL, + G_CALLBACK (edit_redo_cmd_callback), + GIMP_HELP_EDIT_REDO }, + + { "edit-cut", GTK_STOCK_CUT, + N_("Cu_t"), "X", NULL, + G_CALLBACK (edit_cut_cmd_callback), + GIMP_HELP_EDIT_CUT }, + + { "edit-copy", GTK_STOCK_COPY, + N_("_Copy"), "C", NULL, + G_CALLBACK (edit_copy_cmd_callback), + GIMP_HELP_EDIT_COPY }, + + { "edit-paste", GTK_STOCK_PASTE, + N_("_Paste"), "V", NULL, + G_CALLBACK (edit_paste_cmd_callback), + GIMP_HELP_EDIT_PASTE }, + + { "edit-paste-into", GIMP_STOCK_PASTE_INTO, + N_("Paste _Into"), NULL, NULL, + G_CALLBACK (edit_paste_into_cmd_callback), + GIMP_HELP_EDIT_PASTE_INTO }, + + { "edit-paste-as-new", GIMP_STOCK_PASTE_AS_NEW, + N_("Paste as _New"), NULL, NULL, + G_CALLBACK (edit_paste_as_new_cmd_callback), + GIMP_HELP_EDIT_PASTE_AS_NEW }, + + { "edit-buffer-menu", NULL, + N_("Buffer") }, + + { "edit-cut-named", GTK_STOCK_CUT, + N_("Cu_t Named..."), "X",NULL, + G_CALLBACK (edit_named_cut_cmd_callback), + GIMP_HELP_BUFFER_CUT }, + + { "edit-copy-named", GTK_STOCK_COPY, + N_("_Copy Named..."), "C", NULL, + G_CALLBACK (edit_named_copy_cmd_callback), + GIMP_HELP_BUFFER_COPY }, + + { "edit-paste-named", GTK_STOCK_PASTE, + N_("_Paste Named..."), "V", NULL, + G_CALLBACK (edit_named_paste_cmd_callback), + GIMP_HELP_BUFFER_PASTE }, + + { "edit-clear", GTK_STOCK_CLEAR, + N_("Cl_ear"), "K", NULL, + G_CALLBACK (edit_clear_cmd_callback), + GIMP_HELP_EDIT_CLEAR }, + + { "edit-stroke", GIMP_STOCK_SELECTION_STROKE, + N_("_Stroke Selection..."), NULL, NULL, + G_CALLBACK (edit_stroke_cmd_callback), + GIMP_HELP_SELECTION_STROKE } +}; + +static GimpEnumActionEntry edit_fill_actions[] = +{ + { "edit-fill-fg", GIMP_STOCK_TOOL_BUCKET_FILL, + N_("Fill with _FG Color"), "comma", NULL, + GIMP_FOREGROUND_FILL, + GIMP_HELP_EDIT_FILL_FG }, + + { "edit-fill-bg", GIMP_STOCK_TOOL_BUCKET_FILL, + N_("Fill with B_G Color"), "period", NULL, + GIMP_BACKGROUND_FILL, + GIMP_HELP_EDIT_FILL_BG }, + + { "edit-fill-pattern", GIMP_STOCK_TOOL_BUCKET_FILL, + N_("Fill with P_attern"), NULL, NULL, + GIMP_PATTERN_FILL, + GIMP_HELP_EDIT_FILL_PATTERN } +}; + + +void +edit_actions_setup (GimpActionGroup *group, + gpointer data) +{ + GimpContext *user_context; + GimpRGB color; + + gimp_action_group_add_actions (group, + edit_actions, + G_N_ELEMENTS (edit_actions), + data); + + gimp_action_group_add_enum_actions (group, + edit_fill_actions, + G_N_ELEMENTS (edit_fill_actions), + G_CALLBACK (edit_fill_cmd_callback), + data); + + g_signal_connect_object (group->gimp, "buffer_changed", + G_CALLBACK (edit_actions_buffer_changed), + group, 0); + edit_actions_buffer_changed (group->gimp, group); + + user_context = gimp_get_user_context (group->gimp); + + g_signal_connect_object (user_context, "foreground_changed", + G_CALLBACK (edit_actions_foreground_changed), + group, 0); + g_signal_connect_object (user_context, "background_changed", + G_CALLBACK (edit_actions_background_changed), + group, 0); + + gimp_context_get_foreground (user_context, &color); + edit_actions_foreground_changed (user_context, &color, group); + + gimp_context_get_background (user_context, &color); + edit_actions_background_changed (user_context, &color, group); +} + +void +edit_action_update (GimpActionGroup *group, + gpointer data) +{ + GimpDisplay *gdisp = NULL; + GimpDisplayShell *shell = NULL; + GimpImage *gimage = NULL; + GimpDrawable *drawable = NULL; + gboolean sel = FALSE; + + if (GIMP_IS_DISPLAY_SHELL (data)) + { + shell = GIMP_DISPLAY_SHELL (data); + gdisp = shell->gdisp; + } + else if (GIMP_IS_DISPLAY (data)) + { + gdisp = GIMP_DISPLAY (data); + shell = GIMP_DISPLAY_SHELL (gdisp->shell); + } + + if (gdisp) + { + gimage = gdisp->gimage; + + sel = ! gimp_channel_is_empty (gimp_image_get_mask (gimage)); + + drawable = gimp_image_active_drawable (gimage); + } + +#define SET_LABEL(action,label) \ + gimp_action_group_set_action_label (group, action, (label)) +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + { + gchar *undo_name = NULL; + gchar *redo_name = NULL; + + if (gdisp && gimp_image_undo_is_enabled (gimage)) + { + GimpUndo *undo; + GimpUndo *redo; + + undo = gimp_undo_stack_peek (gimage->undo_stack); + redo = gimp_undo_stack_peek (gimage->redo_stack); + + if (undo) + undo_name = + g_strdup_printf (_("_Undo %s"), + gimp_object_get_name (GIMP_OBJECT (undo))); + + if (redo) + redo_name = + g_strdup_printf (_("_Redo %s"), + gimp_object_get_name (GIMP_OBJECT (redo))); + } + + SET_LABEL ("edit-undo", undo_name ? undo_name : _("_Undo")); + SET_LABEL ("edit-redo", redo_name ? redo_name : _("_Redo")); + + SET_SENSITIVE ("edit-undo", undo_name); + SET_SENSITIVE ("edit-redo", redo_name); + + g_free (undo_name); + g_free (redo_name); + } + + SET_SENSITIVE ("edit-cut", drawable); + SET_SENSITIVE ("edit-copy", drawable); + SET_SENSITIVE ("edit-paste", gdisp && group->gimp->global_buffer); + SET_SENSITIVE ("edit-paste-into", gdisp && group->gimp->global_buffer); + + SET_SENSITIVE ("edit-cut-named", drawable); + SET_SENSITIVE ("edit-copy-named", drawable); + + SET_SENSITIVE ("edit-clear", drawable); + SET_SENSITIVE ("edit-fill-fg", drawable); + SET_SENSITIVE ("edit-fill-bg", drawable); + SET_SENSITIVE ("edit-fill-pattern", drawable); + SET_SENSITIVE ("edit-stroke", drawable && sel); + +#undef SET_LABEL +#undef SET_SENSITIVE +} + + +/* private functions */ + +static void +edit_actions_buffer_changed (Gimp *gimp, + GimpActionGroup *group) +{ + gboolean buf = (gimp->global_buffer != NULL); + + gimp_action_group_set_action_sensitive (group, "edit-paste", buf); + gimp_action_group_set_action_sensitive (group, "edit-paste-into", buf); + gimp_action_group_set_action_sensitive (group, "edit-paste-as-new", buf); +} + +static void +edit_actions_foreground_changed (GimpContext *context, + const GimpRGB *color, + GimpActionGroup *group) +{ + gimp_action_group_set_action_color (group, "edit-fill-fg", color, FALSE); +} + +static void +edit_actions_background_changed (GimpContext *context, + const GimpRGB *color, + GimpActionGroup *group) +{ + gimp_action_group_set_action_color (group, "edit-fill-bg", color, FALSE); +} diff --git a/app/actions/edit-actions.h b/app/actions/edit-actions.h new file mode 100644 index 0000000000..9e12f8baf0 --- /dev/null +++ b/app/actions/edit-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __EDIT_ACTIONS_H__ +#define __EDIT_ACTIONS_H__ + + +void edit_actions_setup (GimpActionGroup *group, + gpointer data); +void edit_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __EDIT_ACTIONS_H__ */ diff --git a/app/actions/edit-commands.c b/app/actions/edit-commands.c index c91bd63b5a..d199be2d6c 100644 --- a/app/actions/edit-commands.c +++ b/app/actions/edit-commands.c @@ -140,17 +140,10 @@ edit_copy_cmd_callback (GtkWidget *widget, gimp_image_flush (gimage); } -void -edit_paste_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +static void +edit_paste (GimpDisplay *gdisp, + gboolean paste_into) { - GimpDisplay *gdisp; - gboolean paste_into; - return_if_no_display (gdisp, data); - - paste_into = (gboolean) action; - if (gdisp->gimage->gimp->global_buffer) { GimpDisplayShell *shell; @@ -170,6 +163,26 @@ edit_paste_cmd_callback (GtkWidget *widget, } } +void +edit_paste_cmd_callback (GtkWidget *widget, + gpointer data) +{ + GimpDisplay *gdisp; + return_if_no_display (gdisp, data); + + edit_paste (gdisp, FALSE); +} + +void +edit_paste_into_cmd_callback (GtkWidget *widget, + gpointer data) +{ + GimpDisplay *gdisp; + return_if_no_display (gdisp, data); + + edit_paste (gdisp, TRUE); +} + void edit_paste_as_new_cmd_callback (GtkWidget *widget, gpointer data) diff --git a/app/actions/edit-commands.h b/app/actions/edit-commands.h index 28d1af4f88..a7d3913b91 100644 --- a/app/actions/edit-commands.h +++ b/app/actions/edit-commands.h @@ -29,8 +29,9 @@ void edit_cut_cmd_callback (GtkWidget *widget, void edit_copy_cmd_callback (GtkWidget *widget, gpointer data); void edit_paste_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); +void edit_paste_into_cmd_callback (GtkWidget *widget, + gpointer data); void edit_paste_as_new_cmd_callback (GtkWidget *widget, gpointer data); void edit_named_cut_cmd_callback (GtkWidget *widget, diff --git a/app/actions/error-console-actions.c b/app/actions/error-console-actions.c new file mode 100644 index 0000000000..6bf7ba8d60 --- /dev/null +++ b/app/actions/error-console-actions.c @@ -0,0 +1,86 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimperrorconsole.h" +#include "widgets/gimphelp-ids.h" + +#include "error-console-actions.h" +#include "gui/error-console-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry error_console_actions[] = +{ + { "error-console-clear", GTK_STOCK_CLEAR, + N_("_Clear Errors"), "", NULL, + G_CALLBACK (error_console_clear_cmd_callback), + GIMP_HELP_ERRORS_CLEAR }, + + { "error-console-save-all", GTK_STOCK_SAVE_AS, + N_("Save _All Errors to File..."), "", NULL, + G_CALLBACK (error_console_save_all_cmd_callback), + GIMP_HELP_ERRORS_SAVE }, + + { "error-console-save-selection", GTK_STOCK_SAVE_AS, + N_("Save _Selection to File..."), "", NULL, + G_CALLBACK (error_console_save_selection_cmd_callback), + GIMP_HELP_ERRORS_SAVE } +}; + + +void +error_console_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + error_console_actions, + G_N_ELEMENTS (error_console_actions), + data); +} + +void +error_console_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpErrorConsole *console; + gboolean selection; + + console = GIMP_ERROR_CONSOLE (data); + + selection = gtk_text_buffer_get_selection_bounds (console->text_buffer, + NULL, NULL); + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("error-console-clear", TRUE); + SET_SENSITIVE ("error-console-save-all", TRUE); + SET_SENSITIVE ("error-console-save-selection", selection); + +#undef SET_SENSITIVE +} diff --git a/app/actions/error-console-actions.h b/app/actions/error-console-actions.h new file mode 100644 index 0000000000..43c8ff289b --- /dev/null +++ b/app/actions/error-console-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __ERROR_CONSOLE_ACIONS_H__ +#define __ERROR_CONSOLE_ACIONS_H__ + + +void error_console_actions_setup (GimpActionGroup *group, + gpointer data); +void error_console_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __ERROR_CONSOLE_ACTIONS_H__ */ diff --git a/app/actions/file-actions.c b/app/actions/file-actions.c new file mode 100644 index 0000000000..e9afb068dc --- /dev/null +++ b/app/actions/file-actions.c @@ -0,0 +1,298 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "config/gimpguiconfig.h" + +#include "core/gimp.h" +#include "core/gimpcontainer.h" +#include "core/gimpimage.h" + +#include "file/file-utils.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" + +#include "display/gimpdisplay.h" +#include "display/gimpdisplayshell.h" + +#include "file-actions.h" +#include "gui/file-commands.h" + +#include "gimp-intl.h" + + +/* local function prototypes */ + +static void file_actions_last_opened_update (GimpContainer *container, + GimpImagefile *unused, + GimpActionGroup *group); +static void file_actions_last_opened_reorder (GimpContainer *container, + GimpImagefile *unused1, + gint unused2, + GimpActionGroup *group); + + +static GimpActionEntry file_actions[] = +{ + { "file-menu", NULL, + N_("_File") }, + + { "file-open-recent-menu", NULL, + N_("Open _Recent") }, + + { "file-open-recent-empty", NULL, + N_("(Empty)") }, + + { "file-new", GTK_STOCK_NEW, + N_("_New..."), "N", NULL, + G_CALLBACK (file_new_cmd_callback), + GIMP_HELP_FILE_NEW }, + + { "file-open", GTK_STOCK_OPEN, + N_("_Open..."), "O", NULL, + G_CALLBACK (file_open_cmd_callback), + GIMP_HELP_FILE_OPEN }, + + { "file-save", GTK_STOCK_SAVE, + N_("_Save"), "S", NULL, + G_CALLBACK (file_save_cmd_callback), + GIMP_HELP_FILE_SAVE }, + + { "file-save-as", GTK_STOCK_SAVE_AS, + N_("Save _as..."), "S", NULL, + G_CALLBACK (file_save_as_cmd_callback), + GIMP_HELP_FILE_SAVE_AS }, + + { "file-save-a-copy", NULL, + N_("Save a Cop_y..."), NULL, NULL, + G_CALLBACK (file_save_a_copy_cmd_callback), + GIMP_HELP_FILE_SAVE_A_COPY }, + + { "file-save-as-template", NULL, + N_("Save as _Template..."), NULL, NULL, + G_CALLBACK (file_save_template_cmd_callback), + GIMP_HELP_FILE_SAVE_AS_TEMPLATE }, + + { "file-revert", GTK_STOCK_REVERT_TO_SAVED, + N_("Re_vert"), NULL, NULL, + G_CALLBACK (file_revert_cmd_callback), + GIMP_HELP_FILE_REVERT }, + + { "file-close", GTK_STOCK_CLOSE, + N_( "_Close"), "W", NULL, + G_CALLBACK (file_close_cmd_callback), + GIMP_HELP_FILE_CLOSE }, + + { "file-quit", GTK_STOCK_QUIT, + N_("_Quit"), "Q", NULL, + G_CALLBACK (file_quit_cmd_callback), + GIMP_HELP_FILE_QUIT } +}; + + +void +file_actions_setup (GimpActionGroup *group, + gpointer data) +{ + GimpEnumActionEntry *entries; + gint n_entries; + gint i; + + gimp_action_group_add_actions (group, + file_actions, + G_N_ELEMENTS (file_actions), + data); + + n_entries = GIMP_GUI_CONFIG (group->gimp->config)->last_opened_size; + + entries = g_new0 (GimpEnumActionEntry, n_entries); + + for (i = 0; i < n_entries; i++) + { + entries[i].name = g_strdup_printf ("file-last-opened-%02d", i + 1); + entries[i].stock_id = GTK_STOCK_OPEN; + entries[i].label = NULL; + entries[i].tooltip = NULL; + entries[i].value = i; + entries[i].help_id = GIMP_HELP_FILE_OPEN_RECENT; + + if (i < 9) + entries[i].accelerator = g_strdup_printf ("%d", i + 1); + else if (i == 9) + entries[i].accelerator = "0"; + else + entries[i].accelerator = ""; + } + + gimp_action_group_add_enum_actions (group, entries, n_entries, + G_CALLBACK (file_last_opened_cmd_callback), + data); + + gimp_action_group_set_action_sensitive (group, "file-open-recent-empty", + FALSE); + + for (i = 0; i < n_entries; i++) + { + gimp_action_group_set_action_visible (group, entries[i].name, FALSE); + + g_free ((gchar *) entries[i].name); + + if (i < 9) + g_free ((gchar *) entries[i].accelerator); + } + + g_free (entries); + + g_signal_connect_object (group->gimp->documents, "add", + G_CALLBACK (file_actions_last_opened_update), + group, 0); + g_signal_connect_object (group->gimp->documents, "remove", + G_CALLBACK (file_actions_last_opened_update), + group, 0); + g_signal_connect_object (group->gimp->documents, "reorder", + G_CALLBACK (file_actions_last_opened_reorder), + group, 0); + + file_actions_last_opened_update (group->gimp->documents, NULL, group); +} + +void +file_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpDisplay *gdisp = NULL; + GimpDisplayShell *shell = NULL; + GimpImage *gimage = NULL; + GimpDrawable *drawable = NULL; + + if (GIMP_IS_DISPLAY_SHELL (data)) + { + shell = GIMP_DISPLAY_SHELL (data); + gdisp = shell->gdisp; + } + else if (GIMP_IS_DISPLAY (data)) + { + gdisp = GIMP_DISPLAY (data); + shell = GIMP_DISPLAY_SHELL (gdisp->shell); + } + + if (gdisp) + { + gimage = gdisp->gimage; + + drawable = gimp_image_active_drawable (gimage); + } + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("file-save", gdisp && drawable); + SET_SENSITIVE ("file-save-as", gdisp && drawable); + SET_SENSITIVE ("file-save-a-copy", gdisp && drawable); + SET_SENSITIVE ("file-save-as-template", gdisp); + SET_SENSITIVE ("file-revert", gdisp && GIMP_OBJECT (gimage)->name); + SET_SENSITIVE ("file-close", gdisp); + +#undef SET_SENSITIVE +} + + +/* private functions */ + +static void +file_actions_last_opened_update (GimpContainer *container, + GimpImagefile *unused, + GimpActionGroup *group) +{ + gint num_documents; + gint i; + gint n = GIMP_GUI_CONFIG (group->gimp->config)->last_opened_size; + + num_documents = gimp_container_num_children (container); + + gimp_action_group_set_action_visible (group, + "file-open-recent-empty", + num_documents == 0); + + for (i = 0; i < n; i++) + { + GtkAction *action; + gchar *name = g_strdup_printf ("file-open-recent-%02d", i + 1); + + action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), name); + + if (i < num_documents) + { + GimpImagefile *imagefile = (GimpImagefile *) + gimp_container_get_child_by_index (container, i); + + if (g_object_get_data (G_OBJECT (action), "gimp-imagefile") != + (gpointer) imagefile) + { + const gchar *uri; + gchar *filename; + gchar *basename; + + uri = gimp_object_get_name (GIMP_OBJECT (imagefile)); + + filename = file_utils_uri_to_utf8_filename (uri); + basename = file_utils_uri_to_utf8_basename (uri); + + g_object_set (G_OBJECT (action), + "label", basename, + "tooltip", filename, + "visible", TRUE, + NULL); + +#if 0 + gimp_help_set_help_data (widget, filename, NULL); +#endif + + g_free (filename); + g_free (basename); + + g_object_set_data (G_OBJECT (action), + "gimp-imagefile", imagefile); + } + } + else + { + g_object_set_data (G_OBJECT (action), "gimp-imagefile", NULL); + g_object_set (G_OBJECT (action), "visible", FALSE, NULL); + } + + g_free (name); + } +} + +static void +file_actions_last_opened_reorder (GimpContainer *container, + GimpImagefile *unused1, + gint unused2, + GimpActionGroup *group) +{ + file_actions_last_opened_update (container, unused1, group); +} diff --git a/app/actions/file-actions.h b/app/actions/file-actions.h new file mode 100644 index 0000000000..9f85d4fb43 --- /dev/null +++ b/app/actions/file-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __FILE_ACTIONS_H__ +#define __FILE_ACTIONS_H__ + + +void file_actions_setup (GimpActionGroup *group, + gpointer data); +void file_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __FILE_ACTIONS_H__ */ diff --git a/app/actions/fonts-actions.c b/app/actions/fonts-actions.c new file mode 100644 index 0000000000..57abce5321 --- /dev/null +++ b/app/actions/fonts-actions.c @@ -0,0 +1,78 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimpcontext.h" + +#include "text/gimpfont.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpcontainerview.h" +#include "widgets/gimpfontview.h" +#include "widgets/gimphelp-ids.h" + +#include "fonts-actions.h" +#include "gui/fonts-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry fonts_actions[] = +{ + { "fonts-refresh", GTK_STOCK_REFRESH, + N_("_Rescan Font List"), "", NULL, + G_CALLBACK (fonts_refresh_cmd_callback), + GIMP_HELP_FONT_REFRESH } +}; + + +void +fonts_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + fonts_actions, + G_N_ELEMENTS (fonts_actions), + data); +} + +void +fonts_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpContainerEditor *editor; + GimpFont *font; + + editor = GIMP_CONTAINER_EDITOR (data); + + font = gimp_context_get_font (editor->view->context); + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("fonts-refresh", TRUE); + +#undef SET_SENSITIVE +} diff --git a/app/actions/fonts-actions.h b/app/actions/fonts-actions.h new file mode 100644 index 0000000000..b1742b8602 --- /dev/null +++ b/app/actions/fonts-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __FONTS_ACTIONS_H__ +#define __FONTS_ACTIONS_H__ + + +void fonts_actions_setup (GimpActionGroup *group, + gpointer data); +void fonts_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __FONTS_ACTIONS_H__ */ diff --git a/app/actions/gradient-editor-actions.c b/app/actions/gradient-editor-actions.c new file mode 100644 index 0000000000..eb649f4b53 --- /dev/null +++ b/app/actions/gradient-editor-actions.c @@ -0,0 +1,587 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimp.h" +#include "core/gimpcontext.h" +#include "core/gimpdatafactory.h" +#include "core/gimpgradient.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpdataeditor.h" +#include "widgets/gimpgradienteditor.h" +#include "widgets/gimphelp-ids.h" + +#include "gradient-editor-actions.h" +#include "gui/gradient-editor-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry gradient_editor_actions[] = +{ + { "gradient-editor-left-color", NULL, + N_("L_eft Endpoint's Color..."), NULL, NULL, + G_CALLBACK (gradient_editor_left_color_cmd_callback), + GIMP_HELP_GRADIENT_EDITOR_LEFT_COLOR }, + + { "gradient-editor-load-left-color", NULL, + N_("_Load Left Color From") }, + + { "gradient-editor-save-left-color", NULL, + N_("/_Save Left Color To") }, + + { "gradient-editor-right-color", NULL, + N_("R_ight Endpoint's Color..."), NULL, NULL, + G_CALLBACK (gradient_editor_right_color_cmd_callback), + GIMP_HELP_GRADIENT_EDITOR_RIGHT_COLOR }, + + { "gradient-editor-load-right-color", NULL, + N_("Load Right Color Fr_om") }, + + { "gradient-editor-save-right-color", NULL, + N_("Sa_ve Right Color To") }, + + { "gradient-editor-blending-func", NULL, + "blending-function" }, + + { "gradient-editor-coloring-type", NULL, + "coloring-type" }, + + { "gradient-editor-flip", NULL, + "flip", "F", NULL, + G_CALLBACK (gradient_editor_flip_cmd_callback), + GIMP_HELP_GRADIENT_EDITOR_FLIP }, + + { "gradient-editor-replicate", NULL, + "replicate", "R", NULL, + G_CALLBACK (gradient_editor_replicate_cmd_callback), + GIMP_HELP_GRADIENT_EDITOR_FLIP }, + + { "gradient-editor-split-midpoint", NULL, + "splitmidpoint", "S", NULL, + G_CALLBACK (gradient_editor_split_midpoint_cmd_callback), + GIMP_HELP_GRADIENT_EDITOR_SPLIT_MIDPOINT }, + + { "gradient-editor-split-uniform", NULL, + "splituniform", "U", NULL, + G_CALLBACK (gradient_editor_split_uniformly_cmd_callback), + GIMP_HELP_GRADIENT_EDITOR_SPLIT_UNIFORM }, + + { "gradient-editor-delete", NULL, + "delete", "D", NULL, + G_CALLBACK (gradient_editor_delete_cmd_callback), + GIMP_HELP_GRADIENT_EDITOR_DELETE }, + + { "gradient-editor-recenter", NULL, + "recenter", "C", NULL, + G_CALLBACK (gradient_editor_recenter_cmd_callback), + GIMP_HELP_GRADIENT_EDITOR_RECENTER }, + + { "gradient-editor-redistribute", NULL, + "redistribute", "C", NULL, + G_CALLBACK (gradient_editor_redistribute_cmd_callback), + GIMP_HELP_GRADIENT_EDITOR_REDISTRIBUTE }, + + { "gradient-editor-blend-color", NULL, + N_("Ble_nd Endpoints' Colors"), "B", NULL, + G_CALLBACK (gradient_editor_blend_color_cmd_callback), + GIMP_HELP_GRADIENT_EDITOR_BLEND_COLOR }, + + { "gradient-editor-blend-opacity", NULL, + N_("Blend Endpoints' Opacit_y"), "B", NULL, + G_CALLBACK (gradient_editor_blend_opacity_cmd_callback), + GIMP_HELP_GRADIENT_EDITOR_BLEND_OPACITY } +}; + + +#define LOAD_LEFT_FROM(num,magic) \ + { "gradient-editor-load-left-" num, NULL, \ + num, NULL, NULL, \ + (magic), \ + GIMP_HELP_GRADIENT_EDITOR_LEFT_LOAD } +#define SAVE_LEFT_TO(num,magic) \ + { "gradient-editor-save-left-" num, NULL, \ + num, NULL, NULL, \ + (magic), \ + GIMP_HELP_GRADIENT_EDITOR_LEFT_SAVE } +#define LOAD_RIGHT_FROM(num,magic) \ + { "gradient-editor-load-right-" num, NULL, \ + num, NULL, NULL, \ + (magic), \ + GIMP_HELP_GRADIENT_EDITOR_RIGHT_LOAD } +#define SAVE_RIGHT_TO(num,magic) \ + { "gradient-editor-save-right-" num, NULL, \ + num, NULL, NULL, \ + (magic), \ + GIMP_HELP_GRADIENT_EDITOR_RIGHT_SAVE } + +static GimpEnumActionEntry gradient_editor_load_left_actions[] = +{ + { "gradient-editor-load-left-left-neighbor", NULL, + N_("_Left Neighbor's Right Endpoint"), NULL, NULL, + 0, + GIMP_HELP_GRADIENT_EDITOR_LEFT_LOAD }, + + { "gradient-editor-load-left-right-endpoint", NULL, + N_("_Right Endpoint"), NULL, NULL, + 1, + GIMP_HELP_GRADIENT_EDITOR_LEFT_LOAD }, + + { "gradient-editor-load-left-fg", NULL, + N_("_FG Color"), NULL, NULL, + 2, + GIMP_HELP_GRADIENT_EDITOR_LEFT_LOAD }, + + { "gradient-editor-load-left-bg", NULL, + N_("_BG Color"), NULL, NULL, + 3, + GIMP_HELP_GRADIENT_EDITOR_LEFT_LOAD }, + + LOAD_LEFT_FROM ("01", 4), + LOAD_LEFT_FROM ("02", 5), + LOAD_LEFT_FROM ("03", 6), + LOAD_LEFT_FROM ("04", 7), + LOAD_LEFT_FROM ("05", 8), + LOAD_LEFT_FROM ("06", 9), + LOAD_LEFT_FROM ("07", 10), + LOAD_LEFT_FROM ("08", 11), + LOAD_LEFT_FROM ("09", 12), + LOAD_LEFT_FROM ("10", 13) +}; + +static GimpEnumActionEntry gradient_editor_save_left_actions[] = +{ + SAVE_LEFT_TO ("01", 0), + SAVE_LEFT_TO ("02", 1), + SAVE_LEFT_TO ("03", 2), + SAVE_LEFT_TO ("04", 3), + SAVE_LEFT_TO ("05", 4), + SAVE_LEFT_TO ("06", 5), + SAVE_LEFT_TO ("07", 6), + SAVE_LEFT_TO ("08", 7), + SAVE_LEFT_TO ("09", 8), + SAVE_LEFT_TO ("10", 9) +}; + +static GimpEnumActionEntry gradient_editor_load_right_actions[] = +{ + { "gradient-editor-load-right-right-neighbor", NULL, + N_("_Right Neighbor's Left Endpoint"), NULL, NULL, + 0, + GIMP_HELP_GRADIENT_EDITOR_RIGHT_LOAD }, + + { "gradient-editor-load-right-left-endpoint", NULL, + N_("_Left Endpoint"), NULL, NULL, + 1, + GIMP_HELP_GRADIENT_EDITOR_RIGHT_LOAD }, + + { "gradient-editor-load-right-fg", NULL, + N_("_FG Color"), NULL, NULL, + 2, + GIMP_HELP_GRADIENT_EDITOR_RIGHT_LOAD }, + + { "gradient-editor-load-right-bg", NULL, + N_("_BG Color"), NULL, NULL, + 3, + GIMP_HELP_GRADIENT_EDITOR_RIGHT_LOAD }, + + LOAD_RIGHT_FROM ("01", 4), + LOAD_RIGHT_FROM ("02", 5), + LOAD_RIGHT_FROM ("03", 6), + LOAD_RIGHT_FROM ("04", 7), + LOAD_RIGHT_FROM ("05", 8), + LOAD_RIGHT_FROM ("06", 9), + LOAD_RIGHT_FROM ("07", 10), + LOAD_RIGHT_FROM ("08", 11), + LOAD_RIGHT_FROM ("09", 12), + LOAD_RIGHT_FROM ("10", 13) +}; + +static GimpEnumActionEntry gradient_editor_save_right_actions[] = +{ + SAVE_RIGHT_TO ("01", 0), + SAVE_RIGHT_TO ("02", 1), + SAVE_RIGHT_TO ("03", 2), + SAVE_RIGHT_TO ("04", 3), + SAVE_RIGHT_TO ("05", 4), + SAVE_RIGHT_TO ("06", 5), + SAVE_RIGHT_TO ("07", 6), + SAVE_RIGHT_TO ("08", 7), + SAVE_RIGHT_TO ("09", 8), + SAVE_RIGHT_TO ("10", 9) +}; + +#undef LOAD_LEFT_FROM +#undef SAVE_LEFT_TO +#undef LOAD_RIGHT_FROM +#undef SAVE_RIGHT_TO + + +static GimpRadioActionEntry gradient_editor_blending_actions[] = +{ + { "gradient-editor-blending-linear", NULL, + N_("_Linear"), NULL, NULL, + GIMP_GRAD_LINEAR, + GIMP_HELP_GRADIENT_EDITOR_BLENDING }, + + { "gradient-editor-blending-curved", NULL, + N_("_Curved"), NULL, NULL, + GIMP_GRAD_CURVED, + GIMP_HELP_GRADIENT_EDITOR_BLENDING }, + + { "gradient-editor-blending-sine", NULL, + N_("_Sinusodial"), NULL, NULL, + GIMP_GRAD_SINE, + GIMP_HELP_GRADIENT_EDITOR_BLENDING }, + + { "gradient-editor-blending-sphere-increasing", NULL, + N_("Spherical (i_ncreasing)"), NULL, NULL, + GIMP_GRAD_SPHERE_INCREASING, + GIMP_HELP_GRADIENT_EDITOR_BLENDING }, + + { "gradient-editor-blending-sphere-decreasing", NULL, + N_("Spherical (_decreasing)"), NULL, NULL, + GIMP_GRAD_SPHERE_DECREASING, + GIMP_HELP_GRADIENT_EDITOR_BLENDING }, + + { "gradient-editor-blending-varies", NULL, + N_("(Varies)"), NULL, NULL, + 0, + GIMP_HELP_GRADIENT_EDITOR_BLENDING } +}; + +static GimpRadioActionEntry gradient_editor_coloring_actions[] = +{ + { "gradient-editor-coloring-rgb", NULL, + N_("_RGB"), NULL, NULL, + GIMP_GRAD_RGB, + GIMP_HELP_GRADIENT_EDITOR_COLORING }, + + { "gradient-editor-coloring-hsv-ccw", NULL, + N_("HSV (_counter-clockwise hue)"), NULL, NULL, + GIMP_GRAD_HSV_CCW, + GIMP_HELP_GRADIENT_EDITOR_COLORING }, + + { "gradient-editor-coloring-hsv-cw", NULL, + N_("HSV (clockwise _hue)"), NULL, NULL, + GIMP_GRAD_HSV_CW, + GIMP_HELP_GRADIENT_EDITOR_COLORING }, + + { "gradient-editor-coloring-varies", NULL, + N_("(Varies)"), NULL, NULL, + 0, + GIMP_HELP_GRADIENT_EDITOR_COLORING } +}; + + +void +gradient_editor_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + gradient_editor_actions, + G_N_ELEMENTS (gradient_editor_actions), + data); + + gimp_action_group_add_enum_actions (group, + gradient_editor_load_left_actions, + G_N_ELEMENTS (gradient_editor_load_left_actions), + G_CALLBACK (gradient_editor_load_left_cmd_callback), + data); + + gimp_action_group_add_enum_actions (group, + gradient_editor_save_left_actions, + G_N_ELEMENTS (gradient_editor_save_left_actions), + G_CALLBACK (gradient_editor_save_left_cmd_callback), + data); + + gimp_action_group_add_enum_actions (group, + gradient_editor_load_right_actions, + G_N_ELEMENTS (gradient_editor_load_right_actions), + G_CALLBACK (gradient_editor_load_right_cmd_callback), + data); + + + gimp_action_group_add_enum_actions (group, + gradient_editor_save_right_actions, + G_N_ELEMENTS (gradient_editor_save_right_actions), + G_CALLBACK (gradient_editor_save_right_cmd_callback), + data); + + gimp_action_group_add_radio_actions (group, + gradient_editor_blending_actions, + G_N_ELEMENTS (gradient_editor_blending_actions), + 0, + G_CALLBACK (gradient_editor_blending_func_cmd_callback), + data); + + gimp_action_group_add_radio_actions (group, + gradient_editor_coloring_actions, + G_N_ELEMENTS (gradient_editor_coloring_actions), + 0, + G_CALLBACK (gradient_editor_coloring_type_cmd_callback), + data); +} + +void +gradient_editor_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpGradientEditor *editor; + GimpContext *user_context; + GimpGradientSegment *left_seg; + GimpGradientSegment *right_seg; + GimpRGB fg; + GimpRGB bg; + gboolean blending_equal = TRUE; + gboolean coloring_equal = TRUE; + gboolean selection; + gboolean delete; + + editor = GIMP_GRADIENT_EDITOR (data); + + user_context = + gimp_get_user_context (GIMP_DATA_EDITOR (editor)->data_factory->gimp); + + if (editor->control_sel_l->prev) + left_seg = editor->control_sel_l->prev; + else + left_seg = gimp_gradient_segment_get_last (editor->control_sel_l); + + if (editor->control_sel_r->next) + right_seg = editor->control_sel_r->next; + else + right_seg = gimp_gradient_segment_get_first (editor->control_sel_r); + + gimp_context_get_foreground (user_context, &fg); + gimp_context_get_background (user_context, &bg); + + { + GimpGradientSegmentType type; + GimpGradientSegmentColor color; + GimpGradientSegment *seg, *aseg; + + type = editor->control_sel_l->type; + color = editor->control_sel_l->color; + + seg = editor->control_sel_l; + + do + { + blending_equal = blending_equal && (seg->type == type); + coloring_equal = coloring_equal && (seg->color == color); + + aseg = seg; + seg = seg->next; + } + while (aseg != editor->control_sel_r); + } + + selection = (editor->control_sel_l != editor->control_sel_r); + delete = (editor->control_sel_l->prev || editor->control_sel_r->next); + +#define SET_ACTIVE(action,active) \ + gimp_action_group_set_action_active (group, action, (active)) +#define SET_COLOR(action,color,set_label) \ + gimp_action_group_set_action_color (group, action, (color), (set_label)) +#define SET_LABEL(action,label) \ + gimp_action_group_set_action_label (group, action, (label)) +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) +#define SET_VISIBLE(action,condition) \ + gimp_action_group_set_action_visible (group, action, (condition) != 0) + + SET_COLOR ("gradient-editor-left-color", + &editor->control_sel_l->left_color, FALSE); + SET_COLOR ("gradient-editor-load-left-left-neighbor", + &left_seg->right_color, FALSE); + SET_COLOR ("gradient-editor-load-left-right-endpoint", + &editor->control_sel_r->right_color, FALSE); + SET_COLOR ("gradient-editor-load-left-fg", &fg, FALSE); + SET_COLOR ("gradient-editor-load-left-bg", &bg, FALSE); + + SET_COLOR ("gradient-editor-load-left-01", &editor->saved_colors[0], TRUE); + SET_COLOR ("gradient-editor-load-left-02", &editor->saved_colors[1], TRUE); + SET_COLOR ("gradient-editor-load-left-03", &editor->saved_colors[2], TRUE); + SET_COLOR ("gradient-editor-load-left-04", &editor->saved_colors[3], TRUE); + SET_COLOR ("gradient-editor-load-left-05", &editor->saved_colors[4], TRUE); + SET_COLOR ("gradient-editor-load-left-06", &editor->saved_colors[5], TRUE); + SET_COLOR ("gradient-editor-load-left-07", &editor->saved_colors[6], TRUE); + SET_COLOR ("gradient-editor-load-left-08", &editor->saved_colors[7], TRUE); + SET_COLOR ("gradient-editor-load-left-09", &editor->saved_colors[8], TRUE); + SET_COLOR ("gradient-editor-load-left-10", &editor->saved_colors[9], TRUE); + + SET_COLOR ("gradient-editor-save-left-01", &editor->saved_colors[0], TRUE); + SET_COLOR ("gradient-editor-save-left-02", &editor->saved_colors[1], TRUE); + SET_COLOR ("gradient-editor-save-left-03", &editor->saved_colors[2], TRUE); + SET_COLOR ("gradient-editor-save-left-04", &editor->saved_colors[3], TRUE); + SET_COLOR ("gradient-editor-save-left-05", &editor->saved_colors[4], TRUE); + SET_COLOR ("gradient-editor-save-left-06", &editor->saved_colors[5], TRUE); + SET_COLOR ("gradient-editor-save-left-07", &editor->saved_colors[6], TRUE); + SET_COLOR ("gradient-editor-save-left-08", &editor->saved_colors[7], TRUE); + SET_COLOR ("gradient-editor-save-left-09", &editor->saved_colors[8], TRUE); + SET_COLOR ("gradient-editor-save-left-10", &editor->saved_colors[9], TRUE); + + SET_COLOR ("gradient-editor-right-color", + &editor->control_sel_r->right_color, FALSE); + SET_COLOR ("gradient-editor-load-right-right-neighbor", + &right_seg->left_color, FALSE); + SET_COLOR ("gradient-editor-load-right-left-endpoint", + &editor->control_sel_l->left_color, FALSE); + SET_COLOR ("gradient-editor-load-right-fg", &fg, FALSE); + SET_COLOR ("gradient-editor-load-right-bg", &bg, FALSE); + + SET_COLOR ("gradient-editor-load-right-01", &editor->saved_colors[0], TRUE); + SET_COLOR ("gradient-editor-load-right-02", &editor->saved_colors[1], TRUE); + SET_COLOR ("gradient-editor-load-right-03", &editor->saved_colors[2], TRUE); + SET_COLOR ("gradient-editor-load-right-04", &editor->saved_colors[3], TRUE); + SET_COLOR ("gradient-editor-load-right-05", &editor->saved_colors[4], TRUE); + SET_COLOR ("gradient-editor-load-right-06", &editor->saved_colors[5], TRUE); + SET_COLOR ("gradient-editor-load-right-07", &editor->saved_colors[6], TRUE); + SET_COLOR ("gradient-editor-load-right-08", &editor->saved_colors[7], TRUE); + SET_COLOR ("gradient-editor-load-right-09", &editor->saved_colors[8], TRUE); + SET_COLOR ("gradient-editor-load-right-10", &editor->saved_colors[9], TRUE); + + SET_COLOR ("gradient-editor-save-right-01", &editor->saved_colors[0], TRUE); + SET_COLOR ("gradient-editor-save-right-02", &editor->saved_colors[1], TRUE); + SET_COLOR ("gradient-editor-save-right-03", &editor->saved_colors[2], TRUE); + SET_COLOR ("gradient-editor-save-right-04", &editor->saved_colors[3], TRUE); + SET_COLOR ("gradient-editor-save-right-05", &editor->saved_colors[4], TRUE); + SET_COLOR ("gradient-editor-save-right-06", &editor->saved_colors[5], TRUE); + SET_COLOR ("gradient-editor-save-right-07", &editor->saved_colors[6], TRUE); + SET_COLOR ("gradient-editor-save-right-08", &editor->saved_colors[7], TRUE); + SET_COLOR ("gradient-editor-save-right-09", &editor->saved_colors[8], TRUE); + SET_COLOR ("gradient-editor-save-right-10", &editor->saved_colors[9], TRUE); + + if (! selection) + { + SET_LABEL ("gradient-editor-blending-func", + _("_Blending Function for Segment")); + SET_LABEL ("gradient-editor-coloring-type", + _("Coloring _Type for Segment")); + + SET_LABEL ("gradient-editor-flip", + _("_Flip Segment")); + SET_LABEL ("gradient-editor-replicate", + _("_Replicate Segment...")); + SET_LABEL ("gradient-editor-split-midpoint", + _("Split Segment at _Midpoint")); + SET_LABEL ("gradient-editor-split-uniform", + _("Split Segment _Uniformly...")); + SET_LABEL ("gradient-editor-delete", + _("_Delete Segment")); + SET_LABEL ("gradient-editor-recenter", + _("Re-_center Segment's Midpoint")); + SET_LABEL ("/redistribute", _("Re-distribute _Handles in Segment")); + } + else + { + SET_LABEL ("gradient-editor-blending-func", + _("_Blending Function for Selection")); + SET_LABEL ("gradient-editor-coloring-type", + _("Coloring _Type for Selection")); + + SET_LABEL ("gradient-editor-flip", + _("_Flip Selection")); + SET_LABEL ("gradient-editor-replicate", + _("_Replicate Selection...")); + SET_LABEL ("gradient-editor-split-midpoint", + _("Split Segments at _Midpoints")); + SET_LABEL ("gradient-editor-split-uniform", + _("Split Segments _Uniformly...")); + SET_LABEL ("gradient-editor-delete", + _("_Delete Selection")); + SET_LABEL ("gradient-editor-recenter", + _("Re-_center Midpoints in Selection")); + SET_LABEL ("gradient-editor-redistribute", + _("Re-distribute _Handles in Selection")); + } + + SET_SENSITIVE ("gradient-editor-blending-varies", FALSE); + SET_SENSITIVE ("gradient-editor-coloring-varies", FALSE); + + if (blending_equal) + { + SET_VISIBLE ("gradient-editor-blending-varies", FALSE); + + switch (editor->control_sel_l->type) + { + case GIMP_GRAD_LINEAR: + SET_ACTIVE ("gradient-editor-blending-linear", TRUE); + break; + case GIMP_GRAD_CURVED: + SET_ACTIVE ("gradient-editor-blending-curved", TRUE); + break; + case GIMP_GRAD_SINE: + SET_ACTIVE ("gradient-editor-blending-sine", TRUE); + break; + case GIMP_GRAD_SPHERE_INCREASING: + SET_ACTIVE ("gradient-editor-blending-sphere-increasing", TRUE); + break; + case GIMP_GRAD_SPHERE_DECREASING: + SET_ACTIVE ("gradient-editor-blending-sphere-decreasing", TRUE); + break; + } + } + else + { + SET_VISIBLE ("gradient-editor-blending-varies", TRUE); + SET_ACTIVE ("gradient-editor-blending-varies", TRUE); + } + + if (coloring_equal) + { + SET_VISIBLE ("gradient-editor-coloring-varies", FALSE); + + switch (editor->control_sel_l->color) + { + case GIMP_GRAD_RGB: + SET_ACTIVE ("gradient-editor-coloring-rgb", TRUE); + break; + case GIMP_GRAD_HSV_CCW: + SET_ACTIVE ("gradient-editor-coloring-hsv-ccw", TRUE); + break; + case GIMP_GRAD_HSV_CW: + SET_ACTIVE ("gradient-editor-coloring-hsv-cw", TRUE); + break; + } + } + else + { + SET_VISIBLE ("gradient-editor-coloring-varies", TRUE); + SET_ACTIVE ("gradient-editor-coloring-varies", TRUE); + } + + SET_SENSITIVE ("gradient-editor-blend-color", selection); + SET_SENSITIVE ("gradient-editor-blend-opacity", selection); + SET_SENSITIVE ("gradient-editor-delete", delete); + +#undef SET_ACTIVE +#undef SET_COLOR +#undef SET_LABEL +#undef SET_SENSITIVE +#undef SET_VISIBLE +} diff --git a/app/actions/gradient-editor-actions.h b/app/actions/gradient-editor-actions.h new file mode 100644 index 0000000000..7530f6c2ba --- /dev/null +++ b/app/actions/gradient-editor-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __GRADIENT_EDITOR_ACTIONS_H__ +#define __GRADIENT_EDITOR_ACTIONS_H__ + + +void gradient_editor_actions_setup (GimpActionGroup *group, + gpointer data); +void gradient_editor_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __GRADIENT_EDITOR_ACTIONS_H__ */ diff --git a/app/actions/gradients-actions.c b/app/actions/gradients-actions.c new file mode 100644 index 0000000000..1b048a78f1 --- /dev/null +++ b/app/actions/gradients-actions.c @@ -0,0 +1,115 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimpcontext.h" +#include "core/gimpdata.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpcontainereditor.h" +#include "widgets/gimpcontainerview.h" +#include "widgets/gimpdatafactoryview.h" +#include "widgets/gimphelp-ids.h" + +#include "gui/data-commands.h" +#include "gradients-actions.h" +#include "gui/gradients-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry gradients_actions[] = +{ + { "gradients-edit", GIMP_STOCK_EDIT, + N_("_Edit Gradient..."), NULL, NULL, + G_CALLBACK (data_edit_data_cmd_callback), + GIMP_HELP_GRADIENT_EDIT }, + + { "gradients-new", GTK_STOCK_NEW, + N_("_New Gradient"), "", NULL, + G_CALLBACK (data_new_data_cmd_callback), + GIMP_HELP_GRADIENT_NEW }, + + { "gradients-duplicate", GIMP_STOCK_DUPLICATE, + N_("D_uplicate Gradient"), NULL, NULL, + G_CALLBACK (data_duplicate_data_cmd_callback), + GIMP_HELP_GRADIENT_DUPLICATE }, + + { "gradients-save-as-pov", GTK_STOCK_SAVE_AS, + N_("Save as _POV-Ray..."), "", NULL, + G_CALLBACK (gradients_save_as_pov_ray_cmd_callback), + GIMP_HELP_GRADIENT_SAVE_AS_POV }, + + { "gradients-delete", GTK_STOCK_DELETE, + N_("_Delete Gradient..."), "", NULL, + G_CALLBACK (data_delete_data_cmd_callback), + GIMP_HELP_GRADIENT_DELETE }, + + { "gradients-refresh", GTK_STOCK_REFRESH, + N_("_Refresh Gradients"), "", NULL, + G_CALLBACK (data_refresh_data_cmd_callback), + GIMP_HELP_GRADIENT_REFRESH } +}; + + +void +gradients_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + gradients_actions, + G_N_ELEMENTS (gradients_actions), + data); +} + +void +gradients_actions_update (GimpActionGroup *group, + gpointer user_data) +{ + GimpContainerEditor *editor; + GimpGradient *gradient; + GimpData *data = NULL; + + editor = GIMP_CONTAINER_EDITOR (user_data); + + gradient = gimp_context_get_gradient (editor->view->context); + + if (gradient) + data = GIMP_DATA (gradient); + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("gradients-edit", + gradient && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func); + SET_SENSITIVE ("gradients-duplicate", + gradient && GIMP_DATA_GET_CLASS (data)->duplicate); + SET_SENSITIVE ("gradients-save-as-pov", + gradient); + SET_SENSITIVE ("gradients-delete", + gradient && data->deletable); + +#undef SET_SENSITIVE +} diff --git a/app/actions/gradients-actions.h b/app/actions/gradients-actions.h new file mode 100644 index 0000000000..1bb5ea3044 --- /dev/null +++ b/app/actions/gradients-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __GRADIENTS_ACTIONS_H__ +#define __GRADIENTS_ACTIONS_H__ + + +void gradients_actions_setup (GimpActionGroup *group, + gpointer data); +void gradients_actions_update (GimpActionGroup *group, + gpointer user_data); + + +#endif /* __GRADIENT_ACTIONS_H__ */ diff --git a/app/actions/help-actions.c b/app/actions/help-actions.c new file mode 100644 index 0000000000..dfefeb7af0 --- /dev/null +++ b/app/actions/help-actions.c @@ -0,0 +1,67 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" + +#include "help-actions.h" +#include "gui/help-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry help_actions[] = +{ + { "help-menu", NULL, + N_("/_Help") }, + + { "help-help", GTK_STOCK_HELP, + N_("_Help"), "F1", NULL, + G_CALLBACK (help_help_cmd_callback), + GIMP_HELP_HELP }, + + { "help-context-help", GTK_STOCK_HELP, + N_("_Context Help"), "F1", NULL, + G_CALLBACK (help_context_help_cmd_callback), + GIMP_HELP_HELP_CONTEXT } +}; + + +void +help_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + help_actions, + G_N_ELEMENTS (help_actions), + data); +} + +void +help_actions_update (GimpActionGroup *group, + gpointer data) +{ +} diff --git a/app/actions/help-actions.h b/app/actions/help-actions.h new file mode 100644 index 0000000000..205fa0f11a --- /dev/null +++ b/app/actions/help-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __HELP_ACTIONS_H__ +#define __HELP_ACTIONS_H__ + + +void help_actions_setup (GimpActionGroup *group, + gpointer data); +void help_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __HELP_ACTIONS_H__ */ diff --git a/app/actions/image-actions.c b/app/actions/image-actions.c new file mode 100644 index 0000000000..ac76a5dba1 --- /dev/null +++ b/app/actions/image-actions.c @@ -0,0 +1,229 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "config/gimpguiconfig.h" + +#include "core/gimp.h" +#include "core/gimpchannel.h" +#include "core/gimpcontext.h" +#include "core/gimpimage.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" + +#include "display/gimpdisplay.h" +#include "display/gimpdisplayshell.h" + +#include "image-actions.h" +#include "gui/image-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry image_actions[] = +{ + { "image-menu", NULL, + N_("/_Image") }, + + { "image-mode-menu", NULL, + N_("/_Mode") }, + + { "image-convert-rgb", GIMP_STOCK_CONVERT_RGB, + N_("_RGB"), NULL, NULL, + G_CALLBACK (image_convert_rgb_cmd_callback), + GIMP_HELP_IMAGE_CONVERT_RGB }, + + { "image-convert-grayscale", GIMP_STOCK_CONVERT_GRAYSCALE, + N_("_Grayscale"), NULL, NULL, + G_CALLBACK (image_convert_grayscale_cmd_callback), + GIMP_HELP_IMAGE_CONVERT_GRAYSCALE }, + + { "image-convert-indexed", GIMP_STOCK_CONVERT_INDEXED, + N_("_Indexed..."), NULL, NULL, + G_CALLBACK (image_convert_indexed_cmd_callback), + GIMP_HELP_IMAGE_CONVERT_INDEXED }, + + { "image-transform-menu", NULL, + N_("/Image/_Transform") }, + + { "image-resize", GIMP_STOCK_RESIZE, + N_("Can_vas Size..."), NULL, NULL, + G_CALLBACK (image_resize_cmd_callback), + GIMP_HELP_IMAGE_RESIZE }, + + { "image-scale", GIMP_STOCK_SCALE, + N_("_Scale Image..."), NULL, NULL, + G_CALLBACK (image_scale_cmd_callback), + GIMP_HELP_IMAGE_SCALE }, + + { "image-crop", GIMP_STOCK_TOOL_CROP, + N_("_Crop Image"), NULL, NULL, + G_CALLBACK (image_crop_cmd_callback), + GIMP_HELP_IMAGE_CROP }, + + { "image-duplicate", GIMP_STOCK_DUPLICATE, + N_("_Duplicate"), "D", NULL, + G_CALLBACK (image_duplicate_cmd_callback), + GIMP_HELP_IMAGE_DUPLICATE }, + + { "image-merge-layers", NULL, + N_("Merge Visible _Layers..."), "M", NULL, + G_CALLBACK (image_merge_layers_cmd_callback), + GIMP_HELP_IMAGE_MERGE_LAYERS }, + + { "image-flatten", NULL, + N_("_Flatten Image"), NULL, NULL, + G_CALLBACK (image_flatten_image_cmd_callback), + GIMP_HELP_IMAGE_FLATTEN }, + + { "image-configure-grid", GIMP_STOCK_GRID, + N_("Configure G_rid..."), NULL, NULL, + G_CALLBACK (image_configure_grid_cmd_callback), + GIMP_HELP_IMAGE_GRID } +}; + +static GimpEnumActionEntry image_flip_actions[] = +{ + { "image-flip-horizontal", GIMP_STOCK_FLIP_HORIZONTAL, + N_("Flip _Horizontally"), NULL, NULL, + GIMP_ORIENTATION_HORIZONTAL, + GIMP_HELP_IMAGE_FLIP_HORIZONTAL }, + + { "image-flip-vertical", GIMP_STOCK_FLIP_VERTICAL, + N_("Flip _Vertically"), NULL, NULL, + GIMP_ORIENTATION_VERTICAL, + GIMP_HELP_IMAGE_FLIP_VERTICAL } +}; + +static GimpEnumActionEntry image_rotate_actions[] = +{ + { "image-rotate-90", GIMP_STOCK_ROTATE_90, + /* please use the degree symbol in the translation */ + N_("Rotate 90 degrees _CW"), NULL, NULL, + GIMP_ROTATE_90, + GIMP_HELP_IMAGE_ROTATE_90 }, + + { "image-rotate-180", GIMP_STOCK_ROTATE_180, + N_("Rotate _180 degrees"), NULL, NULL, + GIMP_ROTATE_180, + GIMP_HELP_IMAGE_ROTATE_180 }, + + { "image-rotate-270", GIMP_STOCK_ROTATE_270, + N_("Rotate 90 degrees CC_W"), NULL, NULL, + GIMP_ROTATE_270, + GIMP_HELP_IMAGE_ROTATE_270 } +}; + + +void +image_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + image_actions, + G_N_ELEMENTS (image_actions), + data); + + gimp_action_group_add_enum_actions (group, + image_flip_actions, + G_N_ELEMENTS (image_flip_actions), + G_CALLBACK (image_flip_cmd_callback), + data); + + gimp_action_group_add_enum_actions (group, + image_rotate_actions, + G_N_ELEMENTS (image_rotate_actions), + G_CALLBACK (image_rotate_cmd_callback), + data); +} + +void +image_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpDisplay *gdisp = NULL; + GimpDisplayShell *shell = NULL; + GimpImage *gimage = NULL; + gboolean is_rgb = FALSE; + gboolean is_gray = FALSE; + gboolean is_indexed = FALSE; + gboolean fs = FALSE; + gboolean aux = FALSE; + gboolean lp = FALSE; + gboolean sel = FALSE; + + if (GIMP_IS_DISPLAY_SHELL (data)) + { + shell = GIMP_DISPLAY_SHELL (data); + gdisp = shell->gdisp; + } + else if (GIMP_IS_DISPLAY (data)) + { + gdisp = GIMP_DISPLAY (data); + shell = GIMP_DISPLAY_SHELL (gdisp->shell); + } + + if (gdisp) + { + GimpImageBaseType base_type; + + gimage = gdisp->gimage; + + base_type = gimp_image_base_type (gimage); + + is_rgb = (base_type == GIMP_RGB); + is_gray = (base_type == GIMP_GRAY); + is_indexed = (base_type == GIMP_INDEXED); + + fs = (gimp_image_floating_sel (gimage) != NULL); + aux = (gimp_image_get_active_channel (gimage) != NULL); + lp = ! gimp_image_is_empty (gimage); + sel = ! gimp_channel_is_empty (gimp_image_get_mask (gimage)); + } + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("image-convert-rgb", gdisp && ! is_rgb); + SET_SENSITIVE ("image-convert-grayscale", gdisp && ! is_gray); + SET_SENSITIVE ("image-convert-indexed", gdisp && ! is_indexed); + + SET_SENSITIVE ("image-flip-horizontal", gdisp); + SET_SENSITIVE ("image-flip-vertical", gdisp); + SET_SENSITIVE ("image-rotate-90", gdisp); + SET_SENSITIVE ("image-rotate-180", gdisp); + SET_SENSITIVE ("image-rotate-270", gdisp); + + SET_SENSITIVE ("image-resize", gdisp); + SET_SENSITIVE ("image-scale", gdisp); + SET_SENSITIVE ("image-crop", gdisp && sel); + SET_SENSITIVE ("image-duplicate", gdisp); + SET_SENSITIVE ("image-merge-layers", gdisp && !fs && !aux && lp); + SET_SENSITIVE ("image-flatten", gdisp && !fs && !aux && lp); + SET_SENSITIVE ("image-configure-grid", gdisp); + +#undef SET_SENSITIVE +} diff --git a/app/actions/image-actions.h b/app/actions/image-actions.h new file mode 100644 index 0000000000..b568d9382c --- /dev/null +++ b/app/actions/image-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __IMAGE_ACTIONS_H__ +#define __IMAGE_ACTIONS_H__ + + +void image_actions_setup (GimpActionGroup *group, + gpointer data); +void image_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __IMAGE_ACTIONS_H__ */ diff --git a/app/actions/images-actions.c b/app/actions/images-actions.c new file mode 100644 index 0000000000..c02dce0247 --- /dev/null +++ b/app/actions/images-actions.c @@ -0,0 +1,88 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimpcontext.h" +#include "core/gimpimage.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpcontainereditor.h" +#include "widgets/gimpcontainerview.h" + +#include "images-actions.h" +#include "gui/images-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry images_actions[] = +{ + { "images-raise-views", GTK_STOCK_GOTO_TOP, + N_("_Raise Views"), "", NULL, + G_CALLBACK (images_raise_views_cmd_callback), + NULL }, + + { "images-new-view", GTK_STOCK_NEW, + N_("_New View"), "", NULL, + G_CALLBACK (images_new_view_cmd_callback), + NULL }, + + { "images-delete", GTK_STOCK_DELETE, + N_("_Delete Image"), "", NULL, + G_CALLBACK (images_delete_image_cmd_callback), + NULL } +}; + + +void +images_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + images_actions, + G_N_ELEMENTS (images_actions), + data); +} + +void +images_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpContainerEditor *editor; + GimpImage *image; + + editor = GIMP_CONTAINER_EDITOR (data); + + image = gimp_context_get_image (editor->view->context); + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("images-raise-views", image); + SET_SENSITIVE ("images-new-view", image); + SET_SENSITIVE ("images-delete", image && image->disp_count == 0); + +#undef SET_SENSITIVE +} diff --git a/app/actions/images-actions.h b/app/actions/images-actions.h new file mode 100644 index 0000000000..9c56ad6e16 --- /dev/null +++ b/app/actions/images-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __IMAGES_ACTIONS_H__ +#define __IMAGES_ACTIONS_H__ + + +void images_actions_setup (GimpActionGroup *group, + gpointer data); +void images_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __IMAGES_ACTIONS_H__ */ diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c new file mode 100644 index 0000000000..02a05b349e --- /dev/null +++ b/app/actions/layers-actions.c @@ -0,0 +1,372 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimpimage.h" +#include "core/gimplayer.h" +#include "core/gimplist.h" + +#include "text/gimptextlayer.h" + +#include "widgets/gimphelp-ids.h" +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpitemtreeview.h" + +#include "display/gimpdisplay.h" +#include "display/gimpdisplayshell.h" + +#include "layers-actions.h" +#include "gui/layers-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry layers_actions[] = +{ + { "layers-menu", NULL, + N_("_Layer") }, + + { "layers-stack-menu", NULL, + N_("Stac_k") }, + + { "layers-colors-menu", NULL, + N_("_Colors") }, + + { "layers-colors-auto-menu", NULL, + N_("_Auto") }, + + { "layers-mask-menu", NULL, + N_("_Mask") }, + + { "layers-transparency-menu", NULL, + N_("Tr_ansparency") }, + + { "layers-transform-menu", NULL, + N_("_Transform") }, + + { "layers-text-tool", GIMP_STOCK_TOOL_TEXT, + N_("Te_xt Tool"), NULL, NULL, + G_CALLBACK (layers_text_tool_cmd_callback), + GIMP_HELP_TOOL_TEXT }, + + { "layers-edit-attributes", GIMP_STOCK_EDIT, + N_("_Edit Layer Attributes..."), NULL, NULL, + G_CALLBACK (layers_edit_attributes_cmd_callback), + GIMP_HELP_LAYER_EDIT }, + + { "layers-new", GTK_STOCK_NEW, + N_("_New Layer..."), "", NULL, + G_CALLBACK (layers_new_cmd_callback), + GIMP_HELP_LAYER_NEW }, + + { "layers-duplicate", GIMP_STOCK_DUPLICATE, + N_("D_uplicate Layer"), NULL, NULL, + G_CALLBACK (layers_duplicate_cmd_callback), + GIMP_HELP_LAYER_DUPLICATE }, + + { "layers-delete", GTK_STOCK_DELETE, + N_("_Delete Layer"), "", NULL, + G_CALLBACK (layers_delete_cmd_callback), + GIMP_HELP_LAYER_DELETE }, + + { "layers-select-previous", NULL, + N_("Select _Previous Layer"), "Prior", NULL, + G_CALLBACK (layers_select_previous_cmd_callback), + GIMP_HELP_LAYER_PREVIOUS }, + + { "layers-select-top", NULL, + N_("Select _Top Layer"), "Home", NULL, + G_CALLBACK (layers_select_top_cmd_callback), + GIMP_HELP_LAYER_TOP }, + + { "layers-select-next", NULL, + N_("Select _Next Layer"), "Next", NULL, + G_CALLBACK (layers_select_next_cmd_callback), + GIMP_HELP_LAYER_NEXT }, + + { "layer-select-bottom", NULL, + N_("Select _Bottom Layer"), "End", NULL, + G_CALLBACK (layers_select_bottom_cmd_callback), + GIMP_HELP_LAYER_BOTTOM }, + + { "layers-raise", GTK_STOCK_GO_UP, + N_("_Raise Layer"), "", NULL, + G_CALLBACK (layers_raise_cmd_callback), + GIMP_HELP_LAYER_RAISE }, + + { "layers-raise-to-top", GTK_STOCK_GOTO_TOP, + N_("Layer to _Top"), "", NULL, + G_CALLBACK (layers_raise_to_top_cmd_callback), + GIMP_HELP_LAYER_RAISE_TO_TOP }, + + { "layers-lower", GTK_STOCK_GO_DOWN, + N_("_Lower Layer"), "", NULL, + G_CALLBACK (layers_lower_cmd_callback), + GIMP_HELP_LAYER_LOWER }, + + { "layers-lower-to-bottom", GTK_STOCK_GOTO_BOTTOM, + N_("Layer to _Bottom"), "", NULL, + G_CALLBACK (layers_lower_to_bottom_cmd_callback), + GIMP_HELP_LAYER_LOWER_TO_BOTTOM }, + + { "layers-anchor", GIMP_STOCK_ANCHOR, + N_("_Anchor Layer"), NULL, NULL, + G_CALLBACK (layers_anchor_cmd_callback), + GIMP_HELP_LAYER_ANCHOR }, + + { "layers-merge-down", GIMP_STOCK_MERGE_DOWN, + N_("Merge Do_wn"), NULL, NULL, + G_CALLBACK (layers_merge_down_cmd_callback), + GIMP_HELP_LAYER_MERGE_DOWN }, + + { "layers-merge-layers", NULL, + N_("Merge _Visible Layers..."), NULL, NULL, + G_CALLBACK (layers_merge_layers_cmd_callback), + GIMP_HELP_IMAGE_MERGE_LAYERS }, + + { "layers-flatten-image", NULL, + N_("_Flatten Image"), NULL, NULL, + G_CALLBACK (layers_flatten_image_cmd_callback), + GIMP_HELP_IMAGE_FLATTEN }, + + { "layers-text-discard", GIMP_STOCK_TOOL_TEXT, + N_("_Discard Text Information"), NULL, NULL, + G_CALLBACK (layers_text_discard_cmd_callback), + GIMP_HELP_LAYER_TEXT_DISCARD }, + + { "layers-resize", GIMP_STOCK_RESIZE, + N_("Layer B_oundary Size..."), NULL, NULL, + G_CALLBACK (layers_resize_cmd_callback), + GIMP_HELP_LAYER_RESIZE }, + + { "layers-resize-to-image", GIMP_STOCK_LAYER_TO_IMAGESIZE, + N_("Layer to _Image Size"), NULL, NULL, + G_CALLBACK (layers_resize_to_image_cmd_callback), + GIMP_HELP_LAYER_RESIZE_TO_IMAGE }, + + { "layers-scale", GIMP_STOCK_SCALE, + N_("_Scale Layer..."), NULL, NULL, + G_CALLBACK (layers_scale_cmd_callback), + GIMP_HELP_LAYER_SCALE }, + + { "layers-mask-add", GIMP_STOCK_LAYER_MASK, + N_("Add La_yer Mask..."), NULL, NULL, + G_CALLBACK (layers_mask_add_cmd_callback), + GIMP_HELP_LAYER_MASK_ADD }, + + { "layers-mask-apply", NULL, + N_("Apply Layer _Mask"), NULL, NULL, + G_CALLBACK (layers_mask_apply_cmd_callback), + GIMP_HELP_LAYER_MASK_APPLY }, + + { "layers-mask-delete", GTK_STOCK_DELETE, + N_("Delete Layer Mas_k"), "", NULL, + G_CALLBACK (layers_mask_delete_cmd_callback), + GIMP_HELP_LAYER_MASK_DELETE }, + + { "layers-alpha-add", GIMP_STOCK_TRANSPARENCY, + N_("Add Alpha C_hannel"), NULL, NULL, + G_CALLBACK (layers_alpha_add_cmd_callback), + GIMP_HELP_LAYER_ALPHA_ADD } +}; + +static GimpEnumActionEntry layers_mask_to_selection_actions[] = +{ + { "layers-mask-selection-replace", GIMP_STOCK_SELECTION_REPLACE, + N_("_Mask to Selection"), NULL, NULL, + GIMP_CHANNEL_OP_REPLACE, + GIMP_HELP_LAYER_MASK_SELECTION_REPLACE }, + + { "layer-mask-selection-add", GIMP_STOCK_SELECTION_ADD, + N_("_Add to Selection"), NULL, NULL, + GIMP_CHANNEL_OP_ADD, + GIMP_HELP_LAYER_MASK_SELECTION_ADD }, + + { "layers-mask-selection-subtract", GIMP_STOCK_SELECTION_SUBTRACT, + N_("_Subtract from Selection"), NULL, NULL, + GIMP_CHANNEL_OP_SUBTRACT, + GIMP_HELP_LAYER_MASK_SELECTION_SUBTRACT }, + + { "layers-mask-selection-intersect", GIMP_STOCK_SELECTION_INTERSECT, + N_("_Intersect with Selection"), NULL, NULL, + GIMP_CHANNEL_OP_INTERSECT, + GIMP_HELP_LAYER_MASK_SELECTION_INTERSECT } +}; + +static GimpEnumActionEntry layers_alpha_to_selection_actions[] = +{ + { "layers-alpha-selection-replace", GIMP_STOCK_SELECTION_REPLACE, + N_("Al_pha to Selection"), NULL, NULL, + GIMP_CHANNEL_OP_REPLACE, + GIMP_HELP_LAYER_ALPHA_SELECTION_REPLACE }, + + { "layers-alpha-selection-add", GIMP_STOCK_SELECTION_ADD, + N_("A_dd to Selection"), NULL, NULL, + GIMP_CHANNEL_OP_ADD, + GIMP_HELP_LAYER_ALPHA_SELECTION_ADD }, + + { "layers-alpha-selection-subtract", GIMP_STOCK_SELECTION_SUBTRACT, + N_("_Subtract from Selection"), NULL, NULL, + GIMP_CHANNEL_OP_SUBTRACT, + GIMP_HELP_LAYER_ALPHA_SELECTION_SUBTRACT }, + + { "layer-alpha-selection-intersect", GIMP_STOCK_SELECTION_INTERSECT, + N_("_Intersect with Selection"), NULL, NULL, + GIMP_CHANNEL_OP_INTERSECT, + GIMP_HELP_LAYER_ALPHA_SELECTION_INTERSECT } +}; + +void +layers_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + layers_actions, + G_N_ELEMENTS (layers_actions), + data); + + gimp_action_group_add_enum_actions (group, + layers_mask_to_selection_actions, + G_N_ELEMENTS (layers_mask_to_selection_actions), + G_CALLBACK (layers_mask_to_selection_cmd_callback), + data); + + gimp_action_group_add_enum_actions (group, + layers_alpha_to_selection_actions, + G_N_ELEMENTS (layers_alpha_to_selection_actions), + G_CALLBACK (layers_alpha_to_selection_cmd_callback), + data); +} + +void +layers_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpImage *gimage = NULL; + GimpLayer *layer = NULL; + gboolean fs = FALSE; /* floating sel */ + gboolean ac = FALSE; /* active channel */ + gboolean lm = FALSE; /* layer mask */ + gboolean alpha = FALSE; /* alpha channel present */ + gboolean indexed = FALSE; /* is indexed */ + gboolean next_alpha = FALSE; + gboolean text_layer = FALSE; + GList *next = NULL; + GList *prev = NULL; + + if (GIMP_IS_ITEM_TREE_VIEW (data)) + gimage = GIMP_ITEM_TREE_VIEW (data)->gimage; + else if (GIMP_IS_DISPLAY_SHELL (data)) + gimage = GIMP_DISPLAY_SHELL (data)->gdisp->gimage; + else if (GIMP_IS_DISPLAY (data)) + gimage = GIMP_DISPLAY (data)->gimage; + + if (gimage) + { + GList *list; + + layer = gimp_image_get_active_layer (gimage); + + if (layer) + lm = (gimp_layer_get_mask (layer)) ? TRUE : FALSE; + + fs = (gimp_image_floating_sel (gimage) != NULL); + ac = (gimp_image_get_active_channel (gimage) != NULL); + + alpha = layer && gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)); + + indexed = (gimp_image_base_type (gimage) == GIMP_INDEXED); + + for (list = GIMP_LIST (gimage->layers)->list; + list; + list = g_list_next (list)) + { + if (layer == (GimpLayer *) list->data) + { + prev = g_list_previous (list); + next = g_list_next (list); + break; + } + } + + if (next) + next_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (next->data)); + else + next_alpha = FALSE; + + text_layer = (layer && + gimp_drawable_is_text_layer (GIMP_DRAWABLE (layer))); + } + +#define SET_VISIBLE(action,condition) \ + gimp_action_group_set_action_visible (group, action, (condition) != 0) +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_VISIBLE ("layers-text-tool", text_layer && !ac); + SET_SENSITIVE ("layers-edit-attributes", layer && !fs && !ac); + + SET_SENSITIVE ("layers-new", gimage); + SET_SENSITIVE ("layers-duplicate", layer && !fs && !ac); + SET_SENSITIVE ("layers-delete", layer && !ac); + + SET_SENSITIVE ("layers-select-previous", layer && !fs && !ac && prev); + SET_SENSITIVE ("layers-select-top", layer && !fs && !ac && prev); + SET_SENSITIVE ("layers-select-next", layer && !fs && !ac && next); + SET_SENSITIVE ("layers-select-bottom", layer && !fs && !ac && next); + + SET_SENSITIVE ("layers-raise", layer && !fs && !ac && alpha && prev); + SET_SENSITIVE ("layers-raise-to-top", layer && !fs && !ac && alpha && prev); + SET_SENSITIVE ("layers-lower", layer && !fs && !ac && next && next_alpha); + SET_SENSITIVE ("layers-lower-to-bottom", layer && !fs && !ac && next && next_alpha); + + SET_SENSITIVE ("layers-anchor", layer && fs && !ac); + SET_SENSITIVE ("layers-merge-down", layer && !fs && !ac && next); + SET_SENSITIVE ("layers-merge-layers", layer && !fs && !ac); + SET_SENSITIVE ("layers-flatten-image", layer && !fs && !ac); + SET_VISIBLE ("layers-text-discard", text_layer && !ac); + + SET_SENSITIVE ("layers-resize", layer && !ac); + SET_SENSITIVE ("layers-resize-to-image", layer && !ac); + SET_SENSITIVE ("layers-scale", layer && !ac); + + SET_SENSITIVE ("layers-mask-add", layer && !fs && !ac && !lm && alpha); + SET_SENSITIVE ("layers-mask-apply", layer && !fs && !ac && lm); + SET_SENSITIVE ("layers-mask-delete", layer && !fs && !ac && lm); + SET_SENSITIVE ("layers-alpha-add", layer && !fs && !alpha); + + SET_SENSITIVE ("layers-mask-selection-replace", layer && !fs && !ac && lm); + SET_SENSITIVE ("layers-mask-selection-add", layer && !fs && !ac && lm); + SET_SENSITIVE ("layers-mask-selection-subtract", layer && !fs && !ac && lm); + SET_SENSITIVE ("layers-mask-selection-intersect", layer && !fs && !ac && lm); + + SET_SENSITIVE ("layers-alpha-selection-replace", layer && !fs && !ac); + SET_SENSITIVE ("layers-alpha-selection-add", layer && !fs && !ac); + SET_SENSITIVE ("layers-alpha-selection-subtract", layer && !fs && !ac); + SET_SENSITIVE ("layers-alpha-selection-intersect", layer && !fs && !ac); + +#undef SET_VISIBLE +#undef SET_SENSITIVE +} diff --git a/app/actions/layers-actions.h b/app/actions/layers-actions.h new file mode 100644 index 0000000000..b6eeebd6f0 --- /dev/null +++ b/app/actions/layers-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __LAYERS_ACTIONS_H__ +#define __LAYERS_ACTIONS_H__ + + +void layers_actions_setup (GimpActionGroup *group, + gpointer data); +void layers_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __LAYERS_ACTIONS_H__ */ diff --git a/app/actions/palette-editor-actions.c b/app/actions/palette-editor-actions.c new file mode 100644 index 0000000000..4007314a14 --- /dev/null +++ b/app/actions/palette-editor-actions.c @@ -0,0 +1,113 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" +#include "widgets/gimppaletteeditor.h" + +#include "palette-editor-actions.h" +#include "gui/palette-editor-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry palette_editor_actions[] = +{ + { "palette-editor-edit-color", GIMP_STOCK_EDIT, + N_("_Edit Color..."), "", NULL, + G_CALLBACK (palette_editor_edit_color_cmd_callback), + GIMP_HELP_PALETTE_EDITOR_EDIT }, + + { "palette-editor-new-color-fg", GTK_STOCK_NEW, + N_("New Color from _FG"), "", NULL, + G_CALLBACK (palette_editor_new_color_fg_cmd_callback), + GIMP_HELP_PALETTE_EDITOR_NEW }, + + { "palette-editor-new-color-bg", GTK_STOCK_NEW, + N_("New Color from _BG"), "", NULL, + G_CALLBACK (palette_editor_new_color_bg_cmd_callback), + GIMP_HELP_PALETTE_EDITOR_NEW }, + + { "palette-editor-delete-color", GTK_STOCK_DELETE, + N_("_Delete Color"), "", NULL, + G_CALLBACK (palette_editor_delete_color_cmd_callback), + GIMP_HELP_PALETTE_EDITOR_DELETE }, + + { "palette-editor-zoom-out", GTK_STOCK_ZOOM_OUT, + N_("Zoom _Out"), "", NULL, + G_CALLBACK (palette_editor_zoom_out_cmd_callback), + GIMP_HELP_PALETTE_EDITOR_ZOOM_OUT }, + + { "palette-editor-zoom-in", GTK_STOCK_ZOOM_IN, + N_("Zoom _In"), "", NULL, + G_CALLBACK (palette_editor_zoom_in_cmd_callback), + GIMP_HELP_PALETTE_EDITOR_ZOOM_IN }, + + { "palette-editor-zoom-all", GTK_STOCK_ZOOM_FIT, + N_("Zoom _All"), "", NULL, + G_CALLBACK (palette_editor_zoom_all_cmd_callback), + GIMP_HELP_PALETTE_EDITOR_ZOOM_ALL } +}; + + +void +palette_editor_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + palette_editor_actions, + G_N_ELEMENTS (palette_editor_actions), + data); +} + +void +palette_editor_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpPaletteEditor *editor; + GimpDataEditor *data_editor; + gboolean editable = FALSE; + + editor = GIMP_PALETTE_EDITOR (data); + data_editor = GIMP_DATA_EDITOR (data); + + if (data_editor->data && data_editor->data_editable) + editable = TRUE; + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("palette-editor-edit-color", editable && editor->color); + SET_SENSITIVE ("palette-editor-new-color-fg", editable); + SET_SENSITIVE ("palette-editor-new-color-bg", editable); + SET_SENSITIVE ("palette-editor-delete-color", editable && editor->color); + + SET_SENSITIVE ("palette-editor-zoom-out", data_editor->data); + SET_SENSITIVE ("palette-editor-zoom-in", data_editor->data); + SET_SENSITIVE ("palette-editor-zoom-all", data_editor->data); + +#undef SET_SENSITIVE +} diff --git a/app/actions/palette-editor-actions.h b/app/actions/palette-editor-actions.h new file mode 100644 index 0000000000..e9b4de8b7c --- /dev/null +++ b/app/actions/palette-editor-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __PALETTE_EDITOR_ACTIONS_H__ +#define __PALETTE_EDITOR_ACTIONS_H__ + + +void palette_editor_actions_setup (GimpActionGroup *group, + gpointer data); +void palette_editor_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __PALETTE_EDITOR_ACTIONS_H__ */ diff --git a/app/actions/palette-editor-commands.c b/app/actions/palette-editor-commands.c index 5a030de51b..af522f9e73 100644 --- a/app/actions/palette-editor-commands.c +++ b/app/actions/palette-editor-commands.c @@ -33,8 +33,7 @@ void palette_editor_edit_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); @@ -43,21 +42,29 @@ palette_editor_edit_color_cmd_callback (GtkWidget *widget, } void -palette_editor_new_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +palette_editor_new_color_fg_cmd_callback (GtkWidget *widget, + gpointer data) +{ + GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); + + if (GTK_WIDGET_SENSITIVE (editor->new_button)) + gimp_button_extended_clicked (GIMP_BUTTON (editor->new_button), 0); +} + +void +palette_editor_new_color_bg_cmd_callback (GtkWidget *widget, + gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); if (GTK_WIDGET_SENSITIVE (editor->new_button)) gimp_button_extended_clicked (GIMP_BUTTON (editor->new_button), - action ? GDK_CONTROL_MASK : 0); + GDK_CONTROL_MASK); } void palette_editor_delete_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); @@ -67,8 +74,7 @@ palette_editor_delete_color_cmd_callback (GtkWidget *widget, void palette_editor_zoom_in_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); @@ -78,8 +84,7 @@ palette_editor_zoom_in_cmd_callback (GtkWidget *widget, void palette_editor_zoom_out_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); @@ -89,8 +94,7 @@ palette_editor_zoom_out_cmd_callback (GtkWidget *widget, void palette_editor_zoom_all_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); diff --git a/app/actions/palette-editor-commands.h b/app/actions/palette-editor-commands.h index 9bedfe536e..dc106b9210 100644 --- a/app/actions/palette-editor-commands.h +++ b/app/actions/palette-editor-commands.h @@ -21,24 +21,20 @@ void palette_editor_edit_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void palette_editor_new_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); +void palette_editor_new_color_fg_cmd_callback (GtkWidget *widget, + gpointer data); +void palette_editor_new_color_bg_cmd_callback (GtkWidget *widget, + gpointer data); void palette_editor_delete_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); void palette_editor_zoom_in_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); void palette_editor_zoom_out_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); void palette_editor_zoom_all_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); #endif /* __PALETTE_EDITOR_COMMANDS_H__ */ diff --git a/app/actions/palettes-actions.c b/app/actions/palettes-actions.c new file mode 100644 index 0000000000..95835e4e59 --- /dev/null +++ b/app/actions/palettes-actions.c @@ -0,0 +1,120 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimpcontext.h" +#include "core/gimpdata.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpcontainereditor.h" +#include "widgets/gimpcontainerview.h" +#include "widgets/gimpdatafactoryview.h" +#include "widgets/gimphelp-ids.h" + +#include "gui/data-commands.h" +#include "palettes-actions.h" +#include "gui/palettes-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry palettes_actions[] = +{ + { "palettes-edit", GIMP_STOCK_EDIT, + N_("_Edit Palette..."), NULL, NULL, + G_CALLBACK (data_edit_data_cmd_callback), + GIMP_HELP_PALETTE_EDIT }, + + { "palettes-new", GTK_STOCK_NEW, + N_("_New Palette"), "", NULL, + G_CALLBACK (data_new_data_cmd_callback), + GIMP_HELP_PALETTE_NEW }, + + { "palettes-import", GTK_STOCK_CONVERT, + N_("_Import Palette..."), "", NULL, + G_CALLBACK (palettes_import_palette_cmd_callback), + GIMP_HELP_PALETTE_IMPORT }, + + { "palettes-duplicate", GIMP_STOCK_DUPLICATE, + N_("D_uplicate Palette"), NULL, NULL, + G_CALLBACK (data_duplicate_data_cmd_callback), + GIMP_HELP_PALETTE_DUPLICATE }, + + { "palettes-merge", NULL, + N_("_Merge Palettes..."), NULL, NULL, + G_CALLBACK (palettes_merge_palettes_cmd_callback), + GIMP_HELP_PALETTE_MERGE }, + + { "palettes-delete", GTK_STOCK_DELETE, + N_("_Delete Palette"), "", NULL, + G_CALLBACK (data_delete_data_cmd_callback), + GIMP_HELP_PALETTE_DELETE }, + + { "palettes-refresh", GTK_STOCK_REFRESH, + N_("_Refresh Palettes"), "", NULL, + G_CALLBACK (data_refresh_data_cmd_callback), + GIMP_HELP_PALETTE_REFRESH } +}; + + +void +palettes_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + palettes_actions, + G_N_ELEMENTS (palettes_actions), + data); +} + +void +palettes_actions_update (GimpActionGroup *group, + gpointer user_data) +{ + GimpContainerEditor *editor; + GimpPalette *palette; + GimpData *data = NULL; + + editor = GIMP_CONTAINER_EDITOR (user_data); + + palette = gimp_context_get_palette (editor->view->context); + + if (palette) + data = GIMP_DATA (palette); + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("palettes-edit", + palette && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func); + SET_SENSITIVE ("palettes-duplicate", + palette && GIMP_DATA_GET_CLASS (data)->duplicate); + SET_SENSITIVE ("palettes-merge", + FALSE); /* FIXME palette && GIMP_IS_CONTAINER_LIST_VIEW (editor->view)); */ + SET_SENSITIVE ("palettes-delete", + palette && data->deletable); + +#undef SET_SENSITIVE +} diff --git a/app/actions/palettes-actions.h b/app/actions/palettes-actions.h new file mode 100644 index 0000000000..d4d6f6e7f1 --- /dev/null +++ b/app/actions/palettes-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __PALETTES_ACTIONS_H__ +#define __PALETTES_ACTIONS_H__ + + +void palettes_actions_setup (GimpActionGroup *group, + gpointer data); +void palettes_actions_update (GimpActionGroup *group, + gpointer user_data); + + +#endif /* __PALETTES_ACTIONS_H__ */ diff --git a/app/actions/patterns-actions.c b/app/actions/patterns-actions.c new file mode 100644 index 0000000000..057f927ebe --- /dev/null +++ b/app/actions/patterns-actions.c @@ -0,0 +1,107 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimpcontext.h" +#include "core/gimpdata.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpcontainereditor.h" +#include "widgets/gimpcontainerview.h" +#include "widgets/gimpdatafactoryview.h" +#include "widgets/gimphelp-ids.h" + +#include "gui/data-commands.h" +#include "patterns-actions.h" + +#include "gimp-intl.h" + + +static GimpActionEntry patterns_actions[] = +{ + { "patterns-edit", GIMP_STOCK_EDIT, + N_("_Edit Pattern..."), NULL, NULL, + G_CALLBACK (data_edit_data_cmd_callback), + GIMP_HELP_PATTERN_EDIT }, + + { "patterns-new", GTK_STOCK_NEW, + N_("_New Pattern"), "", NULL, + G_CALLBACK (data_new_data_cmd_callback), + GIMP_HELP_PATTERN_NEW }, + + { "patterns-duplicate", GIMP_STOCK_DUPLICATE, + N_("D_uplicate Pattern"), NULL, NULL, + G_CALLBACK (data_duplicate_data_cmd_callback), + GIMP_HELP_PATTERN_DUPLICATE }, + + { "patterns-delete", GTK_STOCK_DELETE, + N_("_Delete Pattern..."), "", NULL, + G_CALLBACK (data_delete_data_cmd_callback), + GIMP_HELP_PATTERN_DELETE }, + + { "patterns-refresh", GTK_STOCK_REFRESH, + N_("_Refresh Patterns"), "", NULL, + G_CALLBACK (data_refresh_data_cmd_callback), + GIMP_HELP_PATTERN_REFRESH } +}; + + +void +patterns_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + patterns_actions, + G_N_ELEMENTS (patterns_actions), + data); +} + +void +patterns_actions_update (GimpActionGroup *group, + gpointer user_data) +{ + GimpContainerEditor *editor; + GimpPattern *pattern; + GimpData *data = NULL; + + editor = GIMP_CONTAINER_EDITOR (user_data); + + pattern = gimp_context_get_pattern (editor->view->context); + + if (pattern) + data = GIMP_DATA (pattern); + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("patterns-edit", + pattern && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func); + SET_SENSITIVE ("patterns-duplicate", + pattern && GIMP_DATA_GET_CLASS (data)->duplicate); + SET_SENSITIVE ("patterns-delete", + pattern && data->deletable); + +#undef SET_SENSITIVE +} diff --git a/app/actions/patterns-actions.h b/app/actions/patterns-actions.h new file mode 100644 index 0000000000..7ba8899455 --- /dev/null +++ b/app/actions/patterns-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __PATTERNS_ACTIONS_H__ +#define __PATTERNS_ACTIONS_H__ + + +void patterns_actions_setup (GimpActionGroup *group, + gpointer data); +void patterns_actions_update (GimpActionGroup *group, + gpointer user_data); + + +#endif /* __PATTERNS_ACTIONS_H__ */ diff --git a/app/actions/qmask-actions.c b/app/actions/qmask-actions.c new file mode 100644 index 0000000000..2009c90cf8 --- /dev/null +++ b/app/actions/qmask-actions.c @@ -0,0 +1,118 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimpimage.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" + +#include "display/gimpdisplay.h" +#include "display/gimpdisplayshell.h" + +#include "qmask-actions.h" +#include "gui/qmask-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry qmask_actions[] = +{ + { "qmask-configure", NULL, + N_("_Configure Color and Opacity..."), NULL, NULL, + G_CALLBACK (qmask_configure_cmd_callback), + GIMP_HELP_QMASK_EDIT } +}; + +static GimpToggleActionEntry qmask_toggle_actions[] = +{ + { "qmask-toggle", NULL, + N_("_QMask Active"), NULL, NULL, + G_CALLBACK (qmask_toggle_cmd_callback), + FALSE, + GIMP_HELP_QMASK_TOGGLE } +}; + +static GimpRadioActionEntry qmask_invert_actions[] = +{ + { "qmask-invert-on", NULL, + N_("Mask _Selected Areas"), NULL, NULL, + TRUE, + GIMP_HELP_QMASK_INVERT }, + + { "qmask-invert-off", NULL, + N_("Mask _Unselected Areas"), NULL, NULL, + FALSE, + GIMP_HELP_QMASK_INVERT } +}; + + +void +qmask_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + qmask_actions, + G_N_ELEMENTS (qmask_actions), + data); + + gimp_action_group_add_toggle_actions (group, + qmask_toggle_actions, + G_N_ELEMENTS (qmask_toggle_actions), + data); + + gimp_action_group_add_radio_actions (group, + qmask_invert_actions, + G_N_ELEMENTS (qmask_invert_actions), + FALSE, + G_CALLBACK (qmask_invert_cmd_callback), + data); +} + +void +qmask_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpDisplayShell *shell; + + shell = GIMP_DISPLAY_SHELL (data); + +#define SET_ACTIVE(action,active) \ + gimp_action_group_set_action_active (group, action, (active)) +#define SET_COLOR(action,color) \ + gimp_action_group_set_action_color (group, action, (color), FALSE) + + SET_ACTIVE ("qmask-toggle", shell->gdisp->gimage->qmask_state); + + if (shell->gdisp->gimage->qmask_inverted) + SET_ACTIVE ("qmask-invert-on", TRUE); + else + SET_ACTIVE ("qmask-invert-off", TRUE); + + SET_COLOR ("qmask-configure", &shell->gdisp->gimage->qmask_color); + +#undef SET_SENSITIVE +#undef SET_COLOR +} diff --git a/app/actions/qmask-actions.h b/app/actions/qmask-actions.h new file mode 100644 index 0000000000..5d7ea2138e --- /dev/null +++ b/app/actions/qmask-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __QMASK_ACTIONS_H__ +#define __QMASK_ACTIONS_H__ + + +void qmask_actions_setup (GimpActionGroup *group, + gpointer data); +void qmask_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __QMASK_ACTIONS_H__ */ diff --git a/app/actions/quick-mask-actions.c b/app/actions/quick-mask-actions.c new file mode 100644 index 0000000000..2009c90cf8 --- /dev/null +++ b/app/actions/quick-mask-actions.c @@ -0,0 +1,118 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimpimage.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" + +#include "display/gimpdisplay.h" +#include "display/gimpdisplayshell.h" + +#include "qmask-actions.h" +#include "gui/qmask-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry qmask_actions[] = +{ + { "qmask-configure", NULL, + N_("_Configure Color and Opacity..."), NULL, NULL, + G_CALLBACK (qmask_configure_cmd_callback), + GIMP_HELP_QMASK_EDIT } +}; + +static GimpToggleActionEntry qmask_toggle_actions[] = +{ + { "qmask-toggle", NULL, + N_("_QMask Active"), NULL, NULL, + G_CALLBACK (qmask_toggle_cmd_callback), + FALSE, + GIMP_HELP_QMASK_TOGGLE } +}; + +static GimpRadioActionEntry qmask_invert_actions[] = +{ + { "qmask-invert-on", NULL, + N_("Mask _Selected Areas"), NULL, NULL, + TRUE, + GIMP_HELP_QMASK_INVERT }, + + { "qmask-invert-off", NULL, + N_("Mask _Unselected Areas"), NULL, NULL, + FALSE, + GIMP_HELP_QMASK_INVERT } +}; + + +void +qmask_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + qmask_actions, + G_N_ELEMENTS (qmask_actions), + data); + + gimp_action_group_add_toggle_actions (group, + qmask_toggle_actions, + G_N_ELEMENTS (qmask_toggle_actions), + data); + + gimp_action_group_add_radio_actions (group, + qmask_invert_actions, + G_N_ELEMENTS (qmask_invert_actions), + FALSE, + G_CALLBACK (qmask_invert_cmd_callback), + data); +} + +void +qmask_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpDisplayShell *shell; + + shell = GIMP_DISPLAY_SHELL (data); + +#define SET_ACTIVE(action,active) \ + gimp_action_group_set_action_active (group, action, (active)) +#define SET_COLOR(action,color) \ + gimp_action_group_set_action_color (group, action, (color), FALSE) + + SET_ACTIVE ("qmask-toggle", shell->gdisp->gimage->qmask_state); + + if (shell->gdisp->gimage->qmask_inverted) + SET_ACTIVE ("qmask-invert-on", TRUE); + else + SET_ACTIVE ("qmask-invert-off", TRUE); + + SET_COLOR ("qmask-configure", &shell->gdisp->gimage->qmask_color); + +#undef SET_SENSITIVE +#undef SET_COLOR +} diff --git a/app/actions/quick-mask-actions.h b/app/actions/quick-mask-actions.h new file mode 100644 index 0000000000..5d7ea2138e --- /dev/null +++ b/app/actions/quick-mask-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __QMASK_ACTIONS_H__ +#define __QMASK_ACTIONS_H__ + + +void qmask_actions_setup (GimpActionGroup *group, + gpointer data); +void qmask_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __QMASK_ACTIONS_H__ */ diff --git a/app/actions/select-actions.c b/app/actions/select-actions.c new file mode 100644 index 0000000000..4b6a9853d0 --- /dev/null +++ b/app/actions/select-actions.c @@ -0,0 +1,198 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimp.h" +#include "core/gimpchannel.h" +#include "core/gimpimage.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" + +#include "display/gimpdisplay.h" +#include "display/gimpdisplayshell.h" + +#include "select-actions.h" +#include "gui/select-commands.h" +#include "gui/tools-commands.h" +#include "gui/vectors-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry select_actions[] = +{ + { "select-menu", NULL, + N_("_Select") }, + + { "select-all", GIMP_STOCK_SELECTION_ALL, + N_("_All"), "A", NULL, + G_CALLBACK (select_all_cmd_callback), + GIMP_HELP_SELECTION_ALL }, + + { "select-none", GIMP_STOCK_SELECTION_NONE, + N_("_None"), "A", NULL, + G_CALLBACK (select_none_cmd_callback), + GIMP_HELP_SELECTION_NONE }, + + { "select-invert", GIMP_STOCK_INVERT, + N_("_Invert"), "I", NULL, + G_CALLBACK (select_invert_cmd_callback), + GIMP_HELP_SELECTION_INVERT }, + + { "select-from-vectors", GIMP_STOCK_SELECTION_REPLACE, + N_("Fr_om Path"), "V", NULL, + G_CALLBACK (select_from_vectors_cmd_callback), + NULL /* FIXME */ }, + + { "select-float", GIMP_STOCK_FLOATING_SELECTION, + N_("_Float"), "L", NULL, + G_CALLBACK (select_float_cmd_callback), + GIMP_HELP_SELECTION_FLOAT }, + + { "select-feather", NULL, + N_("Fea_ther..."), NULL, NULL, + G_CALLBACK (select_feather_cmd_callback), + GIMP_HELP_SELECTION_FEATHER }, + + { "select-sharpen", NULL, + N_("_Sharpen"), NULL, NULL, + G_CALLBACK (select_sharpen_cmd_callback), + GIMP_HELP_SELECTION_SHARPEN }, + + { "select-shrink", GIMP_STOCK_SELECTION_SHRINK, + N_("S_hrink..."), NULL, NULL, + G_CALLBACK (select_shrink_cmd_callback), + GIMP_HELP_SELECTION_SHRINK }, + + { "select-grow", GIMP_STOCK_SELECTION_GROW, + N_("_Grow..."), NULL, NULL, + G_CALLBACK (select_grow_cmd_callback), + GIMP_HELP_SELECTION_GROW }, + + { "select-border", GIMP_STOCK_SELECTION_BORDER, + N_("Bo_rder..."), NULL, NULL, + G_CALLBACK (select_border_cmd_callback), + GIMP_HELP_SELECTION_BORDER }, + + { "select-toggle-qmask", GIMP_STOCK_QMASK_ON, + N_("Toggle _QuickMask"), "Q", NULL, + G_CALLBACK (select_toggle_quickmask_cmd_callback), + GIMP_HELP_QMASK_TOGGLE }, + + { "select-save", GIMP_STOCK_SELECTION_TO_CHANNEL, + N_("Save to _Channel"), NULL, NULL, + G_CALLBACK (select_save_cmd_callback), + GIMP_HELP_SELECTION_TO_CHANNEL }, + + { "select-to-vectors", GIMP_STOCK_SELECTION_TO_PATH, + N_("To _Path"), NULL, NULL, + G_CALLBACK (vectors_selection_to_vectors_cmd_callback), + GIMP_HELP_SELECTION_TO_PATH } +}; + +static GimpStringActionEntry select_tool_actions[] = +{ + { "select-by-color", GIMP_STOCK_TOOL_BY_COLOR_SELECT, + N_("_By Color"), "O", NULL, + "gimp-by-color-select-tool", + GIMP_HELP_TOOL_BY_COLOR_SELECT } +}; + + +void +select_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + select_actions, + G_N_ELEMENTS (select_actions), + data); + + gimp_action_group_add_string_actions (group, + select_tool_actions, + G_N_ELEMENTS (select_tool_actions), + G_CALLBACK (tools_select_cmd_callback), + data); +} + +void +select_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpDisplay *gdisp = NULL; + GimpDisplayShell *shell = NULL; + GimpImage *gimage = NULL; + GimpVectors *vectors = NULL; + gboolean fs = FALSE; + gboolean lp = FALSE; + gboolean sel = FALSE; + + if (GIMP_IS_DISPLAY_SHELL (data)) + { + shell = GIMP_DISPLAY_SHELL (data); + gdisp = shell->gdisp; + } + else if (GIMP_IS_DISPLAY (data)) + { + gdisp = GIMP_DISPLAY (data); + shell = GIMP_DISPLAY_SHELL (gdisp->shell); + } + + if (gdisp) + { + gimage = gdisp->gimage; + + fs = (gimp_image_floating_sel (gimage) != NULL); + lp = ! gimp_image_is_empty (gimage); + sel = ! gimp_channel_is_empty (gimp_image_get_mask (gimage)); + + vectors = gimp_image_get_active_vectors (gimage); + } + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("select-all", lp); + SET_SENSITIVE ("select-none", lp && sel); + SET_SENSITIVE ("select-invert", lp && sel); + SET_SENSITIVE ("select-from-vectors", lp && vectors); + SET_SENSITIVE ("select-float", lp && sel); + + SET_SENSITIVE ("select-by-color", lp); + + SET_SENSITIVE ("select-feather", lp && sel); + SET_SENSITIVE ("select-sharpen", lp && sel); + SET_SENSITIVE ("select-shrink", lp && sel); + SET_SENSITIVE ("select-grow", lp && sel); + SET_SENSITIVE ("select-border", lp && sel); + + SET_SENSITIVE ("select-toggle-qmask", gdisp); + + SET_SENSITIVE ("select-save", sel && !fs); + SET_SENSITIVE ("select-to-vectors", sel && !fs); + +#undef SET_SENSITIVE +} diff --git a/app/actions/select-actions.h b/app/actions/select-actions.h new file mode 100644 index 0000000000..4b2b3b0a04 --- /dev/null +++ b/app/actions/select-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __SELECT_ACTIONS_H__ +#define __SELECT_ACTIONS_H__ + + +void select_actions_setup (GimpActionGroup *group, + gpointer data); +void select_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __SELECT_ACTIONS_H__ */ diff --git a/app/actions/templates-actions.c b/app/actions/templates-actions.c new file mode 100644 index 0000000000..6dded32621 --- /dev/null +++ b/app/actions/templates-actions.c @@ -0,0 +1,100 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimpcontext.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpcontainereditor.h" +#include "widgets/gimpcontainerview.h" +#include "widgets/gimphelp-ids.h" + +#include "templates-actions.h" +#include "gui/templates-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry templates_actions[] = +{ + { "templates-create-image", GIMP_STOCK_IMAGE, + N_("_Create Image from Template..."), "", NULL, + G_CALLBACK (templates_create_image_cmd_callback), + GIMP_HELP_TEMPLATE_IMAGE_NEW }, + + { "templates-new", GTK_STOCK_NEW, + N_("_New Template..."), "", NULL, + G_CALLBACK (templates_new_template_cmd_callback), + GIMP_HELP_TEMPLATE_NEW }, + + { "templates-duplicate", GIMP_STOCK_DUPLICATE, + N_("D_uplicate Template..."), "", NULL, + G_CALLBACK (templates_duplicate_template_cmd_callback), + GIMP_HELP_TEMPLATE_DUPLICATE }, + + { "templates-edit", GIMP_STOCK_EDIT, + N_("_Edit Template..."), "", NULL, + G_CALLBACK (templates_edit_template_cmd_callback), + GIMP_HELP_TEMPLATE_EDIT }, + + { "templates-delete", GTK_STOCK_DELETE, + N_("_Delete Template"), "", NULL, + G_CALLBACK (templates_delete_template_cmd_callback), + GIMP_HELP_TEMPLATE_DELETE } +}; + + +void +templates_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + templates_actions, + G_N_ELEMENTS (templates_actions), + data); +} + +void +templates_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpContainerEditor *editor; + GimpTemplate *template; + + editor = GIMP_CONTAINER_EDITOR (data); + + template = gimp_context_get_template (editor->view->context); + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("templates-create-image", template); + SET_SENSITIVE ("templates-new", TRUE); + SET_SENSITIVE ("templates-duplicate", template); + SET_SENSITIVE ("templates-edit", template); + SET_SENSITIVE ("templates-delete", template); + +#undef SET_SENSITIVE +} diff --git a/app/actions/templates-actions.h b/app/actions/templates-actions.h new file mode 100644 index 0000000000..963aa13a09 --- /dev/null +++ b/app/actions/templates-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __TEMPLATES_ACTIONS_H__ +#define __TEMPLATES_ACTIONS_H__ + + +void templates_actions_setup (GimpActionGroup *group, + gpointer data); +void templates_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __TEMPLATES_COMMANDS_H__ */ diff --git a/app/actions/tool-options-actions.c b/app/actions/tool-options-actions.c new file mode 100644 index 0000000000..4a138a8848 --- /dev/null +++ b/app/actions/tool-options-actions.c @@ -0,0 +1,213 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimp.h" +#include "core/gimpcontext.h" +#include "core/gimplist.h" +#include "core/gimptoolinfo.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" + +#include "tool-options-actions.h" +#include "gui/tool-options-commands.h" + +#include "gimp-intl.h" + + +/* local function prototypes */ + +static void tool_options_actions_update_presets (GimpActionGroup *group, + const gchar *menu, + gint keep_n, + GCallback callback, + const gchar *stock_id, + const gchar *help_id, + GimpContainer *presets); + + +/* global variables */ + +static GimpActionEntry tool_options_actions[] = +{ + { "tool-options-save-menu", NULL, + N_("_Save Options to") }, + + { "tool-options-save-new", GTK_STOCK_NEW, + N_("_New Entry..."), "", NULL, + G_CALLBACK (tool_options_save_new_cmd_callback), + GIMP_HELP_TOOL_OPTIONS_SAVE }, + + { "tool-options-restore-menu", NULL, + N_("_Restore Options from") }, + + { "tool-options-rename-menu", NULL, + N_("Re_name Saved Options") }, + + { "tool-options-delete-menu", NULL, + N_("_Delete Saved Options") }, + + { "tool-options-reset", GIMP_STOCK_RESET, + N_("R_eset Tool Options"), "", NULL, + G_CALLBACK (tool_options_reset_cmd_callback), + GIMP_HELP_TOOL_OPTIONS_RESET }, + + { "tool-options-reset-all", GIMP_STOCK_RESET, + N_("Reset _all Tool Options..."), "", NULL, + G_CALLBACK (tool_options_reset_all_cmd_callback), + GIMP_HELP_TOOL_OPTIONS_RESET } +}; + + +/* public functions */ + +#define SET_VISIBLE(action,condition) \ + gimp_action_group_set_action_visible (group, action, (condition) != 0) +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) +#define SET_IMPORTANT(action,condition) \ + gimp_action_group_set_action_important (group, action, (condition) != 0) + +void +tool_options_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + tool_options_actions, + G_N_ELEMENTS (tool_options_actions), + data); + + SET_IMPORTANT ("tool-options-restore-menu", FALSE); + SET_IMPORTANT ("tool-options-rename-menu", FALSE); + SET_IMPORTANT ("tool-options-delete-menu", FALSE); +} + +void +tool_options_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpContext *context; + GimpToolInfo *tool_info; + + context = gimp_get_user_context (group->gimp); + tool_info = gimp_context_get_tool (context); + + SET_VISIBLE ("tool-options-save-menu", tool_info->options_presets); + SET_VISIBLE ("tool-options-restore-menu", tool_info->options_presets); + SET_VISIBLE ("tool-options-rename-menu", tool_info->options_presets); + SET_VISIBLE ("tool-options-delete-menu", tool_info->options_presets); + + if (! tool_info->options_presets) + return; + + tool_options_actions_update_presets (group, "tool-options-save-menu", 2, + G_CALLBACK (tool_options_save_to_cmd_callback), + GTK_STOCK_SAVE, + GIMP_HELP_TOOL_OPTIONS_SAVE, + tool_info->options_presets); + + tool_options_actions_update_presets (group, "tool-options-restore-menu", 1, + G_CALLBACK (tool_options_restore_from_cmd_callback), + GTK_STOCK_REVERT_TO_SAVED, + GIMP_HELP_TOOL_OPTIONS_RESTORE, + tool_info->options_presets); + + tool_options_actions_update_presets (group, "tool-options-rename-menu", 1, + G_CALLBACK (tool_options_rename_saved_cmd_callback), + GIMP_STOCK_EDIT, + GIMP_HELP_TOOL_OPTIONS_RENAME, + tool_info->options_presets); + + tool_options_actions_update_presets (group, "tool-options-delete-menu", 1, + G_CALLBACK (tool_options_delete_saved_cmd_callback), + GTK_STOCK_DELETE, + GIMP_HELP_TOOL_OPTIONS_DELETE, + tool_info->options_presets); +} + + +/* privat function */ + +static void +tool_options_actions_update_presets (GimpActionGroup *group, + const gchar *menu, + gint keep_n, + GCallback callback, + const gchar *stock_id, + const gchar *help_id, + GimpContainer *presets) +{ +#if 0 + GtkWidget *menu; + + menu = gtk_item_factory_get_widget (factory, menu); + + if (menu) + { + GList *list; + gint num_children; + + list = g_list_nth (GTK_MENU_SHELL (menu)->children, keep_n - 1); + while (g_list_next (list)) + gtk_widget_destroy (g_list_next (list)->data); + + num_children = gimp_container_num_children (presets); + + if (num_children > 0) + { + GimpItemFactoryEntry entry; + + entry.entry.path = NULL; + entry.entry.accelerator = ""; + entry.entry.callback = callback; + entry.entry.callback_action = 0; + entry.entry.item_type = stock_id ? "" : ""; + entry.entry.extra_data = stock_id; + entry.quark_string = NULL; + entry.help_id = help_id; + entry.description = NULL; + + for (list = GIMP_LIST (presets)->list; + list; + list = g_list_next (list)) + { + GimpToolOptions *options = list->data; + + entry.entry.path = g_strdup_printf ("%s/%s", + menu_path, + GIMP_OBJECT (options)->name); + gimp_item_factory_create_item (GIMP_ITEM_FACTORY (factory), + &entry, NULL, + options, 2, FALSE); + g_free (entry.entry.path); + } + } + } +#endif +} + +#undef SET_SENSITIVE +#undef SET_VISIBLE diff --git a/app/actions/tool-options-actions.h b/app/actions/tool-options-actions.h new file mode 100644 index 0000000000..b1ff0705d1 --- /dev/null +++ b/app/actions/tool-options-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __TOOL_OPTIONS_ACTIONS_H__ +#define __TOOL_OPTIONS_ACTIONS_H__ + + +void tool_options_actions_setup (GimpActionGroup *group, + gpointer data); +void tool_options_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __TOOL_OPTIONS_ACTIONS_H__ */ diff --git a/app/actions/vectors-actions.c b/app/actions/vectors-actions.c new file mode 100644 index 0000000000..ce035165eb --- /dev/null +++ b/app/actions/vectors-actions.c @@ -0,0 +1,230 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "core/gimpchannel.h" +#include "core/gimpimage.h" +#include "core/gimplist.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" +#include "widgets/gimpitemtreeview.h" + +#include "vectors-actions.h" +#include "gui/vectors-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry vectors_actions[] = +{ + { "vectors-path-tool", GIMP_STOCK_TOOL_PATH, + N_("Path _Tool"), NULL, NULL, + G_CALLBACK (vectors_vectors_tool_cmd_callback), + GIMP_HELP_TOOL_VECTORS }, + + { "vectors-edit-attributes", GIMP_STOCK_EDIT, + N_("_Edit Path Attributes..."), NULL, NULL, + G_CALLBACK (vectors_edit_attributes_cmd_callback), + GIMP_HELP_PATH_EDIT }, + + { "vectors-new", GTK_STOCK_NEW, + N_("_New Path..."), "", NULL, + G_CALLBACK (vectors_new_cmd_callback), + GIMP_HELP_PATH_NEW }, + + { "vectors-duplicate", GIMP_STOCK_DUPLICATE, + N_("D_uplicate Path"), NULL, NULL, + G_CALLBACK (vectors_duplicate_cmd_callback), + GIMP_HELP_PATH_DUPLICATE }, + + { "vectors-delete", GTK_STOCK_DELETE, + N_("_Delete Path"), "", NULL, + G_CALLBACK (vectors_delete_cmd_callback), + GIMP_HELP_PATH_DELETE }, + + { "vectors-merge-visible", NULL, + N_("Merge _Visible Paths"), NULL, NULL, + G_CALLBACK (vectors_merge_visible_cmd_callback), + GIMP_HELP_PATH_MERGE_VISIBLE }, + + { "vectors-raise", GTK_STOCK_GO_UP, + N_("_Raise Path"), "", NULL, + G_CALLBACK (vectors_raise_cmd_callback), + GIMP_HELP_PATH_RAISE }, + + { "vectors-raise-to-top", GTK_STOCK_GOTO_TOP, + N_("Raise Path to _Top"), "", NULL, + G_CALLBACK (vectors_raise_to_top_cmd_callback), + GIMP_HELP_PATH_RAISE_TO_TOP }, + + { "vectors-lower", GTK_STOCK_GO_DOWN, + N_("_Lower Path"), "", NULL, + G_CALLBACK (vectors_lower_cmd_callback), + GIMP_HELP_PATH_LOWER }, + + { "vectors-lower-to-bottom", GTK_STOCK_GOTO_BOTTOM, + N_("Lower Path to _Bottom"), "", NULL, + G_CALLBACK (vectors_lower_to_bottom_cmd_callback), + GIMP_HELP_PATH_LOWER_TO_BOTTOM }, + + { "vectors-selection-to-vectors", GIMP_STOCK_SELECTION_TO_PATH, + N_("Selecti_on to Path"), NULL, NULL, + G_CALLBACK (vectors_selection_to_vectors_cmd_callback), + GIMP_HELP_SELECTION_TO_PATH }, + + { "vectors-stroke", GIMP_STOCK_PATH_STROKE, + N_("Stro_ke Path..."), NULL, NULL, + G_CALLBACK (vectors_stroke_cmd_callback), + GIMP_HELP_PATH_STROKE }, + + { "vectors-copy", GTK_STOCK_COPY, + N_("Co_py Path"), "", NULL, + G_CALLBACK (vectors_copy_cmd_callback), + GIMP_HELP_PATH_COPY }, + + { "vectors-paste", GTK_STOCK_PASTE, + N_("Paste Pat_h"), "", NULL, + G_CALLBACK (vectors_paste_cmd_callback), + GIMP_HELP_PATH_PASTE }, + + { "vectors-import", GTK_STOCK_OPEN, + N_("I_mport Path..."), "", NULL, + G_CALLBACK (vectors_import_cmd_callback), + GIMP_HELP_PATH_IMPORT }, + + { "vectors-export", GTK_STOCK_SAVE, + N_("E_xport Path..."), "", NULL, + G_CALLBACK (vectors_export_cmd_callback), + GIMP_HELP_PATH_EXPORT } +}; + +static GimpEnumActionEntry vectors_to_selection_actions[] = +{ + { "vectors-selection-replace", GIMP_STOCK_SELECTION_REPLACE, + N_("Path to Sele_ction"), NULL, NULL, + GIMP_CHANNEL_OP_REPLACE, + GIMP_HELP_PATH_SELECTION_REPLACE }, + + { "vectors-selection-add", GIMP_STOCK_SELECTION_ADD, + N_("_Add to Selection"), NULL, NULL, + GIMP_CHANNEL_OP_ADD, + GIMP_HELP_PATH_SELECTION_ADD }, + + { "vectors-selection-subtract", GIMP_STOCK_SELECTION_SUBTRACT, + N_("_Subtract from Selection"), NULL, NULL, + GIMP_CHANNEL_OP_SUBTRACT, + GIMP_HELP_PATH_SELECTION_SUBTRACT }, + + { "vectors-selection-intersect", GIMP_STOCK_SELECTION_INTERSECT, + N_("_Intersect with Selection"), NULL, NULL, + GIMP_CHANNEL_OP_INTERSECT, + GIMP_HELP_PATH_SELECTION_INTERSECT } +}; + + +void +vectors_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + vectors_actions, + G_N_ELEMENTS (vectors_actions), + data); + + gimp_action_group_add_enum_actions (group, + vectors_to_selection_actions, + G_N_ELEMENTS (vectors_to_selection_actions), + G_CALLBACK (vectors_to_selection_cmd_callback), + data); +} + +void +vectors_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpImage *gimage = NULL; + GimpVectors *vectors = NULL; + gboolean mask_empty = TRUE; + gboolean global_buf = FALSE; + GList *next = NULL; + GList *prev = NULL; + + if (GIMP_IS_ITEM_TREE_VIEW (data)) + gimage = GIMP_ITEM_TREE_VIEW (data)->gimage; + + if (gimage) + { + GList *list; + + vectors = gimp_image_get_active_vectors (gimage); + + mask_empty = gimp_channel_is_empty (gimp_image_get_mask (gimage)); + + global_buf = FALSE; + + for (list = GIMP_LIST (gimage->vectors)->list; + list; + list = g_list_next (list)) + { + if (vectors == (GimpVectors *) list->data) + { + prev = g_list_previous (list); + next = g_list_next (list); + break; + } + } + } + +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("vectors-path-tool", vectors); + SET_SENSITIVE ("vectors-edit-attributes", vectors); + + SET_SENSITIVE ("vectors-new", gimage); + SET_SENSITIVE ("vectors-duplicate", vectors); + SET_SENSITIVE ("vectors-delete", vectors); + + SET_SENSITIVE ("vectors-raise", vectors && prev); + SET_SENSITIVE ("vectors-raise-to-top", vectors && prev); + SET_SENSITIVE ("vectors-lower", vectors && next); + SET_SENSITIVE ("vectors-lower-to-bottom", vectors && next); + + SET_SENSITIVE ("vectors-selection-to-vectors", ! mask_empty); + SET_SENSITIVE ("vectors-stroke", vectors); + + SET_SENSITIVE ("vectors-copy", vectors); + SET_SENSITIVE ("vectors-paste", global_buf); + SET_SENSITIVE ("vectors-import", gimage); + SET_SENSITIVE ("vectors-export", vectors); + + SET_SENSITIVE ("vectors-selection-replace", vectors); + SET_SENSITIVE ("vectors-selection-add", vectors); + SET_SENSITIVE ("vectors-selection-subtract", vectors); + SET_SENSITIVE ("vectors-selection-intersect", vectors); + +#undef SET_SENSITIVE +} diff --git a/app/actions/vectors-actions.h b/app/actions/vectors-actions.h new file mode 100644 index 0000000000..1f125d8aaa --- /dev/null +++ b/app/actions/vectors-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __VECTORS_ACTIONS_H__ +#define __VECTORS_ACTIONS_H__ + + +void vectors_actions_setup (GimpActionGroup *group, + gpointer data); +void vectors_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __VECTORS_ACTIONS_H__ */ diff --git a/app/actions/vectors-commands.c b/app/actions/vectors-commands.c index 0d39f721d7..663b183c43 100644 --- a/app/actions/vectors-commands.c +++ b/app/actions/vectors-commands.c @@ -101,6 +101,18 @@ vectors_new_cmd_callback (GtkWidget *widget, vectors_new_vectors_query (gimage, NULL, TRUE, widget); } +void +vectors_raise_to_top_cmd_callback (GtkWidget *widget, + gpointer data) +{ + GimpImage *gimage; + GimpVectors *active_vectors; + return_if_no_vectors (gimage, active_vectors, data); + + gimp_image_raise_vectors_to_top (gimage, active_vectors); + gimp_image_flush (gimage); +} + void vectors_raise_cmd_callback (GtkWidget *widget, gpointer data) @@ -125,6 +137,18 @@ vectors_lower_cmd_callback (GtkWidget *widget, gimp_image_flush (gimage); } +void +vectors_lower_to_bottom_cmd_callback (GtkWidget *widget, + gpointer data) +{ + GimpImage *gimage; + GimpVectors *active_vectors; + return_if_no_vectors (gimage, active_vectors, data); + + gimp_image_lower_vectors_to_bottom (gimage, active_vectors); + gimp_image_flush (gimage); +} + void vectors_duplicate_cmd_callback (GtkWidget *widget, gpointer data) diff --git a/app/actions/vectors-commands.h b/app/actions/vectors-commands.h index f708a1d104..b31b04f502 100644 --- a/app/actions/vectors-commands.h +++ b/app/actions/vectors-commands.h @@ -24,8 +24,12 @@ void vectors_new_cmd_callback (GtkWidget *widget, gpointer data); void vectors_raise_cmd_callback (GtkWidget *widget, gpointer data); +void vectors_raise_to_top_cmd_callback (GtkWidget *widget, + gpointer data); void vectors_lower_cmd_callback (GtkWidget *widget, gpointer data); +void vectors_lower_to_bottom_cmd_callback (GtkWidget *widget, + gpointer data); void vectors_duplicate_cmd_callback (GtkWidget *widget, gpointer data); void vectors_delete_cmd_callback (GtkWidget *widget, diff --git a/app/actions/view-actions.c b/app/actions/view-actions.c new file mode 100644 index 0000000000..2c486c8b18 --- /dev/null +++ b/app/actions/view-actions.c @@ -0,0 +1,409 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "config/gimpguiconfig.h" + +#include "core/gimp.h" +#include "core/gimpcontext.h" +#include "core/gimpimage.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" + +#include "display/gimpdisplay.h" +#include "display/gimpdisplayoptions.h" +#include "display/gimpdisplayshell.h" +#include "display/gimpdisplayshell-appearance.h" +#include "display/gimpdisplayshell-selection.h" + +#include "view-actions.h" +#include "gui/view-commands.h" + +#include "gimp-intl.h" + + +/* local function prototypes */ + +static void view_actions_set_zoom (GimpActionGroup *group, + GimpDisplayShell *shell); + + +static GimpActionEntry view_actions[] = +{ + { "view-menu", NULL, + N_("/_View") }, + + { "view-zoom-menu", NULL, + N_("_Zoom") }, + + { "view-new", GTK_STOCK_NEW, + N_("_New View"), "", NULL, + G_CALLBACK (view_new_view_cmd_callback), + GIMP_HELP_VIEW_NEW }, + + { "view-zoom-out", GTK_STOCK_ZOOM_OUT, + N_("Zoom _Out"), "minus", NULL, + G_CALLBACK (view_zoom_out_cmd_callback), + GIMP_HELP_VIEW_ZOOM_OUT }, + + { "view-zoom-in", GTK_STOCK_ZOOM_IN, + N_("Zoom _In"), "plus", NULL, + G_CALLBACK (view_zoom_in_cmd_callback), + GIMP_HELP_VIEW_ZOOM_IN }, + + { "view-zoom-fit", GTK_STOCK_ZOOM_FIT, + N_("Zoom to _Fit Window"), "E", NULL, + G_CALLBACK (view_zoom_fit_cmd_callback), + GIMP_HELP_VIEW_ZOOM_FIT }, + + { "view-info-window", GIMP_STOCK_INFO, + N_("_Info Window"), "I", NULL, + G_CALLBACK (view_info_window_cmd_callback), + GIMP_HELP_INFO_DIALOG }, + + { "view-navigation-window", GIMP_STOCK_NAVIGATION, + N_("Na_vigation Window"), "N", NULL, + G_CALLBACK (view_navigation_window_cmd_callback), + GIMP_HELP_NAVIGATION_DIALOG }, + + { "view-display-filters", GIMP_STOCK_DISPLAY_FILTER, + N_("Display _Filters..."), NULL, NULL, + G_CALLBACK (view_display_filters_cmd_callback), + GIMP_HELP_DISPLAY_FILTER_DIALOG }, + + { "view-shrink-wrap", NULL, + N_("Shrink _Wrap"), "E", NULL, + G_CALLBACK (view_shrink_wrap_cmd_callback), + GIMP_HELP_VIEW_SHRINK_WRAP }, + + { "view-move-to-screen", GIMP_STOCK_MOVE_TO_SCREEN, + N_("Move to Screen..."), NULL, NULL, + G_CALLBACK (view_change_screen_cmd_callback), + GIMP_HELP_VIEW_CHANGE_SCREEN } +}; + +static GimpToggleActionEntry view_toggle_actions[] = +{ + { "view-dot-for-dot", NULL, + N_("_Dot for Dot"), NULL, NULL, + G_CALLBACK (view_dot_for_dot_cmd_callback), + TRUE, + GIMP_HELP_VIEW_DOT_FOR_DOT }, + + { "view-show-selection", NULL, + N_("Show _Selection"), "T", NULL, + G_CALLBACK (view_toggle_selection_cmd_callback), + TRUE, + GIMP_HELP_VIEW_SHOW_SELECTION }, + + { "view-show-layer-boundary", NULL, + N_("Show _Layer Boundary"), NULL, NULL, + G_CALLBACK (view_toggle_layer_boundary_cmd_callback), + TRUE, + GIMP_HELP_VIEW_SHOW_LAYER_BOUNDARY }, + + { "view-show-guides", NULL, + N_("Show _Guides"), "T", NULL, + G_CALLBACK (view_toggle_guides_cmd_callback), + TRUE, + GIMP_HELP_VIEW_SHOW_GUIDES }, + + { "view-snap-to-giudes", NULL, + N_("Sn_ap to Guides"), NULL, NULL, + G_CALLBACK (view_snap_to_guides_cmd_callback), + TRUE, + GIMP_HELP_VIEW_SNAP_TO_GUIDES }, + + { "view-show-grid", NULL, + N_("S_how Grid"), NULL, NULL, + G_CALLBACK (view_toggle_grid_cmd_callback), + FALSE, + GIMP_HELP_VIEW_SHOW_GRID }, + + { "view-snap-to-grid", NULL, + N_("Sna_p to Grid"), NULL, NULL, + G_CALLBACK (view_snap_to_grid_cmd_callback), + FALSE, + GIMP_HELP_VIEW_SNAP_TO_GRID }, + + { "view-show-menubar", NULL, + N_("Show _Menubar"), NULL, NULL, + G_CALLBACK (view_toggle_menubar_cmd_callback), + TRUE, + GIMP_HELP_VIEW_SHOW_MENUBAR }, + + { "view-show-rulers", NULL, + N_("Show R_ulers"), "R", NULL, + G_CALLBACK (view_toggle_rulers_cmd_callback), + TRUE, + GIMP_HELP_VIEW_SHOW_RULERS }, + + { "view-show-scrollbars", NULL, + N_("Show Scroll_bars"), NULL, NULL, + G_CALLBACK (view_toggle_scrollbars_cmd_callback), + TRUE, + GIMP_HELP_VIEW_SHOW_SCROLLBARS }, + + { "view-show-statusbar", NULL, + N_("Show S_tatusbar"), NULL, NULL, + G_CALLBACK (view_toggle_statusbar_cmd_callback), + TRUE, + GIMP_HELP_VIEW_SHOW_STATUSBAR }, + + { "view-fullscreen", NULL, + N_("Fullscr_een"), "F11", NULL, + G_CALLBACK (view_fullscreen_cmd_callback), + FALSE, + GIMP_HELP_VIEW_FULLSCREEN } +}; + +static GimpRadioActionEntry view_zoom_actions[] = +{ + { "view-zoom-16-1", NULL, + N_("16:1 (1600%)"), NULL, NULL, + 160000, + GIMP_HELP_VIEW_ZOOM_IN }, + + { "view-zoom-8-1", NULL, + N_("8:1 (800%)"), NULL, NULL, + 80000, + GIMP_HELP_VIEW_ZOOM_IN }, + + { "view-zoom-4-1", NULL, + N_("4:1 (400%)"), NULL, NULL, + 40000, + GIMP_HELP_VIEW_ZOOM_IN }, + + { "view-zoom-2-1", NULL, + N_("2:1 (200%)"), NULL, NULL, + 20000, + GIMP_HELP_VIEW_ZOOM_IN }, + + { "view-zoom-1-1", NULL, + N_("1:1 (100%)"), "1", NULL, + 10000, + GIMP_HELP_VIEW_ZOOM_100 }, + + { "view-zoom-1-2", NULL, + N_("1:2 (50%)"), NULL, NULL, + 5000, + GIMP_HELP_VIEW_ZOOM_OUT }, + + { "view-zoom-1-4", NULL, + N_("1:4 (25%)"), NULL, NULL, + 2500, + GIMP_HELP_VIEW_ZOOM_OUT }, + + { "view-zoom-1-8", NULL, + N_("1:8 (12.5%)"), NULL, NULL, + 1250, + GIMP_HELP_VIEW_ZOOM_OUT }, + + { "view-zoom-1-16", NULL, + N_("1:16 (6.25%)"), NULL, NULL, + 625, + GIMP_HELP_VIEW_ZOOM_OUT }, + + { "view-zoom-other", NULL, + "/View/Zoom/O_ther...", NULL, NULL, + 0, + GIMP_HELP_VIEW_ZOOM_OTHER } +}; + + +void +view_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + view_actions, + G_N_ELEMENTS (view_actions), + data); + + gimp_action_group_add_toggle_actions (group, + view_toggle_actions, + G_N_ELEMENTS (view_toggle_actions), + data); + + gimp_action_group_add_radio_actions (group, + view_zoom_actions, + G_N_ELEMENTS (view_zoom_actions), + 10000, + G_CALLBACK (view_zoom_cmd_callback), + data); +} + +void +view_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpDisplay *gdisp = NULL; + GimpDisplayShell *shell = NULL; + GimpDisplayOptions *options = NULL; + GimpImage *gimage = NULL; + gboolean fullscreen = FALSE; + gint n_screens = 1; + + if (GIMP_IS_DISPLAY_SHELL (data)) + { + shell = GIMP_DISPLAY_SHELL (data); + gdisp = shell->gdisp; + } + else if (GIMP_IS_DISPLAY (data)) + { + gdisp = GIMP_DISPLAY (data); + shell = GIMP_DISPLAY_SHELL (gdisp->shell); + } + + if (gdisp) + { + gimage = gdisp->gimage; + + fullscreen = gimp_display_shell_get_fullscreen (shell); + + options = fullscreen ? shell->fullscreen_options : shell->options; + + n_screens = + gdk_display_get_n_screens (gtk_widget_get_display (GTK_WIDGET (shell))); + } + +#define SET_ACTIVE(action,condition) \ + gimp_action_group_set_action_active (group, action, (condition) != 0) +#define SET_VISIBLE(action,condition) \ + gimp_action_group_set_action_visible (group, action, (condition) != 0) +#define SET_LABEL(action,label) \ + gimp_action_group_set_action_label (group, action, (label)) +#define SET_SENSITIVE(action,condition) \ + gimp_action_group_set_action_sensitive (group, action, (condition) != 0) + + SET_SENSITIVE ("view-new", gdisp); + + SET_SENSITIVE ("view-dot-for-dot", gdisp); + SET_ACTIVE ("view-dot-for-dot", gdisp && shell->dot_for_dot); + + SET_SENSITIVE ("view-zoom-out", gdisp); + SET_SENSITIVE ("view-zoom-in", gdisp); + SET_SENSITIVE ("view-zoom-fit", gdisp); + + SET_SENSITIVE ("view-zoom-16-1", gdisp); + SET_SENSITIVE ("view-zoom-8-1", gdisp); + SET_SENSITIVE ("view-zoom-4-1", gdisp); + SET_SENSITIVE ("view-zoom-2-1", gdisp); + SET_SENSITIVE ("view-zoom-1-1", gdisp); + SET_SENSITIVE ("view-zoom-1-2", gdisp); + SET_SENSITIVE ("view-zoom-1-4", gdisp); + SET_SENSITIVE ("view-zoom-1-8", gdisp); + SET_SENSITIVE ("view-zoom-1-16", gdisp); + SET_SENSITIVE ("view-zoom-other", gdisp); + + if (gdisp) + view_actions_set_zoom (group, shell); + + SET_SENSITIVE ("view-info-window", gdisp); + SET_SENSITIVE ("view-navigation-window", gdisp); + SET_SENSITIVE ("view-display-filters", gdisp); + + SET_SENSITIVE ("view-show-selection", gdisp); + SET_ACTIVE ("view-show-selection", gdisp && options->show_selection); + SET_SENSITIVE ("view-show-layer-boundary", gdisp); + SET_ACTIVE ("view-show-layer-boundary", gdisp && options->show_layer_boundary); + SET_ACTIVE ("view-show-guides", gdisp && options->show_guides); + SET_ACTIVE ("view-snap-to-guides", gdisp && shell->snap_to_guides); + SET_ACTIVE ("view-show-grid", gdisp && options->show_grid); + SET_ACTIVE ("view-snap-to-grid", gdisp && shell->snap_to_grid); + + SET_SENSITIVE ("view-show-menubar", gdisp); + SET_ACTIVE ("view-show-menubar", gdisp && options->show_menubar); + SET_SENSITIVE ("view-show-rulers", gdisp); + SET_ACTIVE ("view-show-rulers", gdisp && options->show_rulers); + SET_SENSITIVE ("view-show-scrollbars", gdisp); + SET_ACTIVE ("view-show-scrollbars", gdisp && options->show_scrollbars); + SET_SENSITIVE ("view-show-statusbar", gdisp); + SET_ACTIVE ("view-show-statusbar", gdisp && options->show_statusbar); + + SET_SENSITIVE ("view-shrink-wrap", gdisp); + SET_SENSITIVE ("view-fullscreen", gdisp); + SET_ACTIVE ("view-fullscreen", gdisp && fullscreen); + SET_VISIBLE ("view-move-to-screen", gdisp && n_screens > 1); + +#undef SET_ACTIVE +#undef SET_VISIBLE +#undef SET_LABEL +#undef SET_SENSITIVE +} + + +/* private functions */ + +static void +view_actions_set_zoom (GimpActionGroup *group, + GimpDisplayShell *shell) +{ + const gchar *action = NULL; + guint scale; + gchar buf[16]; + gchar *label; + + scale = ROUND (shell->scale * 1000); + + switch (scale) + { + case 16000: action = "view-zoom-16-1"; break; + case 8000: action = "view-zoom-8-1"; break; + case 4000: action = "view-zoom-4-1"; break; + case 2000: action = "view-zoom-2-1"; break; + case 1000: action = "view-zoom-1-1"; break; + case 500: action = "view-zoom-1-2"; break; + case 250: action = "view-zoom-1-4"; break; + case 125: action = "view-zoom-1-8"; break; + case 63: + case 62: action = "view-zoom-1-16"; break; + } + + g_snprintf (buf, sizeof (buf), + shell->scale >= 0.15 ? "%.0f%%" : "%.2f%%", + shell->scale * 100.0); + + if (!action) + { + action = "/View/Zoom/Other..."; + + label = g_strdup_printf (_("Other (%s) ..."), buf); + gimp_action_group_set_action_label (group, action, label); + g_free (label); + + shell->other_scale = shell->scale; + } + + gimp_action_group_set_action_active (group, action, TRUE); + + label = g_strdup_printf (_("_Zoom (%s)"), buf); + gimp_action_group_set_action_label (group, "view-zoom-menu", label); + g_free (label); + + /* flag as dirty */ + shell->other_scale = - fabs (shell->other_scale); +} diff --git a/app/actions/view-actions.h b/app/actions/view-actions.h new file mode 100644 index 0000000000..ec6b85f439 --- /dev/null +++ b/app/actions/view-actions.h @@ -0,0 +1,29 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __VIEW_ACTIONS_H__ +#define __VIEW_ACTIONS_H__ + + +void view_actions_setup (GimpActionGroup *group, + gpointer data); +void view_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __VIEW_ACTIONS_H__ */ diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index 037a4c373d..6d1bd9d6c1 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -2964,6 +2964,28 @@ gimp_image_raise_channel (GimpImage *gimage, TRUE, _("Raise Channel")); } +gboolean +gimp_image_raise_channel_to_top (GimpImage *gimage, + GimpChannel *channel) +{ + gint index; + + g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE); + g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE); + + index = gimp_container_get_child_index (gimage->channels, + GIMP_OBJECT (channel)); + + if (index == 0) + { + g_message (_("Channel is already on top.")); + return FALSE; + } + + return gimp_image_position_channel (gimage, channel, 0, + TRUE, _("Raise Channel to Top")); +} + gboolean gimp_image_lower_channel (GimpImage *gimage, GimpChannel *channel) @@ -2986,6 +3008,31 @@ gimp_image_lower_channel (GimpImage *gimage, TRUE, _("Lower Channel")); } +gboolean +gimp_image_lower_channel_to_bottom (GimpImage *gimage, + GimpChannel *channel) +{ + gint index; + gint length; + + g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE); + g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE); + + index = gimp_container_get_child_index (gimage->channels, + GIMP_OBJECT (channel)); + + length = gimp_container_num_children (gimage->channels); + + if (index == length - 1) + { + g_message (_("Channel is already on the bottom.")); + return FALSE; + } + + return gimp_image_position_channel (gimage, channel, length - 1, + TRUE, _("Lower Channel to Bottom")); +} + gboolean gimp_image_position_channel (GimpImage *gimage, GimpChannel *channel, @@ -3157,6 +3204,28 @@ gimp_image_raise_vectors (GimpImage *gimage, TRUE, _("Raise Path")); } +gboolean +gimp_image_raise_vectors_to_top (GimpImage *gimage, + GimpVectors *vectors) +{ + gint index; + + g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE); + g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE); + + index = gimp_container_get_child_index (gimage->vectors, + GIMP_OBJECT (vectors)); + + if (index == 0) + { + g_message (_("Path is already on top.")); + return FALSE; + } + + return gimp_image_position_vectors (gimage, vectors, 0, + TRUE, _("Raise Path to Top")); +} + gboolean gimp_image_lower_vectors (GimpImage *gimage, GimpVectors *vectors) @@ -3179,6 +3248,31 @@ gimp_image_lower_vectors (GimpImage *gimage, TRUE, _("Lower Path")); } +gboolean +gimp_image_lower_vectors_to_bottom (GimpImage *gimage, + GimpVectors *vectors) +{ + gint index; + gint length; + + g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE); + g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE); + + index = gimp_container_get_child_index (gimage->vectors, + GIMP_OBJECT (vectors)); + + length = gimp_container_num_children (gimage->vectors); + + if (index == length - 1) + { + g_message (_("Path is already on the bottom.")); + return FALSE; + } + + return gimp_image_position_vectors (gimage, vectors, length - 1, + TRUE, _("Lower Path to Bottom")); +} + gboolean gimp_image_position_vectors (GimpImage *gimage, GimpVectors *vectors, diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h index fc6690cd8c..265b8473ce 100644 --- a/app/core/gimpimage.h +++ b/app/core/gimpimage.h @@ -454,8 +454,12 @@ void gimp_image_remove_channel (GimpImage *gimage, gboolean gimp_image_raise_channel (GimpImage *gimage, GimpChannel *channel); +gboolean gimp_image_raise_channel_to_top (GimpImage *gimage, + GimpChannel *channel); gboolean gimp_image_lower_channel (GimpImage *gimage, GimpChannel *channel); +gboolean gimp_image_lower_channel_to_bottom (GimpImage *gimage, + GimpChannel *channel); gboolean gimp_image_position_channel (GimpImage *gimage, GimpChannel *channel, gint new_index, @@ -470,8 +474,12 @@ void gimp_image_remove_vectors (GimpImage *gimage, gboolean gimp_image_raise_vectors (GimpImage *gimage, GimpVectors *vectors); +gboolean gimp_image_raise_vectors_to_top (GimpImage *gimage, + GimpVectors *vectors); gboolean gimp_image_lower_vectors (GimpImage *gimage, GimpVectors *vectors); +gboolean gimp_image_lower_vectors_to_bottom (GimpImage *gimage, + GimpVectors *vectors); gboolean gimp_image_position_vectors (GimpImage *gimage, GimpVectors *vectors, gint new_index, diff --git a/app/gui/Makefile.am b/app/gui/Makefile.am index 3903f9605d..69751867e4 100644 --- a/app/gui/Makefile.am +++ b/app/gui/Makefile.am @@ -51,10 +51,6 @@ dialogs_sources = \ resolution-calibrate-dialog.h \ stroke-dialog.c \ stroke-dialog.h \ - templates-commands.c \ - templates-commands.h \ - templates-menu.c \ - templates-menu.h \ tips-dialog.c \ tips-dialog.h \ tips-parser.c \ @@ -85,6 +81,8 @@ menus_sources = \ dialogs-commands.h \ dialogs-menu.c \ dialogs-menu.h \ + dockable-commands.c \ + dockable-commands.h \ documents-commands.c \ documents-commands.h \ documents-menu.c \ @@ -151,6 +149,10 @@ menus_sources = \ qmask-menu.h \ select-commands.c \ select-commands.h \ + templates-commands.c \ + templates-commands.h \ + templates-menu.c \ + templates-menu.h \ tool-options-menu.c \ tool-options-menu.h \ tool-options-commands.c \ diff --git a/app/gui/channels-commands.c b/app/gui/channels-commands.c index de25867573..a1481b6168 100644 --- a/app/gui/channels-commands.c +++ b/app/gui/channels-commands.c @@ -104,6 +104,18 @@ channels_raise_cmd_callback (GtkWidget *widget, gimp_image_flush (gimage); } +void +channels_raise_to_top_cmd_callback (GtkWidget *widget, + gpointer data) +{ + GimpImage *gimage; + GimpChannel *active_channel; + return_if_no_channel (gimage, active_channel, data); + + gimp_image_raise_channel_to_top (gimage, active_channel); + gimp_image_flush (gimage); +} + void channels_lower_cmd_callback (GtkWidget *widget, gpointer data) @@ -116,6 +128,18 @@ channels_lower_cmd_callback (GtkWidget *widget, gimp_image_flush (gimage); } +void +channels_lower_to_bottom_cmd_callback (GtkWidget *widget, + gpointer data) +{ + GimpImage *gimage; + GimpChannel *active_channel; + return_if_no_channel (gimage, active_channel, data); + + gimp_image_lower_channel_to_bottom (gimage, active_channel); + gimp_image_flush (gimage); +} + void channels_duplicate_cmd_callback (GtkWidget *widget, gpointer data) diff --git a/app/gui/channels-commands.h b/app/gui/channels-commands.h index 370ed9981f..43def974a1 100644 --- a/app/gui/channels-commands.h +++ b/app/gui/channels-commands.h @@ -24,8 +24,12 @@ void channels_new_cmd_callback (GtkWidget *widget, gpointer data); void channels_raise_cmd_callback (GtkWidget *widget, gpointer data); +void channels_raise_to_top_cmd_callback (GtkWidget *widget, + gpointer data); void channels_lower_cmd_callback (GtkWidget *widget, gpointer data); +void channels_lower_to_bottom_cmd_callback (GtkWidget *widget, + gpointer data); void channels_duplicate_cmd_callback (GtkWidget *widget, gpointer data); void channels_delete_cmd_callback (GtkWidget *widget, diff --git a/app/gui/dialogs-commands.c b/app/gui/dialogs-commands.c index fb8fa5ab80..9d8cbc491f 100644 --- a/app/gui/dialogs-commands.c +++ b/app/gui/dialogs-commands.c @@ -26,13 +26,10 @@ #include "gui-types.h" -#include "widgets/gimpcontainerview.h" -#include "widgets/gimpcontainerview-utils.h" #include "widgets/gimpdialogfactory.h" #include "widgets/gimpdockable.h" #include "widgets/gimpdockbook.h" #include "widgets/gimpimagedock.h" -#include "widgets/gimpsessioninfo.h" #include "dialogs.h" #include "dialogs-commands.h" @@ -50,8 +47,7 @@ static void dialogs_create_dock (GdkScreen *screen, void dialogs_show_toolbox_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { dialogs_show_toolbox (); } @@ -90,325 +86,9 @@ dialogs_create_dockable_cmd_callback (GtkWidget *widget, } } -void -dialogs_add_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - - if (action) - { - GtkWidget *dockable; - const gchar *identifier; - - identifier = g_quark_to_string ((GQuark) action); - - if (identifier) - { - dockable = - gimp_dialog_factory_dockable_new (dockbook->dock->dialog_factory, - dockbook->dock, - identifier, - -1); - - /* Maybe gimp_dialog_factory_dockable_new() returned an already - * existing singleton dockable, so check if it already is - * attached to a dockbook. - */ - if (dockable && ! GIMP_DOCKABLE (dockable)->dockbook) - gimp_dockbook_add (dockbook, GIMP_DOCKABLE (dockable), -1); - } - } -} - -void -dialogs_close_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - GimpDockable *dockable; - gint page_num; - - page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); - - dockable = (GimpDockable *) - gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); - - if (dockable) - gimp_dockbook_remove (dockbook, dockable); -} - -void -dialogs_detach_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - GimpDockable *dockable; - gint page_num; - - page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); - - dockable = (GimpDockable *) - gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); - - if (dockable) - gimp_dockable_detach (dockable); -} - -void -dialogs_toggle_view_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - GimpDockable *dockable; - GimpViewType view_type; - gint page_num; - - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - view_type = (GimpViewType) action; - - page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); - - dockable = (GimpDockable *) - gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); - - if (dockable) - { - GimpDialogFactoryEntry *entry; - - gimp_dialog_factory_from_widget (GTK_WIDGET (dockable), &entry); - - if (entry) - { - gchar *identifier; - gchar *substring = NULL; - - identifier = g_strdup (entry->identifier); - - substring = strstr (identifier, "grid"); - - if (substring && view_type == GIMP_VIEW_TYPE_GRID) - return; - - if (! substring) - { - substring = strstr (identifier, "list"); - - if (substring && view_type == GIMP_VIEW_TYPE_LIST) - return; - } - - if (substring) - { - GimpContainerView *old_view; - GtkWidget *new_dockable; - gint preview_size = -1; - - if (view_type == GIMP_VIEW_TYPE_LIST) - memcpy (substring, "list", 4); - else if (view_type == GIMP_VIEW_TYPE_GRID) - memcpy (substring, "grid", 4); - - old_view = gimp_container_view_get_by_dockable (dockable); - - if (old_view) - preview_size = old_view->preview_size; - - new_dockable = - gimp_dialog_factory_dockable_new (dockbook->dock->dialog_factory, - dockbook->dock, - identifier, - preview_size); - - /* Maybe gimp_dialog_factory_dockable_new() returned - * an already existing singleton dockable, so check - * if it already is attached to a dockbook. - */ - if (new_dockable && ! GIMP_DOCKABLE (new_dockable)->dockbook) - { - gimp_dockbook_add (dockbook, GIMP_DOCKABLE (new_dockable), - page_num); - - gimp_dockbook_remove (dockbook, dockable); - - gtk_notebook_set_current_page (GTK_NOTEBOOK (dockbook), - page_num); - } - } - - g_free (identifier); - } - } -} - -void -dialogs_preview_size_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - GimpDockable *dockable; - gint preview_size; - gint page_num; - - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - preview_size = (gint) action; - - page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); - - dockable = (GimpDockable *) - gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); - - if (dockable) - { - GimpContainerView *view; - - view = gimp_container_view_get_by_dockable (dockable); - - if (view && view->preview_size != preview_size) - gimp_container_view_set_preview_size (view, preview_size, - view->preview_border_width); - } -} - -void -dialogs_tab_style_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - GimpDockable *dockable; - GimpTabStyle tab_style; - gint page_num; - - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - tab_style = (gint) action; - - page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); - - dockable = (GimpDockable *) - gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); - - if (dockable && dockable->tab_style != tab_style) - { - GtkWidget *tab_widget; - - dockable->tab_style = tab_style; - - tab_widget = gimp_dockbook_get_tab_widget (dockbook, dockable); - - gtk_notebook_set_tab_label (GTK_NOTEBOOK (dockbook), - GTK_WIDGET (dockable), - tab_widget); - } -} - -void -dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - - if (GIMP_IS_IMAGE_DOCK (dockbook->dock)) - gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dockbook->dock), - GTK_CHECK_MENU_ITEM (widget)->active); -} - -void -dialogs_toggle_auto_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - - if (GIMP_IS_IMAGE_DOCK (dockbook->dock)) - gimp_image_dock_set_auto_follow_active (GIMP_IMAGE_DOCK (dockbook->dock), - GTK_CHECK_MENU_ITEM (widget)->active); -} - -static void -dialogs_change_screen_confirm_callback (GtkWidget *query_box, - gint value, - gpointer data) -{ - GdkScreen *screen; - - screen = gdk_display_get_screen (gtk_widget_get_display (GTK_WIDGET (data)), - value); - - if (screen) - gtk_window_set_screen (GTK_WINDOW (data), screen); -} - -static void -dialogs_change_screen_destroy_callback (GtkWidget *query_box, - GtkWidget *dock) -{ - g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", NULL); -} - -void -dialogs_change_screen_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDockbook *dockbook = GIMP_DOCKBOOK (data); - GtkWidget *dock; - GdkScreen *screen; - GdkDisplay *display; - gint cur_screen; - gint num_screens; - GtkWidget *qbox; - - dock = GTK_WIDGET (dockbook->dock); - - qbox = g_object_get_data (G_OBJECT (dock), "gimp-change-screen-dialog"); - - if (qbox) - { - gtk_window_present (GTK_WINDOW (qbox)); - return; - } - - screen = gtk_widget_get_screen (dock); - display = gtk_widget_get_display (dock); - - cur_screen = gdk_screen_get_number (screen); - num_screens = gdk_display_get_n_screens (display); - - qbox = gimp_query_int_box ("Move Dock to Screen", - dock, - NULL, 0, - "Enter destination screen", - cur_screen, 0, num_screens - 1, - G_OBJECT (dock), "destroy", - dialogs_change_screen_confirm_callback, - dock); - - g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", qbox); - - g_signal_connect (qbox, "destroy", - G_CALLBACK (dialogs_change_screen_destroy_callback), - dock); - - gtk_widget_show (qbox); -} - void dialogs_create_lc_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { static const gchar *tabs[] = { @@ -424,8 +104,7 @@ dialogs_create_lc_cmd_callback (GtkWidget *widget, void dialogs_create_data_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { static const gchar *tabs[] = { @@ -442,8 +121,7 @@ dialogs_create_data_cmd_callback (GtkWidget *widget, void dialogs_create_stuff_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { static const gchar *tabs[] = { diff --git a/app/gui/dialogs-commands.h b/app/gui/dialogs-commands.h index 1fd4548cc0..039435b0d9 100644 --- a/app/gui/dialogs-commands.h +++ b/app/gui/dialogs-commands.h @@ -21,8 +21,7 @@ void dialogs_show_toolbox_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); void dialogs_create_toplevel_cmd_callback (GtkWidget *widget, gpointer data, guint action); @@ -30,45 +29,12 @@ void dialogs_create_dockable_cmd_callback (GtkWidget *widget, gpointer data, guint action); -void dialogs_add_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dialogs_close_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dialogs_detach_tab_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - -void dialogs_toggle_view_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dialogs_preview_size_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dialogs_tab_style_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - -void dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dialogs_toggle_auto_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dialogs_change_screen_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - void dialogs_create_lc_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); void dialogs_create_data_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); void dialogs_create_stuff_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); void dialogs_show_toolbox (void); diff --git a/app/gui/dialogs-menu.c b/app/gui/dialogs-menu.c index 8e9ec66315..f20159d1ea 100644 --- a/app/gui/dialogs-menu.c +++ b/app/gui/dialogs-menu.c @@ -36,7 +36,7 @@ #include "widgets/gimpimagedock.h" #include "widgets/gimpitemfactory.h" -#include "dialogs-commands.h" +#include "dockable-commands.h" #include "dialogs-menu.h" #include "menus.h" @@ -44,15 +44,15 @@ #define ADD_TAB(path,id,stock_id,help_id) \ - { { (path), "", dialogs_add_tab_cmd_callback, 0, \ + { { (path), "", dockable_add_tab_cmd_callback, 0, \ "", (stock_id) }, \ (id), (help_id), NULL } #define PREVIEW_SIZE(path,size) \ - { { (path), NULL, dialogs_preview_size_cmd_callback, \ + { { (path), NULL, dockable_preview_size_cmd_callback, \ (size), "/Preview Size/Tiny" }, \ NULL, GIMP_HELP_DOCK_PREVIEW_SIZE, NULL } #define TAB_STYLE(path,style) \ - { { (path), NULL, dialogs_tab_style_cmd_callback, \ + { { (path), NULL, dockable_tab_style_cmd_callback, \ (style), "/Tab Style/Icon" }, \ NULL, GIMP_HELP_DOCK_TAB_STYLE, NULL } @@ -120,12 +120,12 @@ GimpItemFactoryEntry dialogs_menu_entries[] = GIMP_STOCK_WARNING, GIMP_HELP_ERRORS_DIALOG), { { N_("/_Close Tab"), "", - dialogs_close_tab_cmd_callback, 0, + dockable_close_tab_cmd_callback, 0, "", GTK_STOCK_CLOSE }, NULL, GIMP_HELP_DOCK_TAB_CLOSE, NULL }, { { N_("/_Detach Tab"), "", - dialogs_detach_tab_cmd_callback, 0, + dockable_detach_tab_cmd_callback, 0, "", GTK_STOCK_CONVERT }, NULL, GIMP_HELP_DOCK_TAB_DETACH, NULL }, @@ -135,7 +135,7 @@ GimpItemFactoryEntry dialogs_menu_entries[] = MENU_BRANCH (N_("/Preview Si_ze")), { { N_("/Preview Size/_Tiny"), NULL, - dialogs_preview_size_cmd_callback, + dockable_preview_size_cmd_callback, GIMP_PREVIEW_SIZE_TINY, "" }, NULL, GIMP_HELP_DOCK_PREVIEW_SIZE, NULL }, @@ -152,7 +152,7 @@ GimpItemFactoryEntry dialogs_menu_entries[] = MENU_BRANCH (N_("/_Tab Style")), { { N_("/Tab Style/_Icon"), NULL, - dialogs_tab_style_cmd_callback, + dockable_tab_style_cmd_callback, GIMP_TAB_STYLE_ICON, "" }, NULL, GIMP_HELP_DOCK_TAB_STYLE, NULL }, @@ -163,26 +163,26 @@ GimpItemFactoryEntry dialogs_menu_entries[] = TAB_STYLE (N_("/Tab Style/St_atus & Text"), GIMP_TAB_STYLE_PREVIEW_NAME), { { N_("/View as _List"), NULL, - dialogs_toggle_view_cmd_callback, GIMP_VIEW_TYPE_LIST, "" }, + dockable_toggle_view_cmd_callback, GIMP_VIEW_TYPE_LIST, "" }, NULL, GIMP_HELP_DOCK_VIEW_AS_LIST, NULL }, { { N_("/View as _Grid"), NULL, - dialogs_toggle_view_cmd_callback, GIMP_VIEW_TYPE_GRID, "/View as List" }, + dockable_toggle_view_cmd_callback, GIMP_VIEW_TYPE_GRID, "/View as List" }, NULL, GIMP_HELP_DOCK_VIEW_AS_GRID, NULL }, MENU_SEPARATOR ("/image-menu-separator"), { { N_("/Show Image _Menu"), NULL, - dialogs_toggle_image_menu_cmd_callback, 0, "" }, + dockable_toggle_image_menu_cmd_callback, 0, "" }, NULL, GIMP_HELP_DOCK_IMAGE_MENU, NULL }, { { N_("/Auto Follow Active _Image"), NULL, - dialogs_toggle_auto_cmd_callback, 0, "" }, + dockable_toggle_auto_cmd_callback, 0, "" }, NULL, GIMP_HELP_DOCK_AUTO_BUTTON, NULL }, { { N_("/Move to Screen..."), NULL, - dialogs_change_screen_cmd_callback, 0, + dockable_change_screen_cmd_callback, 0, "", GIMP_STOCK_MOVE_TO_SCREEN }, NULL, GIMP_HELP_DOCK_CHANGE_SCREEN, NULL } diff --git a/app/gui/dockable-commands.c b/app/gui/dockable-commands.c new file mode 100644 index 0000000000..6b1843e41a --- /dev/null +++ b/app/gui/dockable-commands.c @@ -0,0 +1,356 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "gui-types.h" + +#include "widgets/gimpcontainerview.h" +#include "widgets/gimpcontainerview-utils.h" +#include "widgets/gimpdialogfactory.h" +#include "widgets/gimpdockable.h" +#include "widgets/gimpdockbook.h" +#include "widgets/gimpimagedock.h" +#include "widgets/gimpsessioninfo.h" + +#include "dialogs.h" +#include "dockable-commands.h" + + +/* public functions */ + +void +dockable_add_tab_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + + if (action) + { + GtkWidget *dockable; + const gchar *identifier; + + identifier = g_quark_to_string ((GQuark) action); + + if (identifier) + { + dockable = + gimp_dialog_factory_dockable_new (dockbook->dock->dialog_factory, + dockbook->dock, + identifier, + -1); + + /* Maybe gimp_dialog_factory_dockable_new() returned an already + * existing singleton dockable, so check if it already is + * attached to a dockbook. + */ + if (dockable && ! GIMP_DOCKABLE (dockable)->dockbook) + gimp_dockbook_add (dockbook, GIMP_DOCKABLE (dockable), -1); + } + } +} + +void +dockable_close_tab_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + GimpDockable *dockable; + gint page_num; + + page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); + + dockable = (GimpDockable *) + gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); + + if (dockable) + gimp_dockbook_remove (dockbook, dockable); +} + +void +dockable_detach_tab_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + GimpDockable *dockable; + gint page_num; + + page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); + + dockable = (GimpDockable *) + gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); + + if (dockable) + gimp_dockable_detach (dockable); +} + +void +dockable_toggle_view_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + GimpDockable *dockable; + GimpViewType view_type; + gint page_num; + + if (! GTK_CHECK_MENU_ITEM (widget)->active) + return; + + view_type = (GimpViewType) action; + + page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); + + dockable = (GimpDockable *) + gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); + + if (dockable) + { + GimpDialogFactoryEntry *entry; + + gimp_dialog_factory_from_widget (GTK_WIDGET (dockable), &entry); + + if (entry) + { + gchar *identifier; + gchar *substring = NULL; + + identifier = g_strdup (entry->identifier); + + substring = strstr (identifier, "grid"); + + if (substring && view_type == GIMP_VIEW_TYPE_GRID) + return; + + if (! substring) + { + substring = strstr (identifier, "list"); + + if (substring && view_type == GIMP_VIEW_TYPE_LIST) + return; + } + + if (substring) + { + GimpContainerView *old_view; + GtkWidget *new_dockable; + gint preview_size = -1; + + if (view_type == GIMP_VIEW_TYPE_LIST) + memcpy (substring, "list", 4); + else if (view_type == GIMP_VIEW_TYPE_GRID) + memcpy (substring, "grid", 4); + + old_view = gimp_container_view_get_by_dockable (dockable); + + if (old_view) + preview_size = old_view->preview_size; + + new_dockable = + gimp_dialog_factory_dockable_new (dockbook->dock->dialog_factory, + dockbook->dock, + identifier, + preview_size); + + /* Maybe gimp_dialog_factory_dockable_new() returned + * an already existing singleton dockable, so check + * if it already is attached to a dockbook. + */ + if (new_dockable && ! GIMP_DOCKABLE (new_dockable)->dockbook) + { + gimp_dockbook_add (dockbook, GIMP_DOCKABLE (new_dockable), + page_num); + + gimp_dockbook_remove (dockbook, dockable); + + gtk_notebook_set_current_page (GTK_NOTEBOOK (dockbook), + page_num); + } + } + + g_free (identifier); + } + } +} + +void +dockable_preview_size_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + GimpDockable *dockable; + gint preview_size; + gint page_num; + + if (! GTK_CHECK_MENU_ITEM (widget)->active) + return; + + preview_size = (gint) action; + + page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); + + dockable = (GimpDockable *) + gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); + + if (dockable) + { + GimpContainerView *view; + + view = gimp_container_view_get_by_dockable (dockable); + + if (view && view->preview_size != preview_size) + gimp_container_view_set_preview_size (view, preview_size, + view->preview_border_width); + } +} + +void +dockable_tab_style_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + GimpDockable *dockable; + GimpTabStyle tab_style; + gint page_num; + + if (! GTK_CHECK_MENU_ITEM (widget)->active) + return; + + tab_style = (gint) action; + + page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); + + dockable = (GimpDockable *) + gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); + + if (dockable && dockable->tab_style != tab_style) + { + GtkWidget *tab_widget; + + dockable->tab_style = tab_style; + + tab_widget = gimp_dockbook_get_tab_widget (dockbook, dockable); + + gtk_notebook_set_tab_label (GTK_NOTEBOOK (dockbook), + GTK_WIDGET (dockable), + tab_widget); + } +} + +void +dockable_toggle_image_menu_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + + if (GIMP_IS_IMAGE_DOCK (dockbook->dock)) + gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dockbook->dock), + GTK_CHECK_MENU_ITEM (widget)->active); +} + +void +dockable_toggle_auto_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + + if (GIMP_IS_IMAGE_DOCK (dockbook->dock)) + gimp_image_dock_set_auto_follow_active (GIMP_IMAGE_DOCK (dockbook->dock), + GTK_CHECK_MENU_ITEM (widget)->active); +} + +static void +dockable_change_screen_confirm_callback (GtkWidget *query_box, + gint value, + gpointer data) +{ + GdkScreen *screen; + + screen = gdk_display_get_screen (gtk_widget_get_display (GTK_WIDGET (data)), + value); + + if (screen) + gtk_window_set_screen (GTK_WINDOW (data), screen); +} + +static void +dockable_change_screen_destroy_callback (GtkWidget *query_box, + GtkWidget *dock) +{ + g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", NULL); +} + +void +dockable_change_screen_cmd_callback (GtkWidget *widget, + gpointer data, + guint action) +{ + GimpDockbook *dockbook = GIMP_DOCKBOOK (data); + GtkWidget *dock; + GdkScreen *screen; + GdkDisplay *display; + gint cur_screen; + gint num_screens; + GtkWidget *qbox; + + dock = GTK_WIDGET (dockbook->dock); + + qbox = g_object_get_data (G_OBJECT (dock), "gimp-change-screen-dialog"); + + if (qbox) + { + gtk_window_present (GTK_WINDOW (qbox)); + return; + } + + screen = gtk_widget_get_screen (dock); + display = gtk_widget_get_display (dock); + + cur_screen = gdk_screen_get_number (screen); + num_screens = gdk_display_get_n_screens (display); + + qbox = gimp_query_int_box ("Move Dock to Screen", + dock, + NULL, 0, + "Enter destination screen", + cur_screen, 0, num_screens - 1, + G_OBJECT (dock), "destroy", + dockable_change_screen_confirm_callback, + dock); + + g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", qbox); + + g_signal_connect (qbox, "destroy", + G_CALLBACK (dockable_change_screen_destroy_callback), + dock); + + gtk_widget_show (qbox); +} diff --git a/app/gui/dockable-commands.h b/app/gui/dockable-commands.h new file mode 100644 index 0000000000..ea6360e6f0 --- /dev/null +++ b/app/gui/dockable-commands.h @@ -0,0 +1,54 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __DOCKABLE_COMMANDS_H__ +#define __DOCKABLE_COMMANDS_H__ + + +void dockable_add_tab_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); +void dockable_close_tab_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); +void dockable_detach_tab_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); + +void dockable_toggle_view_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); +void dockable_preview_size_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); +void dockable_tab_style_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); + +void dockable_toggle_image_menu_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); +void dockable_toggle_auto_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); +void dockable_change_screen_cmd_callback (GtkWidget *widget, + gpointer data, + guint action); + + +#endif /* __DOCKABLE_COMMANDS_H__ */ diff --git a/app/gui/edit-commands.c b/app/gui/edit-commands.c index c91bd63b5a..d199be2d6c 100644 --- a/app/gui/edit-commands.c +++ b/app/gui/edit-commands.c @@ -140,17 +140,10 @@ edit_copy_cmd_callback (GtkWidget *widget, gimp_image_flush (gimage); } -void -edit_paste_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +static void +edit_paste (GimpDisplay *gdisp, + gboolean paste_into) { - GimpDisplay *gdisp; - gboolean paste_into; - return_if_no_display (gdisp, data); - - paste_into = (gboolean) action; - if (gdisp->gimage->gimp->global_buffer) { GimpDisplayShell *shell; @@ -170,6 +163,26 @@ edit_paste_cmd_callback (GtkWidget *widget, } } +void +edit_paste_cmd_callback (GtkWidget *widget, + gpointer data) +{ + GimpDisplay *gdisp; + return_if_no_display (gdisp, data); + + edit_paste (gdisp, FALSE); +} + +void +edit_paste_into_cmd_callback (GtkWidget *widget, + gpointer data) +{ + GimpDisplay *gdisp; + return_if_no_display (gdisp, data); + + edit_paste (gdisp, TRUE); +} + void edit_paste_as_new_cmd_callback (GtkWidget *widget, gpointer data) diff --git a/app/gui/edit-commands.h b/app/gui/edit-commands.h index 28d1af4f88..a7d3913b91 100644 --- a/app/gui/edit-commands.h +++ b/app/gui/edit-commands.h @@ -29,8 +29,9 @@ void edit_cut_cmd_callback (GtkWidget *widget, void edit_copy_cmd_callback (GtkWidget *widget, gpointer data); void edit_paste_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); +void edit_paste_into_cmd_callback (GtkWidget *widget, + gpointer data); void edit_paste_as_new_cmd_callback (GtkWidget *widget, gpointer data); void edit_named_cut_cmd_callback (GtkWidget *widget, diff --git a/app/gui/image-menu.c b/app/gui/image-menu.c index a6f077dddf..18c75ea744 100644 --- a/app/gui/image-menu.c +++ b/app/gui/image-menu.c @@ -200,12 +200,12 @@ GimpItemFactoryEntry image_menu_entries[] = NULL, GIMP_HELP_EDIT_COPY, NULL }, { { N_("/Edit/_Paste"), "V", - edit_paste_cmd_callback, (guint) FALSE, + edit_paste_cmd_callback, 0, "", GTK_STOCK_PASTE }, NULL, GIMP_HELP_EDIT_PASTE, NULL }, { { N_("/Edit/Paste _Into"), NULL, - edit_paste_cmd_callback, (guint) TRUE, + edit_paste_into_cmd_callback, 0, "", GIMP_STOCK_PASTE_INTO }, NULL, GIMP_HELP_EDIT_PASTE_INTO, NULL }, diff --git a/app/gui/palette-editor-commands.c b/app/gui/palette-editor-commands.c index 5a030de51b..af522f9e73 100644 --- a/app/gui/palette-editor-commands.c +++ b/app/gui/palette-editor-commands.c @@ -33,8 +33,7 @@ void palette_editor_edit_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); @@ -43,21 +42,29 @@ palette_editor_edit_color_cmd_callback (GtkWidget *widget, } void -palette_editor_new_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) +palette_editor_new_color_fg_cmd_callback (GtkWidget *widget, + gpointer data) +{ + GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); + + if (GTK_WIDGET_SENSITIVE (editor->new_button)) + gimp_button_extended_clicked (GIMP_BUTTON (editor->new_button), 0); +} + +void +palette_editor_new_color_bg_cmd_callback (GtkWidget *widget, + gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); if (GTK_WIDGET_SENSITIVE (editor->new_button)) gimp_button_extended_clicked (GIMP_BUTTON (editor->new_button), - action ? GDK_CONTROL_MASK : 0); + GDK_CONTROL_MASK); } void palette_editor_delete_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); @@ -67,8 +74,7 @@ palette_editor_delete_color_cmd_callback (GtkWidget *widget, void palette_editor_zoom_in_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); @@ -78,8 +84,7 @@ palette_editor_zoom_in_cmd_callback (GtkWidget *widget, void palette_editor_zoom_out_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); @@ -89,8 +94,7 @@ palette_editor_zoom_out_cmd_callback (GtkWidget *widget, void palette_editor_zoom_all_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) + gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); diff --git a/app/gui/palette-editor-commands.h b/app/gui/palette-editor-commands.h index 9bedfe536e..dc106b9210 100644 --- a/app/gui/palette-editor-commands.h +++ b/app/gui/palette-editor-commands.h @@ -21,24 +21,20 @@ void palette_editor_edit_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void palette_editor_new_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); +void palette_editor_new_color_fg_cmd_callback (GtkWidget *widget, + gpointer data); +void palette_editor_new_color_bg_cmd_callback (GtkWidget *widget, + gpointer data); void palette_editor_delete_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); void palette_editor_zoom_in_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); void palette_editor_zoom_out_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); void palette_editor_zoom_all_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); + gpointer data); #endif /* __PALETTE_EDITOR_COMMANDS_H__ */ diff --git a/app/gui/palette-editor-menu.c b/app/gui/palette-editor-menu.c index 670e265445..29c463fc9f 100644 --- a/app/gui/palette-editor-menu.c +++ b/app/gui/palette-editor-menu.c @@ -46,12 +46,12 @@ GimpItemFactoryEntry palette_editor_menu_entries[] = MENU_SEPARATOR ("/---"), { { N_("/New Color from _FG"), "", - palette_editor_new_color_cmd_callback, 0, + palette_editor_new_color_fg_cmd_callback, 0, "", GTK_STOCK_NEW }, NULL, GIMP_HELP_PALETTE_EDITOR_NEW, NULL }, { { N_("/New Color from _BG"), "", - palette_editor_new_color_cmd_callback, TRUE, + palette_editor_new_color_bg_cmd_callback, 0, "", GTK_STOCK_NEW }, NULL, GIMP_HELP_PALETTE_EDITOR_NEW, NULL }, diff --git a/app/gui/vectors-commands.c b/app/gui/vectors-commands.c index 0d39f721d7..663b183c43 100644 --- a/app/gui/vectors-commands.c +++ b/app/gui/vectors-commands.c @@ -101,6 +101,18 @@ vectors_new_cmd_callback (GtkWidget *widget, vectors_new_vectors_query (gimage, NULL, TRUE, widget); } +void +vectors_raise_to_top_cmd_callback (GtkWidget *widget, + gpointer data) +{ + GimpImage *gimage; + GimpVectors *active_vectors; + return_if_no_vectors (gimage, active_vectors, data); + + gimp_image_raise_vectors_to_top (gimage, active_vectors); + gimp_image_flush (gimage); +} + void vectors_raise_cmd_callback (GtkWidget *widget, gpointer data) @@ -125,6 +137,18 @@ vectors_lower_cmd_callback (GtkWidget *widget, gimp_image_flush (gimage); } +void +vectors_lower_to_bottom_cmd_callback (GtkWidget *widget, + gpointer data) +{ + GimpImage *gimage; + GimpVectors *active_vectors; + return_if_no_vectors (gimage, active_vectors, data); + + gimp_image_lower_vectors_to_bottom (gimage, active_vectors); + gimp_image_flush (gimage); +} + void vectors_duplicate_cmd_callback (GtkWidget *widget, gpointer data) diff --git a/app/gui/vectors-commands.h b/app/gui/vectors-commands.h index f708a1d104..b31b04f502 100644 --- a/app/gui/vectors-commands.h +++ b/app/gui/vectors-commands.h @@ -24,8 +24,12 @@ void vectors_new_cmd_callback (GtkWidget *widget, gpointer data); void vectors_raise_cmd_callback (GtkWidget *widget, gpointer data); +void vectors_raise_to_top_cmd_callback (GtkWidget *widget, + gpointer data); void vectors_lower_cmd_callback (GtkWidget *widget, gpointer data); +void vectors_lower_to_bottom_cmd_callback (GtkWidget *widget, + gpointer data); void vectors_duplicate_cmd_callback (GtkWidget *widget, gpointer data); void vectors_delete_cmd_callback (GtkWidget *widget, diff --git a/app/menus/image-menu.c b/app/menus/image-menu.c index a6f077dddf..18c75ea744 100644 --- a/app/menus/image-menu.c +++ b/app/menus/image-menu.c @@ -200,12 +200,12 @@ GimpItemFactoryEntry image_menu_entries[] = NULL, GIMP_HELP_EDIT_COPY, NULL }, { { N_("/Edit/_Paste"), "V", - edit_paste_cmd_callback, (guint) FALSE, + edit_paste_cmd_callback, 0, "", GTK_STOCK_PASTE }, NULL, GIMP_HELP_EDIT_PASTE, NULL }, { { N_("/Edit/Paste _Into"), NULL, - edit_paste_cmd_callback, (guint) TRUE, + edit_paste_into_cmd_callback, 0, "", GIMP_STOCK_PASTE_INTO }, NULL, GIMP_HELP_EDIT_PASTE_INTO, NULL }, diff --git a/app/widgets/gimpactiongroup.c b/app/widgets/gimpactiongroup.c index dd40c9ecfe..323a6455c2 100644 --- a/app/widgets/gimpactiongroup.c +++ b/app/widgets/gimpactiongroup.c @@ -25,6 +25,8 @@ #include "widgets-types.h" +#include "core/gimp.h" + #include "gimpactiongroup.h" #include "gimpenumaction.h" #include "gimpstringaction.h" @@ -35,6 +37,7 @@ enum { PROP_0, + PROP_GIMP, PROP_TRANSLATION_DOMAIN }; @@ -95,6 +98,13 @@ gimp_action_group_class_init (GimpActionGroupClass *klass) object_class->set_property = gimp_action_group_set_property; object_class->get_property = gimp_action_group_get_property; + g_object_class_install_property (object_class, PROP_GIMP, + g_param_spec_object ("gimp", + NULL, NULL, + GIMP_TYPE_GIMP, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (object_class, PROP_TRANSLATION_DOMAIN, g_param_spec_string ("translation-domain", NULL, NULL, @@ -133,6 +143,9 @@ gimp_action_group_set_property (GObject *object, switch (prop_id) { + case PROP_GIMP: + group->gimp = g_value_get_object (value); + break; case PROP_TRANSLATION_DOMAIN: g_free (group->translation_domain); group->translation_domain = g_value_dup_string (value); @@ -153,6 +166,9 @@ gimp_action_group_get_property (GObject *object, switch (prop_id) { + case PROP_GIMP: + g_value_set_object (value, group->gimp); + break; case PROP_TRANSLATION_DOMAIN: g_value_set_string (value, group->translation_domain); break; @@ -173,9 +189,14 @@ gimp_action_group_get_property (GObject *object, * Returns: the new #GimpActionGroup */ GimpActionGroup * -gimp_action_group_new (const gchar *name) +gimp_action_group_new (Gimp *gimp, + const gchar *name) { + g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); + g_return_val_if_fail (name != NULL, NULL); + return g_object_new (GIMP_TYPE_ACTION_GROUP, + "gimp", gimp, "name", name, NULL); } @@ -369,3 +390,140 @@ gimp_action_group_add_string_actions (GimpActionGroup *group, g_object_unref (action); } } + +void +gimp_action_group_set_action_visible (GimpActionGroup *group, + const gchar *action_name, + gboolean visible) +{ + GtkAction *action; + + g_return_if_fail (GIMP_IS_ACTION_GROUP (group)); + g_return_if_fail (action_name != NULL); + + action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name); + + if (! action) + { + g_warning ("%s: Unable to set visibility of action " + "which doesn't exist: %s", + G_STRLOC, action_name); + return; + } + + g_object_set (action, "visible", visible, NULL); +} + +void +gimp_action_group_set_action_sensitive (GimpActionGroup *group, + const gchar *action_name, + gboolean sensitive) +{ + GtkAction *action; + + g_return_if_fail (GIMP_IS_ACTION_GROUP (group)); + g_return_if_fail (action_name != NULL); + + action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name); + + if (! action) + { + g_warning ("%s: Unable to set sensitivity of action " + "which doesn't exist: %s", + G_STRLOC, action_name); + return; + } + + g_object_set (action, "sensitive", sensitive, NULL); +} + +void +gimp_action_group_set_action_active (GimpActionGroup *group, + const gchar *action_name, + gboolean active) +{ + GtkAction *action; + + g_return_if_fail (GIMP_IS_ACTION_GROUP (group)); + g_return_if_fail (action_name != NULL); + + action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name); + + if (! action) + { + g_warning ("%s: Unable to set \"active\" of action " + "which doesn't exist: %s", + G_STRLOC, action_name); + return; + } + + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active); +} + +void +gimp_action_group_set_action_label (GimpActionGroup *group, + const gchar *action_name, + const gchar *label) +{ + GtkAction *action; + + g_return_if_fail (GIMP_IS_ACTION_GROUP (group)); + g_return_if_fail (action_name != NULL); + + action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name); + + if (! action) + { + g_warning ("%s: Unable to set label of action " + "which doesn't exist: %s", + G_STRLOC, action_name); + return; + } + + g_object_set (action, "label", label, NULL); +} + +void +gimp_action_group_set_action_color (GimpActionGroup *group, + const gchar *action_name, + const GimpRGB *color, + gboolean set_label) +{ + GtkAction *action; + + g_return_if_fail (GIMP_IS_ACTION_GROUP (group)); + g_return_if_fail (action_name != NULL); + + action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name); + + if (! action) + { + g_warning ("%s: Unable to set color of action " + "which doesn't exist: %s", + G_STRLOC, action_name); + return; + } +} + +void +gimp_action_group_set_action_important (GimpActionGroup *group, + const gchar *action_name, + gboolean is_important) +{ + GtkAction *action; + + g_return_if_fail (GIMP_IS_ACTION_GROUP (group)); + g_return_if_fail (action_name != NULL); + + action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name); + + if (! action) + { + g_warning ("%s: Unable to set \"is_important\" of action " + "which doesn't exist: %s", + G_STRLOC, action_name); + return; + } + + g_object_set (action, "is-important", is_important, NULL); +} diff --git a/app/widgets/gimpactiongroup.h b/app/widgets/gimpactiongroup.h index fe088a749b..f2aac1a909 100644 --- a/app/widgets/gimpactiongroup.h +++ b/app/widgets/gimpactiongroup.h @@ -39,6 +39,7 @@ struct _GimpActionGroup { GtkActionGroup parent_instance; + Gimp *gimp; gchar *translation_domain; }; @@ -110,33 +111,54 @@ struct _GimpStringActionEntry GType gimp_action_group_get_type (void); -GimpActionGroup *gimp_action_group_new (const gchar *name); +GimpActionGroup *gimp_action_group_new (Gimp *gimp, + const gchar *name); -void gimp_action_group_add_actions (GimpActionGroup *action_group, +void gimp_action_group_add_actions (GimpActionGroup *group, GimpActionEntry *entries, guint n_entries, gpointer user_data); -void gimp_action_group_add_toggle_actions (GimpActionGroup *action_group, +void gimp_action_group_add_toggle_actions (GimpActionGroup *group, GimpToggleActionEntry *entries, guint n_entries, gpointer user_data); -void gimp_action_group_add_radio_actions (GimpActionGroup *action_group, +void gimp_action_group_add_radio_actions (GimpActionGroup *group, GimpRadioActionEntry *entries, guint n_entries, gint value, GCallback on_change, gpointer user_data); -void gimp_action_group_add_enum_actions (GimpActionGroup *action_group, +void gimp_action_group_add_enum_actions (GimpActionGroup *group, GimpEnumActionEntry *entries, guint n_entries, GCallback callback, gpointer user_data); -void gimp_action_group_add_string_actions (GimpActionGroup *action_group, +void gimp_action_group_add_string_actions (GimpActionGroup *group, GimpStringActionEntry *entries, guint n_entries, GCallback callback, gpointer user_data); +void gimp_action_group_set_action_visible (GimpActionGroup *group, + const gchar *action_name, + gboolean visible); +void gimp_action_group_set_action_sensitive (GimpActionGroup *group, + const gchar *action_name, + gboolean sensitive); +void gimp_action_group_set_action_active (GimpActionGroup *group, + const gchar *action_name, + gboolean active); +void gimp_action_group_set_action_label (GimpActionGroup *group, + const gchar *action_name, + const gchar *label); +void gimp_action_group_set_action_color (GimpActionGroup *group, + const gchar *action_name, + const GimpRGB *color, + gboolean set_label); +void gimp_action_group_set_action_important (GimpActionGroup *group, + const gchar *action_name, + gboolean is_important); + #endif /* __GIMP_ACTION_GROUP_H__ */ diff --git a/app/widgets/widgets-types.h b/app/widgets/widgets-types.h index d764fa7270..f6b0e2b3be 100644 --- a/app/widgets/widgets-types.h +++ b/app/widgets/widgets-types.h @@ -31,7 +31,6 @@ typedef struct _GimpDeviceInfo GimpDeviceInfo; typedef struct _GimpDialogFactory GimpDialogFactory; -typedef struct _GimpItemFactory GimpItemFactory; typedef struct _GimpMenuFactory GimpMenuFactory; typedef struct _GimpActionGroup GimpActionGroup; @@ -135,8 +134,6 @@ typedef struct _GimpToggleActionEntry GimpToggleActionEntry; typedef struct _GimpRadioActionEntry GimpRadioActionEntry; typedef struct _GimpEnumActionEntry GimpEnumActionEntry; typedef struct _GimpStringActionEntry GimpStringActionEntry; - -typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry; typedef struct _GimpDialogFactoryEntry GimpDialogFactoryEntry; typedef struct _GimpSessionInfo GimpSessionInfo; typedef struct _GimpSessionInfoBook GimpSessionInfoBook; @@ -146,10 +143,10 @@ typedef struct _GimpSessionInfoAux GimpSessionInfoAux; /* function types */ -typedef void (* GimpItemFactorySetupFunc) (GimpItemFactory *factory, - gpointer callback_data); -typedef void (* GimpItemFactoryUpdateFunc) (GtkItemFactory *factory, - gpointer update_data); +typedef void (* GimpActionGroupSetupFunc) (GimpActionGroup *factory, + gpointer data); +typedef void (* GimpActionGroupUpdateFunc) (GimpActionGroup *factory, + gpointer data); typedef void (* GimpMenuPositionFunc) (GtkMenu *menu, gint *x, @@ -162,4 +159,15 @@ typedef void (* GimpSelectionToVectorsFunc) (GimpImage *gimage, gboolean advanced); +/* deprecated stuff, to be removed */ + +typedef struct _GimpItemFactory GimpItemFactory; +typedef struct _GimpItemFactoryEntry GimpItemFactoryEntry; + +typedef void (* GimpItemFactorySetupFunc) (GimpItemFactory *factory, + gpointer callback_data); +typedef void (* GimpItemFactoryUpdateFunc) (GtkItemFactory *factory, + gpointer update_data); + + #endif /* __WIDGETS_TYPES_H__ */ diff --git a/configure.in b/configure.in index 66512f698c..51883b5f49 100644 --- a/configure.in +++ b/configure.in @@ -1493,6 +1493,7 @@ libgimpmodule/Makefile libgimpthumb/Makefile libgimpwidgets/Makefile app/Makefile +app/actions/Makefile app/base/Makefile app/config/Makefile app/core/Makefile @@ -1572,6 +1573,7 @@ devel-docs/libgimpthumb/version devel-docs/libgimpwidgets/Makefile devel-docs/libgimpwidgets/version docs/Makefile +menus/Makefile tips/Makefile cursors/Makefile themes/Makefile diff --git a/menus/.cvsignore b/menus/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/menus/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/menus/Makefile.am b/menus/Makefile.am new file mode 100644 index 0000000000..63acd5b6e5 --- /dev/null +++ b/menus/Makefile.am @@ -0,0 +1,25 @@ +## Makefile.am for gimp/menus + +menudatadir = $(gimpdatadir)/menus + +menudata_DATA = \ + brushes-menu.xml \ + buffers-menu.xml \ + channels-menu.xml \ + colormap-editor-menu.xml \ + dockable-menu.xml \ + documents-menu.xml \ + error-console-menu.xml \ + fonts-menu.xml \ + gradient-editor-menu.xml \ + gradients-menu.xml \ + images-menu.xml \ + layers-menu.xml \ + palette-editor-menu.xml \ + palettes-menu.xml \ + patterns-menu.xml \ + qmask-menu.xml \ + templates-menu.xml \ + vectors-menu.xml + +EXTRA_DIST = $(menudata_DATA) diff --git a/menus/brushes-menu.xml b/menus/brushes-menu.xml new file mode 100644 index 0000000000..1ac5ec8fd1 --- /dev/null +++ b/menus/brushes-menu.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/menus/buffers-menu.xml b/menus/buffers-menu.xml new file mode 100644 index 0000000000..0129b7371d --- /dev/null +++ b/menus/buffers-menu.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/menus/channels-menu.xml b/menus/channels-menu.xml new file mode 100644 index 0000000000..4df27b89f3 --- /dev/null +++ b/menus/channels-menu.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/menus/colormap-editor-menu.xml b/menus/colormap-editor-menu.xml new file mode 100644 index 0000000000..95fb4ea759 --- /dev/null +++ b/menus/colormap-editor-menu.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/menus/colormap-menu.xml b/menus/colormap-menu.xml new file mode 100644 index 0000000000..95fb4ea759 --- /dev/null +++ b/menus/colormap-menu.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/menus/dockable-menu.xml b/menus/dockable-menu.xml new file mode 100644 index 0000000000..b6b1b50d86 --- /dev/null +++ b/menus/dockable-menu.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/menus/documents-menu.xml b/menus/documents-menu.xml new file mode 100644 index 0000000000..ff54445e48 --- /dev/null +++ b/menus/documents-menu.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/menus/error-console-menu.xml b/menus/error-console-menu.xml new file mode 100644 index 0000000000..dd542a1e76 --- /dev/null +++ b/menus/error-console-menu.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/menus/fonts-menu.xml b/menus/fonts-menu.xml new file mode 100644 index 0000000000..924b88fe88 --- /dev/null +++ b/menus/fonts-menu.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/menus/gradient-editor-menu.xml b/menus/gradient-editor-menu.xml new file mode 100644 index 0000000000..7b493d92c2 --- /dev/null +++ b/menus/gradient-editor-menu.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/menus/gradients-menu.xml b/menus/gradients-menu.xml new file mode 100644 index 0000000000..bdd705ef51 --- /dev/null +++ b/menus/gradients-menu.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/menus/images-menu.xml b/menus/images-menu.xml new file mode 100644 index 0000000000..0975c6fb85 --- /dev/null +++ b/menus/images-menu.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/menus/layers-menu.xml b/menus/layers-menu.xml new file mode 100644 index 0000000000..ec8f9b172f --- /dev/null +++ b/menus/layers-menu.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/menus/palette-editor-menu.xml b/menus/palette-editor-menu.xml new file mode 100644 index 0000000000..04bbb3ff04 --- /dev/null +++ b/menus/palette-editor-menu.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/menus/palettes-menu.xml b/menus/palettes-menu.xml new file mode 100644 index 0000000000..f31b9f532e --- /dev/null +++ b/menus/palettes-menu.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/menus/patterns-menu.xml b/menus/patterns-menu.xml new file mode 100644 index 0000000000..31e2266caa --- /dev/null +++ b/menus/patterns-menu.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/menus/qmask-menu.xml b/menus/qmask-menu.xml new file mode 100644 index 0000000000..aa254bed33 --- /dev/null +++ b/menus/qmask-menu.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/menus/templates-menu.xml b/menus/templates-menu.xml new file mode 100644 index 0000000000..68304d8b5a --- /dev/null +++ b/menus/templates-menu.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/menus/vectors-menu.xml b/menus/vectors-menu.xml new file mode 100644 index 0000000000..125dbe3ba3 --- /dev/null +++ b/menus/vectors-menu.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +