diff --git a/ChangeLog b/ChangeLog index f357aab17c..a38d8cbf72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2004-04-20 Michael Natterer + + * app/gui/*-commands.[ch]: removed... + + * app/actions/*-commands.[ch]: ...and added here. + + * app/gui/Makefile.am + * app/gui/*-menu.c + * app/gui/dialogs-constructors.c + * app/gui/gui.c + * app/gui/menus.c + * app/actions/Makefile.am + * app/actions/*-actions.c: changed accordingly. + + * app/actions/plug-in-actions.[ch] + * app/actions/tools-actions.[ch]: new files. + + * app/Makefile.am: had to add more -u evilness because gui/ + and actions/ have cyclic dependencies. + + * menus/image-menu.xml: added some more items. + 2004-04-20 Sven Neumann * app/widgets/gimpwidgets-constructors.[ch]: added new function diff --git a/app/Makefile.am b/app/Makefile.am index 8376ef1d91..4b6ae91167 100644 --- a/app/Makefile.am +++ b/app/Makefile.am @@ -76,10 +76,22 @@ INCLUDES = \ -I$(includedir) gimp_2_1_LDFLAGS = \ - $(mwindows) \ - -u $(SYMPREFIX)gimp_container_filter \ - -u $(SYMPREFIX)gimp_xml_parser_new \ - -u $(SYMPREFIX)gimp_drawable_stroke_vectors + $(mwindows) \ + -u $(SYMPREFIX)gimp_container_filter \ + -u $(SYMPREFIX)gimp_xml_parser_new \ + -u $(SYMPREFIX)gimp_drawable_stroke_vectors \ + \ + -u $(SYMPREFIX)convert_to_indexed \ + -u $(SYMPREFIX)grid_dialog_new \ + -u $(SYMPREFIX)info_dialog_new \ + -u $(SYMPREFIX)info_window_create \ + -u $(SYMPREFIX)offset_dialog_create \ + -u $(SYMPREFIX)palette_import_dialog_show \ + -u $(SYMPREFIX)resize_widget_new \ + -u $(SYMPREFIX)stroke_dialog_new \ + -u $(SYMPREFIX)file_open_dialog_show \ + -u $(SYMPREFIX)file_save_dialog_show \ + -u $(SYMPREFIX)color_notebook_new gimp_2_1_LDADD = \ config/libappconfig.a \ diff --git a/app/actions/Makefile.am b/app/actions/Makefile.am index 6773047c61..f4c6f781f2 100644 --- a/app/actions/Makefile.am +++ b/app/actions/Makefile.am @@ -9,58 +9,120 @@ libappactions_a_SOURCES = \ brushes-actions.h \ buffers-actions.c \ buffers-actions.h \ + buffers-commands.c \ + buffers-commands.h \ channels-actions.c \ channels-actions.h \ + channels-commands.c \ + channels-commands.h \ colormap-editor-actions.c \ colormap-editor-actions.h \ + colormap-editor-commands.c \ + colormap-editor-commands.h \ + data-commands.c \ + data-commands.h \ debug-actions.c \ debug-actions.h \ + debug-commands.c \ + debug-commands.h \ dialogs-actions.c \ dialogs-actions.h \ + dialogs-commands.c \ + dialogs-commands.h \ dockable-actions.c \ dockable-actions.h \ + dockable-commands.c \ + dockable-commands.h \ documents-actions.c \ documents-actions.h \ + documents-commands.c \ + documents-commands.h \ drawable-actions.c \ drawable-actions.h \ + drawable-commands.c \ + drawable-commands.h \ edit-actions.c \ edit-actions.h \ + edit-commands.c \ + edit-commands.h \ error-console-actions.c \ error-console-actions.h \ + error-console-commands.c \ + error-console-commands.h \ file-actions.c \ file-actions.h \ + file-commands.c \ + file-commands.h \ fonts-actions.c \ fonts-actions.h \ + fonts-commands.c \ + fonts-commands.h \ gradient-editor-actions.c \ gradient-editor-actions.h \ + gradient-editor-commands.c \ + gradient-editor-commands.h \ gradients-actions.c \ gradients-actions.h \ + gradients-commands.c \ + gradients-commands.h \ help-actions.c \ help-actions.h \ + help-commands.c \ + help-commands.h \ image-actions.c \ image-actions.h \ + image-commands.c \ + image-commands.h \ images-actions.c \ images-actions.h \ + images-commands.c \ + images-commands.h \ layers-actions.c \ layers-actions.h \ + layers-commands.c \ + layers-commands.h \ palette-editor-actions.c \ palette-editor-actions.h \ + palette-editor-commands.c \ + palette-editor-commands.h \ palettes-actions.c \ palettes-actions.h \ + palettes-commands.c \ + palettes-commands.h \ patterns-actions.c \ patterns-actions.h \ + plug-in-actions.c \ + plug-in-actions.h \ + plug-in-commands.c \ + plug-in-commands.h \ qmask-actions.c \ qmask-actions.h \ + qmask-commands.c \ + qmask-commands.h \ select-actions.c \ select-actions.h \ + select-commands.c \ + select-commands.h \ templates-actions.c \ templates-actions.h \ + templates-commands.c \ + templates-commands.h \ tool-options-actions.c \ tool-options-actions.h \ + tool-options-commands.c \ + tool-options-commands.h \ + tools-actions.c \ + tools-actions.h \ + tools-commands.c \ + tools-commands.h \ vectors-actions.c \ vectors-actions.h \ + vectors-commands.c \ + vectors-commands.h \ view-actions.c \ - view-actions.h + view-actions.h \ + view-commands.c \ + view-commands.h EXTRA_DIST = makefile.msc diff --git a/app/actions/brushes-actions.c b/app/actions/brushes-actions.c index 6e27c5f9a3..91ba87ecd2 100644 --- a/app/actions/brushes-actions.c +++ b/app/actions/brushes-actions.c @@ -34,7 +34,7 @@ #include "widgets/gimphelp-ids.h" #include "brushes-actions.h" -#include "gui/data-commands.h" +#include "data-commands.h" #include "gimp-intl.h" diff --git a/app/actions/buffers-actions.c b/app/actions/buffers-actions.c index c940500a4e..98b6a524b1 100644 --- a/app/actions/buffers-actions.c +++ b/app/actions/buffers-actions.c @@ -32,7 +32,7 @@ #include "widgets/gimphelp-ids.h" #include "buffers-actions.h" -#include "gui/buffers-commands.h" +#include "buffers-commands.h" #include "gimp-intl.h" diff --git a/app/actions/buffers-commands.c b/app/actions/buffers-commands.c index 5624f6c413..e09d0242cd 100644 --- a/app/actions/buffers-commands.c +++ b/app/actions/buffers-commands.c @@ -20,7 +20,7 @@ #include -#include "gui-types.h" +#include "actions-types.h" #include "widgets/gimpbufferview.h" diff --git a/app/actions/channels-actions.c b/app/actions/channels-actions.c index 64f9198982..12d03f24e5 100644 --- a/app/actions/channels-actions.c +++ b/app/actions/channels-actions.c @@ -33,7 +33,7 @@ #include "widgets/gimpitemtreeview.h" #include "channels-actions.h" -#include "gui/channels-commands.h" +#include "channels-commands.h" #include "gimp-intl.h" diff --git a/app/actions/channels-commands.c b/app/actions/channels-commands.c index a1481b6168..08fc3aa102 100644 --- a/app/actions/channels-commands.c +++ b/app/actions/channels-commands.c @@ -25,7 +25,7 @@ #include "libgimpcolor/gimpcolor.h" #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "core/gimp.h" #include "core/gimpchannel.h" diff --git a/app/actions/colormap-actions.c b/app/actions/colormap-actions.c index 2a7f8e2eb0..ef506aaf73 100644 --- a/app/actions/colormap-actions.c +++ b/app/actions/colormap-actions.c @@ -31,7 +31,7 @@ #include "widgets/gimphelp-ids.h" #include "colormap-editor-actions.h" -#include "gui/colormap-editor-commands.h" +#include "colormap-editor-commands.h" #include "gimp-intl.h" diff --git a/app/actions/colormap-commands.c b/app/actions/colormap-commands.c index 04b219df35..c8c72c896d 100644 --- a/app/actions/colormap-commands.c +++ b/app/actions/colormap-commands.c @@ -22,7 +22,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "widgets/gimpcolormapeditor.h" diff --git a/app/actions/colormap-editor-actions.c b/app/actions/colormap-editor-actions.c index 2a7f8e2eb0..ef506aaf73 100644 --- a/app/actions/colormap-editor-actions.c +++ b/app/actions/colormap-editor-actions.c @@ -31,7 +31,7 @@ #include "widgets/gimphelp-ids.h" #include "colormap-editor-actions.h" -#include "gui/colormap-editor-commands.h" +#include "colormap-editor-commands.h" #include "gimp-intl.h" diff --git a/app/actions/colormap-editor-commands.c b/app/actions/colormap-editor-commands.c index 04b219df35..c8c72c896d 100644 --- a/app/actions/colormap-editor-commands.c +++ b/app/actions/colormap-editor-commands.c @@ -22,7 +22,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "widgets/gimpcolormapeditor.h" diff --git a/app/actions/data-commands.c b/app/actions/data-commands.c index 5f34c03d91..03a6cd3774 100644 --- a/app/actions/data-commands.c +++ b/app/actions/data-commands.c @@ -20,7 +20,7 @@ #include -#include "gui-types.h" +#include "actions-types.h" #include "widgets/gimpdatafactoryview.h" diff --git a/app/actions/debug-actions.c b/app/actions/debug-actions.c index 7fc158f716..c49298030d 100644 --- a/app/actions/debug-actions.c +++ b/app/actions/debug-actions.c @@ -27,7 +27,7 @@ #include "widgets/gimpactiongroup.h" #include "debug-actions.h" -#include "gui/debug-commands.h" +#include "debug-commands.h" static GimpActionEntry debug_actions[] = diff --git a/app/actions/debug-commands.c b/app/actions/debug-commands.c index 8bae029761..57490af44b 100644 --- a/app/actions/debug-commands.c +++ b/app/actions/debug-commands.c @@ -24,7 +24,7 @@ #include "libgimpbase/gimpbase.h" -#include "gui-types.h" +#include "actions-types.h" #include "core/gimpobject.h" @@ -32,7 +32,7 @@ #include "widgets/gimpmenufactory.h" #include "debug-commands.h" -#include "menus.h" +#include "gui/menus.h" #ifdef ENABLE_DEBUG_MENU diff --git a/app/actions/dialogs-actions.c b/app/actions/dialogs-actions.c index 2f5cb8599f..213cbd5de5 100644 --- a/app/actions/dialogs-actions.c +++ b/app/actions/dialogs-actions.c @@ -28,7 +28,7 @@ #include "widgets/gimphelp-ids.h" #include "dialogs-actions.h" -#include "gui/dialogs-commands.h" +#include "dialogs-commands.h" #include "gimp-intl.h" diff --git a/app/actions/dialogs-commands.c b/app/actions/dialogs-commands.c index 9d8cbc491f..42f561528b 100644 --- a/app/actions/dialogs-commands.c +++ b/app/actions/dialogs-commands.c @@ -24,14 +24,14 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "widgets/gimpdialogfactory.h" #include "widgets/gimpdockable.h" #include "widgets/gimpdockbook.h" #include "widgets/gimpimagedock.h" -#include "dialogs.h" +#include "gui/dialogs.h" #include "dialogs-commands.h" diff --git a/app/actions/dockable-actions.c b/app/actions/dockable-actions.c index c7574f4ea7..78ca240ce1 100644 --- a/app/actions/dockable-actions.c +++ b/app/actions/dockable-actions.c @@ -38,7 +38,7 @@ #include "dialogs-actions.h" #include "dockable-actions.h" -#include "gui/dockable-commands.h" +#include "dockable-commands.h" #include "gimp-intl.h" diff --git a/app/actions/dockable-commands.c b/app/actions/dockable-commands.c index e0b25f7f57..04962106f1 100644 --- a/app/actions/dockable-commands.c +++ b/app/actions/dockable-commands.c @@ -24,7 +24,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "widgets/gimpcontainerview.h" #include "widgets/gimpcontainerview-utils.h" @@ -34,7 +34,7 @@ #include "widgets/gimpimagedock.h" #include "widgets/gimpsessioninfo.h" -#include "dialogs.h" +#include "gui/dialogs.h" #include "dockable-commands.h" diff --git a/app/actions/documents-actions.c b/app/actions/documents-actions.c index d931f5338f..d3196e38ca 100644 --- a/app/actions/documents-actions.c +++ b/app/actions/documents-actions.c @@ -32,7 +32,7 @@ #include "widgets/gimphelp-ids.h" #include "documents-actions.h" -#include "gui/documents-commands.h" +#include "documents-commands.h" #include "gimp-intl.h" diff --git a/app/actions/documents-commands.c b/app/actions/documents-commands.c index 58781da241..d043c0a405 100644 --- a/app/actions/documents-commands.c +++ b/app/actions/documents-commands.c @@ -22,7 +22,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "widgets/gimpdocumentview.h" diff --git a/app/actions/drawable-actions.c b/app/actions/drawable-actions.c index 1de0dd8c5f..cbd8a78db9 100644 --- a/app/actions/drawable-actions.c +++ b/app/actions/drawable-actions.c @@ -37,7 +37,7 @@ #include "display/gimpdisplayshell.h" #include "drawable-actions.h" -#include "gui/drawable-commands.h" +#include "drawable-commands.h" #include "gimp-intl.h" diff --git a/app/actions/drawable-commands.c b/app/actions/drawable-commands.c index 85c89468a4..061be6b10b 100644 --- a/app/actions/drawable-commands.c +++ b/app/actions/drawable-commands.c @@ -24,7 +24,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "core/gimp.h" #include "core/gimpcontext.h" @@ -42,7 +42,7 @@ #include "display/gimpdisplay.h" #include "drawable-commands.h" -#include "offset-dialog.h" +#include "gui/offset-dialog.h" #include "gimp-intl.h" diff --git a/app/actions/edit-actions.c b/app/actions/edit-actions.c index fb6ede0935..a81a172072 100644 --- a/app/actions/edit-actions.c +++ b/app/actions/edit-actions.c @@ -42,7 +42,7 @@ #include "display/gimpdisplayshell-selection.h" #include "edit-actions.h" -#include "gui/edit-commands.h" +#include "edit-commands.h" #include "gimp-intl.h" diff --git a/app/actions/edit-commands.c b/app/actions/edit-commands.c index d199be2d6c..196d2678d9 100644 --- a/app/actions/edit-commands.c +++ b/app/actions/edit-commands.c @@ -24,7 +24,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "core/gimp.h" #include "core/gimp-edit.h" @@ -44,9 +44,10 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpdialogfactory.h" -#include "dialogs.h" +#include "gui/dialogs.h" +#include "gui/stroke-dialog.h" + #include "edit-commands.h" -#include "stroke-dialog.h" #include "gimp-intl.h" diff --git a/app/actions/error-console-actions.c b/app/actions/error-console-actions.c index 6bf7ba8d60..df55376417 100644 --- a/app/actions/error-console-actions.c +++ b/app/actions/error-console-actions.c @@ -29,7 +29,7 @@ #include "widgets/gimphelp-ids.h" #include "error-console-actions.h" -#include "gui/error-console-commands.h" +#include "error-console-commands.h" #include "gimp-intl.h" diff --git a/app/actions/error-console-commands.c b/app/actions/error-console-commands.c index ead24bb3c5..4a3e48d7a4 100644 --- a/app/actions/error-console-commands.c +++ b/app/actions/error-console-commands.c @@ -22,7 +22,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "widgets/gimperrorconsole.h" diff --git a/app/actions/file-actions.c b/app/actions/file-actions.c index e9afb068dc..3cab9add93 100644 --- a/app/actions/file-actions.c +++ b/app/actions/file-actions.c @@ -39,7 +39,7 @@ #include "display/gimpdisplayshell.h" #include "file-actions.h" -#include "gui/file-commands.h" +#include "file-commands.h" #include "gimp-intl.h" diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c index 3b5e0c29b3..c81cefb1a6 100644 --- a/app/actions/file-commands.c +++ b/app/actions/file-commands.c @@ -24,7 +24,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "config/gimpguiconfig.h" @@ -48,12 +48,13 @@ #include "display/gimpdisplay-foreach.h" #include "display/gimpdisplayshell.h" -#include "dialogs.h" +#include "gui/dialogs.h" +#include "gui/file-new-dialog.h" +#include "gui/file-open-dialog.h" +#include "gui/file-save-dialog.h" +#include "gui/menus.h" + #include "file-commands.h" -#include "file-new-dialog.h" -#include "file-open-dialog.h" -#include "file-save-dialog.h" -#include "menus.h" #include "gimp-intl.h" diff --git a/app/actions/fonts-actions.c b/app/actions/fonts-actions.c index 57abce5321..38f6d90f02 100644 --- a/app/actions/fonts-actions.c +++ b/app/actions/fonts-actions.c @@ -34,7 +34,7 @@ #include "widgets/gimphelp-ids.h" #include "fonts-actions.h" -#include "gui/fonts-commands.h" +#include "fonts-commands.h" #include "gimp-intl.h" diff --git a/app/actions/fonts-commands.c b/app/actions/fonts-commands.c index eed9cf5fa8..2671f8e999 100644 --- a/app/actions/fonts-commands.c +++ b/app/actions/fonts-commands.c @@ -20,7 +20,7 @@ #include -#include "gui-types.h" +#include "actions-types.h" #include "widgets/gimpfontview.h" diff --git a/app/actions/gradient-editor-actions.c b/app/actions/gradient-editor-actions.c index eb649f4b53..d5a60dcc4a 100644 --- a/app/actions/gradient-editor-actions.c +++ b/app/actions/gradient-editor-actions.c @@ -35,7 +35,7 @@ #include "widgets/gimphelp-ids.h" #include "gradient-editor-actions.h" -#include "gui/gradient-editor-commands.h" +#include "gradient-editor-commands.h" #include "gimp-intl.h" diff --git a/app/actions/gradient-editor-commands.c b/app/actions/gradient-editor-commands.c index 7283dd7fe7..a329c4d50c 100644 --- a/app/actions/gradient-editor-commands.c +++ b/app/actions/gradient-editor-commands.c @@ -22,7 +22,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "core/gimp.h" #include "core/gimpcontext.h" @@ -33,8 +33,9 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpviewabledialog.h" -#include "color-notebook.h" -#include "dialogs.h" +#include "gui/color-notebook.h" +#include "gui/dialogs.h" + #include "gradient-editor-commands.h" #include "gimp-intl.h" diff --git a/app/actions/gradients-actions.c b/app/actions/gradients-actions.c index 1b048a78f1..9916bbd0b6 100644 --- a/app/actions/gradients-actions.c +++ b/app/actions/gradients-actions.c @@ -33,9 +33,9 @@ #include "widgets/gimpdatafactoryview.h" #include "widgets/gimphelp-ids.h" -#include "gui/data-commands.h" +#include "data-commands.h" #include "gradients-actions.h" -#include "gui/gradients-commands.h" +#include "gradients-commands.h" #include "gimp-intl.h" diff --git a/app/actions/gradients-commands.c b/app/actions/gradients-commands.c index 4de312dac4..0fc2040b7a 100644 --- a/app/actions/gradients-commands.c +++ b/app/actions/gradients-commands.c @@ -22,7 +22,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "core/gimpgradient.h" #include "core/gimpcontext.h" diff --git a/app/actions/help-actions.c b/app/actions/help-actions.c index dfefeb7af0..219e395aff 100644 --- a/app/actions/help-actions.c +++ b/app/actions/help-actions.c @@ -28,7 +28,7 @@ #include "widgets/gimphelp-ids.h" #include "help-actions.h" -#include "gui/help-commands.h" +#include "help-commands.h" #include "gimp-intl.h" diff --git a/app/actions/help-commands.c b/app/actions/help-commands.c index 30c2ba6d9d..b13d892974 100644 --- a/app/actions/help-commands.c +++ b/app/actions/help-commands.c @@ -22,7 +22,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "help-commands.h" diff --git a/app/actions/image-actions.c b/app/actions/image-actions.c index ac76a5dba1..7520d4f838 100644 --- a/app/actions/image-actions.c +++ b/app/actions/image-actions.c @@ -38,7 +38,7 @@ #include "display/gimpdisplayshell.h" #include "image-actions.h" -#include "gui/image-commands.h" +#include "image-commands.h" #include "gimp-intl.h" diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c index f1d9cec0a4..a4321bf5b3 100644 --- a/app/actions/image-commands.c +++ b/app/actions/image-commands.c @@ -23,7 +23,7 @@ #include "libgimpbase/gimputils.h" #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "config/gimpguiconfig.h" @@ -49,10 +49,11 @@ #include "display/gimpdisplayshell.h" #include "display/gimpprogress.h" -#include "convert-dialog.h" +#include "gui/convert-dialog.h" +#include "gui/grid-dialog.h" +#include "gui/resize-dialog.h" + #include "image-commands.h" -#include "grid-dialog.h" -#include "resize-dialog.h" #include "gimp-intl.h" diff --git a/app/actions/images-actions.c b/app/actions/images-actions.c index c02dce0247..6124b46ab2 100644 --- a/app/actions/images-actions.c +++ b/app/actions/images-actions.c @@ -32,7 +32,7 @@ #include "widgets/gimpcontainerview.h" #include "images-actions.h" -#include "gui/images-commands.h" +#include "images-commands.h" #include "gimp-intl.h" diff --git a/app/actions/images-commands.c b/app/actions/images-commands.c index fd9cd42caf..473c2ecbe9 100644 --- a/app/actions/images-commands.c +++ b/app/actions/images-commands.c @@ -20,7 +20,7 @@ #include -#include "gui-types.h" +#include "actions-types.h" #include "core/gimp.h" #include "core/gimpimage.h" diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c index 02a05b349e..352e632d94 100644 --- a/app/actions/layers-actions.c +++ b/app/actions/layers-actions.c @@ -38,7 +38,7 @@ #include "display/gimpdisplayshell.h" #include "layers-actions.h" -#include "gui/layers-commands.h" +#include "layers-commands.h" #include "gimp-intl.h" diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c index f641c9483f..e805a32bbb 100644 --- a/app/actions/layers-commands.c +++ b/app/actions/layers-commands.c @@ -26,7 +26,7 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "core/gimp.h" #include "core/gimpchannel-select.h" @@ -58,9 +58,10 @@ #include "tools/gimptexttool.h" #include "tools/tool_manager.h" +#include "gui/resize-dialog.h" + #include "layers-commands.h" #include "image-commands.h" -#include "resize-dialog.h" #include "gimp-intl.h" diff --git a/app/actions/palette-editor-actions.c b/app/actions/palette-editor-actions.c index 4007314a14..e253401bc3 100644 --- a/app/actions/palette-editor-actions.c +++ b/app/actions/palette-editor-actions.c @@ -29,7 +29,7 @@ #include "widgets/gimppaletteeditor.h" #include "palette-editor-actions.h" -#include "gui/palette-editor-commands.h" +#include "palette-editor-commands.h" #include "gimp-intl.h" diff --git a/app/actions/palette-editor-commands.c b/app/actions/palette-editor-commands.c index af522f9e73..7fc20f02c9 100644 --- a/app/actions/palette-editor-commands.c +++ b/app/actions/palette-editor-commands.c @@ -22,7 +22,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "widgets/gimppaletteeditor.h" diff --git a/app/actions/palettes-actions.c b/app/actions/palettes-actions.c index 95835e4e59..956850e5f0 100644 --- a/app/actions/palettes-actions.c +++ b/app/actions/palettes-actions.c @@ -33,9 +33,9 @@ #include "widgets/gimpdatafactoryview.h" #include "widgets/gimphelp-ids.h" -#include "gui/data-commands.h" +#include "data-commands.h" #include "palettes-actions.h" -#include "gui/palettes-commands.h" +#include "palettes-commands.h" #include "gimp-intl.h" diff --git a/app/actions/palettes-commands.c b/app/actions/palettes-commands.c index 22d2d5e36b..a2bb6517eb 100644 --- a/app/actions/palettes-commands.c +++ b/app/actions/palettes-commands.c @@ -22,7 +22,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "core/gimppalette.h" #include "core/gimpcontainer.h" @@ -33,7 +33,8 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimppreview.h" -#include "palette-import-dialog.h" +#include "gui/palette-import-dialog.h" + #include "palettes-commands.h" #include "gimp-intl.h" diff --git a/app/actions/patterns-actions.c b/app/actions/patterns-actions.c index 057f927ebe..4742adfb95 100644 --- a/app/actions/patterns-actions.c +++ b/app/actions/patterns-actions.c @@ -33,7 +33,7 @@ #include "widgets/gimpdatafactoryview.h" #include "widgets/gimphelp-ids.h" -#include "gui/data-commands.h" +#include "data-commands.h" #include "patterns-actions.h" #include "gimp-intl.h" diff --git a/app/actions/plug-in-actions.c b/app/actions/plug-in-actions.c new file mode 100644 index 0000000000..56a3665aa4 --- /dev/null +++ b/app/actions/plug-in-actions.c @@ -0,0 +1,109 @@ +/* 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 "plug-in/plug-ins.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" + +#include "display/gimpdisplay.h" +#include "display/gimpdisplayshell.h" + +#include "plug-in-actions.h" +#include "plug-in-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry plug_in_actions[] = +{ + { "plug-in-menu", NULL, N_("/Filte_rs") }, + { "plug-in-blur-menu", NULL, N_("_Blur") }, + { "plug-in-colors-menu", NULL, N_("_Colors") }, + { "plug-in-colors-map-menu", NULL, N_("Ma_p") }, + { "plug-in-noise-menu", NULL, N_("_Noise") }, + { "pluf-in-edge-detect-menu", NULL, N_("Edge-De_tect") }, + { "plug-in-enhance-menu", NULL, N_("En_hance") }, + { "plug-in-generic-menu", NULL, N_("_Generic") }, + { "plug-in-glass-effects-menu", NULL, N_("Gla_ss Effects") }, + { "plug-in-light-effects-menu", NULL, N_("_Light Effects") }, + { "plug-in-distorts-menu", NULL, N_("_Distorts") }, + { "plug-in-artistic-menu", NULL, N_("_Artistic") }, + { "plug-in-map-menu", NULL, N_("_Map") }, + { "plug-in-render-menu", NULL, N_("_Render") }, + { "plug-in-render-clouds-menu", NULL, N_("_Clouds") }, + { "plug-in-render-nature-menu", NULL, N_("_Nature") }, + { "plug-in-render-pattern-menu", NULL, N_("_Pattern") }, + { "plug-in-web-menu", NULL, N_("_Web") }, + { "plug-in-animation-menu", NULL, N_("An_imation") }, + { "plug-in-combine-menu", NULL, N_("C_ombine") }, + { "plug-in-toys-menu", NULL, N_("To_ys") } +}; + +static GimpEnumActionEntry plug_in_repeat_actions[] = +{ + { "plug-in-repeat", GTK_STOCK_EXECUTE, + N_("Repeat Last"), "F", NULL, + FALSE, + GIMP_HELP_FILTER_REPEAT }, + + { "plug-in-reshow", GIMP_STOCK_RESHOW_FILTER, + N_("Re-Show Last"), "F", NULL, + TRUE, + GIMP_HELP_FILTER_RESHOW } +}; + + +void +plug_in_actions_setup (GimpActionGroup *group, + gpointer data) +{ + gimp_action_group_add_actions (group, + plug_in_actions, + G_N_ELEMENTS (plug_in_actions), + data); + + gimp_action_group_add_enum_actions (group, + plug_in_repeat_actions, + G_N_ELEMENTS (plug_in_repeat_actions), + G_CALLBACK (plug_in_repeat_cmd_callback), + data); +} + +void +plug_in_actions_update (GimpActionGroup *group, + gpointer data) +{ +} diff --git a/app/gui/help-commands.h b/app/actions/plug-in-actions.h similarity index 72% rename from app/gui/help-commands.h rename to app/actions/plug-in-actions.h index 665978e730..7b3403aad5 100644 --- a/app/gui/help-commands.h +++ b/app/actions/plug-in-actions.h @@ -16,14 +16,14 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __HELP_COMMANDS_H__ -#define __HELP_COMMANDS_H__ +#ifndef __PLUG_IN_ACTIONS_H__ +#define __PLUG_IN_ACTIONS_H__ -void help_help_cmd_callback (GtkWidget *widget, - gpointer data); -void help_context_help_cmd_callback (GtkWidget *widget, - gpointer data); +void plug_in_actions_setup (GimpActionGroup *group, + gpointer data); +void plug_in_actions_update (GimpActionGroup *group, + gpointer data); -#endif /* __HELP_COMMANDS_H__ */ +#endif /* __PLUG_IN_ACTIONS_H__ */ diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index 744cb6d70a..5a9a9cda01 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -22,7 +22,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "core/gimp.h" #include "core/gimpcontext.h" @@ -38,8 +38,9 @@ #include "display/gimpdisplay.h" +#include "gui/plug-in-menus.h" + #include "plug-in-commands.h" -#include "plug-in-menus.h" #define return_if_no_display(gdisp,data) \ diff --git a/app/actions/qmask-actions.c b/app/actions/qmask-actions.c index 2009c90cf8..7a202525d4 100644 --- a/app/actions/qmask-actions.c +++ b/app/actions/qmask-actions.c @@ -33,7 +33,7 @@ #include "display/gimpdisplayshell.h" #include "qmask-actions.h" -#include "gui/qmask-commands.h" +#include "qmask-commands.h" #include "gimp-intl.h" diff --git a/app/actions/qmask-commands.c b/app/actions/qmask-commands.c index 10f4db8b2b..62dc67ccfa 100644 --- a/app/actions/qmask-commands.c +++ b/app/actions/qmask-commands.c @@ -23,7 +23,7 @@ #include "libgimpcolor/gimpcolor.h" #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "core/gimp.h" #include "core/gimpchannel.h" diff --git a/app/actions/quick-mask-actions.c b/app/actions/quick-mask-actions.c index 2009c90cf8..7a202525d4 100644 --- a/app/actions/quick-mask-actions.c +++ b/app/actions/quick-mask-actions.c @@ -33,7 +33,7 @@ #include "display/gimpdisplayshell.h" #include "qmask-actions.h" -#include "gui/qmask-commands.h" +#include "qmask-commands.h" #include "gimp-intl.h" diff --git a/app/actions/quick-mask-commands.c b/app/actions/quick-mask-commands.c index 10f4db8b2b..62dc67ccfa 100644 --- a/app/actions/quick-mask-commands.c +++ b/app/actions/quick-mask-commands.c @@ -23,7 +23,7 @@ #include "libgimpcolor/gimpcolor.h" #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "core/gimp.h" #include "core/gimpchannel.h" diff --git a/app/actions/select-actions.c b/app/actions/select-actions.c index 4b6a9853d0..37e49c237e 100644 --- a/app/actions/select-actions.c +++ b/app/actions/select-actions.c @@ -35,9 +35,9 @@ #include "display/gimpdisplayshell.h" #include "select-actions.h" -#include "gui/select-commands.h" -#include "gui/tools-commands.h" -#include "gui/vectors-commands.h" +#include "select-commands.h" +#include "tools-commands.h" +#include "vectors-commands.h" #include "gimp-intl.h" diff --git a/app/actions/select-commands.c b/app/actions/select-commands.c index 7fb268f958..00ab5808e6 100644 --- a/app/actions/select-commands.c +++ b/app/actions/select-commands.c @@ -23,7 +23,7 @@ #include "libgimpmath/gimpmath.h" #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "core/gimp.h" #include "core/gimpchannel.h" @@ -40,7 +40,8 @@ #include "display/gimpdisplay.h" #include "display/gimpdisplayshell.h" -#include "dialogs.h" +#include "gui/dialogs.h" + #include "select-commands.h" #include "gimp-intl.h" diff --git a/app/actions/templates-actions.c b/app/actions/templates-actions.c index 6dded32621..3ecd1dc53a 100644 --- a/app/actions/templates-actions.c +++ b/app/actions/templates-actions.c @@ -32,7 +32,7 @@ #include "widgets/gimphelp-ids.h" #include "templates-actions.h" -#include "gui/templates-commands.h" +#include "templates-commands.h" #include "gimp-intl.h" diff --git a/app/actions/templates-commands.c b/app/actions/templates-commands.c index 9821313f13..f0b8974297 100644 --- a/app/actions/templates-commands.c +++ b/app/actions/templates-commands.c @@ -22,7 +22,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "config/gimpconfig.h" #include "config/gimpconfig-utils.h" @@ -39,8 +39,9 @@ #include "widgets/gimptemplateview.h" #include "widgets/gimpviewabledialog.h" -#include "dialogs.h" -#include "file-new-dialog.h" +#include "gui/dialogs.h" +#include "gui/file-new-dialog.h" + #include "templates-commands.h" #include "gimp-intl.h" diff --git a/app/actions/tool-options-actions.c b/app/actions/tool-options-actions.c index 4a138a8848..bd705a2214 100644 --- a/app/actions/tool-options-actions.c +++ b/app/actions/tool-options-actions.c @@ -33,7 +33,7 @@ #include "widgets/gimphelp-ids.h" #include "tool-options-actions.h" -#include "gui/tool-options-commands.h" +#include "tool-options-commands.h" #include "gimp-intl.h" diff --git a/app/actions/tool-options-commands.c b/app/actions/tool-options-commands.c index 4482cbd604..be4a52316f 100644 --- a/app/actions/tool-options-commands.c +++ b/app/actions/tool-options-commands.c @@ -24,7 +24,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "config/gimpconfig.h" #include "config/gimpconfig-utils.h" diff --git a/app/actions/tools-actions.c b/app/actions/tools-actions.c new file mode 100644 index 0000000000..44d07c4bfa --- /dev/null +++ b/app/actions/tools-actions.c @@ -0,0 +1,114 @@ +/* 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/gimplist.h" +#include "core/gimptoolinfo.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" + +#include "actions/tools-actions.h" +#include "actions/tools-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry tools_actions[] = +{ + { "tools-menu", NULL, + N_("_Tools") }, + + { "tools-select-menu", NULL, + N_("_Selection Tools") }, + + { "tools-paint-menu", NULL, + N_("_Paint Tools") }, + + { "tools-transform-menu", NULL, + N_("/Tools/_Transform Tools") }, + + { "tools-color-menu", NULL, + N_("_Color Tools") }, + + { "tools-default-colors", GIMP_STOCK_DEFAULT_COLORS, + N_("_Default Colors"), "D", NULL, + G_CALLBACK (tools_default_colors_cmd_callback), + GIMP_HELP_TOOLBOX_DEFAULT_COLORS }, + + { "tools-swap-colors", GIMP_STOCK_SWAP_COLORS, + N_("S_wap Colors"), "X", NULL, + G_CALLBACK (tools_swap_colors_cmd_callback), + GIMP_HELP_TOOLBOX_SWAP_COLORS } +}; + + +void +tools_actions_setup (GimpActionGroup *group, + gpointer data) +{ + GList *list; + + gimp_action_group_add_actions (group, + tools_actions, + G_N_ELEMENTS (tools_actions), + data); + + for (list = GIMP_LIST (group->gimp->tool_info_list)->list; + list; + list = g_list_next (list)) + { + GimpToolInfo *tool_info = list->data; + + if (tool_info->menu_path) + { + GimpStringActionEntry entry; + const gchar *stock_id; + const gchar *identifier; + + stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info)); + identifier = gimp_object_get_name (GIMP_OBJECT (tool_info)); + + entry.name = identifier; /* FIXME */ + entry.stock_id = stock_id; + entry.label = tool_info->menu_path; + entry.accelerator = tool_info->menu_accel; + entry.tooltip = tool_info->blurb; + entry.value = identifier; + + gimp_action_group_add_string_actions (group, + &entry, 1, + G_CALLBACK (tools_select_cmd_callback), + data); + } + } +} + +void +tools_actions_update (GimpActionGroup *group, + gpointer data) +{ +} diff --git a/app/gui/fonts-commands.h b/app/actions/tools-actions.h similarity index 73% rename from app/gui/fonts-commands.h rename to app/actions/tools-actions.h index 07a32c7513..430997ec74 100644 --- a/app/gui/fonts-commands.h +++ b/app/actions/tools-actions.h @@ -16,12 +16,14 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __FONTS_COMMANDS_H__ -#define __FONTS_COMMANDS_H__ +#ifndef __TOOLS_ACTIONS_H__ +#define __TOOLS_ACTIONS_H__ -void fonts_refresh_cmd_callback (GtkWidget *widget, - gpointer data); +void tools_actions_setup (GimpActionGroup *group, + gpointer data); +void tools_actions_update (GimpActionGroup *group, + gpointer data); -#endif /* __FONTS_COMMANDS_H__ */ +#endif /* __TOOLS_ACTIONS_H__ */ diff --git a/app/actions/tools-commands.c b/app/actions/tools-commands.c index 692c196791..5fa81825c3 100644 --- a/app/actions/tools-commands.c +++ b/app/actions/tools-commands.c @@ -20,7 +20,7 @@ #include -#include "gui-types.h" +#include "actions-types.h" #include "core/gimp.h" #include "core/gimpcontainer.h" @@ -35,6 +35,8 @@ #include "tools/gimptool.h" #include "tools/tool_manager.h" +#include "tools-commands.h" + #define return_if_no_gimp(gimp,data) \ if (GIMP_IS_DISPLAY (data)) \ diff --git a/app/actions/vectors-actions.c b/app/actions/vectors-actions.c index ce035165eb..4325722355 100644 --- a/app/actions/vectors-actions.c +++ b/app/actions/vectors-actions.c @@ -33,7 +33,7 @@ #include "widgets/gimpitemtreeview.h" #include "vectors-actions.h" -#include "gui/vectors-commands.h" +#include "vectors-commands.h" #include "gimp-intl.h" diff --git a/app/actions/vectors-commands.c b/app/actions/vectors-commands.c index 663b183c43..6100d6e57a 100644 --- a/app/actions/vectors-commands.c +++ b/app/actions/vectors-commands.c @@ -24,7 +24,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "core/gimp.h" #include "core/gimpchannel.h" @@ -54,7 +54,8 @@ #include "tools/gimpvectortool.h" #include "tools/tool_manager.h" -#include "stroke-dialog.h" +#include "gui/stroke-dialog.h" + #include "vectors-commands.h" #include "gimp-intl.h" diff --git a/app/actions/view-actions.c b/app/actions/view-actions.c index 2c486c8b18..9ebcda0b63 100644 --- a/app/actions/view-actions.c +++ b/app/actions/view-actions.c @@ -40,7 +40,7 @@ #include "display/gimpdisplayshell-selection.h" #include "view-actions.h" -#include "gui/view-commands.h" +#include "view-commands.h" #include "gimp-intl.h" diff --git a/app/actions/view-commands.c b/app/actions/view-commands.c index 6071126267..c83fee60e2 100644 --- a/app/actions/view-commands.c +++ b/app/actions/view-commands.c @@ -22,7 +22,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "gui-types.h" +#include "actions-types.h" #include "config/gimpguiconfig.h" @@ -41,9 +41,10 @@ #include "widgets/gimpdialogfactory.h" #include "widgets/gimpitemfactory.h" -#include "dialogs.h" -#include "info-dialog.h" -#include "info-window.h" +#include "gui/dialogs.h" +#include "gui/info-dialog.h" +#include "gui/info-window.h" + #include "view-commands.h" diff --git a/app/dialogs/dialogs-constructors.c b/app/dialogs/dialogs-constructors.c index 6ffe187e2b..832b3c4875 100644 --- a/app/dialogs/dialogs-constructors.c +++ b/app/dialogs/dialogs-constructors.c @@ -69,20 +69,21 @@ #include "display/gimpdisplayshell.h" #include "display/gimpnavigationview.h" +#include "actions/channels-commands.h" +#include "actions/edit-commands.h" +#include "actions/file-commands.h" +#include "actions/images-commands.h" +#include "actions/layers-commands.h" +#include "actions/templates-commands.h" +#include "actions/vectors-commands.h" + #include "about-dialog.h" -#include "channels-commands.h" #include "dialogs.h" #include "dialogs-constructors.h" -#include "edit-commands.h" -#include "file-commands.h" #include "file-new-dialog.h" -#include "images-commands.h" -#include "layers-commands.h" #include "module-browser.h" #include "preferences-dialog.h" -#include "templates-commands.h" #include "tips-dialog.h" -#include "vectors-commands.h" #include "gimp-intl.h" diff --git a/app/gui/Makefile.am b/app/gui/Makefile.am index 69751867e4..d6699c0785 100644 --- a/app/gui/Makefile.am +++ b/app/gui/Makefile.am @@ -61,112 +61,54 @@ dialogs_sources = \ menus_sources = \ brushes-menu.c \ brushes-menu.h \ - buffers-commands.c \ - buffers-commands.h \ buffers-menu.c \ buffers-menu.h \ - channels-commands.c \ - channels-commands.h \ channels-menu.c \ channels-menu.h \ - colormap-editor-commands.c \ - colormap-editor-commands.h \ colormap-editor-menu.c \ colormap-editor-menu.h \ - data-commands.c \ - data-commands.h \ - debug-commands.c \ - debug-commands.h \ - dialogs-commands.c \ - dialogs-commands.h \ dialogs-menu.c \ dialogs-menu.h \ - dockable-commands.c \ - dockable-commands.h \ - documents-commands.c \ - documents-commands.h \ documents-menu.c \ documents-menu.h \ - drawable-commands.c \ - drawable-commands.h \ - edit-commands.c \ - edit-commands.h \ - error-console-commands.c \ - error-console-commands.h \ error-console-menu.c \ error-console-menu.h \ - file-commands.c \ - file-commands.h \ file-open-menu.c \ file-open-menu.h \ file-save-menu.c \ file-save-menu.h \ - fonts-commands.c \ - fonts-commands.h \ fonts-menu.c \ fonts-menu.h \ - gradient-editor-commands.c \ - gradient-editor-commands.h \ gradient-editor-menu.c \ gradient-editor-menu.h \ - gradients-commands.c \ - gradients-commands.h \ gradients-menu.c \ gradients-menu.h \ - help-commands.c \ - help-commands.h \ - image-commands.c \ - image-commands.h \ image-menu.c \ image-menu.h \ - images-commands.c \ - images-commands.h \ images-menu.c \ images-menu.h \ - layers-commands.c \ - layers-commands.h \ layers-menu.c \ layers-menu.h \ menus.c \ menus.h \ - palette-editor-commands.c \ - palette-editor-commands.h \ palette-editor-menu.c \ palette-editor-menu.h \ - palettes-commands.c \ - palettes-commands.h \ palettes-menu.c \ palettes-menu.h \ patterns-menu.c \ patterns-menu.h \ - plug-in-commands.c \ - plug-in-commands.h \ plug-in-menus.c \ plug-in-menus.h \ - qmask-commands.c \ - qmask-commands.h \ qmask-menu.c \ 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 \ - tool-options-commands.h \ toolbox-menu.c \ toolbox-menu.h \ - tools-commands.c \ - tools-commands.h \ - vectors-commands.c \ - vectors-commands.h \ vectors-menu.c \ - vectors-menu.h \ - view-commands.c \ - view-commands.h + vectors-menu.h libappgui_a_SOURCES = \ $(dialogs_sources) \ diff --git a/app/gui/brushes-menu.c b/app/gui/brushes-menu.c index f1f13018f4..260f11b22a 100644 --- a/app/gui/brushes-menu.c +++ b/app/gui/brushes-menu.c @@ -33,8 +33,9 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" +#include "actions/data-commands.h" + #include "brushes-menu.h" -#include "data-commands.h" #include "menus.h" #include "gimp-intl.h" diff --git a/app/gui/buffers-commands.c b/app/gui/buffers-commands.c deleted file mode 100644 index 5624f6c413..0000000000 --- a/app/gui/buffers-commands.c +++ /dev/null @@ -1,68 +0,0 @@ -/* 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 "gui-types.h" - -#include "widgets/gimpbufferview.h" - -#include "buffers-commands.h" - -#include "gimp-intl.h" - - -/* public functionss */ - -void -buffers_paste_buffer_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpBufferView *view = GIMP_BUFFER_VIEW (data); - - gtk_button_clicked (GTK_BUTTON (view->paste_button)); -} - -void -buffers_paste_buffer_into_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpBufferView *view = GIMP_BUFFER_VIEW (data); - - gtk_button_clicked (GTK_BUTTON (view->paste_into_button)); -} - -void -buffers_paste_buffer_as_new_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpBufferView *view = GIMP_BUFFER_VIEW (data); - - gtk_button_clicked (GTK_BUTTON (view->paste_as_new_button)); -} - -void -buffers_delete_buffer_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpBufferView *view = GIMP_BUFFER_VIEW (data); - - gtk_button_clicked (GTK_BUTTON (view->delete_button)); -} diff --git a/app/gui/buffers-commands.h b/app/gui/buffers-commands.h deleted file mode 100644 index 49972c8f01..0000000000 --- a/app/gui/buffers-commands.h +++ /dev/null @@ -1,33 +0,0 @@ -/* 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_COMMANDS_H__ -#define __BUFFERS_COMMANDS_H__ - - -void buffers_paste_buffer_cmd_callback (GtkWidget *widget, - gpointer data); -void buffers_paste_buffer_into_cmd_callback (GtkWidget *widget, - gpointer data); -void buffers_paste_buffer_as_new_cmd_callback (GtkWidget *widget, - gpointer data); -void buffers_delete_buffer_cmd_callback (GtkWidget *widget, - gpointer data); - - -#endif /* __BUFFERS_COMMANDS_H__ */ diff --git a/app/gui/buffers-menu.c b/app/gui/buffers-menu.c index 36b5118bd2..0511043098 100644 --- a/app/gui/buffers-menu.c +++ b/app/gui/buffers-menu.c @@ -31,7 +31,8 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" -#include "buffers-commands.h" +#include "actions/buffers-commands.h" + #include "buffers-menu.h" #include "gimp-intl.h" diff --git a/app/gui/channels-commands.c b/app/gui/channels-commands.c deleted file mode 100644 index a1481b6168..0000000000 --- a/app/gui/channels-commands.c +++ /dev/null @@ -1,630 +0,0 @@ -/* 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 "libgimpcolor/gimpcolor.h" -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimp.h" -#include "core/gimpchannel.h" -#include "core/gimpchannel-select.h" -#include "core/gimpcontext.h" -#include "core/gimpimage.h" -#include "core/gimpimage-undo.h" - -#include "widgets/gimpcolorpanel.h" -#include "widgets/gimpcomponenteditor.h" -#include "widgets/gimpdock.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemtreeview.h" -#include "widgets/gimpviewabledialog.h" - -#include "display/gimpdisplay.h" - -#include "channels-commands.h" - -#include "gimp-intl.h" - - -/* local function prototypes */ - -static void channels_opacity_update (GtkAdjustment *adjustment, - gpointer data); -static void channels_color_changed (GimpColorButton *button, - gpointer data); - - -#define return_if_no_image(gimage,data) \ - if (GIMP_IS_DISPLAY (data)) \ - gimage = ((GimpDisplay *) data)->gimage; \ - else if (GIMP_IS_GIMP (data)) \ - gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \ - else if (GIMP_IS_DOCK (data)) \ - gimage = gimp_context_get_image (((GimpDock *) data)->context); \ - else if (GIMP_IS_COMPONENT_EDITOR (data)) \ - gimage = ((GimpImageEditor *) data)->gimage; \ - else if (GIMP_IS_ITEM_TREE_VIEW (data)) \ - gimage = ((GimpItemTreeView *) data)->gimage; \ - else \ - gimage = NULL; \ - \ - if (! gimage) \ - return - -#define return_if_no_channel(gimage,channel,data) \ - return_if_no_image (gimage,data); \ - channel = gimp_image_get_active_channel (gimage); \ - if (! channel) \ - return - - -/* public functions */ - -void -channels_new_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - channels_new_channel_query (gimage, NULL, TRUE, widget); -} - -void -channels_raise_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpChannel *active_channel; - return_if_no_channel (gimage, active_channel, data); - - gimp_image_raise_channel (gimage, active_channel); - 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) -{ - GimpImage *gimage; - GimpChannel *active_channel; - return_if_no_channel (gimage, active_channel, data); - - gimp_image_lower_channel (gimage, active_channel); - 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) -{ - GimpImage *gimage; - GimpChannel *new_channel; - - if (GIMP_IS_COMPONENT_EDITOR (data)) - { - GimpRGB color; - GimpChannelType component; - GEnumClass *enum_class; - GEnumValue *enum_value; - gchar *name; - return_if_no_image (gimage, data); - - gimp_rgba_set (&color, 0, 0, 0, 0.5); - - component = GIMP_COMPONENT_EDITOR (data)->clicked_component; - - enum_class = g_type_class_ref (GIMP_TYPE_CHANNEL_TYPE); - enum_value = g_enum_get_value (enum_class, component); - g_type_class_unref (enum_class); - - name = g_strdup_printf (_("%s Channel Copy"), - gettext (enum_value->value_name)); - - new_channel = gimp_channel_new_from_component (gimage, component, - name, &color); - - /* copied components are invisible by default so subsequent copies - * of components don't affect each other - */ - gimp_item_set_visible (GIMP_ITEM (new_channel), FALSE, FALSE); - - g_free (name); - } - else - { - GimpChannel *active_channel; - return_if_no_channel (gimage, active_channel, data); - - new_channel = - GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (active_channel), - G_TYPE_FROM_INSTANCE (active_channel), - TRUE)); - } - - gimp_image_add_channel (gimage, new_channel, -1); - gimp_image_flush (gimage); -} - -void -channels_delete_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpChannel *active_channel; - return_if_no_channel (gimage, active_channel, data); - - gimp_image_remove_channel (gimage, active_channel); - gimp_image_flush (gimage); -} - -void -channels_to_selection_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpChannelOps op; - GimpImage *gimage; - - op = (GimpChannelOps) action; - - if (GIMP_IS_COMPONENT_EDITOR (data)) - { - GimpChannelType component; - return_if_no_image (gimage, data); - - component = GIMP_COMPONENT_EDITOR (data)->clicked_component; - - gimp_channel_select_component (gimp_image_get_mask (gimage), component, - op, FALSE, 0.0, 0.0); - } - else - { - GimpChannel *channel; - return_if_no_channel (gimage, channel, data); - - gimp_channel_select_channel (gimp_image_get_mask (gimage), - _("Channel to Selection"), - channel, 0, 0, - op, FALSE, 0.0, 0.0); - } - - gimp_image_flush (gimage); -} - -void -channels_edit_attributes_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpChannel *active_channel; - return_if_no_channel (gimage, active_channel, data); - - channels_edit_channel_query (active_channel, widget); -} - - -/**********************************/ -/* The new channel query dialog */ -/**********************************/ - -typedef struct _NewChannelOptions NewChannelOptions; - -struct _NewChannelOptions -{ - GtkWidget *query_box; - GtkWidget *name_entry; - GtkWidget *color_panel; - - GimpImage *gimage; -}; - -static gchar *channel_name = NULL; -static GimpRGB channel_color = { 0.0, 0.0, 0.0, 0.5 }; - - -static void -new_channel_query_response (GtkWidget *widget, - gint response_id, - NewChannelOptions *options) -{ - if (response_id == GTK_RESPONSE_OK) - { - GimpChannel *new_channel; - GimpImage *gimage; - - if (channel_name) - g_free (channel_name); - channel_name = - g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry))); - - if ((gimage = options->gimage)) - { - gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel), - &channel_color); - new_channel = gimp_channel_new (gimage, gimage->width, gimage->height, - channel_name, - &channel_color); - - gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_channel), - gimp_get_user_context (gimage->gimp), - GIMP_TRANSPARENT_FILL); - - gimp_image_add_channel (gimage, new_channel, -1); - gimp_image_flush (gimage); - } - } - - gtk_widget_destroy (options->query_box); -} - -void -channels_new_channel_query (GimpImage *gimage, - GimpChannel *template, - gboolean interactive, - GtkWidget *parent) -{ - NewChannelOptions *options; - GtkWidget *hbox; - GtkWidget *vbox; - GtkWidget *table; - GtkObject *opacity_scale_data; - - g_return_if_fail (GIMP_IS_IMAGE (gimage)); - g_return_if_fail (! template || GIMP_IS_CHANNEL (template)); - - if (template || ! interactive) - { - GimpChannel *new_channel; - gint width, height; - GimpRGB color; - - if (template) - { - width = gimp_item_width (GIMP_ITEM (template)); - height = gimp_item_height (GIMP_ITEM (template)); - color = template->color; - } - else - { - width = gimp_image_get_width (gimage); - height = gimp_image_get_height (gimage); - gimp_rgba_set (&color, 0.0, 0.0, 0.0, 0.5); - } - - gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_EDIT_PASTE, - _("New Channel")); - - new_channel = gimp_channel_new (gimage, - width, height, - _("Empty Channel"), - &color); - - gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_channel), - gimp_get_user_context (gimage->gimp), - GIMP_TRANSPARENT_FILL); - - gimp_image_add_channel (gimage, new_channel, -1); - - gimp_image_undo_group_end (gimage); - return; - } - - /* the new options structure */ - options = g_new (NewChannelOptions, 1); - options->gimage = gimage; - options->color_panel = gimp_color_panel_new (_("New Channel Color"), - &channel_color, - GIMP_COLOR_AREA_LARGE_CHECKS, - 48, 64); - gimp_color_panel_set_context (GIMP_COLOR_PANEL (options->color_panel), - gimp_get_user_context (gimage->gimp)); - - /* The dialog */ - options->query_box = - gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage), - _("New Channel"), "gimp-channel-new", - GIMP_STOCK_CHANNEL, - _("New Channel Options"), - parent, - gimp_standard_help_func, - GIMP_HELP_CHANNEL_NEW, - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - - NULL); - - g_object_weak_ref (G_OBJECT (options->query_box), - (GWeakNotify) g_free, - options); - - g_signal_connect (options->query_box, "response", - G_CALLBACK (new_channel_query_response), - options); - - /* The main hbox */ - hbox = gtk_hbox_new (FALSE, 4); - gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox), - hbox); - - /* The vbox */ - vbox = gtk_vbox_new (FALSE, 2); - gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); - - /* The table */ - table = gtk_table_new (2, 3, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (table), 2); - gtk_table_set_row_spacings (GTK_TABLE (table), 2); - gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); - - /* The name entry */ - options->name_entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (options->name_entry), - (channel_name ? channel_name : _("New Channel"))); - gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, - _("Channel Name:"), 1.0, 0.5, - options->name_entry, 2, FALSE); - - /* The opacity scale */ - opacity_scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 1, - _("Fill Opacity:"), 100, -1, - channel_color.a * 100.0, - 0.0, 100.0, 1.0, 10.0, 1, - TRUE, 0.0, 0.0, - NULL, NULL); - - g_signal_connect (opacity_scale_data, "value_changed", - G_CALLBACK (channels_opacity_update), - options->color_panel); - - /* The color panel */ - gtk_box_pack_start (GTK_BOX (hbox), options->color_panel, - TRUE, TRUE, 0); - gtk_widget_show (options->color_panel); - - g_signal_connect (options->color_panel, "color_changed", - G_CALLBACK (channels_color_changed), - opacity_scale_data); - - gtk_widget_show (table); - gtk_widget_show (vbox); - gtk_widget_show (hbox); - gtk_widget_show (options->query_box); -} - -/****************************************/ -/* The edit channel attributes dialog */ -/****************************************/ - -typedef struct _EditChannelOptions EditChannelOptions; - -struct _EditChannelOptions -{ - GtkWidget *query_box; - GtkWidget *name_entry; - GtkWidget *color_panel; - - GimpChannel *channel; - GimpImage *gimage; -}; - -static void -edit_channel_query_response (GtkWidget *widget, - gint response_id, - EditChannelOptions *options) -{ - if (response_id == GTK_RESPONSE_OK) - { - GimpChannel *channel = options->channel; - - if (options->gimage) - { - const gchar *new_name; - GimpRGB color; - gboolean name_changed = FALSE; - gboolean color_changed = FALSE; - - new_name = gtk_entry_get_text (GTK_ENTRY (options->name_entry)); - - gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel), - &color); - - if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (channel)))) - name_changed = TRUE; - - if (gimp_rgba_distance (&color, &channel->color) > 0.0001) - color_changed = TRUE; - - if (name_changed && color_changed) - gimp_image_undo_group_start (options->gimage, - GIMP_UNDO_GROUP_ITEM_PROPERTIES, - _("Channel Attributes")); - - if (name_changed) - gimp_item_rename (GIMP_ITEM (channel), new_name); - - if (color_changed) - gimp_channel_set_color (channel, &color, TRUE); - - if (name_changed && color_changed) - gimp_image_undo_group_end (options->gimage); - - if (name_changed || color_changed) - gimp_image_flush (options->gimage); - } - } - - gtk_widget_destroy (options->query_box); -} - -void -channels_edit_channel_query (GimpChannel *channel, - GtkWidget *parent) -{ - EditChannelOptions *options; - GtkWidget *hbox; - GtkWidget *vbox; - GtkWidget *table; - GtkObject *opacity_scale_data; - - options = g_new0 (EditChannelOptions, 1); - - options->channel = channel; - options->gimage = gimp_item_get_image (GIMP_ITEM (channel)); - - channel_color = channel->color; - - options->color_panel = gimp_color_panel_new (_("Edit Channel Color"), - &channel_color, - GIMP_COLOR_AREA_LARGE_CHECKS, - 48, 64); - gimp_color_panel_set_context (GIMP_COLOR_PANEL (options->color_panel), - gimp_get_user_context (options->gimage->gimp)); - - /* The dialog */ - options->query_box = - gimp_viewable_dialog_new (GIMP_VIEWABLE (channel), - _("Channel Attributes"), "gimp-channel-edit", - GIMP_STOCK_EDIT, - _("Edit Channel Attributes"), - parent, - gimp_standard_help_func, - GIMP_HELP_CHANNEL_EDIT, - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - - NULL); - - g_object_weak_ref (G_OBJECT (options->query_box), - (GWeakNotify) g_free, - options); - - g_signal_connect (options->query_box, "response", - G_CALLBACK (edit_channel_query_response), - options); - - /* The main hbox */ - hbox = gtk_hbox_new (FALSE, 4); - gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox), - hbox); - - /* The vbox */ - vbox = gtk_vbox_new (FALSE, 2); - gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); - - /* The table */ - table = gtk_table_new (2, 3, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (table), 2); - gtk_table_set_row_spacings (GTK_TABLE (table), 2); - gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); - - /* The name entry */ - options->name_entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (options->name_entry), - gimp_object_get_name (GIMP_OBJECT (channel))); - gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, - _("Channel Name:"), 1.0, 0.5, - options->name_entry, 2, FALSE); - - /* The opacity scale */ - opacity_scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 1, - _("Fill Opacity:"), 100, -1, - channel_color.a * 100.0, - 0.0, 100.0, 1.0, 10.0, 1, - TRUE, 0.0, 0.0, - NULL, NULL); - - g_signal_connect (opacity_scale_data, "value_changed", - G_CALLBACK (channels_opacity_update), - options->color_panel); - - /* The color panel */ - gtk_box_pack_start (GTK_BOX (hbox), options->color_panel, - TRUE, TRUE, 0); - gtk_widget_show (options->color_panel); - - g_signal_connect (options->color_panel, "color_changed", - G_CALLBACK (channels_color_changed), - opacity_scale_data); - - gtk_widget_show (table); - gtk_widget_show (vbox); - gtk_widget_show (hbox); - gtk_widget_show (options->query_box); -} - - -/* private functions */ - -static void -channels_opacity_update (GtkAdjustment *adjustment, - gpointer data) -{ - GimpRGB color; - - gimp_color_button_get_color (GIMP_COLOR_BUTTON (data), &color); - gimp_rgb_set_alpha (&color, adjustment->value / 100.0); - gimp_color_button_set_color (GIMP_COLOR_BUTTON (data), &color); -} - -static void -channels_color_changed (GimpColorButton *button, - gpointer data) -{ - GtkAdjustment *adj = GTK_ADJUSTMENT (data); - GimpRGB color; - - gimp_color_button_get_color (button, &color); - gtk_adjustment_set_value (adj, color.a * 100.0); -} - diff --git a/app/gui/channels-commands.h b/app/gui/channels-commands.h deleted file mode 100644 index 43def974a1..0000000000 --- a/app/gui/channels-commands.h +++ /dev/null @@ -1,51 +0,0 @@ -/* 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_COMMANDS_H__ -#define __CHANNELS_COMMANDS_H__ - - -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, - gpointer data); -void channels_to_selection_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void channels_edit_attributes_cmd_callback (GtkWidget *widget, - gpointer data); - -void channels_new_channel_query (GimpImage *gimage, - GimpChannel *template, - gboolean interactive, - GtkWidget *parent); -void channels_edit_channel_query (GimpChannel *channel, - GtkWidget *parent); - - -#endif /* __CHANNELS_COMMANDS_H__ */ diff --git a/app/gui/channels-menu.c b/app/gui/channels-menu.c index 455859e852..18745c9744 100644 --- a/app/gui/channels-menu.c +++ b/app/gui/channels-menu.c @@ -32,7 +32,8 @@ #include "widgets/gimpitemfactory.h" #include "widgets/gimpitemtreeview.h" -#include "channels-commands.h" +#include "actions/channels-commands.h" + #include "channels-menu.h" #include "menus.h" diff --git a/app/gui/colormap-editor-commands.c b/app/gui/colormap-editor-commands.c deleted file mode 100644 index 04b219df35..0000000000 --- a/app/gui/colormap-editor-commands.c +++ /dev/null @@ -1,54 +0,0 @@ -/* 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 "gui-types.h" - -#include "widgets/gimpcolormapeditor.h" - -#include "colormap-editor-commands.h" - - -/* public functions */ - -void -colormap_editor_edit_color_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data); - - if (GTK_WIDGET_SENSITIVE (editor->edit_button)) - gtk_button_clicked (GTK_BUTTON (editor->edit_button)); -} - -void -colormap_editor_add_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data); - - if (GTK_WIDGET_SENSITIVE (editor->add_button)) - gimp_button_extended_clicked (GIMP_BUTTON (editor->add_button), - action ? GDK_CONTROL_MASK : 0); -} diff --git a/app/gui/colormap-editor-commands.h b/app/gui/colormap-editor-commands.h deleted file mode 100644 index d1222255c4..0000000000 --- a/app/gui/colormap-editor-commands.h +++ /dev/null @@ -1,30 +0,0 @@ -/* 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_COMMANDS_H__ -#define __COLORMAP_EDITOR_COMMANDS_H__ - - -void colormap_editor_edit_color_cmd_callback (GtkWidget *widget, - gpointer data); -void colormap_editor_add_color_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - - -#endif /* __COLORMAP_EDITOR_COMMANDS_H__ */ diff --git a/app/gui/colormap-editor-menu.c b/app/gui/colormap-editor-menu.c index ca3dccbe84..c1025d60e2 100644 --- a/app/gui/colormap-editor-menu.c +++ b/app/gui/colormap-editor-menu.c @@ -30,7 +30,8 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" -#include "colormap-editor-commands.h" +#include "actions/colormap-editor-commands.h" + #include "colormap-editor-menu.h" #include "gimp-intl.h" diff --git a/app/gui/data-commands.c b/app/gui/data-commands.c deleted file mode 100644 index 5f34c03d91..0000000000 --- a/app/gui/data-commands.c +++ /dev/null @@ -1,80 +0,0 @@ -/* 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 "gui-types.h" - -#include "widgets/gimpdatafactoryview.h" - -#include "data-commands.h" - -#include "gimp-intl.h" - - -void -data_new_data_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data); - - if (GTK_WIDGET_SENSITIVE (view->new_button)) - gtk_button_clicked (GTK_BUTTON (view->new_button)); -} - -void -data_duplicate_data_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data); - - if (GTK_WIDGET_SENSITIVE (view->duplicate_button)) - gtk_button_clicked (GTK_BUTTON (view->duplicate_button)); -} - -void -data_edit_data_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data); - - if (GTK_WIDGET_SENSITIVE (view->edit_button)) - gtk_button_clicked (GTK_BUTTON (view->edit_button)); -} - -void -data_delete_data_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data); - - if (GTK_WIDGET_SENSITIVE (view->delete_button)) - gtk_button_clicked (GTK_BUTTON (view->delete_button)); -} - -void -data_refresh_data_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (data); - - if (GTK_WIDGET_SENSITIVE (view->refresh_button)) - gtk_button_clicked (GTK_BUTTON (view->refresh_button)); -} diff --git a/app/gui/data-commands.h b/app/gui/data-commands.h deleted file mode 100644 index 89bbb3ad99..0000000000 --- a/app/gui/data-commands.h +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 __DATA_COMMANDS_H__ -#define __DATA_COMMANDS_H__ - - -void data_new_data_cmd_callback (GtkWidget *widget, - gpointer data); -void data_duplicate_data_cmd_callback (GtkWidget *widget, - gpointer data); -void data_edit_data_cmd_callback (GtkWidget *widget, - gpointer data); -void data_delete_data_cmd_callback (GtkWidget *widget, - gpointer data); -void data_refresh_data_cmd_callback (GtkWidget *widget, - gpointer data); - - -#endif /* __DATA_COMMANDS_H__ */ diff --git a/app/gui/debug-commands.c b/app/gui/debug-commands.c deleted file mode 100644 index 8bae029761..0000000000 --- a/app/gui/debug-commands.c +++ /dev/null @@ -1,146 +0,0 @@ -/* 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 "libgimpbase/gimpbase.h" - -#include "gui-types.h" - -#include "core/gimpobject.h" - -#include "widgets/gimpitemfactory.h" -#include "widgets/gimpmenufactory.h" - -#include "debug-commands.h" -#include "menus.h" - - -#ifdef ENABLE_DEBUG_MENU - -/* local function prototypes */ - -static void debug_dump_menus_recurse_menu (GtkWidget *menu, - gint depth, - gchar *path); - - -/* public functions */ - -void -debug_dump_menus_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GList *list; - - for (list = global_menu_factory->registered_menus; - list; - list = g_list_next (list)) - { - GimpMenuFactoryEntry *entry; - GimpItemFactory *item_factory; - - entry = list->data; - - item_factory = gimp_item_factory_from_path (entry->identifier); - - if (item_factory) - { - GtkWidget *menu_item; - - g_print ("%s\n", entry->identifier); - - menu_item = gtk_item_factory_get_item (GTK_ITEM_FACTORY (item_factory), - entry->entries[0].entry.path); - - if (menu_item && - menu_item->parent && - GTK_IS_MENU (menu_item->parent)) - debug_dump_menus_recurse_menu (menu_item->parent, 1, - entry->identifier); - - g_print ("\n"); - } - } -} - -void -debug_mem_profile_cmd_callback (GtkWidget *widget, - gpointer data) -{ - extern gboolean gimp_debug_memsize; - - gimp_debug_memsize = TRUE; - - gimp_object_get_memsize (GIMP_OBJECT (data), NULL); - - gimp_debug_memsize = FALSE; -} - - -/* private functions */ - -static void -debug_dump_menus_recurse_menu (GtkWidget *menu, - gint depth, - gchar *path) -{ - GtkItemFactory *item_factory; - GtkWidget *menu_item; - GList *list; - const gchar *label; - gchar *help_page; - gchar *full_path; - gchar *format_str; - - for (list = GTK_MENU_SHELL (menu)->children; list; list = g_list_next (list)) - { - menu_item = GTK_WIDGET (list->data); - - if (GTK_IS_LABEL (GTK_BIN (menu_item)->child)) - { - label = gtk_label_get_text (GTK_LABEL (GTK_BIN (menu_item)->child)); - full_path = g_strconcat (path, "/", label, NULL); - - item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path (path)); - help_page = g_object_get_data (G_OBJECT (menu_item), - "gimp-help-id"); - - help_page = g_strdup (help_page); - - format_str = g_strdup_printf ("%%%ds%%%ds %%-20s %%s\n", - depth * 2, depth * 2 - 40); - g_print (format_str, - "", label, "", help_page ? help_page : ""); - g_free (format_str); - g_free (help_page); - - if (GTK_MENU_ITEM (menu_item)->submenu) - debug_dump_menus_recurse_menu (GTK_MENU_ITEM (menu_item)->submenu, - depth + 1, full_path); - - g_free (full_path); - } - } -} - -#endif /* ENABLE_DEBUG_MENU */ diff --git a/app/gui/debug-commands.h b/app/gui/debug-commands.h deleted file mode 100644 index 614154569c..0000000000 --- a/app/gui/debug-commands.h +++ /dev/null @@ -1,38 +0,0 @@ -/* 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_COMMANDS_H__ -#define __DEBUG_COMMANDS_H__ - - -#ifdef GIMP_UNSTABLE -#define ENABLE_DEBUG_MENU 1 -#endif - - -#ifdef ENABLE_DEBUG_MENU - -void debug_dump_menus_cmd_callback (GtkWidget *widget, - gpointer data); -void debug_mem_profile_cmd_callback (GtkWidget *widget, - gpointer data); - -#endif /* ENABLE_DEBUG_MENU */ - - -#endif /* __DEBUG_COMMANDS_H__ */ diff --git a/app/gui/dialogs-commands.c b/app/gui/dialogs-commands.c deleted file mode 100644 index 9d8cbc491f..0000000000 --- a/app/gui/dialogs-commands.c +++ /dev/null @@ -1,200 +0,0 @@ -/* 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/gimpdialogfactory.h" -#include "widgets/gimpdockable.h" -#include "widgets/gimpdockbook.h" -#include "widgets/gimpimagedock.h" - -#include "dialogs.h" -#include "dialogs-commands.h" - - -/* local function prototypes */ - -static void dialogs_create_dock (GdkScreen *screen, - gboolean show_image_menu, - const gchar *tabs[], - gint n_tabs); - - -/* public functions */ - -void -dialogs_show_toolbox_cmd_callback (GtkWidget *widget, - gpointer data) -{ - dialogs_show_toolbox (); -} - -void -dialogs_create_toplevel_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - if (action) - { - const gchar *identifier = g_quark_to_string ((GQuark) action); - - if (identifier) - gimp_dialog_factory_dialog_new (global_dialog_factory, - gtk_widget_get_screen (widget), - identifier, -1); - } -} - -void -dialogs_create_dockable_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - if (action) - { - const gchar *identifier = g_quark_to_string ((GQuark) action); - - if (!identifier) - return; - - gimp_dialog_factory_dialog_raise (global_dock_factory, - gtk_widget_get_screen (widget), - identifier, -1); - } -} - -void -dialogs_create_lc_cmd_callback (GtkWidget *widget, - gpointer data) -{ - static const gchar *tabs[] = - { - "gimp-layer-list", - "gimp-channel-list", - "gimp-vectors-list", - "gimp-undo-history" - }; - - dialogs_create_dock (gtk_widget_get_screen (widget), TRUE, - tabs, G_N_ELEMENTS (tabs)); -} - -void -dialogs_create_data_cmd_callback (GtkWidget *widget, - gpointer data) -{ - static const gchar *tabs[] = - { - "gimp-brush-grid", - "gimp-pattern-grid", - "gimp-gradient-list", - "gimp-palette-list", - "gimp-font-list" - }; - - dialogs_create_dock (gtk_widget_get_screen (widget), FALSE, - tabs, G_N_ELEMENTS (tabs)); -} - -void -dialogs_create_stuff_cmd_callback (GtkWidget *widget, - gpointer data) -{ - static const gchar *tabs[] = - { - "gimp-buffer-list", - "gimp-image-list", - "gimp-document-list", - "gimp-template-list" - }; - - dialogs_create_dock (gtk_widget_get_screen (widget), FALSE, - tabs, G_N_ELEMENTS (tabs)); -} - -void -dialogs_show_toolbox (void) -{ - if (! global_toolbox_factory->open_dialogs) - { - GtkWidget *toolbox; - - toolbox = gimp_dialog_factory_dock_new (global_toolbox_factory, - gdk_screen_get_default ()); - - gtk_widget_show (toolbox); - } - else - { - GList *list; - - for (list = global_toolbox_factory->open_dialogs; - list; - list = g_list_next (list)) - { - if (GTK_WIDGET_TOPLEVEL (list->data)) - { - gtk_window_present (GTK_WINDOW (list->data)); - break; - } - } - } -} - - -/* private functions */ - -static void -dialogs_create_dock (GdkScreen *screen, - gboolean show_image_menu, - const gchar *tabs[], - gint n_tabs) -{ - GtkWidget *dock; - GtkWidget *dockbook; - GtkWidget *dockable; - gint i; - - dock = gimp_dialog_factory_dock_new (global_dock_factory, screen); - - gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dock), show_image_menu); - - dockbook = gimp_dockbook_new (global_dock_factory->menu_factory); - - gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0); - - for (i = 0; i < n_tabs; i++) - { - dockable = gimp_dialog_factory_dialog_new (global_dock_factory, - screen, - tabs[i], -1); - - if (dockable && ! GIMP_DOCKABLE (dockable)->dockbook) - gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1); - } - - gtk_widget_show (dock); -} diff --git a/app/gui/dialogs-commands.h b/app/gui/dialogs-commands.h deleted file mode 100644 index 039435b0d9..0000000000 --- a/app/gui/dialogs-commands.h +++ /dev/null @@ -1,42 +0,0 @@ -/* 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_COMMANDS_H__ -#define __DIALOGS_COMMANDS_H__ - - -void dialogs_show_toolbox_cmd_callback (GtkWidget *widget, - gpointer data); -void dialogs_create_toplevel_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void dialogs_create_dockable_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - -void dialogs_create_lc_cmd_callback (GtkWidget *widget, - gpointer data); -void dialogs_create_data_cmd_callback (GtkWidget *widget, - gpointer data); -void dialogs_create_stuff_cmd_callback (GtkWidget *widget, - gpointer data); - -void dialogs_show_toolbox (void); - - -#endif /* __DIALOGS_COMMANDS_H__ */ diff --git a/app/gui/dialogs-constructors.c b/app/gui/dialogs-constructors.c index 6ffe187e2b..832b3c4875 100644 --- a/app/gui/dialogs-constructors.c +++ b/app/gui/dialogs-constructors.c @@ -69,20 +69,21 @@ #include "display/gimpdisplayshell.h" #include "display/gimpnavigationview.h" +#include "actions/channels-commands.h" +#include "actions/edit-commands.h" +#include "actions/file-commands.h" +#include "actions/images-commands.h" +#include "actions/layers-commands.h" +#include "actions/templates-commands.h" +#include "actions/vectors-commands.h" + #include "about-dialog.h" -#include "channels-commands.h" #include "dialogs.h" #include "dialogs-constructors.h" -#include "edit-commands.h" -#include "file-commands.h" #include "file-new-dialog.h" -#include "images-commands.h" -#include "layers-commands.h" #include "module-browser.h" #include "preferences-dialog.h" -#include "templates-commands.h" #include "tips-dialog.h" -#include "vectors-commands.h" #include "gimp-intl.h" diff --git a/app/gui/dialogs-menu.c b/app/gui/dialogs-menu.c index f20159d1ea..8e5923753b 100644 --- a/app/gui/dialogs-menu.c +++ b/app/gui/dialogs-menu.c @@ -36,7 +36,8 @@ #include "widgets/gimpimagedock.h" #include "widgets/gimpitemfactory.h" -#include "dockable-commands.h" +#include "actions/dockable-commands.h" + #include "dialogs-menu.h" #include "menus.h" diff --git a/app/gui/dockable-commands.c b/app/gui/dockable-commands.c deleted file mode 100644 index e0b25f7f57..0000000000 --- a/app/gui/dockable-commands.c +++ /dev/null @@ -1,351 +0,0 @@ -/* 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) -{ - 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) -{ - 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) -{ - 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) -{ - 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) -{ - 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 deleted file mode 100644 index 04d7785d63..0000000000 --- a/app/gui/dockable-commands.h +++ /dev/null @@ -1,49 +0,0 @@ -/* 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); -void dockable_detach_tab_cmd_callback (GtkWidget *widget, - gpointer data); - -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); -void dockable_toggle_auto_cmd_callback (GtkWidget *widget, - gpointer data); -void dockable_change_screen_cmd_callback (GtkWidget *widget, - gpointer data); - - -#endif /* __DOCKABLE_COMMANDS_H__ */ diff --git a/app/gui/documents-commands.c b/app/gui/documents-commands.c deleted file mode 100644 index 58781da241..0000000000 --- a/app/gui/documents-commands.c +++ /dev/null @@ -1,100 +0,0 @@ -/* 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 "gui-types.h" - -#include "widgets/gimpdocumentview.h" - -#include "documents-commands.h" - - -/* public functions */ - -void -documents_open_document_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data); - - gtk_button_clicked (GTK_BUTTON (view->open_button)); -} - -void -documents_raise_or_open_document_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data); - - gimp_button_extended_clicked (GIMP_BUTTON (view->open_button), - GDK_SHIFT_MASK); -} - -void -documents_file_open_dialog_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data); - - gimp_button_extended_clicked (GIMP_BUTTON (view->open_button), - GDK_CONTROL_MASK); -} - -void -documents_remove_document_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data); - - gtk_button_clicked (GTK_BUTTON (view->remove_button)); -} - - -void -documents_recreate_preview_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data); - - gtk_button_clicked (GTK_BUTTON (view->refresh_button)); -} - -void -documents_reload_previews_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data); - - gimp_button_extended_clicked (GIMP_BUTTON (view->refresh_button), - GDK_SHIFT_MASK); -} - -void -documents_delete_dangling_documents_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDocumentView *view = GIMP_DOCUMENT_VIEW (data); - - gimp_button_extended_clicked (GIMP_BUTTON (view->refresh_button), - GDK_CONTROL_MASK); -} diff --git a/app/gui/documents-commands.h b/app/gui/documents-commands.h deleted file mode 100644 index 7d84b3249c..0000000000 --- a/app/gui/documents-commands.h +++ /dev/null @@ -1,39 +0,0 @@ -/* 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_COMMANDS_H__ -#define __DOCUMENTS_COMMANDS_H__ - - -void documents_open_document_cmd_callback (GtkWidget *widget, - gpointer data); -void documents_raise_or_open_document_cmd_callback (GtkWidget *widget, - gpointer data); -void documents_file_open_dialog_cmd_callback (GtkWidget *widget, - gpointer data); -void documents_remove_document_cmd_callback (GtkWidget *widget, - gpointer data); -void documents_recreate_preview_cmd_callback (GtkWidget *widget, - gpointer data); -void documents_reload_previews_cmd_callback (GtkWidget *widget, - gpointer data); -void documents_delete_dangling_documents_cmd_callback (GtkWidget *widget, - gpointer data); - - -#endif /* __DOCUMENTS_COMMANDS_H__ */ diff --git a/app/gui/documents-menu.c b/app/gui/documents-menu.c index 8075f89ab4..e7fcadc767 100644 --- a/app/gui/documents-menu.c +++ b/app/gui/documents-menu.c @@ -31,7 +31,8 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" -#include "documents-commands.h" +#include "actions/documents-commands.h" + #include "documents-menu.h" #include "menus.h" diff --git a/app/gui/drawable-commands.c b/app/gui/drawable-commands.c deleted file mode 100644 index 85c89468a4..0000000000 --- a/app/gui/drawable-commands.c +++ /dev/null @@ -1,225 +0,0 @@ -/* 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 "core/gimp.h" -#include "core/gimpcontext.h" -#include "core/gimpdrawable.h" -#include "core/gimpdrawable-desaturate.h" -#include "core/gimpdrawable-equalize.h" -#include "core/gimpdrawable-invert.h" -#include "core/gimpimage.h" -#include "core/gimpimage-undo.h" -#include "core/gimpitem-linked.h" - -#include "widgets/gimpdock.h" -#include "widgets/gimpitemtreeview.h" - -#include "display/gimpdisplay.h" - -#include "drawable-commands.h" -#include "offset-dialog.h" - -#include "gimp-intl.h" - - -#define return_if_no_image(gimage,data) \ - if (GIMP_IS_DISPLAY (data)) \ - gimage = ((GimpDisplay *) data)->gimage; \ - else if (GIMP_IS_GIMP (data)) \ - gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \ - else if (GIMP_IS_DOCK (data)) \ - gimage = gimp_context_get_image (((GimpDock *) data)->context); \ - else if (GIMP_IS_ITEM_TREE_VIEW (data)) \ - gimage = ((GimpItemTreeView *) data)->gimage; \ - else \ - gimage = NULL; \ - \ - if (! gimage) \ - return - -#define return_if_no_drawable(gimage,drawable,data) \ - return_if_no_image (gimage,data); \ - drawable = gimp_image_active_drawable (gimage); \ - if (! drawable) \ - return - - -/* public functions */ - -void -drawable_desaturate_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpDrawable *active_drawable; - return_if_no_drawable (gimage, active_drawable, data); - - if (! gimp_drawable_is_rgb (active_drawable)) - { - g_message (_("Desaturate operates only on RGB color layers.")); - return; - } - - gimp_drawable_desaturate (active_drawable); - gimp_image_flush (gimage); -} - -void -drawable_invert_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpDrawable *active_drawable; - return_if_no_drawable (gimage, active_drawable, data); - - if (gimp_drawable_is_indexed (active_drawable)) - { - g_message (_("Invert does not operate on indexed layers.")); - return; - } - - gimp_drawable_invert (active_drawable); - gimp_image_flush (gimage); -} - -void -drawable_equalize_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpDrawable *active_drawable; - return_if_no_drawable (gimage, active_drawable, data); - - if (gimp_drawable_is_indexed (active_drawable)) - { - g_message (_("Equalize does not operate on indexed layers.")); - return; - } - - gimp_drawable_equalize (active_drawable, TRUE); - gimp_image_flush (gimage); -} - -void -drawable_flip_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpImage *gimage; - GimpDrawable *active_drawable; - GimpItem *item; - GimpContext *context; - gint off_x, off_y; - gdouble axis = 0.0; - return_if_no_drawable (gimage, active_drawable, data); - - item = GIMP_ITEM (active_drawable); - - gimp_item_offsets (item, &off_x, &off_y); - - switch ((GimpOrientationType) action) - { - case GIMP_ORIENTATION_HORIZONTAL: - axis = ((gdouble) off_x + (gdouble) gimp_item_width (item) / 2.0); - break; - - case GIMP_ORIENTATION_VERTICAL: - axis = ((gdouble) off_y + (gdouble) gimp_item_height (item) / 2.0); - break; - - default: - break; - } - - context = gimp_get_user_context (gimage->gimp); - - if (gimp_item_get_linked (item)) - gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM, - _("Flip Layer")); - - gimp_item_flip (item, context, (GimpOrientationType) action, axis, FALSE); - - if (gimp_item_get_linked (item)) - { - gimp_item_linked_flip (item, context, (GimpOrientationType) action, axis, - FALSE); - gimp_image_undo_group_end (gimage); - } - - gimp_image_flush (gimage); -} - -void -drawable_rotate_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpImage *gimage; - GimpDrawable *active_drawable; - GimpItem *item; - GimpContext *context; - gint off_x, off_y; - gdouble center_x, center_y; - return_if_no_drawable (gimage, active_drawable, data); - - item = GIMP_ITEM (active_drawable); - - gimp_item_offsets (item, &off_x, &off_y); - - center_x = ((gdouble) off_x + (gdouble) gimp_item_width (item) / 2.0); - center_y = ((gdouble) off_y + (gdouble) gimp_item_height (item) / 2.0); - - context = gimp_get_user_context (gimage->gimp); - - if (gimp_item_get_linked (item)) - gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM, - _("Rotate Layer")); - - gimp_item_rotate (item, context, (GimpRotationType) action, - center_x, center_y, FALSE); - - if (gimp_item_get_linked (item)) - { - gimp_item_linked_rotate (item, context, (GimpRotationType) action, - center_x, center_y, FALSE); - gimp_image_undo_group_end (gimage); - } - - gimp_image_flush (gimage); -} - -void -drawable_offset_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpDrawable *drawable; - return_if_no_drawable (gimage, drawable, data); - - offset_dialog_create (drawable, widget); -} diff --git a/app/gui/drawable-commands.h b/app/gui/drawable-commands.h deleted file mode 100644 index df3b6f2fa4..0000000000 --- a/app/gui/drawable-commands.h +++ /dev/null @@ -1,39 +0,0 @@ -/* 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_COMMANDS_H__ -#define __DRAWABLE_COMMANDS_H__ - - -void drawable_desaturate_cmd_callback (GtkWidget *widget, - gpointer data); -void drawable_invert_cmd_callback (GtkWidget *widget, - gpointer data); -void drawable_equalize_cmd_callback (GtkWidget *widget, - gpointer data); -void drawable_flip_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void drawable_rotate_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void drawable_offset_cmd_callback (GtkWidget *widget, - gpointer data); - - -#endif /* __DRAWABLE_COMMANDS_H__ */ diff --git a/app/gui/edit-commands.c b/app/gui/edit-commands.c deleted file mode 100644 index d199be2d6c..0000000000 --- a/app/gui/edit-commands.c +++ /dev/null @@ -1,389 +0,0 @@ -/* 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 "core/gimp.h" -#include "core/gimp-edit.h" -#include "core/gimpbuffer.h" -#include "core/gimpcontainer.h" -#include "core/gimpcontext.h" -#include "core/gimpdrawable.h" -#include "core/gimpimage.h" -#include "core/gimpimage-undo.h" -#include "core/gimptoolinfo.h" - -#include "display/gimpdisplay.h" -#include "display/gimpdisplayshell.h" -#include "display/gimpdisplayshell-transform.h" - -#include "widgets/gimpdock.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpdialogfactory.h" - -#include "dialogs.h" -#include "edit-commands.h" -#include "stroke-dialog.h" - -#include "gimp-intl.h" - - -#define return_if_no_display(gdisp,data) \ - if (GIMP_IS_DISPLAY (data)) \ - gdisp = data; \ - else if (GIMP_IS_GIMP (data)) \ - gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \ - else if (GIMP_IS_DOCK (data)) \ - gdisp = gimp_context_get_display (((GimpDock *) data)->context); \ - else \ - gdisp = NULL; \ - if (! gdisp) \ - return - -#define return_if_no_image(gimage,data) \ - if (GIMP_IS_DISPLAY (data)) \ - gimage = ((GimpDisplay *) data)->gimage; \ - else if (GIMP_IS_GIMP (data)) \ - gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \ - else if (GIMP_IS_DOCK (data)) \ - gimage = gimp_context_get_image (((GimpDock *) data)->context); \ - else \ - gimage = NULL; \ - if (! gimage) \ - return - -#define return_if_no_drawable(gimage,drawable,data) \ - return_if_no_image (gimage, data); \ - drawable = gimp_image_active_drawable (gimage); \ - if (! drawable) \ - return; - - -/* local function prototypes */ - -static void cut_named_buffer_callback (GtkWidget *widget, - const gchar *name, - gpointer data); -static void copy_named_buffer_callback (GtkWidget *widget, - const gchar *name, - gpointer data); - - -/* public functions */ - -void -edit_undo_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - if (gimp_image_undo (gimage)) - gimp_image_flush (gimage); -} - -void -edit_redo_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - if (gimp_image_redo (gimage)) - gimp_image_flush (gimage); -} - -void -edit_cut_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpDrawable *drawable; - return_if_no_drawable (gimage, drawable, data); - - if (gimp_edit_cut (gimage, drawable, gimp_get_user_context (gimage->gimp))) - gimp_image_flush (gimage); -} - -void -edit_copy_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpDrawable *drawable; - return_if_no_drawable (gimage, drawable, data); - - if (gimp_edit_copy (gimage, drawable, gimp_get_user_context (gimage->gimp))) - gimp_image_flush (gimage); -} - -static void -edit_paste (GimpDisplay *gdisp, - gboolean paste_into) -{ - if (gdisp->gimage->gimp->global_buffer) - { - GimpDisplayShell *shell; - gint x, y, width, height; - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height); - - if (gimp_edit_paste (gdisp->gimage, - gimp_image_active_drawable (gdisp->gimage), - gdisp->gimage->gimp->global_buffer, - paste_into, x, y, width, height)) - { - gimp_image_flush (gdisp->gimage); - } - } -} - -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) -{ - GimpDisplay *gdisp; - return_if_no_display (gdisp, data); - - if (gdisp->gimage->gimp->global_buffer) - { - gimp_edit_paste_as_new (gdisp->gimage->gimp, - gdisp->gimage, - gdisp->gimage->gimp->global_buffer); - } -} - -void -edit_named_cut_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GtkWidget *qbox; - return_if_no_display (gdisp, data); - - qbox = gimp_query_string_box (_("Cut Named"), - gdisp->shell, - gimp_standard_help_func, - GIMP_HELP_BUFFER_CUT, - _("Enter a name for this buffer"), - NULL, - G_OBJECT (gdisp->gimage), "disconnect", - cut_named_buffer_callback, gdisp->gimage); - gtk_widget_show (qbox); -} - -void -edit_named_copy_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GtkWidget *qbox; - return_if_no_display (gdisp, data); - - qbox = gimp_query_string_box (_("Copy Named"), - gdisp->shell, - gimp_standard_help_func, - GIMP_HELP_BUFFER_COPY, - _("Enter a name for this buffer"), - NULL, - G_OBJECT (gdisp->gimage), "disconnect", - copy_named_buffer_callback, gdisp->gimage); - gtk_widget_show (qbox); -} - -void -edit_named_paste_cmd_callback (GtkWidget *widget, - gpointer data) -{ - gimp_dialog_factory_dialog_raise (global_dock_factory, - gtk_widget_get_screen (widget), - "gimp-buffer-list|gimp-buffer-grid", -1); -} - -void -edit_clear_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpDrawable *drawable; - return_if_no_drawable (gimage, drawable, data); - - gimp_edit_clear (gimage, drawable, gimp_get_user_context (gimage->gimp)); - gimp_image_flush (gimage); -} - -void -edit_fill_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpImage *gimage; - GimpDrawable *drawable; - GimpFillType fill_type; - return_if_no_drawable (gimage, drawable, data); - - fill_type = (GimpFillType) action; - - gimp_edit_fill (gimage, drawable, gimp_get_user_context (gimage->gimp), - fill_type); - gimp_image_flush (gimage); -} - -void -edit_stroke_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpDrawable *drawable; - return_if_no_drawable (gimage, drawable, data); - - edit_stroke_selection (GIMP_ITEM (gimp_image_get_mask (gimage)), widget); -} - -void -edit_stroke_selection (GimpItem *item, - GtkWidget *parent) -{ - GimpImage *gimage; - GimpDrawable *active_drawable; - GtkWidget *dialog; - - g_return_if_fail (GIMP_IS_ITEM (item)); - - gimage = gimp_item_get_image (item); - - active_drawable = gimp_image_active_drawable (gimage); - - if (! active_drawable) - { - g_message (_("There is no active layer or channel to stroke to.")); - return; - } - - dialog = stroke_dialog_new (item, GIMP_STOCK_SELECTION_STROKE, - GIMP_HELP_SELECTION_STROKE, - parent); - gtk_widget_show (dialog); -} - - -/* private functions */ - -static void -cut_named_buffer_callback (GtkWidget *widget, - const gchar *name, - gpointer data) -{ - GimpImage *gimage = GIMP_IMAGE (data); - const GimpBuffer *cut_buffer; - GimpDrawable *active_drawable; - - active_drawable = gimp_image_active_drawable (gimage); - - if (! active_drawable) - { - g_message (_("There is no active layer or channel to cut from.")); - return; - } - - cut_buffer = gimp_edit_cut (gimage, active_drawable, - gimp_get_user_context (gimage->gimp)); - - if (cut_buffer) - { - GimpBuffer *new_buffer; - - if (! (name && strlen (name))) - name = _("(Unnamed Buffer)"); - - new_buffer = gimp_buffer_new (cut_buffer->tiles, name, TRUE); - - gimp_container_add (gimage->gimp->named_buffers, - GIMP_OBJECT (new_buffer)); - g_object_unref (new_buffer); - - gimp_image_flush (gimage); - } -} - -static void -copy_named_buffer_callback (GtkWidget *widget, - const gchar *name, - gpointer data) -{ - GimpImage *gimage = GIMP_IMAGE (data); - const GimpBuffer *copy_buffer; - GimpDrawable *active_drawable; - - active_drawable = gimp_image_active_drawable (gimage); - - if (! active_drawable) - { - g_message (_("There is no active layer or channel to copy from.")); - return; - } - - copy_buffer = gimp_edit_copy (gimage, active_drawable, - gimp_get_user_context (gimage->gimp)); - - if (copy_buffer) - { - GimpBuffer *new_buffer; - - if (! (name && strlen (name))) - name = _("(Unnamed Buffer)"); - - new_buffer = gimp_buffer_new (copy_buffer->tiles, name, TRUE); - - gimp_container_add (gimage->gimp->named_buffers, - GIMP_OBJECT (new_buffer)); - g_object_unref (new_buffer); - - gimp_image_flush (gimage); - } -} diff --git a/app/gui/edit-commands.h b/app/gui/edit-commands.h deleted file mode 100644 index a7d3913b91..0000000000 --- a/app/gui/edit-commands.h +++ /dev/null @@ -1,55 +0,0 @@ -/* 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_COMMANDS_H__ -#define __EDIT_COMMANDS_H__ - - -void edit_undo_cmd_callback (GtkWidget *widget, - gpointer data); -void edit_redo_cmd_callback (GtkWidget *widget, - gpointer data); -void edit_cut_cmd_callback (GtkWidget *widget, - gpointer data); -void edit_copy_cmd_callback (GtkWidget *widget, - gpointer data); -void edit_paste_cmd_callback (GtkWidget *widget, - 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, - gpointer data); -void edit_named_copy_cmd_callback (GtkWidget *widget, - gpointer data); -void edit_named_paste_cmd_callback (GtkWidget *widget, - gpointer data); -void edit_clear_cmd_callback (GtkWidget *widget, - gpointer data); -void edit_fill_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void edit_stroke_cmd_callback (GtkWidget *widget, - gpointer data); - -void edit_stroke_selection (GimpItem *item, - GtkWidget *parent); - - -#endif /* __EDIT_COMMANDS_H__ */ diff --git a/app/gui/error-console-commands.c b/app/gui/error-console-commands.c deleted file mode 100644 index ead24bb3c5..0000000000 --- a/app/gui/error-console-commands.c +++ /dev/null @@ -1,63 +0,0 @@ -/* 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 "gui-types.h" - -#include "widgets/gimperrorconsole.h" - -#include "error-console-commands.h" - - -/* public functions */ - -void -error_console_clear_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data); - - if (GTK_WIDGET_IS_SENSITIVE (console->clear_button)) - gtk_button_clicked (GTK_BUTTON (console->clear_button)); -} - -void -error_console_save_all_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data); - - if (GTK_WIDGET_IS_SENSITIVE (console->save_button)) - gtk_button_clicked (GTK_BUTTON (console->save_button)); -} - -void -error_console_save_selection_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data); - - if (GTK_WIDGET_IS_SENSITIVE (console->save_button)) - gimp_button_extended_clicked (GIMP_BUTTON (console->save_button), - GDK_SHIFT_MASK); -} diff --git a/app/gui/error-console-commands.h b/app/gui/error-console-commands.h deleted file mode 100644 index e2b5cc6f6f..0000000000 --- a/app/gui/error-console-commands.h +++ /dev/null @@ -1,31 +0,0 @@ -/* 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_COMMANDS_H__ -#define __ERROR_CONSOLE_COMMANDS_H__ - - -void error_console_clear_cmd_callback (GtkWidget *widget, - gpointer data); -void error_console_save_all_cmd_callback (GtkWidget *widget, - gpointer data); -void error_console_save_selection_cmd_callback (GtkWidget *widget, - gpointer data); - - -#endif /* __ERROR_CONSOLE_COMMANDS_H__ */ diff --git a/app/gui/error-console-menu.c b/app/gui/error-console-menu.c index 5fbe8c475e..693a634182 100644 --- a/app/gui/error-console-menu.c +++ b/app/gui/error-console-menu.c @@ -28,7 +28,8 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" -#include "error-console-commands.h" +#include "actions/error-console-commands.h" + #include "error-console-menu.h" #include "gimp-intl.h" diff --git a/app/gui/file-commands.c b/app/gui/file-commands.c deleted file mode 100644 index 3b5e0c29b3..0000000000 --- a/app/gui/file-commands.c +++ /dev/null @@ -1,465 +0,0 @@ -/* 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 "config/gimpguiconfig.h" - -#include "core/gimp.h" -#include "core/gimpcontainer.h" -#include "core/gimpcontext.h" -#include "core/gimplist.h" -#include "core/gimpimage.h" -#include "core/gimptemplate.h" - -#include "file/file-open.h" -#include "file/file-save.h" -#include "file/file-utils.h" - -#include "widgets/gimpdock.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpdialogfactory.h" -#include "widgets/gimpfiledialog.h" - -#include "display/gimpdisplay.h" -#include "display/gimpdisplay-foreach.h" -#include "display/gimpdisplayshell.h" - -#include "dialogs.h" -#include "file-commands.h" -#include "file-new-dialog.h" -#include "file-open-dialog.h" -#include "file-save-dialog.h" -#include "menus.h" - -#include "gimp-intl.h" - - -#define REVERT_DATA_KEY "revert-confirm-dialog" - - -#define return_if_no_gimp(gimp,data) \ - if (GIMP_IS_DISPLAY (data)) \ - gimp = ((GimpDisplay *) data)->gimage->gimp; \ - else if (GIMP_IS_GIMP (data)) \ - gimp = data; \ - else if (GIMP_IS_DOCK (data)) \ - gimp = ((GimpDock *) data)->context->gimp; \ - else \ - gimp = NULL; \ - if (! gimp) \ - return - - -#define return_if_no_display(gdisp,data) \ - if (GIMP_IS_DISPLAY (data)) \ - gdisp = data; \ - else if (GIMP_IS_GIMP (data)) \ - gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \ - else if (GIMP_IS_DOCK (data)) \ - gdisp = gimp_context_get_display (((GimpDock *) data)->context); \ - else \ - gdisp = NULL; \ - if (! gdisp) \ - return - - -/* local function prototypes */ - -static void file_new_template_callback (GtkWidget *widget, - const gchar *name, - gpointer data); -static void file_revert_confirm_callback (GtkWidget *widget, - gboolean revert, - gpointer data); - - -/* public functions */ - -void -file_new_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - Gimp *gimp; - GimpImage *gimage; - GtkWidget *dialog; - return_if_no_gimp (gimp, data); - - /* if called from the image menu */ - if (action) - gimage = gimp_context_get_image (gimp_get_user_context (gimp)); - else - gimage = NULL; - - dialog = gimp_dialog_factory_dialog_new (global_dialog_factory, - gtk_widget_get_screen (widget), - "gimp-file-new-dialog", -1); - - if (dialog) - file_new_dialog_set (dialog, gimage, NULL); -} - -void -file_type_cmd_callback (GtkWidget *widget, - gpointer data) -{ - gimp_file_dialog_set_file_proc (GIMP_FILE_DIALOG (data), - g_object_get_data (G_OBJECT (widget), - "file-proc")); -} - -void -file_open_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - Gimp *gimp; - GimpImage *gimage; - return_if_no_gimp (gimp, data); - - /* if called from the image menu */ - if (action) - gimage = gimp_context_get_image (gimp_get_user_context (gimp)); - else - gimage = NULL; - - file_open_dialog_show (gimp, gimage, NULL, global_menu_factory, widget); -} - -void -file_last_opened_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - Gimp *gimp; - GimpImagefile *imagefile; - guint num_entries; - return_if_no_gimp (gimp, data); - - num_entries = gimp_container_num_children (gimp->documents); - - if (action >= num_entries) - return; - - imagefile = (GimpImagefile *) - gimp_container_get_child_by_index (gimp->documents, action); - - if (imagefile) - { - GimpImage *gimage; - GimpPDBStatusType status; - GError *error = NULL; - - gimage = file_open_with_display (gimp, gimp_get_user_context (gimp), - GIMP_OBJECT (imagefile)->name, - &status, &error); - - if (! gimage && status != GIMP_PDB_CANCEL) - { - gchar *filename; - - filename = - file_utils_uri_to_utf8_filename (GIMP_OBJECT (imagefile)->name); - - g_message (_("Opening '%s' failed:\n\n%s"), - filename, error->message); - g_clear_error (&error); - - g_free (filename); - } - } -} - -void -file_save_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - return_if_no_display (gdisp, data); - - g_return_if_fail (gimp_image_active_drawable (gdisp->gimage)); - - /* Only save if the gimage has been modified */ - if (gdisp->gimage->dirty || - ! GIMP_GUI_CONFIG (gdisp->gimage->gimp->config)->trust_dirty_flag) - { - const gchar *uri; - - uri = gimp_object_get_name (GIMP_OBJECT (gdisp->gimage)); - - if (! uri) - { - file_save_as_cmd_callback (widget, data); - } - else - { - GimpPDBStatusType status; - GError *error = NULL; - - status = file_save (gdisp->gimage, - gimp_get_user_context (gdisp->gimage->gimp), - GIMP_RUN_WITH_LAST_VALS, &error); - - if (status != GIMP_PDB_SUCCESS && - status != GIMP_PDB_CANCEL) - { - gchar *filename; - - filename = file_utils_uri_to_utf8_filename (uri); - - g_message (_("Saving '%s' failed:\n\n%s"), - filename, error->message); - g_clear_error (&error); - - g_free (filename); - } - } - } -} - -void -file_save_as_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - return_if_no_display (gdisp, data); - - file_save_dialog_show (gdisp->gimage, global_menu_factory, widget); -} - -void -file_save_a_copy_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - return_if_no_display (gdisp, data); - - file_save_a_copy_dialog_show (gdisp->gimage, global_menu_factory, widget); -} - -void -file_save_template_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GtkWidget *qbox; - return_if_no_display (gdisp, data); - - qbox = gimp_query_string_box (_("Create New Template"), - gdisp->shell, - gimp_standard_help_func, - GIMP_HELP_FILE_SAVE_AS_TEMPLATE, - _("Enter a name for this template"), - NULL, - G_OBJECT (gdisp->gimage), "disconnect", - file_new_template_callback, gdisp->gimage); - gtk_widget_show (qbox); -} - -void -file_revert_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GtkWidget *query_box; - const gchar *uri; - return_if_no_display (gdisp, data); - - uri = gimp_object_get_name (GIMP_OBJECT (gdisp->gimage)); - - query_box = g_object_get_data (G_OBJECT (gdisp->gimage), REVERT_DATA_KEY); - - if (! uri) - { - g_message (_("Revert failed. No file name associated with this image.")); - } - else if (query_box) - { - gtk_window_present (GTK_WINDOW (query_box->window)); - } - else - { - gchar *basename; - gchar *text; - - basename = g_path_get_basename (uri); - - text = g_strdup_printf (_("Revert '%s' to\n" - "'%s'?\n\n" - "You will lose all your changes, " - "including all undo information."), - basename, uri); - - g_free (basename); - - query_box = gimp_query_boolean_box (_("Revert Image"), - gdisp->shell, - gimp_standard_help_func, - GIMP_HELP_FILE_REVERT, - GIMP_STOCK_QUESTION, - text, - GTK_STOCK_YES, GTK_STOCK_NO, - G_OBJECT (gdisp->gimage), - "disconnect", - file_revert_confirm_callback, - gdisp->gimage); - - g_free (text); - - g_object_set_data (G_OBJECT (gdisp->gimage), REVERT_DATA_KEY, - query_box); - - gtk_window_set_transient_for (GTK_WINDOW (query_box), - GTK_WINDOW (gdisp->shell)); - - gtk_widget_show (query_box); - } -} - -void -file_close_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - return_if_no_display (gdisp, data); - - gimp_display_shell_close (GIMP_DISPLAY_SHELL (gdisp->shell), FALSE); -} - -void -file_quit_cmd_callback (GtkWidget *widget, - gpointer data) -{ - Gimp *gimp; - return_if_no_gimp (gimp, data); - - gimp_exit (gimp, FALSE); -} - -void -file_file_open_dialog (Gimp *gimp, - const gchar *uri, - GtkWidget *parent) -{ - file_open_dialog_show (gimp, NULL, uri, global_menu_factory, parent); -} - - -/* private functions */ - -static void -file_new_template_callback (GtkWidget *widget, - const gchar *name, - gpointer data) -{ - GimpTemplate *template; - GimpImage *gimage; - - gimage = (GimpImage *) data; - - if (! (name && strlen (name))) - name = _("(Unnamed Template)"); - - template = gimp_template_new (name); - gimp_template_set_from_image (template, gimage); - - gimp_list_uniquefy_name (GIMP_LIST (gimage->gimp->templates), - GIMP_OBJECT (template), TRUE); - gimp_container_add (gimage->gimp->templates, - GIMP_OBJECT (template)); - g_object_unref (template); -} - -static void -file_revert_confirm_callback (GtkWidget *widget, - gboolean revert, - gpointer data) -{ - GimpImage *old_gimage; - - old_gimage = (GimpImage *) data; - - g_object_set_data (G_OBJECT (old_gimage), REVERT_DATA_KEY, NULL); - - if (revert) - { - Gimp *gimp; - GimpImage *new_gimage; - const gchar *uri; - GimpPDBStatusType status; - GError *error = NULL; - - gimp = old_gimage->gimp; - - uri = gimp_object_get_name (GIMP_OBJECT (old_gimage)); - - new_gimage = file_open_image (gimp, gimp_get_user_context (gimp), - uri, uri, NULL, - GIMP_RUN_INTERACTIVE, - &status, &error); - - if (new_gimage) - { - GList *contexts = NULL; - GList *list; - - /* remember which contexts refer to old_gimage */ - for (list = gimp->context_list; list; list = g_list_next (list)) - { - GimpContext *context = list->data; - - if (gimp_context_get_image (context) == old_gimage) - contexts = g_list_prepend (contexts, list->data); - } - - gimp_displays_reconnect (gimp, old_gimage, new_gimage); - gimp_image_flush (new_gimage); - - /* set the new_gimage on the remembered contexts (in reverse - * order, since older contexts are usually the parents of - * newer ones) - */ - g_list_foreach (contexts, (GFunc) gimp_context_set_image, new_gimage); - g_list_free (contexts); - - /* the displays own the image now */ - g_object_unref (new_gimage); - } - else if (status != GIMP_PDB_CANCEL) - { - gchar *filename; - - filename = file_utils_uri_to_utf8_filename (uri); - - g_message (_("Reverting to '%s' failed:\n\n%s"), - filename, error->message); - g_clear_error (&error); - - g_free (filename); - } - } -} diff --git a/app/gui/file-commands.h b/app/gui/file-commands.h deleted file mode 100644 index 0eda874a17..0000000000 --- a/app/gui/file-commands.h +++ /dev/null @@ -1,58 +0,0 @@ -/* 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_COMMANDS_H__ -#define __FILE_COMMANDS_H__ - - -void file_new_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - -void file_type_cmd_callback (GtkWidget *widget, - gpointer data); - -void file_open_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void file_last_opened_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - -void file_save_cmd_callback (GtkWidget *widget, - gpointer data); -void file_save_as_cmd_callback (GtkWidget *widget, - gpointer data); -void file_save_a_copy_cmd_callback (GtkWidget *widget, - gpointer data); -void file_save_template_cmd_callback (GtkWidget *widget, - gpointer data); - -void file_revert_cmd_callback (GtkWidget *widget, - gpointer data); -void file_close_cmd_callback (GtkWidget *widget, - gpointer data); -void file_quit_cmd_callback (GtkWidget *widget, - gpointer data); - -void file_file_open_dialog (Gimp *gimp, - const gchar *uri, - GtkWidget *parent); - - -#endif /* __FILE_COMMANDS_H__ */ diff --git a/app/gui/file-open-menu.c b/app/gui/file-open-menu.c index a0da6a126d..3562261cdf 100644 --- a/app/gui/file-open-menu.c +++ b/app/gui/file-open-menu.c @@ -34,7 +34,8 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" -#include "file-commands.h" +#include "actions/file-commands.h" + #include "file-open-menu.h" #include "menus.h" diff --git a/app/gui/file-save-menu.c b/app/gui/file-save-menu.c index a53573190e..3a43d81b4e 100644 --- a/app/gui/file-save-menu.c +++ b/app/gui/file-save-menu.c @@ -35,7 +35,8 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" -#include "file-commands.h" +#include "actions/file-commands.h" + #include "file-save-menu.h" #include "menus.h" diff --git a/app/gui/fonts-commands.c b/app/gui/fonts-commands.c deleted file mode 100644 index eed9cf5fa8..0000000000 --- a/app/gui/fonts-commands.c +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 "gui-types.h" - -#include "widgets/gimpfontview.h" - -#include "fonts-commands.h" - -#include "gimp-intl.h" - - -/* public functionss */ - -void -fonts_refresh_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpFontView *view = GIMP_FONT_VIEW (data); - - if (GTK_WIDGET_SENSITIVE (view->refresh_button)) - gtk_button_clicked (GTK_BUTTON (view->refresh_button)); -} diff --git a/app/gui/fonts-menu.c b/app/gui/fonts-menu.c index c8acf06f23..350d45cb1f 100644 --- a/app/gui/fonts-menu.c +++ b/app/gui/fonts-menu.c @@ -33,7 +33,8 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" -#include "fonts-commands.h" +#include "actions/fonts-commands.h" + #include "fonts-menu.h" #include "gimp-intl.h" diff --git a/app/gui/gradient-editor-commands.c b/app/gui/gradient-editor-commands.c deleted file mode 100644 index 7283dd7fe7..0000000000 --- a/app/gui/gradient-editor-commands.c +++ /dev/null @@ -1,1217 +0,0 @@ -/* 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 "gui-types.h" - -#include "core/gimp.h" -#include "core/gimpcontext.h" -#include "core/gimpdatafactory.h" -#include "core/gimpgradient.h" - -#include "widgets/gimpgradienteditor.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpviewabledialog.h" - -#include "color-notebook.h" -#include "dialogs.h" -#include "gradient-editor-commands.h" - -#include "gimp-intl.h" - - -/* local function prototypes */ - -static void gradient_editor_left_color_changed (ColorNotebook *cnb, - const GimpRGB *color, - ColorNotebookState state, - gpointer data); -static void gradient_editor_right_color_changed (ColorNotebook *cnb, - const GimpRGB *color, - ColorNotebookState state, - gpointer data); - -static GimpGradientSegment * - gradient_editor_save_selection (GimpGradientEditor *editor); -static void gradient_editor_replace_selection (GimpGradientEditor *editor, - GimpGradientSegment *replace_seg); - -static void gradient_editor_split_uniform_response (GtkWidget *widget, - gint response_id, - GimpGradientEditor *editor); -static void gradient_editor_replicate_response (GtkWidget *widget, - gint response_id, - GimpGradientEditor *editor); - - -/* public functionss */ - -void -gradient_editor_left_color_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpGradientEditor *editor; - GimpGradient *gradient; - - editor = GIMP_GRADIENT_EDITOR (data); - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - - editor->left_saved_dirty = GIMP_DATA (gradient)->dirty; - editor->left_saved_segments = gradient_editor_save_selection (editor); - - editor->color_notebook = - color_notebook_new (GIMP_VIEWABLE (gradient), - _("Left Endpoint Color"), - GIMP_STOCK_GRADIENT, - _("Gradient Segment's Left Endpoint Color"), - GTK_WIDGET (editor), - global_dialog_factory, - "gimp-gradient-editor-color-dialog", - &editor->control_sel_l->left_color, - gradient_editor_left_color_changed, editor, - editor->instant_update, TRUE); - - gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE); -} - -void -gradient_editor_load_left_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpGradientEditor *editor; - GimpGradient *gradient; - GimpContext *user_context; - GimpGradientSegment *seg; - GimpRGB color; - gint i; - - editor = GIMP_GRADIENT_EDITOR (data); - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - - user_context = gimp_get_user_context (GIMP_DATA_EDITOR (editor)->data_factory->gimp); - - i = (gint) action; - - switch (i) - { - case 0: /* Fetch from left neighbor's right endpoint */ - if (editor->control_sel_l->prev != NULL) - seg = editor->control_sel_l->prev; - else - seg = gimp_gradient_segment_get_last (editor->control_sel_l); - - gimp_gradient_segments_blend_endpoints (editor->control_sel_l, - editor->control_sel_r, - &seg->right_color, - &editor->control_sel_r->right_color, - TRUE, TRUE); - break; - - case 1: /* Fetch from right endpoint */ - gimp_gradient_segments_blend_endpoints (editor->control_sel_l, - editor->control_sel_r, - &editor->control_sel_r->right_color, - &editor->control_sel_r->right_color, - TRUE, TRUE); - break; - - case 2: /* Fetch from FG color */ - gimp_context_get_foreground (user_context, &color); - - gimp_gradient_segments_blend_endpoints (editor->control_sel_l, - editor->control_sel_r, - &color, - &editor->control_sel_r->right_color, - TRUE, TRUE); - break; - - case 3: /* Fetch from BG color */ - gimp_context_get_background (user_context, &color); - - gimp_gradient_segments_blend_endpoints (editor->control_sel_l, - editor->control_sel_r, - &color, - &editor->control_sel_r->right_color, - TRUE, TRUE); - break; - - default: /* Load a color */ - gimp_gradient_segments_blend_endpoints (editor->control_sel_l, - editor->control_sel_r, - &editor->saved_colors[i - 4], - &editor->control_sel_r->right_color, - TRUE, TRUE); - break; - } - - gimp_data_dirty (GIMP_DATA (gradient)); -} - -void -gradient_editor_save_left_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpGradientEditor *editor; - - editor = GIMP_GRADIENT_EDITOR (data); - - editor->saved_colors[action] = editor->control_sel_l->left_color; -} - -void -gradient_editor_right_color_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpGradientEditor *editor; - GimpGradient *gradient; - - editor = GIMP_GRADIENT_EDITOR (data); - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - - editor->right_saved_dirty = GIMP_DATA (gradient)->dirty; - editor->right_saved_segments = gradient_editor_save_selection (editor); - - editor->color_notebook = - color_notebook_new (GIMP_VIEWABLE (gradient), - _("Right Endpoint Color"), - GIMP_STOCK_GRADIENT, - _("Gradient Segment's Right Endpoint Color"), - GTK_WIDGET (editor), - global_dialog_factory, - "gimp-gradient-editor-color-dialog", - &editor->control_sel_l->right_color, - gradient_editor_right_color_changed, editor, - editor->instant_update, TRUE); - - gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE); -} - -void -gradient_editor_load_right_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpGradientEditor *editor; - GimpGradient *gradient; - GimpContext *user_context; - GimpGradientSegment *seg; - GimpRGB color; - gint i; - - editor = GIMP_GRADIENT_EDITOR (data); - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - - user_context = gimp_get_user_context (GIMP_DATA_EDITOR (editor)->data_factory->gimp); - - i = (gint) action; - - switch (i) - { - case 0: /* Fetch from right neighbor's left endpoint */ - if (editor->control_sel_r->next != NULL) - seg = editor->control_sel_r->next; - else - seg = gimp_gradient_segment_get_first (editor->control_sel_r); - - gimp_gradient_segments_blend_endpoints (editor->control_sel_l, - editor->control_sel_r, - &editor->control_sel_r->left_color, - &seg->left_color, - TRUE, TRUE); - break; - - case 1: /* Fetch from left endpoint */ - gimp_gradient_segments_blend_endpoints (editor->control_sel_l, - editor->control_sel_r, - &editor->control_sel_l->left_color, - &editor->control_sel_l->left_color, - TRUE, TRUE); - break; - - case 2: /* Fetch from FG color */ - gimp_context_get_foreground (user_context, &color); - - gimp_gradient_segments_blend_endpoints (editor->control_sel_l, - editor->control_sel_r, - &editor->control_sel_l->left_color, - &color, - TRUE, TRUE); - break; - - case 3: /* Fetch from BG color */ - gimp_context_get_background (user_context, &color); - - gimp_gradient_segments_blend_endpoints (editor->control_sel_l, - editor->control_sel_r, - &editor->control_sel_l->left_color, - &color, - TRUE, TRUE); - break; - - default: /* Load a color */ - gimp_gradient_segments_blend_endpoints (editor->control_sel_l, - editor->control_sel_r, - &editor->control_sel_l->left_color, - &editor->saved_colors[i - 4], - TRUE, TRUE); - break; - } - - gimp_data_dirty (GIMP_DATA (gradient)); -} - -void -gradient_editor_save_right_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpGradientEditor *editor; - - editor = GIMP_GRADIENT_EDITOR (data); - - editor->saved_colors[action] = editor->control_sel_l->left_color; -} - -void -gradient_editor_blending_func_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpGradientEditor *editor; - GimpGradient *gradient; - GimpGradientSegmentType type; - GimpGradientSegment *seg, *aseg; - - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - editor = GIMP_GRADIENT_EDITOR (data); - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - - type = (GimpGradientSegmentType) action; - - seg = editor->control_sel_l; - - do - { - seg->type = type; - - aseg = seg; - seg = seg->next; - } - while (aseg != editor->control_sel_r); - - gimp_data_dirty (GIMP_DATA (gradient)); -} - -void -gradient_editor_coloring_type_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpGradientEditor *editor; - GimpGradient *gradient; - GimpGradientSegmentColor color; - GimpGradientSegment *seg, *aseg; - - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - editor = GIMP_GRADIENT_EDITOR (data); - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - - color = (GimpGradientSegmentColor) action; - - seg = editor->control_sel_l; - - do - { - seg->color = color; - - aseg = seg; - seg = seg->next; - } - while (aseg != editor->control_sel_r); - - gimp_data_dirty (GIMP_DATA (gradient)); -} - -void -gradient_editor_flip_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpGradientEditor *editor; - GimpGradient *gradient; - GimpGradientSegment *oseg, *oaseg; - GimpGradientSegment *seg, *prev, *tmp; - GimpGradientSegment *lseg, *rseg; - gdouble left, right; - - editor = GIMP_GRADIENT_EDITOR (data); - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - - left = editor->control_sel_l->left; - right = editor->control_sel_r->right; - - /* Build flipped segments */ - - prev = NULL; - oseg = editor->control_sel_r; - tmp = NULL; - - do - { - seg = gimp_gradient_segment_new (); - - if (prev == NULL) - { - seg->left = left; - tmp = seg; /* Remember first segment */ - } - else - seg->left = left + right - oseg->right; - - seg->middle = left + right - oseg->middle; - seg->right = left + right - oseg->left; - - seg->left_color = oseg->right_color; - - seg->right_color = oseg->left_color; - - switch (oseg->type) - { - case GIMP_GRAD_SPHERE_INCREASING: - seg->type = GIMP_GRAD_SPHERE_DECREASING; - break; - - case GIMP_GRAD_SPHERE_DECREASING: - seg->type = GIMP_GRAD_SPHERE_INCREASING; - break; - - default: - seg->type = oseg->type; - } - - switch (oseg->color) - { - case GIMP_GRAD_HSV_CCW: - seg->color = GIMP_GRAD_HSV_CW; - break; - - case GIMP_GRAD_HSV_CW: - seg->color = GIMP_GRAD_HSV_CCW; - break; - - default: - seg->color = oseg->color; - } - - seg->prev = prev; - seg->next = NULL; - - if (prev) - prev->next = seg; - - prev = seg; - - oaseg = oseg; - oseg = oseg->prev; /* Move backwards! */ - } - while (oaseg != editor->control_sel_l); - - seg->right = right; /* Squish accumulative error */ - - /* Free old segments */ - - lseg = editor->control_sel_l->prev; - rseg = editor->control_sel_r->next; - - oseg = editor->control_sel_l; - - do - { - oaseg = oseg->next; - gimp_gradient_segment_free (oseg); - oseg = oaseg; - } - while (oaseg != rseg); - - /* Link in new segments */ - - if (lseg) - lseg->next = tmp; - else - gradient->segments = tmp; - - tmp->prev = lseg; - - seg->next = rseg; - - if (rseg) - rseg->prev = seg; - - /* Reset selection */ - - editor->control_sel_l = tmp; - editor->control_sel_r = seg; - - /* Done */ - - gimp_data_dirty (GIMP_DATA (gradient)); - gimp_gradient_editor_update (editor); -} - -void -gradient_editor_replicate_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpGradientEditor *editor; - GtkWidget *dialog; - GtkWidget *vbox; - GtkWidget *label; - GtkWidget *scale; - GtkObject *scale_data; - const gchar *title; - const gchar *desc; - - editor = GIMP_GRADIENT_EDITOR (data); - - if (editor->control_sel_l == editor->control_sel_r) - { - title = _("Replicate Segment"); - desc = _("Replicate Gradient Segment"); - } - else - { - title = _("Replicate Selection"); - desc = _("Replicate Gradient Selection"); - } - - dialog = - gimp_viewable_dialog_new (GIMP_VIEWABLE (GIMP_DATA_EDITOR (editor)->data), - title, "gimp-gradient-segment-replicate", - GIMP_STOCK_GRADIENT, desc, - GTK_WIDGET (editor), - gimp_standard_help_func, - GIMP_HELP_GRADIENT_EDITOR_REPLICATE, - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - _("Replicate"), GTK_RESPONSE_OK, - - NULL); - - g_signal_connect (dialog, "response", - G_CALLBACK (gradient_editor_replicate_response), - editor); - - vbox = gtk_vbox_new (FALSE, 4); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox); - gtk_widget_show (vbox); - - /* Instructions */ - if (editor->control_sel_l == editor->control_sel_r) - label = gtk_label_new (_("Select the number of times\n" - "to replicate the selected segment.")); - else - label = gtk_label_new (_("Select the number of times\n" - "to replicate the selection.")); - - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - gtk_widget_show (label); - - /* Scale */ - editor->replicate_times = 2; - scale_data = gtk_adjustment_new (2.0, 2.0, 21.0, 1.0, 1.0, 1.0); - - scale = gtk_hscale_new (GTK_ADJUSTMENT (scale_data)); - gtk_scale_set_digits (GTK_SCALE (scale), 0); - gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP); - gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, TRUE, 4); - gtk_widget_show (scale); - - g_signal_connect (scale_data, "value_changed", - G_CALLBACK (gimp_int_adjustment_update), - &editor->replicate_times); - - gtk_widget_show (dialog); - gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE); -} - -void -gradient_editor_split_midpoint_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpGradientEditor *editor; - GimpGradient *gradient; - GimpGradientSegment *seg, *lseg, *rseg; - - editor = GIMP_GRADIENT_EDITOR (data); - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - - seg = editor->control_sel_l; - - do - { - gimp_gradient_segment_split_midpoint (gradient, seg, &lseg, &rseg); - seg = rseg->next; - } - while (lseg != editor->control_sel_r); - - editor->control_sel_r = rseg; - - gimp_data_dirty (GIMP_DATA (gradient)); - gimp_gradient_editor_update (editor); -} - -void -gradient_editor_split_uniformly_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpGradientEditor *editor; - GtkWidget *dialog; - GtkWidget *vbox; - GtkWidget *label; - GtkWidget *scale; - GtkObject *scale_data; - const gchar *title; - const gchar *desc; - - editor = GIMP_GRADIENT_EDITOR (data); - - if (editor->control_sel_l == editor->control_sel_r) - { - title = _("Split Segment Uniformly"); - desc = _("Split Gradient Segment Uniformly"); - } - else - { - title = _("Split Segments Uniformly"); - desc = _("Split Gradient Segments Uniformly"); - } - - dialog = - gimp_viewable_dialog_new (GIMP_VIEWABLE (GIMP_DATA_EDITOR (editor)->data), - title, "gimp-gradient-segment-split-uniformly", - GIMP_STOCK_GRADIENT, desc, - GTK_WIDGET (editor), - gimp_standard_help_func, - GIMP_HELP_GRADIENT_EDITOR_SPLIT_UNIFORM, - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - _("Split"), GTK_RESPONSE_OK, - - NULL); - - g_signal_connect (dialog, "response", - G_CALLBACK (gradient_editor_split_uniform_response), - editor); - - /* The main vbox */ - vbox = gtk_vbox_new (FALSE, 4); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox); - gtk_widget_show (vbox); - - /* Instructions */ - if (editor->control_sel_l == editor->control_sel_r) - label = gtk_label_new (_("Select the number of uniform parts\n" - "in which to split the selected segment.")); - else - label = gtk_label_new (_("Select the number of uniform parts\n" - "in which to split the segments in the selection.")); - - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - gtk_widget_show (label); - - /* Scale */ - editor->split_parts = 2; - scale_data = gtk_adjustment_new (2.0, 2.0, 21.0, 1.0, 1.0, 1.0); - - scale = gtk_hscale_new (GTK_ADJUSTMENT (scale_data)); - gtk_scale_set_digits (GTK_SCALE (scale), 0); - gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP); - gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 4); - gtk_widget_show (scale); - - g_signal_connect (scale_data, "value_changed", - G_CALLBACK (gimp_int_adjustment_update), - &editor->split_parts); - - /* Show! */ - gtk_widget_show (dialog); - gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE); -} - -void -gradient_editor_delete_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpGradientEditor *editor; - GimpGradient *gradient; - GimpGradientSegment *lseg, *rseg, *seg, *aseg, *next; - gdouble join; - - editor = GIMP_GRADIENT_EDITOR (data); - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - - /* Remember segments to the left and to the right of the selection */ - - lseg = editor->control_sel_l->prev; - rseg = editor->control_sel_r->next; - - /* Cannot delete all the segments in the gradient */ - - if ((lseg == NULL) && (rseg == NULL)) - return; - - /* Calculate join point */ - - join = (editor->control_sel_l->left + - editor->control_sel_r->right) / 2.0; - - if (lseg == NULL) - join = 0.0; - else if (rseg == NULL) - join = 1.0; - - /* Move segments */ - - if (lseg != NULL) - gimp_gradient_segments_compress_range (lseg, lseg, lseg->left, join); - - if (rseg != NULL) - gimp_gradient_segments_compress_range (rseg, rseg, join, rseg->right); - - /* Link */ - - if (lseg) - lseg->next = rseg; - - if (rseg) - rseg->prev = lseg; - - /* Delete old segments */ - - seg = editor->control_sel_l; - - do - { - next = seg->next; - aseg = seg; - - gimp_gradient_segment_free (seg); - - seg = next; - } - while (aseg != editor->control_sel_r); - - /* Change selection */ - - if (rseg) - { - editor->control_sel_l = rseg; - editor->control_sel_r = rseg; - } - else - { - editor->control_sel_l = lseg; - editor->control_sel_r = lseg; - } - - if (lseg == NULL) - gradient->segments = rseg; - - /* Done */ - - gimp_data_dirty (GIMP_DATA (gradient)); - gimp_gradient_editor_update (editor); -} - -void -gradient_editor_recenter_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpGradientEditor *editor; - GimpGradient *gradient; - GimpGradientSegment *seg, *aseg; - - editor = GIMP_GRADIENT_EDITOR (data); - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - - seg = editor->control_sel_l; - - do - { - seg->middle = (seg->left + seg->right) / 2.0; - - aseg = seg; - seg = seg->next; - } - while (aseg != editor->control_sel_r); - - gimp_data_dirty (GIMP_DATA (gradient)); - gimp_gradient_editor_update (editor); -} - -void -gradient_editor_redistribute_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpGradientEditor *editor; - GimpGradient *gradient; - GimpGradientSegment *seg, *aseg; - gdouble left, right, seg_len; - gint num_segs; - gint i; - - editor = GIMP_GRADIENT_EDITOR (data); - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - - /* Count number of segments in selection */ - - num_segs = 0; - seg = editor->control_sel_l; - - do - { - num_segs++; - aseg = seg; - seg = seg->next; - } - while (aseg != editor->control_sel_r); - - /* Calculate new segment length */ - - left = editor->control_sel_l->left; - right = editor->control_sel_r->right; - seg_len = (right - left) / num_segs; - - /* Redistribute */ - - seg = editor->control_sel_l; - - for (i = 0; i < num_segs; i++) - { - seg->left = left + i * seg_len; - seg->right = left + (i + 1) * seg_len; - seg->middle = (seg->left + seg->right) / 2.0; - - seg = seg->next; - } - - /* Fix endpoints to squish accumulative error */ - - editor->control_sel_l->left = left; - editor->control_sel_r->right = right; - - /* Done */ - - gimp_data_dirty (GIMP_DATA (gradient)); - gimp_gradient_editor_update (editor); -} - -void -gradient_editor_blend_color_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpGradientEditor *editor; - - editor = GIMP_GRADIENT_EDITOR (data); - - gimp_gradient_segments_blend_endpoints (editor->control_sel_l, - editor->control_sel_r, - &editor->control_sel_l->left_color, - &editor->control_sel_r->right_color, - TRUE, FALSE); - - gimp_data_dirty (GIMP_DATA_EDITOR (editor)->data); -} - -void -gradient_editor_blend_opacity_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpGradientEditor *editor; - - editor = GIMP_GRADIENT_EDITOR (data); - - gimp_gradient_segments_blend_endpoints (editor->control_sel_l, - editor->control_sel_r, - &editor->control_sel_l->left_color, - &editor->control_sel_r->right_color, - FALSE, TRUE); - - gimp_data_dirty (GIMP_DATA_EDITOR (editor)->data); -} - - -/* private functions */ - -static void -gradient_editor_left_color_changed (ColorNotebook *cnb, - const GimpRGB *color, - ColorNotebookState state, - gpointer data) -{ - GimpGradientEditor *editor; - GimpGradient *gradient; - - editor = (GimpGradientEditor *) data; - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - - switch (state) - { - case COLOR_NOTEBOOK_UPDATE: - gimp_gradient_segments_blend_endpoints (editor->control_sel_l, - editor->control_sel_r, - (GimpRGB *) color, - &editor->control_sel_r->right_color, - TRUE, TRUE); - gimp_data_dirty (GIMP_DATA (gradient)); - break; - - case COLOR_NOTEBOOK_OK: - gimp_gradient_segments_blend_endpoints (editor->control_sel_l, - editor->control_sel_r, - (GimpRGB *) color, - &editor->control_sel_r->right_color, - TRUE, TRUE); - gimp_gradient_segments_free (editor->left_saved_segments); - gimp_data_dirty (GIMP_DATA (gradient)); - color_notebook_free (cnb); - editor->color_notebook = NULL; - gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE); - break; - - case COLOR_NOTEBOOK_CANCEL: - gradient_editor_replace_selection (editor, editor->left_saved_segments); - GIMP_DATA (gradient)->dirty = editor->left_saved_dirty; - gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gradient)); - color_notebook_free (cnb); - editor->color_notebook = NULL; - gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE); - break; - } -} - -static void -gradient_editor_right_color_changed (ColorNotebook *cnb, - const GimpRGB *color, - ColorNotebookState state, - gpointer data) -{ - GimpGradientEditor *editor; - GimpGradient *gradient; - - editor = (GimpGradientEditor *) data; - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - - switch (state) - { - case COLOR_NOTEBOOK_UPDATE: - gimp_gradient_segments_blend_endpoints (editor->control_sel_l, - editor->control_sel_r, - &editor->control_sel_r->left_color, - (GimpRGB *) color, - TRUE, TRUE); - gimp_data_dirty (GIMP_DATA (gradient)); - break; - - case COLOR_NOTEBOOK_OK: - gimp_gradient_segments_blend_endpoints (editor->control_sel_l, - editor->control_sel_r, - &editor->control_sel_r->left_color, - (GimpRGB *) color, - TRUE, TRUE); - gimp_gradient_segments_free (editor->right_saved_segments); - gimp_data_dirty (GIMP_DATA (gradient)); - color_notebook_free (cnb); - editor->color_notebook = NULL; - gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE); - break; - - case COLOR_NOTEBOOK_CANCEL: - gradient_editor_replace_selection (editor, editor->right_saved_segments); - GIMP_DATA (gradient)->dirty = editor->right_saved_dirty; - gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gradient)); - color_notebook_free (cnb); - editor->color_notebook = NULL; - gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE); - break; - } -} - -static GimpGradientSegment * -gradient_editor_save_selection (GimpGradientEditor *editor) -{ - GimpGradientSegment *seg, *prev, *tmp; - GimpGradientSegment *oseg, *oaseg; - - prev = NULL; - oseg = editor->control_sel_l; - tmp = NULL; - - do - { - seg = gimp_gradient_segment_new (); - - *seg = *oseg; /* Copy everything */ - - if (prev == NULL) - tmp = seg; /* Remember first segment */ - else - prev->next = seg; - - seg->prev = prev; - seg->next = NULL; - - prev = seg; - oaseg = oseg; - oseg = oseg->next; - } - while (oaseg != editor->control_sel_r); - - return tmp; -} - -static void -gradient_editor_replace_selection (GimpGradientEditor *editor, - GimpGradientSegment *replace_seg) -{ - GimpGradient *gradient; - GimpGradientSegment *lseg, *rseg; - GimpGradientSegment *replace_last; - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - - /* Remember left and right segments */ - - lseg = editor->control_sel_l->prev; - rseg = editor->control_sel_r->next; - - replace_last = gimp_gradient_segment_get_last (replace_seg); - - /* Free old selection */ - - editor->control_sel_r->next = NULL; - - gimp_gradient_segments_free (editor->control_sel_l); - - /* Link in new segments */ - - if (lseg) - lseg->next = replace_seg; - else - gradient->segments = replace_seg; - - replace_seg->prev = lseg; - - if (rseg) - rseg->prev = replace_last; - - replace_last->next = rseg; - - editor->control_sel_l = replace_seg; - editor->control_sel_r = replace_last; - - gradient->last_visited = NULL; /* Force re-search */ -} - -static void -gradient_editor_split_uniform_response (GtkWidget *widget, - gint response_id, - GimpGradientEditor *editor) -{ - gtk_widget_destroy (widget); - gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE); - - if (response_id == GTK_RESPONSE_OK) - { - GimpGradient *gradient; - GimpGradientSegment *seg, *aseg, *lseg, *rseg, *lsel; - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - - seg = editor->control_sel_l; - lsel = NULL; - - do - { - aseg = seg; - - gimp_gradient_segment_split_uniform (gradient, seg, - editor->split_parts, - &lseg, &rseg); - - if (seg == editor->control_sel_l) - lsel = lseg; - - seg = rseg->next; - } - while (aseg != editor->control_sel_r); - - editor->control_sel_l = lsel; - editor->control_sel_r = rseg; - - gimp_data_dirty (GIMP_DATA (gradient)); - gimp_gradient_editor_update (editor); - } -} - -static void -gradient_editor_replicate_response (GtkWidget *widget, - gint response_id, - GimpGradientEditor *editor) -{ - gtk_widget_destroy (widget); - gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE); - - if (response_id == GTK_RESPONSE_OK) - { - GimpGradient *gradient; - gdouble sel_left, sel_right, sel_len; - gdouble new_left; - gdouble factor; - GimpGradientSegment *prev, *seg, *tmp; - GimpGradientSegment *oseg, *oaseg; - GimpGradientSegment *lseg, *rseg; - gint i; - - gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data); - - /* Remember original parameters */ - sel_left = editor->control_sel_l->left; - sel_right = editor->control_sel_r->right; - sel_len = sel_right - sel_left; - - factor = 1.0 / editor->replicate_times; - - /* Build replicated segments */ - - prev = NULL; - seg = NULL; - tmp = NULL; - - for (i = 0; i < editor->replicate_times; i++) - { - /* Build one cycle */ - - new_left = sel_left + i * factor * sel_len; - - oseg = editor->control_sel_l; - - do - { - seg = gimp_gradient_segment_new (); - - if (prev == NULL) - { - seg->left = sel_left; - tmp = seg; /* Remember first segment */ - } - else - { - seg->left = new_left + factor * (oseg->left - sel_left); - } - - seg->middle = new_left + factor * (oseg->middle - sel_left); - seg->right = new_left + factor * (oseg->right - sel_left); - - seg->left_color = oseg->left_color; - seg->right_color = oseg->right_color; - - seg->type = oseg->type; - seg->color = oseg->color; - - seg->prev = prev; - seg->next = NULL; - - if (prev) - prev->next = seg; - - prev = seg; - - oaseg = oseg; - oseg = oseg->next; - } - while (oaseg != editor->control_sel_r); - } - - seg->right = sel_right; /* Squish accumulative error */ - - /* Free old segments */ - - lseg = editor->control_sel_l->prev; - rseg = editor->control_sel_r->next; - - oseg = editor->control_sel_l; - - do - { - oaseg = oseg->next; - gimp_gradient_segment_free (oseg); - oseg = oaseg; - } - while (oaseg != rseg); - - /* Link in new segments */ - - if (lseg) - lseg->next = tmp; - else - gradient->segments = tmp; - - tmp->prev = lseg; - - seg->next = rseg; - - if (rseg) - rseg->prev = seg; - - /* Reset selection */ - - editor->control_sel_l = tmp; - editor->control_sel_r = seg; - - /* Done */ - - gimp_data_dirty (GIMP_DATA (gradient)); - gimp_gradient_editor_update (editor); - } -} diff --git a/app/gui/gradient-editor-commands.h b/app/gui/gradient-editor-commands.h deleted file mode 100644 index fc4ca29fd4..0000000000 --- a/app/gui/gradient-editor-commands.h +++ /dev/null @@ -1,69 +0,0 @@ -/* 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_COMMANDS_H__ -#define __GRADIENT_EDITOR_COMMANDS_H__ - - -void gradient_editor_left_color_cmd_callback (GtkWidget *widget, - gpointer data); -void gradient_editor_load_left_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void gradient_editor_save_left_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - -void gradient_editor_right_color_cmd_callback (GtkWidget *widget, - gpointer data); -void gradient_editor_load_right_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void gradient_editor_save_right_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - -void gradient_editor_blending_func_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void gradient_editor_coloring_type_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - -void gradient_editor_flip_cmd_callback (GtkWidget *widget, - gpointer data); -void gradient_editor_replicate_cmd_callback (GtkWidget *widget, - gpointer data); -void gradient_editor_split_midpoint_cmd_callback (GtkWidget *widget, - gpointer data); -void gradient_editor_split_uniformly_cmd_callback (GtkWidget *widget, - gpointer data); -void gradient_editor_delete_cmd_callback (GtkWidget *widget, - gpointer data); -void gradient_editor_recenter_cmd_callback (GtkWidget *widget, - gpointer data); -void gradient_editor_redistribute_cmd_callback (GtkWidget *widget, - gpointer data); - -void gradient_editor_blend_color_cmd_callback (GtkWidget *widget, - gpointer data); -void gradient_editor_blend_opacity_cmd_callback (GtkWidget *widget, - gpointer data); - - -#endif /* __GRADIENT_EDITOR_COMMANDS_H__ */ diff --git a/app/gui/gradient-editor-menu.c b/app/gui/gradient-editor-menu.c index b0335b1cd7..d4037559b5 100644 --- a/app/gui/gradient-editor-menu.c +++ b/app/gui/gradient-editor-menu.c @@ -34,7 +34,8 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" -#include "gradient-editor-commands.h" +#include "actions/gradient-editor-commands.h" + #include "gradient-editor-menu.h" #include "menus.h" diff --git a/app/gui/gradients-commands.c b/app/gui/gradients-commands.c deleted file mode 100644 index 4de312dac4..0000000000 --- a/app/gui/gradients-commands.c +++ /dev/null @@ -1,133 +0,0 @@ -/* 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 "gui-types.h" - -#include "core/gimpgradient.h" -#include "core/gimpcontext.h" - -#include "widgets/gimpcontainereditor.h" -#include "widgets/gimpcontainerview.h" -#include "widgets/gimphelp-ids.h" - -#include "gradients-commands.h" - -#include "gimp-intl.h" - - -/* local function prototypes */ - -static void gradients_save_as_pov_query (GimpContainerEditor *editor); -static void gradients_save_as_pov_response (GtkWidget *dialog, - gint response_id, - GimpGradient *gradient); - - -/* public functions */ - -void -gradients_save_as_pov_ray_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data); - - gradients_save_as_pov_query (editor); -} - - -/* private functions */ - -static void -gradients_save_as_pov_query (GimpContainerEditor *editor) -{ - GimpGradient *gradient; - GtkFileChooser *chooser; - gchar *title; - - gradient = gimp_context_get_gradient (editor->view->context); - - if (! gradient) - return; - - title = g_strdup_printf (_("Save '%s' as POV-Ray"), - GIMP_OBJECT (gradient)->name); - - chooser = GTK_FILE_CHOOSER - (gtk_file_chooser_dialog_new (title, NULL, - GTK_FILE_CHOOSER_ACTION_SAVE, - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_SAVE, GTK_RESPONSE_OK, - - NULL)); - - g_free (title); - - gtk_window_set_screen (GTK_WINDOW (chooser), - gtk_widget_get_screen (GTK_WIDGET (editor))); - - gtk_window_set_role (GTK_WINDOW (chooser), "gimp-gradient-save-pov"); - gtk_window_set_position (GTK_WINDOW (chooser), GTK_WIN_POS_MOUSE); - - g_signal_connect (chooser, "response", - G_CALLBACK (gradients_save_as_pov_response), - gradient); - g_signal_connect (chooser, "delete_event", - G_CALLBACK (gtk_true), - NULL); - - g_object_ref (gradient); - - g_signal_connect_object (chooser, "destroy", - G_CALLBACK (g_object_unref), - gradient, - G_CONNECT_SWAPPED); - - gimp_help_connect (GTK_WIDGET (chooser), gimp_standard_help_func, - GIMP_HELP_GRADIENT_SAVE_AS_POV, NULL); - - gtk_widget_show (GTK_WIDGET (chooser)); -} - -static void -gradients_save_as_pov_response (GtkWidget *dialog, - gint response_id, - GimpGradient *gradient) -{ - if (response_id == GTK_RESPONSE_OK) - { - const gchar *filename; - GError *error = NULL; - - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); - - if (! gimp_gradient_save_as_pov (gradient, filename, &error)) - { - g_message (error->message); - g_clear_error (&error); - } - } - - gtk_widget_destroy (dialog); -} diff --git a/app/gui/gradients-commands.h b/app/gui/gradients-commands.h deleted file mode 100644 index 14533e7a60..0000000000 --- a/app/gui/gradients-commands.h +++ /dev/null @@ -1,27 +0,0 @@ -/* 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_COMMANDS_H__ -#define __GRADIENTS_COMMANDS_H__ - - -void gradients_save_as_pov_ray_cmd_callback (GtkWidget *widget, - gpointer data); - - -#endif /* __GRADIENTS_COMMANDS_H__ */ diff --git a/app/gui/gradients-menu.c b/app/gui/gradients-menu.c index 52d1298eaa..bfadf1c8c9 100644 --- a/app/gui/gradients-menu.c +++ b/app/gui/gradients-menu.c @@ -33,8 +33,9 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" -#include "data-commands.h" -#include "gradients-commands.h" +#include "actions/data-commands.h" +#include "actions/gradients-commands.h" + #include "gradients-menu.h" #include "menus.h" diff --git a/app/gui/gui.c b/app/gui/gui.c index 8571e7201b..3d06df9166 100644 --- a/app/gui/gui.c +++ b/app/gui/gui.c @@ -54,9 +54,10 @@ #include "widgets/gimpsessioninfo.h" #include "widgets/gimpwidgets-utils.h" +#include "actions/dialogs-commands.h" + #include "color-history.h" #include "dialogs.h" -#include "dialogs-commands.h" #include "gui.h" #include "gui-vtable.h" #include "menus.h" diff --git a/app/gui/help-commands.c b/app/gui/help-commands.c deleted file mode 100644 index 30c2ba6d9d..0000000000 --- a/app/gui/help-commands.c +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 "gui-types.h" - -#include "help-commands.h" - - -void -help_help_cmd_callback (GtkWidget *widget, - gpointer data) -{ - gimp_standard_help_func (NULL, NULL); -} - -void -help_context_help_cmd_callback (GtkWidget *widget, - gpointer data) -{ - gimp_context_help (widget); -} diff --git a/app/gui/image-commands.c b/app/gui/image-commands.c deleted file mode 100644 index f1d9cec0a4..0000000000 --- a/app/gui/image-commands.c +++ /dev/null @@ -1,661 +0,0 @@ -/* 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 "libgimpbase/gimputils.h" -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "config/gimpguiconfig.h" - -#include "core/core-enums.h" -#include "core/gimp.h" -#include "core/gimpchannel.h" -#include "core/gimpcontext.h" -#include "core/gimpimage.h" -#include "core/gimpimage-crop.h" -#include "core/gimpimage-duplicate.h" -#include "core/gimpimage-flip.h" -#include "core/gimpimage-merge.h" -#include "core/gimpimage-resize.h" -#include "core/gimpimage-rotate.h" -#include "core/gimpimage-scale.h" -#include "core/gimpimage-undo.h" - -#include "widgets/gimpdock.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpviewabledialog.h" - -#include "display/gimpdisplay.h" -#include "display/gimpdisplayshell.h" -#include "display/gimpprogress.h" - -#include "convert-dialog.h" -#include "image-commands.h" -#include "grid-dialog.h" -#include "resize-dialog.h" - -#include "gimp-intl.h" - - -typedef struct -{ - Resize *resize; - GimpDisplay *gdisp; - GimpImage *gimage; -} ImageResize; - - -#define return_if_no_display(gdisp,data) \ - if (GIMP_IS_DISPLAY (data)) \ - gdisp = data; \ - else if (GIMP_IS_GIMP (data)) \ - gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \ - else if (GIMP_IS_DOCK (data)) \ - gdisp = gimp_context_get_display (((GimpDock *) data)->context); \ - else \ - gdisp = NULL; \ - if (! gdisp) \ - return - -#define return_if_no_image(gimage,data) \ - if (GIMP_IS_DISPLAY (data)) \ - gimage = ((GimpDisplay *) data)->gimage; \ - else if (GIMP_IS_GIMP (data)) \ - gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \ - else if (GIMP_IS_DOCK (data)) \ - gimage = gimp_context_get_image (((GimpDock *) data)->context); \ - else \ - gimage = NULL; \ - if (! gimage) \ - return - - -/* local functions */ - -static void image_resize_callback (GtkWidget *widget, - gpointer data); -static void image_scale_callback (GtkWidget *widget, - gpointer data); -static void image_scale_warn (ImageResize *image_scale, - const gchar *warning_title, - const gchar *warning_message); -static void image_scale_warn_callback (GtkWidget *widget, - gboolean do_scale, - gpointer data); -static void image_scale_implement (ImageResize *image_scale); - - -/* public functions */ - -void -image_convert_rgb_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - convert_to_rgb (gimage); -} - -void -image_convert_grayscale_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - convert_to_grayscale (gimage); -} - -void -image_convert_indexed_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - convert_to_indexed (gimage, widget); -} - -void -image_resize_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpImage *gimage; - ImageResize *image_resize; - return_if_no_display (gdisp, data); - - gimage = gdisp->gimage; - - image_resize = g_new0 (ImageResize, 1); - - image_resize->gdisp = gdisp; - image_resize->gimage = gimage; - - image_resize->resize = - resize_widget_new (GIMP_VIEWABLE (gimage), gdisp->shell, - ResizeWidget, - gimage->width, - gimage->height, - gimage->xresolution, - gimage->yresolution, - gimage->unit, - GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot, - G_CALLBACK (image_resize_callback), - image_resize); - - g_signal_connect_object (gdisp, "disconnect", - G_CALLBACK (gtk_widget_destroy), - image_resize->resize->resize_shell, - G_CONNECT_SWAPPED); - - g_object_weak_ref (G_OBJECT (image_resize->resize->resize_shell), - (GWeakNotify) g_free, - image_resize); - - gtk_widget_show (image_resize->resize->resize_shell); -} - -void -image_scale_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpImage *gimage; - ImageResize *image_scale; - return_if_no_display (gdisp, data); - - gimage = gdisp->gimage; - - image_scale = g_new0 (ImageResize, 1); - - image_scale->gdisp = gdisp; - image_scale->gimage = gimage; - - image_scale->resize = - resize_widget_new (GIMP_VIEWABLE (gimage), gdisp->shell, - ScaleWidget, - gimage->width, - gimage->height, - gimage->xresolution, - gimage->yresolution, - gimage->unit, - GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot, - G_CALLBACK (image_scale_callback), - image_scale); - - g_signal_connect_object (gdisp, "disconnect", - G_CALLBACK (gtk_widget_destroy), - image_scale->resize->resize_shell, - G_CONNECT_SWAPPED); - - g_object_weak_ref (G_OBJECT (image_scale->resize->resize_shell), - (GWeakNotify) g_free, - image_scale); - - gtk_widget_show (image_scale->resize->resize_shell); -} - -void -image_flip_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDisplay *gdisp; - GimpProgress *progress; - return_if_no_display (gdisp, data); - - progress = gimp_progress_start (gdisp, _("Flipping..."), TRUE, NULL, NULL); - - gimp_image_flip (gdisp->gimage, gimp_get_user_context (gdisp->gimage->gimp), - (GimpOrientationType) action, - gimp_progress_update_and_flush, progress); - - gimp_progress_end (progress); - - gimp_image_flush (gdisp->gimage); -} - -void -image_rotate_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDisplay *gdisp; - GimpProgress *progress; - return_if_no_display (gdisp, data); - - progress = gimp_progress_start (gdisp, _("Rotating..."), TRUE, NULL, NULL); - - gimp_image_rotate (gdisp->gimage, gimp_get_user_context (gdisp->gimage->gimp), - (GimpRotationType) action, - gimp_progress_update_and_flush, progress); - - gimp_progress_end (progress); - - gimp_image_flush (gdisp->gimage); -} - -void -image_crop_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - gint x1, y1, x2, y2; - return_if_no_display (gdisp, data); - - if (! gimp_channel_bounds (gimp_image_get_mask (gdisp->gimage), - &x1, &y1, &x2, &y2)) - { - g_message (_("Cannot crop because the current selection is empty.")); - return; - } - - gimp_image_crop (gdisp->gimage, gimp_get_user_context (gdisp->gimage->gimp), - x1, y1, x2, y2, FALSE, TRUE); - gimp_image_flush (gdisp->gimage); -} - -void -image_duplicate_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpImage *new_gimage; - return_if_no_image (gimage, data); - - new_gimage = gimp_image_duplicate (gimage); - - gimp_create_display (new_gimage->gimp, new_gimage, 1.0); - - g_object_unref (new_gimage); -} - -void -image_merge_layers_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - image_layers_merge_query (gimage, TRUE, widget); -} - -void -image_flatten_image_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - gimp_image_flatten (gimage, gimp_get_user_context (gimage->gimp)); - gimp_image_flush (gimage); -} - -void -image_configure_grid_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - GimpImage *gimage; - return_if_no_display (gdisp, data); - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - gimage = GIMP_IMAGE (gdisp->gimage); - - if (! shell->grid_dialog) - { - shell->grid_dialog = grid_dialog_new (GIMP_IMAGE (gimage), widget); - - gtk_window_set_transient_for (GTK_WINDOW (shell->grid_dialog), - GTK_WINDOW (shell)); - gtk_window_set_destroy_with_parent (GTK_WINDOW (shell->grid_dialog), - TRUE); - - g_object_add_weak_pointer (G_OBJECT (shell->grid_dialog), - (gpointer *) &shell->grid_dialog); - } - - gtk_window_present (GTK_WINDOW (shell->grid_dialog)); -} - - -/****************************/ -/* The layer merge dialog */ -/****************************/ - -typedef struct _LayerMergeOptions LayerMergeOptions; - -struct _LayerMergeOptions -{ - GtkWidget *query_box; - GimpImage *gimage; - gboolean merge_visible; - GimpMergeType merge_type; -}; - -static void -image_layers_merge_query_response (GtkWidget *widget, - gint response_id, - LayerMergeOptions *options) -{ - GimpImage *gimage = options->gimage; - - if (! gimage) - return; - - if (response_id == GTK_RESPONSE_OK) - { - if (options->merge_visible) - gimp_image_merge_visible_layers (gimage, - gimp_get_user_context (gimage->gimp), - options->merge_type); - - gimp_image_flush (gimage); - } - - gtk_widget_destroy (options->query_box); -} - -void -image_layers_merge_query (GimpImage *gimage, - /* if FALSE, anchor active layer */ - gboolean merge_visible, - GtkWidget *parent) -{ - LayerMergeOptions *options; - GtkWidget *vbox; - GtkWidget *frame; - - /* The new options structure */ - options = g_new (LayerMergeOptions, 1); - options->gimage = gimage; - options->merge_visible = merge_visible; - options->merge_type = GIMP_EXPAND_AS_NECESSARY; - - /* The dialog */ - options->query_box = - gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage), - _("Merge Layers"), "gimp-image-merge-layers", - GIMP_STOCK_MERGE_DOWN, - _("Layers Merge Options"), - parent, - gimp_standard_help_func, - GIMP_HELP_IMAGE_MERGE_LAYERS, - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - - NULL); - - g_signal_connect (options->query_box, "response", - G_CALLBACK (image_layers_merge_query_response), - options); - - g_object_weak_ref (G_OBJECT (options->query_box), - (GWeakNotify) g_free, - options); - - /* The main vbox */ - vbox = gtk_vbox_new (FALSE, 4); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox), - vbox); - - frame = - gimp_int_radio_group_new (TRUE, - merge_visible ? - _("Final, Merged Layer should be:") : - _("Final, Anchored Layer should be:"), - G_CALLBACK (gimp_radio_button_update), - &options->merge_type, options->merge_type, - - _("Expanded as necessary"), - GIMP_EXPAND_AS_NECESSARY, NULL, - - _("Clipped to image"), - GIMP_CLIP_TO_IMAGE, NULL, - - _("Clipped to bottom layer"), - GIMP_CLIP_TO_BOTTOM_LAYER, NULL, - - NULL); - - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); - gtk_widget_show (frame); - - gtk_widget_show (vbox); - gtk_widget_show (options->query_box); -} - - -/* private functions */ - -static void -image_resize_callback (GtkWidget *widget, - gpointer data) -{ - ImageResize *image_resize; - - image_resize = (ImageResize *) data; - - g_assert (image_resize != NULL); - g_assert (image_resize->gimage != NULL); - - gtk_widget_set_sensitive (image_resize->resize->resize_shell, FALSE); - - if (image_resize->resize->width > 0 && - image_resize->resize->height > 0) - { - GimpProgress *progress; - - progress = gimp_progress_start (image_resize->gdisp, - _("Resizing..."), - TRUE, NULL, NULL); - - gimp_image_resize (image_resize->gimage, - gimp_get_user_context (image_resize->gimage->gimp), - image_resize->resize->width, - image_resize->resize->height, - image_resize->resize->offset_x, - image_resize->resize->offset_y, - gimp_progress_update_and_flush, progress); - - gimp_progress_end (progress); - - gimp_image_flush (image_resize->gimage); - } - else - { - g_message (_("Resize Error: Both width and height must be " - "greater than zero.")); - } - - gtk_widget_destroy (image_resize->resize->resize_shell); -} - -static void -image_scale_callback (GtkWidget *widget, - gpointer data) -{ - ImageResize *image_scale = data; - GimpImageScaleCheckType scale_check; - gint64 new_memsize; - gchar *warning_message; - - g_assert (image_scale != NULL); - g_assert (image_scale->gimage != NULL); - - gtk_widget_set_sensitive (image_scale->resize->resize_shell, FALSE); - - scale_check = gimp_image_scale_check (image_scale->gimage, - image_scale->resize->width, - image_scale->resize->height, - &new_memsize); - switch (scale_check) - { - case GIMP_IMAGE_SCALE_TOO_BIG: - { - gchar *size_str; - gchar *max_size_str; - - size_str = gimp_memsize_to_string (new_memsize); - max_size_str = gimp_memsize_to_string - (GIMP_GUI_CONFIG (image_scale->gimage->gimp->config)->max_new_image_size); - - warning_message = g_strdup_printf - (_("You are trying to create an image with a size of %s.\n\n" - "Choose OK to create this image anyway.\n" - "Choose Cancel if you did not intend to create such a " - "large image.\n\n" - "To prevent this dialog from appearing, increase the " - "\"Maximum Image Size\" setting (currently %s) in the " - "Preferences dialog."), - size_str, max_size_str); - - g_free (size_str); - g_free (max_size_str); - - image_scale_warn (image_scale, _("Image exceeds maximum image size"), - warning_message); - - g_free (warning_message); - } - break; - - case GIMP_IMAGE_SCALE_TOO_SMALL: - warning_message = _("The chosen image size will shrink " - "some layers completely away. " - "Is this what you want?"); - - image_scale_warn (image_scale, _("Layer Too Small"), - warning_message); - break; - - case GIMP_IMAGE_SCALE_OK: - /* If all is well, return directly after scaling image. */ - image_scale_implement (image_scale); - gtk_widget_destroy (image_scale->resize->resize_shell); - break; - } -} - -static void -image_scale_warn (ImageResize *image_scale, - const gchar *warning_title, - const gchar *warning_message) -{ - GtkWidget *dialog; - - dialog = gimp_query_boolean_box (warning_title, - image_scale->resize->resize_shell, - gimp_standard_help_func, - GIMP_HELP_IMAGE_SCALE_WARNING, - GTK_STOCK_DIALOG_QUESTION, - warning_message, - GTK_STOCK_OK, GTK_STOCK_CANCEL, - G_OBJECT (image_scale->resize->resize_shell), - "destroy", - image_scale_warn_callback, - image_scale); - gtk_widget_show (dialog); -} - -static void -image_scale_warn_callback (GtkWidget *widget, - gboolean do_scale, - gpointer data) -{ - ImageResize *image_scale = data; - - if (do_scale) /* User doesn't mind losing layers or - * creating huge image... */ - { - image_scale_implement (image_scale); - gtk_widget_destroy (image_scale->resize->resize_shell); - } - else - { - gtk_widget_set_sensitive (image_scale->resize->resize_shell, TRUE); - } -} - -static void -image_scale_implement (ImageResize *image_scale) -{ - GimpImage *gimage; - - g_assert (image_scale != NULL); - g_assert (image_scale->gimage != NULL); - - gimage = image_scale->gimage; - - if (image_scale->resize->resolution_x == gimage->xresolution && - image_scale->resize->resolution_y == gimage->yresolution && - image_scale->resize->unit == gimage->unit && - image_scale->resize->width == gimage->width && - image_scale->resize->height == gimage->height) - return; - - gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_SCALE, - _("Scale Image")); - - gimp_image_set_resolution (gimage, - image_scale->resize->resolution_x, - image_scale->resize->resolution_y); - gimp_image_set_unit (gimage, image_scale->resize->unit); - - if (image_scale->resize->width != gimage->width || - image_scale->resize->height != gimage->height) - { - if (image_scale->resize->width > 0 && - image_scale->resize->height > 0) - { - GimpProgress *progress; - - progress = gimp_progress_start (image_scale->gdisp, - _("Scaling..."), - TRUE, NULL, NULL); - - gimp_image_scale (gimage, - image_scale->resize->width, - image_scale->resize->height, - image_scale->resize->interpolation, - gimp_progress_update_and_flush, progress); - - gimp_progress_end (progress); - } - else - { - g_message (_("Scale Error: Both width and height must be " - "greater than zero.")); - return; - } - } - - gimp_image_undo_group_end (gimage); - - gimp_image_flush (gimage); -} diff --git a/app/gui/image-commands.h b/app/gui/image-commands.h deleted file mode 100644 index d372c8102c..0000000000 --- a/app/gui/image-commands.h +++ /dev/null @@ -1,58 +0,0 @@ -/* 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_COMMANDS_H__ -#define __IMAGE_COMMANDS_H__ - - -void image_convert_rgb_cmd_callback (GtkWidget *widget, - gpointer data); -void image_convert_grayscale_cmd_callback (GtkWidget *widget, - gpointer data); -void image_convert_indexed_cmd_callback (GtkWidget *widget, - gpointer data); - -void image_resize_cmd_callback (GtkWidget *widget, - gpointer data); -void image_scale_cmd_callback (GtkWidget *widget, - gpointer data); -void image_flip_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void image_rotate_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void image_crop_cmd_callback (GtkWidget *widget, - gpointer data); - -void image_duplicate_cmd_callback (GtkWidget *widget, - gpointer data); - -void image_merge_layers_cmd_callback (GtkWidget *widet, - gpointer data); -void image_flatten_image_cmd_callback (GtkWidget *widet, - gpointer data); - -void image_layers_merge_query (GimpImage *gimage, - gboolean merge_visible, - GtkWidget *parent); - -void image_configure_grid_cmd_callback (GtkWidget *widget, - gpointer data); - -#endif /* __IMAGE_COMMANDS_H__ */ diff --git a/app/gui/image-menu.c b/app/gui/image-menu.c index 18c75ea744..0bd0fd5c75 100644 --- a/app/gui/image-menu.c +++ b/app/gui/image-menu.c @@ -48,20 +48,21 @@ #include "display/gimpdisplayshell-appearance.h" #include "display/gimpdisplayshell-selection.h" -#include "dialogs-commands.h" -#include "drawable-commands.h" -#include "edit-commands.h" -#include "file-commands.h" -#include "image-commands.h" +#include "actions/dialogs-commands.h" +#include "actions/drawable-commands.h" +#include "actions/edit-commands.h" +#include "actions/file-commands.h" +#include "actions/image-commands.h" +#include "actions/layers-commands.h" +#include "actions/plug-in-commands.h" +#include "actions/select-commands.h" +#include "actions/tools-commands.h" +#include "actions/vectors-commands.h" +#include "actions/view-commands.h" + #include "image-menu.h" -#include "layers-commands.h" #include "menus.h" -#include "plug-in-commands.h" #include "plug-in-menus.h" -#include "select-commands.h" -#include "tools-commands.h" -#include "vectors-commands.h" -#include "view-commands.h" #include "gimp-intl.h" diff --git a/app/gui/images-commands.c b/app/gui/images-commands.c deleted file mode 100644 index fd9cd42caf..0000000000 --- a/app/gui/images-commands.c +++ /dev/null @@ -1,84 +0,0 @@ -/* 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 "gui-types.h" - -#include "core/gimp.h" -#include "core/gimpimage.h" -#include "core/gimplist.h" - -#include "widgets/gimpimageview.h" - -#include "display/gimpdisplay.h" - -#include "images-commands.h" - - -/* public functionss */ - -void -images_raise_views_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImageView *view = GIMP_IMAGE_VIEW (data); - - if (GTK_WIDGET_SENSITIVE (view->raise_button)) - gtk_button_clicked (GTK_BUTTON (view->raise_button)); -} - -void -images_new_view_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImageView *view = GIMP_IMAGE_VIEW (data); - - if (GTK_WIDGET_SENSITIVE (view->new_button)) - gtk_button_clicked (GTK_BUTTON (view->new_button)); -} - -void -images_delete_image_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImageView *view = GIMP_IMAGE_VIEW (data); - - if (GTK_WIDGET_SENSITIVE (view->delete_button)) - gtk_button_clicked (GTK_BUTTON (view->delete_button)); -} - -void -images_raise_views (GimpImage *gimage) -{ - GList *list; - - g_return_if_fail (GIMP_IS_IMAGE (gimage)); - - for (list = GIMP_LIST (gimage->gimp->displays)->list; - list; - list = g_list_next (list)) - { - GimpDisplay *display = list->data; - - if (display->gimage == gimage) - gtk_window_present (GTK_WINDOW (display->shell)); - } -} diff --git a/app/gui/images-commands.h b/app/gui/images-commands.h deleted file mode 100644 index 23068e4785..0000000000 --- a/app/gui/images-commands.h +++ /dev/null @@ -1,33 +0,0 @@ -/* 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_COMMANDS_H__ -#define __IMAGES_COMMANDS_H__ - - -void images_raise_views_cmd_callback (GtkWidget *widget, - gpointer data); -void images_new_view_cmd_callback (GtkWidget *widget, - gpointer data); -void images_delete_image_cmd_callback (GtkWidget *widget, - gpointer data); - -void images_raise_views (GimpImage *gimage); - - -#endif /* __IMAGES_COMMANDS_H__ */ diff --git a/app/gui/images-menu.c b/app/gui/images-menu.c index 6506c495bf..0780f9741a 100644 --- a/app/gui/images-menu.c +++ b/app/gui/images-menu.c @@ -31,7 +31,8 @@ #include "widgets/gimpcontainerview.h" #include "widgets/gimpitemfactory.h" -#include "images-commands.h" +#include "actions/images-commands.h" + #include "images-menu.h" #include "gimp-intl.h" diff --git a/app/gui/layers-commands.c b/app/gui/layers-commands.c deleted file mode 100644 index f641c9483f..0000000000 --- a/app/gui/layers-commands.c +++ /dev/null @@ -1,1302 +0,0 @@ -/* 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 "libgimpmath/gimpmath.h" -#include "libgimpbase/gimpbase.h" -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimp.h" -#include "core/gimpchannel-select.h" -#include "core/gimpcontext.h" -#include "core/gimpimage.h" -#include "core/gimpimage-merge.h" -#include "core/gimpimage-undo.h" -#include "core/gimplayer.h" -#include "core/gimplayer-floating-sel.h" -#include "core/gimplayermask.h" -#include "core/gimplist.h" -#include "core/gimptoolinfo.h" - -#include "text/gimptext.h" -#include "text/gimptextlayer.h" - -#include "pdb/procedural_db.h" - -#include "widgets/gimpdock.h" -#include "widgets/gimpenumwidgets.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemtreeview.h" -#include "widgets/gimppropwidgets.h" -#include "widgets/gimpviewabledialog.h" - -#include "display/gimpdisplay.h" -#include "display/gimpprogress.h" - -#include "tools/gimptexttool.h" -#include "tools/tool_manager.h" - -#include "layers-commands.h" -#include "image-commands.h" -#include "resize-dialog.h" - -#include "gimp-intl.h" - - -/* local function prototypes */ - -static void layers_add_mask_query (GimpLayer *layer, - GtkWidget *parent); -static void layers_scale_layer_query (GimpDisplay *gdisp, - GimpImage *gimage, - GimpLayer *layer, - GtkWidget *parent); -static void layers_resize_layer_query (GimpImage *gimage, - GimpLayer *layer, - GtkWidget *parent); - - -#define return_if_no_image(gimage,data) \ - if (GIMP_IS_DISPLAY (data)) \ - gimage = ((GimpDisplay *) data)->gimage; \ - else if (GIMP_IS_GIMP (data)) \ - gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \ - else if (GIMP_IS_DOCK (data)) \ - gimage = gimp_context_get_image (((GimpDock *) data)->context); \ - else if (GIMP_IS_ITEM_TREE_VIEW (data)) \ - gimage = ((GimpItemTreeView *) data)->gimage; \ - else \ - gimage = NULL; \ - if (! gimage) \ - return - -#define return_if_no_layer(gimage,layer,data) \ - return_if_no_image (gimage,data); \ - layer = gimp_image_get_active_layer (gimage); \ - if (! layer) \ - return - - -/* public functions */ - -void -layers_select_previous_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *new_layer; - gint current_layer; - return_if_no_image (gimage, data); - - current_layer = - gimp_image_get_layer_index (gimage, gimp_image_get_active_layer (gimage)); - - if (current_layer > 0) - { - new_layer = (GimpLayer *) - gimp_container_get_child_by_index (gimage->layers, current_layer - 1); - - if (new_layer) - { - gimp_image_set_active_layer (gimage, new_layer); - gimp_image_flush (gimage); - } - } -} - -void -layers_select_next_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *new_layer; - gint current_layer; - return_if_no_image (gimage, data); - - current_layer = - gimp_image_get_layer_index (gimage, gimp_image_get_active_layer (gimage)); - - new_layer = - GIMP_LAYER (gimp_container_get_child_by_index (gimage->layers, - current_layer + 1)); - - if (new_layer) - { - gimp_image_set_active_layer (gimage, new_layer); - gimp_image_flush (gimage); - } -} - -void -layers_select_top_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *new_layer; - return_if_no_image (gimage, data); - - new_layer = (GimpLayer *) - gimp_container_get_child_by_index (gimage->layers, 0); - - if (new_layer) - { - gimp_image_set_active_layer (gimage, new_layer); - gimp_image_flush (gimage); - } -} - -void -layers_select_bottom_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *new_layer; - gint num_layers; - return_if_no_image (gimage, data); - - num_layers = gimp_container_num_children (gimage->layers); - - if (num_layers > 0) - { - new_layer = (GimpLayer *) - gimp_container_get_child_by_index (gimage->layers, num_layers - 1); - - if (new_layer) - { - gimp_image_set_active_layer (gimage, new_layer); - gimp_image_flush (gimage); - } - } -} - -void -layers_raise_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - gimp_image_raise_layer (gimage, active_layer); - gimp_image_flush (gimage); -} - -void -layers_lower_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - gimp_image_lower_layer (gimage, active_layer); - gimp_image_flush (gimage); -} - -void -layers_raise_to_top_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - gimp_image_raise_layer_to_top (gimage, active_layer); - gimp_image_flush (gimage); -} - -void -layers_lower_to_bottom_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - gimp_image_lower_layer_to_bottom (gimage, active_layer); - gimp_image_flush (gimage); -} - -void -layers_new_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - layers_new_layer_query (gimage, NULL, TRUE, widget); -} - -void -layers_duplicate_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - GimpLayer *new_layer; - return_if_no_layer (gimage, active_layer, data); - - new_layer = - GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (active_layer), - G_TYPE_FROM_INSTANCE (active_layer), - TRUE)); - gimp_image_add_layer (gimage, new_layer, -1); - - gimp_image_flush (gimage); -} - -void -layers_anchor_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - if (gimp_layer_is_floating_sel (active_layer)) - { - floating_sel_anchor (active_layer); - gimp_image_flush (gimage); - } -} - -void -layers_merge_down_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - gimp_image_merge_down (gimage, active_layer, - gimp_get_user_context (gimage->gimp), - GIMP_EXPAND_AS_NECESSARY); - gimp_image_flush (gimage); -} - -void -layers_delete_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - if (gimp_layer_is_floating_sel (active_layer)) - floating_sel_remove (active_layer); - else - gimp_image_remove_layer (gimage, active_layer); - - gimp_image_flush (gimage); -} - -void -layers_text_discard_cmd_callback (GtkWidget *widet, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - if (GIMP_IS_TEXT_LAYER (active_layer)) - gimp_text_layer_discard (GIMP_TEXT_LAYER (active_layer)); -} - -void -layers_resize_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - layers_resize_layer_query (gimage, active_layer, widget); -} - -void -layers_resize_to_image_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - gimp_layer_resize_to_image (active_layer, - gimp_get_user_context (gimage->gimp)); - gimp_image_flush (gimage); -} - -void -layers_scale_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - layers_scale_layer_query (GIMP_IS_DISPLAY (data) ? data : NULL, - gimage, active_layer, widget); -} - -void -layers_crop_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - gint x1, y1, x2, y2; - gint off_x, off_y; - return_if_no_layer (gimage, active_layer, data); - - if (! gimp_channel_bounds (gimp_image_get_mask (gimage), - &x1, &y1, &x2, &y2)) - { - g_message (_("Cannot crop because the current selection is empty.")); - return; - } - - gimp_item_offsets (GIMP_ITEM (active_layer), &off_x, &off_y); - - off_x -= x1; - off_y -= y1; - - gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_RESIZE, - _("Crop Layer")); - - gimp_item_resize (GIMP_ITEM (active_layer), - gimp_get_user_context (gimage->gimp), - x2 - x1, y2 - y1, off_x, off_y); - - gimp_image_undo_group_end (gimage); - - gimp_image_flush (gimage); -} - -void -layers_mask_add_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - layers_add_mask_query (active_layer, widget); -} - -void -layers_mask_apply_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - if (gimp_layer_get_mask (active_layer)) - { - gimp_layer_apply_mask (active_layer, GIMP_MASK_APPLY, TRUE); - gimp_image_flush (gimage); - } -} - -void -layers_mask_delete_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - if (gimp_layer_get_mask (active_layer)) - { - gimp_layer_apply_mask (active_layer, GIMP_MASK_DISCARD, TRUE); - gimp_image_flush (gimage); - } -} - -void -layers_mask_to_selection_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpChannelOps op; - GimpImage *gimage; - GimpLayer *active_layer; - GimpLayerMask *mask; - return_if_no_layer (gimage, active_layer, data); - - op = (GimpChannelOps) action; - - mask = gimp_layer_get_mask (active_layer); - - if (mask) - { - gint off_x, off_y; - - gimp_item_offsets (GIMP_ITEM (mask), &off_x, &off_y); - - gimp_channel_select_channel (gimp_image_get_mask (gimage), - _("Layer Mask to Selection"), - GIMP_CHANNEL (mask), - off_x, off_y, - op, FALSE, 0.0, 0.0); - gimp_image_flush (gimage); - } -} - -void -layers_alpha_add_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (active_layer))) - { - gimp_layer_add_alpha (active_layer); - gimp_image_flush (gimage); - } -} - -void -layers_alpha_to_selection_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpChannelOps op; - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - op = (GimpChannelOps) action; - - gimp_channel_select_alpha (gimp_image_get_mask (gimage), - GIMP_DRAWABLE (active_layer), - op, FALSE, 0.0, 0.0); - gimp_image_flush (gimage); -} - -void -layers_merge_layers_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - image_layers_merge_query (gimage, TRUE, widget); -} - -void -layers_flatten_image_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - gimp_image_flatten (gimage, gimp_get_user_context (gimage->gimp)); - gimp_image_flush (gimage); -} - -void -layers_text_tool_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - layers_text_tool (active_layer, widget); -} - -void -layers_edit_attributes_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpLayer *active_layer; - return_if_no_layer (gimage, active_layer, data); - - layers_edit_layer_query (active_layer, widget); -} - -void -layers_text_tool (GimpLayer *layer, - GtkWidget *parent) -{ - GimpImage *gimage; - GimpTool *active_tool; - - g_return_if_fail (GIMP_IS_LAYER (layer)); - - if (! gimp_drawable_is_text_layer (GIMP_DRAWABLE (layer))) - { - layers_edit_layer_query (layer, parent); - return; - } - - gimage = gimp_item_get_image (GIMP_ITEM (layer)); - - active_tool = tool_manager_get_active (gimage->gimp); - - if (! GIMP_IS_TEXT_TOOL (active_tool)) - { - GimpContainer *tool_info_list = gimage->gimp->tool_info_list; - GimpToolInfo *tool_info; - - tool_info = (GimpToolInfo *) - gimp_container_get_child_by_name (tool_info_list, - "gimp-text-tool"); - - if (GIMP_IS_TOOL_INFO (tool_info)) - { - gimp_context_set_tool (gimp_get_user_context (gimage->gimp), - tool_info); - - active_tool = tool_manager_get_active (gimage->gimp); - } - } - - if (GIMP_IS_TEXT_TOOL (active_tool)) - gimp_text_tool_set_layer (GIMP_TEXT_TOOL (active_tool), layer); -} - - -/********************************/ -/* The new layer query dialog */ -/********************************/ - -typedef struct _NewLayerOptions NewLayerOptions; - -struct _NewLayerOptions -{ - GtkWidget *query_box; - GtkWidget *name_entry; - GtkWidget *size_se; - - GimpFillType fill_type; - gint xsize; - gint ysize; - - GimpImage *gimage; -}; - -static GimpFillType fill_type = GIMP_TRANSPARENT_FILL; -static gchar *layer_name = NULL; - -static void -new_layer_query_response (GtkWidget *widget, - gint response_id, - NewLayerOptions *options) -{ - if (response_id == GTK_RESPONSE_OK) - { - GimpLayer *layer; - GimpImage *gimage; - - if (layer_name) - g_free (layer_name); - layer_name = - g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry))); - - options->xsize = - RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (options->size_se), - 0)); - options->ysize = - RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (options->size_se), - 1)); - - fill_type = options->fill_type; - - if ((gimage = options->gimage)) - { - layer = gimp_layer_new (gimage, - options->xsize, - options->ysize, - gimp_image_base_type_with_alpha (gimage), - layer_name, - GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE); - if (layer) - { - gimp_drawable_fill_by_type (GIMP_DRAWABLE (layer), - gimp_get_user_context (gimage->gimp), - fill_type); - gimp_image_add_layer (gimage, layer, -1); - - gimp_image_flush (gimage); - } - else - { - g_message ("new_layer_query_response: " - "could not allocate new layer"); - } - } - } - - gtk_widget_destroy (options->query_box); -} - -void -layers_new_layer_query (GimpImage *gimage, - GimpLayer *template, - gboolean interactive, - GtkWidget *parent) -{ - NewLayerOptions *options; - GimpLayer *floating_sel; - GtkWidget *vbox; - GtkWidget *table; - GtkWidget *label; - GtkObject *adjustment; - GtkWidget *spinbutton; - GtkWidget *frame; - GtkWidget *button; - - g_return_if_fail (GIMP_IS_IMAGE (gimage)); - g_return_if_fail (template == NULL || GIMP_IS_LAYER (template)); - - /* If there is a floating selection, the new command transforms - * the current fs into a new layer - */ - if ((floating_sel = gimp_image_floating_sel (gimage))) - { - floating_sel_to_layer (floating_sel); - gimp_image_flush (gimage); - return; - } - - if (template || ! interactive) - { - GimpLayer *new_layer; - gint width, height; - gint off_x, off_y; - gdouble opacity; - GimpLayerModeEffects mode; - - if (template) - { - gimp_item_offsets (GIMP_ITEM (template), &off_x, &off_y); - width = gimp_item_width (GIMP_ITEM (template)); - height = gimp_item_height (GIMP_ITEM (template)); - opacity = template->opacity; - mode = template->mode; - } - else - { - width = gimp_image_get_width (gimage); - height = gimp_image_get_height (gimage); - off_x = 0; - off_y = 0; - opacity = 1.0; - mode = GIMP_NORMAL_MODE; - } - - gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_EDIT_PASTE, - _("New Layer")); - - new_layer = gimp_layer_new (gimage, - width, - height, - gimp_image_base_type_with_alpha (gimage), - _("Empty Layer"), - opacity, - mode); - - gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_layer), - gimp_get_user_context (gimage->gimp), - GIMP_TRANSPARENT_FILL); - gimp_item_translate (GIMP_ITEM (new_layer), off_x, off_y, FALSE); - - gimp_image_add_layer (gimage, new_layer, -1); - - gimp_image_undo_group_end (gimage); - return; - } - - options = g_new0 (NewLayerOptions, 1); - - options->fill_type = fill_type; - options->gimage = gimage; - - options->query_box = - gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage), - _("New Layer"), "gimp-layer-new", - GIMP_STOCK_LAYER, - _("Create a New Layer"), - parent, - gimp_standard_help_func, - GIMP_HELP_LAYER_NEW, - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - - NULL); - - g_signal_connect (options->query_box, "response", - G_CALLBACK (new_layer_query_response), - options); - - g_object_weak_ref (G_OBJECT (options->query_box), - (GWeakNotify) g_free, - options); - - /* The main vbox */ - vbox = gtk_vbox_new (FALSE, 4); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox), - vbox); - - table = gtk_table_new (3, 2, FALSE); - gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4); - gtk_table_set_row_spacing (GTK_TABLE (table), 0, 4); - gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); - - /* The name label and entry */ - options->name_entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (options->name_entry), - (layer_name ? layer_name : _("New Layer"))); - gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, - _("Layer _Name:"), 1.0, 0.5, - options->name_entry, 1, FALSE); - - /* The size labels */ - label = gtk_label_new (_("Layer Width:")); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, - GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0); - gtk_widget_show (label); - - label = gtk_label_new (_("Height:")); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, - GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0); - gtk_widget_show (label); - - /* The size sizeentry */ - spinbutton = gimp_spin_button_new (&adjustment, - 1, 1, 1, 1, 10, 1, - 1, 2); - gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 10); - - options->size_se = gimp_size_entry_new (1, gimage->unit, "%a", - TRUE, TRUE, FALSE, 10, - GIMP_SIZE_ENTRY_UPDATE_SIZE); - gtk_table_set_col_spacing (GTK_TABLE (options->size_se), 1, 4); - gtk_table_set_row_spacing (GTK_TABLE (options->size_se), 0, 2); - - gimp_size_entry_add_field (GIMP_SIZE_ENTRY (options->size_se), - GTK_SPIN_BUTTON (spinbutton), NULL); - gtk_table_attach_defaults (GTK_TABLE (options->size_se), spinbutton, - 1, 2, 0, 1); - gtk_widget_show (spinbutton); - - gtk_table_attach (GTK_TABLE (table), options->size_se, 1, 2, 1, 3, - GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); - gtk_widget_show (options->size_se); - - gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (options->size_se), - GIMP_UNIT_PIXEL); - - gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options->size_se), 0, - gimage->xresolution, FALSE); - gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options->size_se), 1, - gimage->yresolution, FALSE); - - gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (options->size_se), 0, - GIMP_MIN_IMAGE_SIZE, - GIMP_MAX_IMAGE_SIZE); - gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (options->size_se), 1, - GIMP_MIN_IMAGE_SIZE, - GIMP_MAX_IMAGE_SIZE); - - gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options->size_se), 0, - 0, gimage->width); - gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options->size_se), 1, - 0, gimage->height); - - gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (options->size_se), 0, - gimage->width); - gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (options->size_se), 1, - gimage->height); - - gtk_widget_show (table); - - /* The radio frame */ - frame = gimp_enum_radio_frame_new_with_range (GIMP_TYPE_FILL_TYPE, - GIMP_FOREGROUND_FILL, - GIMP_TRANSPARENT_FILL, - gtk_label_new (_("Layer Fill Type")), - 2, - G_CALLBACK (gimp_radio_button_update), - &options->fill_type, - &button); - gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button), - options->fill_type); - - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); - gtk_widget_show (frame); - - gtk_widget_show (vbox); - gtk_widget_show (options->query_box); -} - -/**************************************/ -/* The edit layer attributes dialog */ -/**************************************/ - -typedef struct _EditLayerOptions EditLayerOptions; - -struct _EditLayerOptions -{ - GtkWidget *query_box; - GtkWidget *name_entry; - GtkWidget *toggle; - GimpLayer *layer; - GimpImage *gimage; -}; - -static void -edit_layer_query_response (GtkWidget *widget, - gint response_id, - EditLayerOptions *options) -{ - if (response_id == GTK_RESPONSE_OK) - { - GimpLayer *layer = options->layer; - - if (options->gimage) - { - const gchar *new_name; - - new_name = gtk_entry_get_text (GTK_ENTRY (options->name_entry)); - - if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (layer)))) - { - gimp_item_rename (GIMP_ITEM (layer), new_name); - gimp_image_flush (options->gimage); - } - - if (options->toggle && - gimp_drawable_is_text_layer (GIMP_DRAWABLE (layer))) - { - g_object_set (layer, - "auto-rename", - GTK_TOGGLE_BUTTON (options->toggle)->active, - NULL); - } - } - } - - gtk_widget_destroy (options->query_box); -} - -static void -edit_layer_query_activate (GtkWidget *widget, - EditLayerOptions *options) -{ - gtk_dialog_response (GTK_DIALOG (options->query_box), GTK_RESPONSE_OK); -} - - -static void -edit_layer_toggle_rename (GtkWidget *widget, - EditLayerOptions *options) -{ - if (GTK_TOGGLE_BUTTON (widget)->active && - gimp_drawable_is_text_layer (GIMP_DRAWABLE (options->layer))) - { - GimpTextLayer *text_layer = GIMP_TEXT_LAYER (options->layer); - GimpText *text = gimp_text_layer_get_text (text_layer); - - if (text && text->text) - { - gchar *name = gimp_utf8_strtrim (text->text, 30); - - gtk_entry_set_text (GTK_ENTRY (options->name_entry), name); - - g_free (name); - } - } -} - -void -layers_edit_layer_query (GimpLayer *layer, - GtkWidget *parent) -{ - EditLayerOptions *options; - GtkWidget *vbox; - GtkWidget *table; - - options = g_new0 (EditLayerOptions, 1); - - options->layer = layer; - options->gimage = gimp_item_get_image (GIMP_ITEM (layer)); - - options->query_box = - gimp_viewable_dialog_new (GIMP_VIEWABLE (layer), - _("Layer Attributes"), "gimp-layer-edit", - GIMP_STOCK_EDIT, - _("Edit Layer Attributes"), - parent, - gimp_standard_help_func, - GIMP_HELP_LAYER_EDIT, - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - - NULL); - - g_signal_connect (options->query_box, "response", - G_CALLBACK (edit_layer_query_response), - options); - - g_object_weak_ref (G_OBJECT (options->query_box), - (GWeakNotify) g_free, - options); - - /* The main vbox */ - vbox = gtk_vbox_new (FALSE, 4); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox), - vbox); - - /* The name label and entry */ - table = gtk_table_new (1, 2, FALSE); - gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4); - gtk_table_set_row_spacings (GTK_TABLE (table), 2); - gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); - gtk_widget_show (table); - - options->name_entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (options->name_entry), - ((gimp_layer_is_floating_sel (layer) ? - _("Floating Selection") : - gimp_object_get_name (GIMP_OBJECT (layer))))); - gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, - _("Layer _Name"), 1.0, 0.5, - options->name_entry, 1, FALSE); - - g_signal_connect (options->name_entry, "activate", - G_CALLBACK (edit_layer_query_activate), - options); - - /* For text layers add a toggle to control "auto-rename" */ - if (gimp_drawable_is_text_layer (GIMP_DRAWABLE (layer))) - { - options->toggle = - gtk_check_button_new_with_mnemonic (_("Set Name from _Text")); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->toggle), - GIMP_TEXT_LAYER (layer)->auto_rename); - - gtk_table_attach (GTK_TABLE (table), options->toggle, 1, 2, 1, 2, - GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); - gtk_widget_show (options->toggle); - - g_signal_connect (options->toggle, "toggled", - G_CALLBACK (edit_layer_toggle_rename), - options); - } - - gtk_widget_show (vbox); - gtk_widget_show (options->query_box); -} - -/*******************************/ -/* The add mask query dialog */ -/*******************************/ - -typedef struct _AddMaskOptions AddMaskOptions; - -struct _AddMaskOptions -{ - GtkWidget *query_box; - GimpLayer *layer; - GimpAddMaskType add_mask_type; - gboolean invert; -}; - -static void -add_mask_query_response (GtkWidget *widget, - gint response_id, - AddMaskOptions *options) -{ - if (response_id == GTK_RESPONSE_OK) - { - GimpImage *gimage; - GimpLayerMask *mask; - GimpLayer *layer; - - if ((layer = (options->layer)) && (gimage = GIMP_ITEM (layer)->gimage)) - { - gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_LAYER_ADD_MASK, - _("Add Layer Mask")); - - mask = gimp_layer_create_mask (layer, options->add_mask_type); - - if (options->invert) - gimp_channel_invert (GIMP_CHANNEL (mask), FALSE); - - gimp_layer_add_mask (layer, mask, TRUE); - - gimp_image_undo_group_end (gimage); - - gimp_image_flush (gimage); - } - } - - gtk_widget_destroy (options->query_box); -} - -static void -layers_add_mask_query (GimpLayer *layer, - GtkWidget *parent) -{ - AddMaskOptions *options; - GtkWidget *frame; - GtkWidget *button; - GtkWidget *sep; - GimpImage *gimage; - - /* The new options structure */ - options = g_new (AddMaskOptions, 1); - options->layer = layer; - options->add_mask_type = GIMP_ADD_WHITE_MASK; - options->invert = FALSE; - - gimage = gimp_item_get_image (GIMP_ITEM (layer)); - - /* The dialog */ - options->query_box = - gimp_viewable_dialog_new (GIMP_VIEWABLE (layer), - _("Add Layer Mask"), "gimp-layer-add-mask", - GIMP_STOCK_LAYER_MASK, - _("Add a Mask to the Layer"), - parent, - gimp_standard_help_func, - GIMP_HELP_LAYER_MASK_ADD, - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - - NULL); - - g_signal_connect (options->query_box, "response", - G_CALLBACK (add_mask_query_response), - options); - - g_object_weak_ref (G_OBJECT (options->query_box), - (GWeakNotify) g_free, options); - - frame = - gimp_enum_radio_frame_new (GIMP_TYPE_ADD_MASK_TYPE, - gtk_label_new (_("Initialize Layer Mask to:")), - 6, - G_CALLBACK (gimp_radio_button_update), - &options->add_mask_type, - &button); - gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button), - options->add_mask_type); - - gtk_container_set_border_width (GTK_CONTAINER (frame), 6); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox), - frame); - gtk_widget_show (frame); - - sep = gtk_hseparator_new (); - gtk_box_pack_start (GTK_BOX (GTK_BIN (frame)->child), sep, FALSE, FALSE, 0); - gtk_widget_show (sep); - - button = gtk_check_button_new_with_mnemonic (_("In_vert Mask")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), options->invert); - g_signal_connect (button, "toggled", - G_CALLBACK (gimp_toggle_button_update), - &options->invert); - - gtk_box_pack_end (GTK_BOX (GTK_BIN (frame)->child), button, FALSE, FALSE, 0); - gtk_widget_show (button); - - gtk_widget_show (options->query_box); -} - - -/****************************/ -/* The scale layer dialog */ -/****************************/ - -typedef struct _ScaleLayerOptions ScaleLayerOptions; - -struct _ScaleLayerOptions -{ - Resize *resize; - GimpDisplay *gdisp; - GimpLayer *layer; -}; - -static void -scale_layer_query_ok_callback (GtkWidget *widget, - gpointer data) -{ - ScaleLayerOptions *options; - GimpLayer *layer; - - options = (ScaleLayerOptions *) data; - - if (options->resize->width > 0 && options->resize->height > 0 && - (layer = (options->layer))) - { - GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (layer)); - GimpProgress *progress; - - gtk_widget_set_sensitive (options->resize->resize_shell, FALSE); - - progress = gimp_progress_start (options->gdisp, - _("Scaling..."), - TRUE, NULL, NULL); - - gimp_item_scale_by_origin (GIMP_ITEM (layer), - options->resize->width, - options->resize->height, - options->resize->interpolation, - gimp_progress_update_and_flush, progress, - TRUE); - - gimp_progress_end (progress); - - gimp_image_flush (gimage); - - gtk_widget_destroy (options->resize->resize_shell); - } - else - { - g_message (_("Invalid width or height. Both must be positive.")); - } -} - -static void -layers_scale_layer_query (GimpDisplay *gdisp, - GimpImage *gimage, - GimpLayer *layer, - GtkWidget *parent) -{ - ScaleLayerOptions *options; - - options = g_new0 (ScaleLayerOptions, 1); - - options->gdisp = gdisp; - options->layer = layer; - - options->resize = - resize_widget_new (GIMP_VIEWABLE (layer), parent, - ScaleWidget, - gimp_item_width (GIMP_ITEM (layer)), - gimp_item_height (GIMP_ITEM (layer)), - gimage->xresolution, - gimage->yresolution, - gimage->unit, - TRUE, - G_CALLBACK (scale_layer_query_ok_callback), - options); - - g_object_weak_ref (G_OBJECT (options->resize->resize_shell), - (GWeakNotify) g_free, - options); - - gtk_widget_show (options->resize->resize_shell); -} - -/*****************************/ -/* The resize layer dialog */ -/*****************************/ - -typedef struct _ResizeLayerOptions ResizeLayerOptions; - -struct _ResizeLayerOptions -{ - GimpLayer *layer; - Resize *resize; -}; - -static void -resize_layer_query_ok_callback (GtkWidget *widget, - gpointer data) -{ - ResizeLayerOptions *options; - GimpLayer *layer; - - options = (ResizeLayerOptions *) data; - - if (options->resize->width > 0 && options->resize->height > 0 && - (layer = (options->layer))) - { - GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (layer)); - - gtk_widget_set_sensitive (options->resize->resize_shell, FALSE); - - gimp_item_resize (GIMP_ITEM (layer), - gimp_get_user_context (gimage->gimp), - options->resize->width, - options->resize->height, - options->resize->offset_x, - options->resize->offset_y); - - gimp_image_flush (gimage); - - gtk_widget_destroy (options->resize->resize_shell); - } - else - { - g_message (_("Invalid width or height. Both must be positive.")); - } -} - -static void -layers_resize_layer_query (GimpImage *gimage, - GimpLayer *layer, - GtkWidget *parent) -{ - ResizeLayerOptions *options; - - options = g_new0 (ResizeLayerOptions, 1); - - options->layer = layer; - - options->resize = - resize_widget_new (GIMP_VIEWABLE (layer), parent, - ResizeWidget, - gimp_item_width (GIMP_ITEM (layer)), - gimp_item_height (GIMP_ITEM (layer)), - gimage->xresolution, - gimage->yresolution, - gimage->unit, - TRUE, - G_CALLBACK (resize_layer_query_ok_callback), - options); - - g_object_weak_ref (G_OBJECT (options->resize->resize_shell), - (GWeakNotify) g_free, - options); - - gtk_widget_show (options->resize->resize_shell); -} diff --git a/app/gui/layers-commands.h b/app/gui/layers-commands.h deleted file mode 100644 index 18fe2185ef..0000000000 --- a/app/gui/layers-commands.h +++ /dev/null @@ -1,99 +0,0 @@ -/* 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_COMMANDS_H__ -#define __LAYERS_COMMANDS_H__ - - -void layers_select_previous_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_select_next_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_select_top_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_select_bottom_cmd_callback (GtkWidget *widet, - gpointer data); - -void layers_raise_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_lower_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_raise_to_top_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_lower_to_bottom_cmd_callback (GtkWidget *widet, - gpointer data); - -void layers_new_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_duplicate_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_anchor_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_merge_down_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_delete_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_text_discard_cmd_callback (GtkWidget *widet, - gpointer data); - -void layers_resize_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_resize_to_image_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_scale_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_crop_cmd_callback (GtkWidget *widet, - gpointer data); - -void layers_mask_add_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_mask_apply_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_mask_delete_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_mask_to_selection_cmd_callback (GtkWidget *widet, - gpointer data, - guint action); - -void layers_alpha_add_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_alpha_to_selection_cmd_callback (GtkWidget *widet, - gpointer data, - guint action); - -void layers_merge_layers_cmd_callback (GtkWidget *widget, - gpointer data); -void layers_flatten_image_cmd_callback (GtkWidget *widget, - gpointer data); - -void layers_text_tool_cmd_callback (GtkWidget *widet, - gpointer data); -void layers_edit_attributes_cmd_callback (GtkWidget *widet, - gpointer data); - -void layers_text_tool (GimpLayer *layer, - GtkWidget *parent); -void layers_new_layer_query (GimpImage *gimage, - GimpLayer *template, - gboolean interactive, - GtkWidget *parent); -void layers_edit_layer_query (GimpLayer *layer, - GtkWidget *parent); - - -#endif /* __LAYERS_COMMANDS_H__ */ diff --git a/app/gui/layers-menu.c b/app/gui/layers-menu.c index e90d416da2..cfecacb36c 100644 --- a/app/gui/layers-menu.c +++ b/app/gui/layers-menu.c @@ -34,7 +34,8 @@ #include "widgets/gimpitemfactory.h" #include "widgets/gimpitemtreeview.h" -#include "layers-commands.h" +#include "actions/layers-commands.h" + #include "layers-menu.h" #include "menus.h" diff --git a/app/gui/menus.c b/app/gui/menus.c index cf46963e7b..0d11cb582d 100644 --- a/app/gui/menus.c +++ b/app/gui/menus.c @@ -37,6 +37,8 @@ #include "widgets/gimpitemfactory.h" #include "widgets/gimpmenufactory.h" +#include "actions/file-commands.h" + #include "brushes-menu.h" #include "buffers-menu.h" #include "channels-menu.h" @@ -46,7 +48,6 @@ #include "error-console-menu.h" #include "file-open-menu.h" #include "file-save-menu.h" -#include "file-commands.h" #include "fonts-menu.h" #include "gradient-editor-menu.h" #include "gradients-menu.h" diff --git a/app/gui/palette-editor-commands.c b/app/gui/palette-editor-commands.c deleted file mode 100644 index af522f9e73..0000000000 --- a/app/gui/palette-editor-commands.c +++ /dev/null @@ -1,103 +0,0 @@ -/* 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 "gui-types.h" - -#include "widgets/gimppaletteeditor.h" - -#include "palette-editor-commands.h" - - -/* public functions */ - -void -palette_editor_edit_color_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); - - if (GTK_WIDGET_SENSITIVE (editor->edit_button)) - gtk_button_clicked (GTK_BUTTON (editor->edit_button)); -} - -void -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), - GDK_CONTROL_MASK); -} - -void -palette_editor_delete_color_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); - - if (GTK_WIDGET_SENSITIVE (editor->delete_button)) - gtk_button_clicked (GTK_BUTTON (editor->delete_button)); -} - -void -palette_editor_zoom_in_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); - - if (GTK_WIDGET_SENSITIVE (editor->zoom_in_button)) - gtk_button_clicked (GTK_BUTTON (editor->zoom_in_button)); -} - -void -palette_editor_zoom_out_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); - - if (GTK_WIDGET_SENSITIVE (editor->zoom_out_button)) - gtk_button_clicked (GTK_BUTTON (editor->zoom_out_button)); -} - -void -palette_editor_zoom_all_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); - - if (GTK_WIDGET_SENSITIVE (editor->zoom_all_button)) - gtk_button_clicked (GTK_BUTTON (editor->zoom_all_button)); -} diff --git a/app/gui/palette-editor-commands.h b/app/gui/palette-editor-commands.h deleted file mode 100644 index dc106b9210..0000000000 --- a/app/gui/palette-editor-commands.h +++ /dev/null @@ -1,40 +0,0 @@ -/* 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_COMMANDS_H__ -#define __PALETTE_EDITOR_COMMANDS_H__ - - -void palette_editor_edit_color_cmd_callback (GtkWidget *widget, - 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); - -void palette_editor_zoom_in_cmd_callback (GtkWidget *widget, - gpointer data); -void palette_editor_zoom_out_cmd_callback (GtkWidget *widget, - gpointer data); -void palette_editor_zoom_all_cmd_callback (GtkWidget *widget, - gpointer data); - - -#endif /* __PALETTE_EDITOR_COMMANDS_H__ */ diff --git a/app/gui/palette-editor-menu.c b/app/gui/palette-editor-menu.c index 29c463fc9f..3f154390b4 100644 --- a/app/gui/palette-editor-menu.c +++ b/app/gui/palette-editor-menu.c @@ -28,8 +28,9 @@ #include "widgets/gimpitemfactory.h" #include "widgets/gimppaletteeditor.h" +#include "actions/palette-editor-commands.h" + #include "menus.h" -#include "palette-editor-commands.h" #include "palette-editor-menu.h" #include "gimp-intl.h" diff --git a/app/gui/palettes-commands.c b/app/gui/palettes-commands.c deleted file mode 100644 index 22d2d5e36b..0000000000 --- a/app/gui/palettes-commands.c +++ /dev/null @@ -1,148 +0,0 @@ -/* 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 "gui-types.h" - -#include "core/gimppalette.h" -#include "core/gimpcontainer.h" -#include "core/gimpcontext.h" - -#include "widgets/gimpcontainertreeview.h" -#include "widgets/gimpdatafactoryview.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimppreview.h" - -#include "palette-import-dialog.h" -#include "palettes-commands.h" - -#include "gimp-intl.h" - - -/* local function prototypes */ - -static void palettes_merge_palettes_query (GimpContainerEditor *editor); -static void palettes_merge_palettes_callback (GtkWidget *widget, - const gchar *palette_name, - gpointer data); - - -/* public functionss */ - -void -palettes_import_palette_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpContainerEditor *editor; - - editor = GIMP_CONTAINER_EDITOR (data); - - palette_import_dialog_show (editor->view->context->gimp); -} - -void -palettes_merge_palettes_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpContainerEditor *editor; - - editor = GIMP_CONTAINER_EDITOR (data); - - palettes_merge_palettes_query (editor); -} - - -/* private functions */ - -static void -palettes_merge_palettes_query (GimpContainerEditor *editor) -{ - GtkWidget *qbox; - - qbox = gimp_query_string_box (_("Merge Palette"), - GTK_WIDGET (editor), - gimp_standard_help_func, - GIMP_HELP_PALETTE_MERGE, - _("Enter a name for the merged palette"), - NULL, - G_OBJECT (editor), "destroy", - palettes_merge_palettes_callback, - editor); - gtk_widget_show (qbox); -} - -static void -palettes_merge_palettes_callback (GtkWidget *widget, - const gchar *palette_name, - gpointer data) -{ -#ifdef __GNUC__ -#warning FIXME: reimplement palettes_merge_palettes_callback() -#endif -#if 0 - GimpContainerEditor *editor; - GimpPalette *palette; - GimpPalette *new_palette; - GimpPaletteEntry *entry; - GList *sel_list; - - editor = (GimpContainerEditor *) data; - - sel_list = GTK_LIST (GIMP_CONTAINER_LIST_VIEW (editor->view)->gtk_list)->selection; - - if (! sel_list) - { - g_message ("Can't merge palettes because there are no palettes selected."); - return; - } - - new_palette = GIMP_PALETTE (gimp_palette_new (palette_name, FALSE)); - - while (sel_list) - { - GimpListItem *list_item; - GList *cols; - - list_item = GIMP_LIST_ITEM (sel_list->data); - - palette = (GimpPalette *) GIMP_PREVIEW (list_item->preview)->viewable; - - if (palette) - { - for (cols = palette->colors; cols; cols = g_list_next (cols)) - { - entry = (GimpPaletteEntry *) cols->data; - - gimp_palette_add_entry (new_palette, - entry->name, - &entry->color); - } - } - - sel_list = sel_list->next; - } - - gimp_container_add (editor->view->container, - GIMP_OBJECT (new_palette)); -#endif -} diff --git a/app/gui/palettes-commands.h b/app/gui/palettes-commands.h deleted file mode 100644 index 707fdb6fbf..0000000000 --- a/app/gui/palettes-commands.h +++ /dev/null @@ -1,29 +0,0 @@ -/* 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_COMMANDS_H__ -#define __PALETTES_COMMANDS_H__ - - -void palettes_import_palette_cmd_callback (GtkWidget *widget, - gpointer data); -void palettes_merge_palettes_cmd_callback (GtkWidget *widget, - gpointer data); - - -#endif /* __PALETTES_COMMANDS_H__ */ diff --git a/app/gui/palettes-menu.c b/app/gui/palettes-menu.c index acf5f85352..95b9da9afe 100644 --- a/app/gui/palettes-menu.c +++ b/app/gui/palettes-menu.c @@ -33,8 +33,9 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" -#include "data-commands.h" -#include "palettes-commands.h" +#include "actions/data-commands.h" +#include "actions/palettes-commands.h" + #include "palettes-menu.h" #include "menus.h" diff --git a/app/gui/patterns-menu.c b/app/gui/patterns-menu.c index 876eb94309..891867cf13 100644 --- a/app/gui/patterns-menu.c +++ b/app/gui/patterns-menu.c @@ -33,7 +33,8 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" -#include "data-commands.h" +#include "actions/data-commands.h" + #include "patterns-menu.h" #include "menus.h" diff --git a/app/gui/plug-in-commands.c b/app/gui/plug-in-commands.c deleted file mode 100644 index 744cb6d70a..0000000000 --- a/app/gui/plug-in-commands.c +++ /dev/null @@ -1,182 +0,0 @@ -/* 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 "gui-types.h" - -#include "core/gimp.h" -#include "core/gimpcontext.h" -#include "core/gimpdrawable.h" -#include "core/gimpimage.h" -#include "core/gimpitem.h" - -#include "plug-in/plug-in-run.h" -#include "plug-in/plug-in-proc.h" - -#include "widgets/gimpdock.h" -#include "widgets/gimpitemfactory.h" - -#include "display/gimpdisplay.h" - -#include "plug-in-commands.h" -#include "plug-in-menus.h" - - -#define return_if_no_display(gdisp,data) \ - if (GIMP_IS_DISPLAY (data)) \ - gdisp = data; \ - else if (GIMP_IS_GIMP (data)) \ - gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \ - else if (GIMP_IS_DOCK (data)) \ - gdisp = gimp_context_get_display (((GimpDock *) data)->context); \ - else \ - gdisp = NULL; \ - if (! gdisp) \ - return - - -void -plug_in_run_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GtkItemFactory *item_factory; - Gimp *gimp; - ProcRecord *proc_rec; - Argument *args; - gint gdisp_ID = -1; - gint i; - gint argc; - GimpImageType drawable_type = GIMP_RGB_IMAGE; - - item_factory = gtk_item_factory_from_widget (widget); - - gimp = GIMP_ITEM_FACTORY (item_factory)->gimp; - - proc_rec = (ProcRecord *) data; - - /* construct the procedures arguments */ - args = g_new0 (Argument, proc_rec->num_args); - - /* initialize the argument types */ - for (i = 0; i < proc_rec->num_args; i++) - args[i].arg_type = proc_rec->args[i].arg_type; - - /* initialize the first argument */ - args[0].value.pdb_int = GIMP_RUN_INTERACTIVE; - argc = 1; - - switch (proc_rec->proc_type) - { - case GIMP_EXTENSION: - break; - - case GIMP_PLUGIN: - case GIMP_TEMPORARY: - if (proc_rec->num_args >= 2 && - proc_rec->args[1].arg_type == GIMP_PDB_IMAGE) - { - GimpDisplay *gdisplay; - - gdisplay = gimp_context_get_display (gimp_get_user_context (gimp)); - - if (gdisplay) - { - gdisp_ID = gimp_display_get_ID (gdisplay); - - args[1].value.pdb_int = gimp_image_get_ID (gdisplay->gimage); - argc++; - - if (proc_rec->num_args >= 2 && - proc_rec->args[2].arg_type == GIMP_PDB_DRAWABLE) - { - GimpDrawable *drawable; - - drawable = gimp_image_active_drawable (gdisplay->gimage); - - if (drawable) - { - drawable_type = gimp_drawable_type (drawable); - - args[2].value.pdb_int = - gimp_item_get_ID (GIMP_ITEM (drawable)); - argc++; - } - else - { - g_warning ("Uh-oh, no active drawable for the plug-in!"); - g_free (args); - return; - } - } - } - } - break; - - default: - g_error ("Unknown procedure type."); - g_free (args); - return; - } - - /* run the plug-in procedure */ - plug_in_run (gimp, gimp_get_user_context (gimp), - proc_rec, args, argc, FALSE, TRUE, gdisp_ID); - - /* remember only "standard" plug-ins */ - if (proc_rec->proc_type == GIMP_PLUGIN && - proc_rec->num_args >= 2 && - proc_rec->args[1].arg_type == GIMP_PDB_IMAGE && - proc_rec->args[2].arg_type == GIMP_PDB_DRAWABLE) - { - gimp->last_plug_in = proc_rec; - plug_in_menus_update (GIMP_ITEM_FACTORY (item_factory), drawable_type); - } - - g_free (args); -} - -void -plug_in_repeat_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDisplay *gdisp; - GimpDrawable *drawable; - gboolean interactive; - return_if_no_display (gdisp, data); - - drawable = gimp_image_active_drawable (gdisp->gimage); - - if (! drawable) - return; - - interactive = action ? TRUE : FALSE; - - plug_in_repeat (gdisp->gimage->gimp, - gimp_get_user_context (gdisp->gimage->gimp), - gimp_display_get_ID (gdisp), - gimp_image_get_ID (gdisp->gimage), - gimp_item_get_ID (GIMP_ITEM (drawable)), - interactive); -} diff --git a/app/gui/plug-in-commands.h b/app/gui/plug-in-commands.h deleted file mode 100644 index 2c9317d55d..0000000000 --- a/app/gui/plug-in-commands.h +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 __PLUG_IN_COMMANDS_H__ -#define __PLUG_IN_COMMANDS_H__ - - -void plug_in_run_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void plug_in_repeat_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - - -#endif /* __PLUG_IN_COMMANDS_H__ */ diff --git a/app/gui/plug-in-menus.c b/app/gui/plug-in-menus.c index 5d165514f0..ab221e553f 100644 --- a/app/gui/plug-in-menus.c +++ b/app/gui/plug-in-menus.c @@ -36,7 +36,8 @@ #include "widgets/gimpitemfactory.h" #include "widgets/gimpwidgets-utils.h" -#include "plug-in-commands.h" +#include "actions/plug-in-commands.h" + #include "plug-in-menus.h" #include "gimp-intl.h" diff --git a/app/gui/qmask-commands.c b/app/gui/qmask-commands.c deleted file mode 100644 index 10f4db8b2b..0000000000 --- a/app/gui/qmask-commands.c +++ /dev/null @@ -1,257 +0,0 @@ -/* 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 "libgimpcolor/gimpcolor.h" -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimp.h" -#include "core/gimpchannel.h" -#include "core/gimpimage.h" -#include "core/gimpimage-qmask.h" - -#include "widgets/gimpcolorpanel.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpviewabledialog.h" - -#include "display/gimpdisplay.h" -#include "display/gimpdisplayshell.h" - -#include "qmask-commands.h" - -#include "gimp-intl.h" - - -typedef struct _EditQmaskOptions EditQmaskOptions; - -struct _EditQmaskOptions -{ - GtkWidget *query_box; - GtkWidget *name_entry; - GtkWidget *color_panel; - - GimpImage *gimage; -}; - - -/* local function prototypes */ - -static void qmask_channel_query (GimpDisplayShell *shell); -static void qmask_query_response (GtkWidget *widget, - gint response_id, - EditQmaskOptions *options); -static void qmask_query_scale_update (GtkAdjustment *adjustment, - gpointer data); -static void qmask_query_color_changed (GimpColorButton *button, - gpointer data); - - -/* public functionss */ - -void -qmask_toggle_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data); - - if (GTK_CHECK_MENU_ITEM (widget)->active != - gimp_image_get_qmask_state (shell->gdisp->gimage)) - { - gimp_image_set_qmask_state (shell->gdisp->gimage, - GTK_CHECK_MENU_ITEM (widget)->active); - - gimp_image_flush (shell->gdisp->gimage); - } -} - -void -qmask_invert_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data); - - if (GTK_CHECK_MENU_ITEM (widget)->active) - { - if (action != shell->gdisp->gimage->qmask_inverted) - { - gimp_image_qmask_invert (shell->gdisp->gimage); - - if (gimp_image_get_qmask_state (shell->gdisp->gimage)) - gimp_image_flush (shell->gdisp->gimage); - } - } -} - -void -qmask_configure_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data); - - qmask_channel_query (shell); -} - - -/* private functions */ - -static void -qmask_channel_query (GimpDisplayShell *shell) -{ - EditQmaskOptions *options; - GtkWidget *hbox; - GtkWidget *vbox; - GtkWidget *table; - GtkWidget *opacity_scale; - GtkObject *opacity_scale_data; - - /* the new options structure */ - options = g_new0 (EditQmaskOptions, 1); - - options->gimage = shell->gdisp->gimage; - options->color_panel = gimp_color_panel_new (_("Edit Qmask Color"), - &options->gimage->qmask_color, - GIMP_COLOR_AREA_LARGE_CHECKS, - 48, 64); - gimp_color_panel_set_context (GIMP_COLOR_PANEL (options->color_panel), - gimp_get_user_context (options->gimage->gimp)); - - /* The dialog */ - options->query_box = - gimp_viewable_dialog_new (GIMP_VIEWABLE (shell->gdisp->gimage), - _("Qmask Attributes"), "gimp-qmask-edit", - GIMP_STOCK_QMASK_ON, - _("Edit QuickMask Attributes"), - GTK_WIDGET (shell), - gimp_standard_help_func, - GIMP_HELP_QMASK_EDIT, - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - - NULL); - - g_signal_connect (options->query_box, "response", - G_CALLBACK (qmask_query_response), - options); - - g_object_weak_ref (G_OBJECT (options->query_box), - (GWeakNotify) g_free, options); - - /* The main hbox */ - hbox = gtk_hbox_new (FALSE, 4); - gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox), - hbox); - gtk_widget_show (hbox); - - /* The vbox */ - vbox = gtk_vbox_new (FALSE, 2); - gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); - gtk_widget_show (vbox); - - /* The table */ - table = gtk_table_new (1, 2, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (table), 4); - gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); - gtk_widget_show (table); - - /* The opacity scale */ - opacity_scale_data = - gtk_adjustment_new (options->gimage->qmask_color.a * 100.0, - 0.0, 100.0, 1.0, 1.0, 0.0); - opacity_scale = gtk_hscale_new (GTK_ADJUSTMENT (opacity_scale_data)); - gtk_widget_set_size_request (opacity_scale, 100, -1); - gtk_scale_set_value_pos (GTK_SCALE (opacity_scale), GTK_POS_TOP); - - gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, - _("Mask Opacity:"), 1.0, 1.0, - opacity_scale, 1, FALSE); - - g_signal_connect (opacity_scale_data, "value_changed", - G_CALLBACK (qmask_query_scale_update), - options->color_panel); - - /* The color panel */ - gtk_box_pack_start (GTK_BOX (hbox), options->color_panel, - TRUE, TRUE, 0); - gtk_widget_show (options->color_panel); - - g_signal_connect (options->color_panel, "color_changed", - G_CALLBACK (qmask_query_color_changed), - opacity_scale_data); - - gtk_widget_show (options->query_box); -} - -static void -qmask_query_response (GtkWidget *widget, - gint response_id, - EditQmaskOptions *options) -{ - if (response_id == GTK_RESPONSE_OK) - { - GimpChannel *channel = gimp_image_get_qmask (options->gimage); - GimpRGB color; - - if (options->gimage && channel) - { - gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel), - &color); - - if (gimp_rgba_distance (&color, &channel->color) > 0.0001) - { - gimp_channel_set_color (channel, &color, TRUE); - - gimp_image_flush (options->gimage); - } - } - - /* update the qmask color no matter what */ - options->gimage->qmask_color = color; - } - - gtk_widget_destroy (options->query_box); -} - -static void -qmask_query_scale_update (GtkAdjustment *adjustment, - gpointer data) -{ - GimpRGB color; - - gimp_color_button_get_color (GIMP_COLOR_BUTTON (data), &color); - gimp_rgb_set_alpha (&color, adjustment->value / 100.0); - gimp_color_button_set_color (GIMP_COLOR_BUTTON (data), &color); -} - -static void -qmask_query_color_changed (GimpColorButton *button, - gpointer data) -{ - GtkAdjustment *adj = GTK_ADJUSTMENT (data); - GimpRGB color; - - gimp_color_button_get_color (button, &color); - gtk_adjustment_set_value (adj, color.a * 100.0); -} diff --git a/app/gui/qmask-commands.h b/app/gui/qmask-commands.h deleted file mode 100644 index 67e13f5b1d..0000000000 --- a/app/gui/qmask-commands.h +++ /dev/null @@ -1,32 +0,0 @@ -/* 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_COMMANDS_H__ -#define __QMASK_COMMANDS_H__ - - -void qmask_toggle_cmd_callback (GtkWidget *widget, - gpointer data); -void qmask_invert_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void qmask_configure_cmd_callback (GtkWidget *widget, - gpointer data); - - -#endif /* __QMASK_COMMANDS_H__ */ diff --git a/app/gui/qmask-menu.c b/app/gui/qmask-menu.c index d141b0f4aa..7d312c617e 100644 --- a/app/gui/qmask-menu.c +++ b/app/gui/qmask-menu.c @@ -32,7 +32,8 @@ #include "display/gimpdisplay.h" #include "display/gimpdisplayshell.h" -#include "qmask-commands.h" +#include "actions/qmask-commands.h" + #include "qmask-menu.h" #include "menus.h" diff --git a/app/gui/select-commands.c b/app/gui/select-commands.c deleted file mode 100644 index 7fb268f958..0000000000 --- a/app/gui/select-commands.c +++ /dev/null @@ -1,450 +0,0 @@ -/* 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 "libgimpmath/gimpmath.h" -#include "libgimpwidgets/gimpwidgets.h" - -#include "gui-types.h" - -#include "core/gimp.h" -#include "core/gimpchannel.h" -#include "core/gimpchannel-select.h" -#include "core/gimpcontext.h" -#include "core/gimpimage.h" -#include "core/gimpimage-qmask.h" -#include "core/gimpselection.h" - -#include "widgets/gimpdock.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpdialogfactory.h" - -#include "display/gimpdisplay.h" -#include "display/gimpdisplayshell.h" - -#include "dialogs.h" -#include "select-commands.h" - -#include "gimp-intl.h" - - -#define return_if_no_display(gdisp,data) \ - if (GIMP_IS_DISPLAY (data)) \ - gdisp = data; \ - else if (GIMP_IS_GIMP (data)) \ - gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \ - else if (GIMP_IS_DOCK (data)) \ - gdisp = gimp_context_get_display (((GimpDock *) data)->context); \ - else \ - gdisp = NULL; \ - if (! gdisp) \ - return - -#define return_if_no_image(gimage,data) \ - if (GIMP_IS_DISPLAY (data)) \ - gimage = ((GimpDisplay *) data)->gimage; \ - else if (GIMP_IS_GIMP (data)) \ - gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \ - else if (GIMP_IS_DOCK (data)) \ - gimage = gimp_context_get_image (((GimpDock *) data)->context); \ - else \ - gimage = NULL; \ - if (! gimage) \ - return - - -/* local functions */ - -static void gimp_image_mask_feather_callback (GtkWidget *widget, - gdouble size, - GimpUnit unit, - gpointer data); -static void gimp_image_mask_border_callback (GtkWidget *widget, - gdouble size, - GimpUnit unit, - gpointer data); -static void gimp_image_mask_grow_callback (GtkWidget *widget, - gdouble size, - GimpUnit unit, - gpointer data); -static void gimp_image_mask_shrink_callback (GtkWidget *widget, - gdouble size, - GimpUnit unit, - gpointer data); - - -/* local variables */ - -static gdouble selection_feather_radius = 5.0; -static gint selection_border_radius = 5; -static gint selection_grow_pixels = 1; -static gint selection_shrink_pixels = 1; -static gboolean selection_shrink_edge_lock = FALSE; - - -void -select_invert_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - gimp_channel_invert (gimp_image_get_mask (gimage), TRUE); - gimp_image_flush (gimage); -} - -void -select_all_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - gimp_channel_all (gimp_image_get_mask (gimage), TRUE); - gimp_image_flush (gimage); -} - -void -select_none_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - gimp_channel_clear (gimp_image_get_mask (gimage), NULL, TRUE); - gimp_image_flush (gimage); -} - -void -select_from_vectors_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpVectors *vectors; - return_if_no_image (gimage, data); - - vectors = gimp_image_get_active_vectors (gimage); - if (!vectors) - return; - - gimp_channel_select_vectors (gimp_image_get_mask (gimage), - _("Path to Selection"), - vectors, - GIMP_CHANNEL_OP_REPLACE, - TRUE, FALSE, 0, 0); - gimp_image_flush (gimage); -} - -void -select_float_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - gimp_selection_float (gimp_image_get_mask (gimage), - gimp_image_active_drawable (gimage), - gimp_get_user_context (gimage->gimp), - TRUE, 0, 0); - gimp_image_flush (gimage); -} - -void -select_feather_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GtkWidget *qbox; - return_if_no_display (gdisp, data); - - qbox = gimp_query_size_box (_("Feather Selection"), - gdisp->shell, - gimp_standard_help_func, - GIMP_HELP_SELECTION_FEATHER, - _("Feather selection by"), - selection_feather_radius, 0, 32767, 3, - gdisp->gimage->unit, - MIN (gdisp->gimage->xresolution, - gdisp->gimage->yresolution), - GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot, - G_OBJECT (gdisp->gimage), "disconnect", - gimp_image_mask_feather_callback, gdisp->gimage); - gtk_widget_show (qbox); -} - -void -select_sharpen_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - gimp_channel_sharpen (gimp_image_get_mask (gimage), TRUE); - gimp_image_flush (gimage); -} - -void -select_shrink_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GtkWidget *shrink_dialog; - GtkWidget *edge_lock; - return_if_no_display (gdisp, data); - - shrink_dialog = - gimp_query_size_box (_("Shrink Selection"), - gdisp->shell, - gimp_standard_help_func, - GIMP_HELP_SELECTION_SHRINK, - _("Shrink selection by"), - selection_shrink_pixels, 1, 32767, 0, - gdisp->gimage->unit, - MIN (gdisp->gimage->xresolution, - gdisp->gimage->yresolution), - GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot, - G_OBJECT (gdisp->gimage), "disconnect", - gimp_image_mask_shrink_callback, gdisp->gimage); - - edge_lock = gtk_check_button_new_with_label (_("Shrink from image border")); - - gtk_box_pack_start (GTK_BOX (GIMP_QUERY_BOX_VBOX (shrink_dialog)), edge_lock, - FALSE, FALSE, 0); - - g_object_set_data (G_OBJECT (shrink_dialog), "edge_lock_toggle", edge_lock); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (edge_lock), - ! selection_shrink_edge_lock); - gtk_widget_show (edge_lock); - - gtk_widget_show (shrink_dialog); -} - -void -select_grow_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GtkWidget *qbox; - return_if_no_display (gdisp, data); - - qbox = gimp_query_size_box (_("Grow Selection"), - gdisp->shell, - gimp_standard_help_func, - GIMP_HELP_SELECTION_GROW, - _("Grow selection by"), - selection_grow_pixels, 1, 32767, 0, - gdisp->gimage->unit, - MIN (gdisp->gimage->xresolution, - gdisp->gimage->yresolution), - GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot, - G_OBJECT (gdisp->gimage), "disconnect", - gimp_image_mask_grow_callback, gdisp->gimage); - gtk_widget_show (qbox); -} - -void -select_border_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GtkWidget *qbox; - return_if_no_display (gdisp, data); - - qbox = gimp_query_size_box (_("Border Selection"), - gdisp->shell, - gimp_standard_help_func, - GIMP_HELP_SELECTION_BORDER, - _("Border selection by"), - selection_border_radius, 1, 32767, 0, - gdisp->gimage->unit, - MIN (gdisp->gimage->xresolution, - gdisp->gimage->yresolution), - GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot, - G_OBJECT (gdisp->gimage), "disconnect", - gimp_image_mask_border_callback, gdisp->gimage); - gtk_widget_show (qbox); -} - -void -select_save_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - gimp_selection_save (gimp_image_get_mask (gimage)); - gimp_image_flush (gimage); - - gimp_dialog_factory_dialog_raise (global_dock_factory, - gtk_widget_get_screen (widget), - "gimp-channel-list", -1); -} - -void -select_toggle_quickmask_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - gimp_image_set_qmask_state (gimage, !gimp_image_get_qmask_state (gimage)); - gimp_image_flush (gimage); -} - - -/* private functions */ - -static void -gimp_image_mask_feather_callback (GtkWidget *widget, - gdouble size, - GimpUnit unit, - gpointer data) -{ - GimpImage *gimage; - gdouble radius_x; - gdouble radius_y; - - gimage = GIMP_IMAGE (data); - - selection_feather_radius = size; - - radius_x = radius_y = selection_feather_radius; - - if (unit != GIMP_UNIT_PIXEL) - { - gdouble factor; - - factor = (MAX (gimage->xresolution, gimage->yresolution) / - MIN (gimage->xresolution, gimage->yresolution)); - - if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution)) - radius_y *= factor; - else - radius_x *= factor; - } - - gimp_channel_feather (gimp_image_get_mask (gimage), radius_x, radius_y, TRUE); - gimp_image_flush (gimage); -} - -static void -gimp_image_mask_border_callback (GtkWidget *widget, - gdouble size, - GimpUnit unit, - gpointer data) -{ - GimpImage *gimage; - gdouble radius_x; - gdouble radius_y; - - gimage = GIMP_IMAGE (data); - - selection_border_radius = ROUND (size); - - radius_x = radius_y = selection_border_radius; - - if (unit != GIMP_UNIT_PIXEL) - { - gdouble factor; - - factor = (MAX (gimage->xresolution, gimage->yresolution) / - MIN (gimage->xresolution, gimage->yresolution)); - - if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution)) - radius_y *= factor; - else - radius_x *= factor; - } - - gimp_channel_border (gimp_image_get_mask (gimage), radius_x, radius_y, TRUE); - gimp_image_flush (gimage); -} - -static void -gimp_image_mask_grow_callback (GtkWidget *widget, - gdouble size, - GimpUnit unit, - gpointer data) -{ - GimpImage *gimage; - gdouble radius_x; - gdouble radius_y; - - gimage = GIMP_IMAGE (data); - - selection_grow_pixels = ROUND (size); - - radius_x = radius_y = selection_grow_pixels; - - if (unit != GIMP_UNIT_PIXEL) - { - gdouble factor; - - factor = (MAX (gimage->xresolution, gimage->yresolution) / - MIN (gimage->xresolution, gimage->yresolution)); - - if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution)) - radius_y *= factor; - else - radius_x *= factor; - } - - gimp_channel_grow (gimp_image_get_mask (gimage), radius_x, radius_y, TRUE); - gimp_image_flush (gimage); -} - -static void -gimp_image_mask_shrink_callback (GtkWidget *widget, - gdouble size, - GimpUnit unit, - gpointer data) -{ - GimpImage *gimage; - gint radius_x; - gint radius_y; - - gimage = GIMP_IMAGE (data); - - selection_shrink_pixels = ROUND (size); - - radius_x = radius_y = selection_shrink_pixels; - - selection_shrink_edge_lock = - ! GTK_TOGGLE_BUTTON (g_object_get_data (G_OBJECT (widget), - "edge_lock_toggle"))->active; - - if (unit != GIMP_UNIT_PIXEL) - { - gdouble factor; - - factor = (MAX (gimage->xresolution, gimage->yresolution) / - MIN (gimage->xresolution, gimage->yresolution)); - - if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution)) - radius_y *= factor; - else - radius_x *= factor; - } - - gimp_channel_shrink (gimp_image_get_mask (gimage), radius_x, radius_y, - selection_shrink_edge_lock, TRUE); - gimp_image_flush (gimage); -} diff --git a/app/gui/select-commands.h b/app/gui/select-commands.h deleted file mode 100644 index f9db9fc495..0000000000 --- a/app/gui/select-commands.h +++ /dev/null @@ -1,49 +0,0 @@ -/* 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_COMMANDS_H__ -#define __SELECT_COMMANDS_H__ - - -void select_invert_cmd_callback (GtkWidget *widget, - gpointer data); -void select_all_cmd_callback (GtkWidget *widget, - gpointer data); -void select_none_cmd_callback (GtkWidget *widget, - gpointer data); -void select_from_vectors_cmd_callback (GtkWidget *widget, - gpointer data); -void select_float_cmd_callback (GtkWidget *widget, - gpointer data); -void select_feather_cmd_callback (GtkWidget *widget, - gpointer data); -void select_sharpen_cmd_callback (GtkWidget *widget, - gpointer data); -void select_shrink_cmd_callback (GtkWidget *widget, - gpointer data); -void select_border_cmd_callback (GtkWidget *widget, - gpointer data); -void select_grow_cmd_callback (GtkWidget *widget, - gpointer data); -void select_save_cmd_callback (GtkWidget *widget, - gpointer data); -void select_toggle_quickmask_cmd_callback (GtkWidget *widget, - gpointer data); - - -#endif /* __SELECT_COMMANDS_H__ */ diff --git a/app/gui/templates-commands.c b/app/gui/templates-commands.c deleted file mode 100644 index 9821313f13..0000000000 --- a/app/gui/templates-commands.c +++ /dev/null @@ -1,252 +0,0 @@ -/* 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 "gui-types.h" - -#include "config/gimpconfig.h" -#include "config/gimpconfig-utils.h" -#include "config/gimpcoreconfig.h" - -#include "core/gimp.h" -#include "core/gimpcontext.h" -#include "core/gimplist.h" -#include "core/gimptemplate.h" - -#include "widgets/gimpdialogfactory.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimptemplateeditor.h" -#include "widgets/gimptemplateview.h" -#include "widgets/gimpviewabledialog.h" - -#include "dialogs.h" -#include "file-new-dialog.h" -#include "templates-commands.h" - -#include "gimp-intl.h" - - -/* public functions */ - -void -templates_new_template_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpTemplateView *view = GIMP_TEMPLATE_VIEW (data); - - gtk_button_clicked (GTK_BUTTON (view->new_button)); -} - -void -templates_duplicate_template_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpTemplateView *view = GIMP_TEMPLATE_VIEW (data); - - gtk_button_clicked (GTK_BUTTON (view->duplicate_button)); -} - -void -templates_edit_template_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpTemplateView *view = GIMP_TEMPLATE_VIEW (data); - - gtk_button_clicked (GTK_BUTTON (view->edit_button)); -} - -void -templates_create_image_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpTemplateView *view = GIMP_TEMPLATE_VIEW (data); - - gtk_button_clicked (GTK_BUTTON (view->create_button)); -} - -void -templates_delete_template_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpTemplateView *view = GIMP_TEMPLATE_VIEW (data); - - gtk_button_clicked (GTK_BUTTON (view->delete_button)); -} - -static void -templates_new_template_response (GtkWidget *widget, - gint response_id, - GtkWidget *dialog) -{ - if (response_id == GTK_RESPONSE_OK) - { - GimpTemplate *template; - Gimp *gimp; - - template = g_object_get_data (G_OBJECT (dialog), "gimp-template"); - gimp = g_object_get_data (G_OBJECT (dialog), "gimp"); - - gimp_container_add (gimp->templates, GIMP_OBJECT (template)); - gimp_context_set_template (gimp_get_user_context (gimp), template); - } - - gtk_widget_destroy (dialog); -} - -void -templates_new_template_dialog (Gimp *gimp, - GimpTemplate *unused, - GtkWidget *parent) -{ - GimpTemplate *template; - GtkWidget *dialog; - GtkWidget *main_vbox; - GtkWidget *editor; - - dialog = gimp_viewable_dialog_new (NULL, - _("New Template"), "gimp-template-new", - GIMP_STOCK_TEMPLATE, - _("Create a New Template"), - parent, - gimp_standard_help_func, - GIMP_HELP_TEMPLATE_NEW, - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - - NULL); - - g_signal_connect (dialog, "response", - G_CALLBACK (templates_new_template_response), - dialog); - - main_vbox = gtk_vbox_new (FALSE, 4); - gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), main_vbox, - TRUE, TRUE, 0); - gtk_widget_show (main_vbox); - - template = gimp_config_duplicate (GIMP_CONFIG (gimp->config->default_image)); - gimp_object_set_name (GIMP_OBJECT (template), _("Unnamed")); - - editor = gimp_template_editor_new (template, gimp, TRUE); - - g_object_unref (template); - - g_object_set_data (G_OBJECT (dialog), "gimp", gimp); - g_object_set_data (G_OBJECT (dialog), "gimp-template", template); - - gtk_box_pack_start (GTK_BOX (main_vbox), editor, FALSE, FALSE, 0); - gtk_widget_show (editor); - - gtk_widget_show (dialog); -} - -static void -templates_edit_template_response (GtkWidget *widget, - gint response_id, - GtkWidget *dialog) -{ - if (response_id == GTK_RESPONSE_OK) - { - GimpTemplateEditor *editor; - GimpTemplate *template; - Gimp *gimp; - - editor = g_object_get_data (G_OBJECT (dialog), "gimp-template-editor"); - template = g_object_get_data (G_OBJECT (dialog), "gimp-template"); - gimp = g_object_get_data (G_OBJECT (dialog), "gimp"); - - gimp_config_sync (GIMP_CONFIG (editor->template), - GIMP_CONFIG (template), 0); - - gimp_list_uniquefy_name (GIMP_LIST (gimp->templates), - GIMP_OBJECT (template), TRUE); - } - - gtk_widget_destroy (dialog); -} - -void -templates_edit_template_dialog (Gimp *gimp, - GimpTemplate *template, - GtkWidget *parent) -{ - GtkWidget *dialog; - GtkWidget *main_vbox; - GtkWidget *editor; - - dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (template), - _("Edit Template"), "gimp-template-edit", - GIMP_STOCK_EDIT, - _("Edit Template"), - parent, - gimp_standard_help_func, - GIMP_HELP_TEMPLATE_EDIT, - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - - NULL); - - g_signal_connect (dialog, "response", - G_CALLBACK (templates_edit_template_response), - dialog); - - main_vbox = gtk_vbox_new (FALSE, 4); - gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), main_vbox, - TRUE, TRUE, 0); - gtk_widget_show (main_vbox); - - g_object_set_data (G_OBJECT (dialog), "gimp", gimp); - g_object_set_data (G_OBJECT (dialog), "gimp-template", template); - - template = gimp_config_duplicate (GIMP_CONFIG (template)); - - editor = gimp_template_editor_new (template, gimp, TRUE); - - g_object_unref (template); - - gtk_box_pack_start (GTK_BOX (main_vbox), editor, FALSE, FALSE, 0); - gtk_widget_show (editor); - - g_object_set_data (G_OBJECT (dialog), "gimp-template-editor", editor); - - gtk_widget_show (dialog); -} - -void -templates_file_new_dialog (Gimp *gimp, - GimpTemplate *template, - GtkWidget *parent) -{ - GtkWidget *dialog; - - dialog = gimp_dialog_factory_dialog_new (global_dialog_factory, - gtk_widget_get_screen (parent), - "gimp-file-new-dialog", -1); - - if (dialog) - file_new_dialog_set (dialog, NULL, template); -} diff --git a/app/gui/templates-commands.h b/app/gui/templates-commands.h deleted file mode 100644 index 752aa17146..0000000000 --- a/app/gui/templates-commands.h +++ /dev/null @@ -1,44 +0,0 @@ -/* 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_COMMANDS_H__ -#define __TEMPLATES_COMMANDS_H__ - - -void templates_new_template_cmd_callback (GtkWidget *widget, - gpointer data); -void templates_duplicate_template_cmd_callback (GtkWidget *widget, - gpointer data); -void templates_edit_template_cmd_callback (GtkWidget *widget, - gpointer data); -void templates_create_image_cmd_callback (GtkWidget *widget, - gpointer data); -void templates_delete_template_cmd_callback (GtkWidget *widget, - gpointer data); - -void templates_new_template_dialog (Gimp *gimp, - GimpTemplate *unused, - GtkWidget *parent); -void templates_edit_template_dialog (Gimp *gimp, - GimpTemplate *template, - GtkWidget *parent); -void templates_file_new_dialog (Gimp *gimp, - GimpTemplate *template, - GtkWidget *parent); - -#endif /* __TEMPLATES_COMMANDS_H__ */ diff --git a/app/gui/templates-menu.c b/app/gui/templates-menu.c index ae57292cf6..082e888d41 100644 --- a/app/gui/templates-menu.c +++ b/app/gui/templates-menu.c @@ -31,7 +31,8 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" -#include "templates-commands.h" +#include "actions/templates-commands.h" + #include "templates-menu.h" #include "menus.h" diff --git a/app/gui/tool-options-commands.c b/app/gui/tool-options-commands.c deleted file mode 100644 index 4482cbd604..0000000000 --- a/app/gui/tool-options-commands.c +++ /dev/null @@ -1,194 +0,0 @@ -/* 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 "config/gimpconfig.h" -#include "config/gimpconfig-utils.h" - -#include "core/gimp.h" -#include "core/gimplist.h" -#include "core/gimptoolinfo.h" -#include "core/gimptooloptions.h" - -#include "widgets/gimpeditor.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemfactory.h" -#include "widgets/gimptooloptionseditor.h" - -#include "tool-options-commands.h" - -#include "gimp-intl.h" - - -/* local function prototypes */ - -static void tool_options_save_callback (GtkWidget *widget, - const gchar *name, - gpointer data); -static void tool_options_rename_callback (GtkWidget *widget, - const gchar *name, - gpointer data); - - -/* public functions */ - -void -tool_options_save_to_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpToolOptions *options = GIMP_TOOL_OPTIONS (data); - gchar *name; - - name = g_strdup (gimp_object_get_name (GIMP_OBJECT (options))); - - gimp_config_sync (GIMP_CONFIG (options->tool_info->tool_options), - GIMP_CONFIG (options), 0); - gimp_object_set_name (GIMP_OBJECT (options), name); - - g_free (name); -} - -void -tool_options_save_new_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpEditor *editor = GIMP_EDITOR (data); - GimpContext *context; - GimpToolInfo *tool_info; - GtkWidget *qbox; - - context = gimp_get_user_context (editor->item_factory->gimp); - tool_info = gimp_context_get_tool (context); - - qbox = gimp_query_string_box (_("Save Tool Options"), - GTK_WIDGET (editor), - gimp_standard_help_func, - GIMP_HELP_TOOL_OPTIONS_DIALOG, - _("Enter a name for the saved options"), - _("Saved Options"), - NULL, NULL, - tool_options_save_callback, tool_info); - gtk_widget_show (qbox); -} - -void -tool_options_restore_from_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpToolOptions *options = GIMP_TOOL_OPTIONS (data); - - gimp_config_sync (GIMP_CONFIG (options), - GIMP_CONFIG (options->tool_info->tool_options), 0); -} - -void -tool_options_rename_saved_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpToolOptions *options = GIMP_TOOL_OPTIONS (data); - GtkWidget *qbox; - - qbox = gimp_query_string_box (_("Rename Saved Tool Options"), - widget, - gimp_standard_help_func, - GIMP_HELP_TOOL_OPTIONS_DIALOG, - _("Enter a new name for the saved options"), - GIMP_OBJECT (options)->name, - NULL, NULL, - tool_options_rename_callback, options); - gtk_widget_show (qbox); -} - -void -tool_options_delete_saved_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpToolOptions *options = GIMP_TOOL_OPTIONS (data); - - gimp_container_remove (options->tool_info->options_presets, - GIMP_OBJECT (options)); -} - -void -tool_options_reset_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpToolOptionsEditor *editor = GIMP_TOOL_OPTIONS_EDITOR (data); - - if (GTK_WIDGET_SENSITIVE (editor->reset_button)) - gtk_button_clicked (GTK_BUTTON (editor->reset_button)); -} - -void -tool_options_reset_all_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpToolOptionsEditor *editor = GIMP_TOOL_OPTIONS_EDITOR (data); - - if (GTK_WIDGET_SENSITIVE (editor->reset_button)) - gimp_button_extended_clicked (GIMP_BUTTON (editor->reset_button), - GDK_SHIFT_MASK); -} - - -/* private functions */ - -static void -tool_options_save_callback (GtkWidget *widget, - const gchar *name, - gpointer data) -{ - GimpToolInfo *tool_info = GIMP_TOOL_INFO (data); - GimpConfig *copy; - - if (! name || ! strlen (name)) - name = _("Saved Options"); - - copy = gimp_config_duplicate (GIMP_CONFIG (tool_info->tool_options)); - - gimp_object_set_name (GIMP_OBJECT (copy), name); - gimp_list_uniquefy_name (GIMP_LIST (tool_info->options_presets), - GIMP_OBJECT (copy), TRUE); - - gimp_container_insert (tool_info->options_presets, GIMP_OBJECT (copy), -1); - g_object_unref (copy); -} - -static void -tool_options_rename_callback (GtkWidget *widget, - const gchar *name, - gpointer data) -{ - GimpToolOptions *options = GIMP_TOOL_OPTIONS (data); - - if (! name || ! strlen (name)) - name = _("Saved Options"); - - gimp_object_set_name (GIMP_OBJECT (options), name); - gimp_list_uniquefy_name (GIMP_LIST (options->tool_info->options_presets), - GIMP_OBJECT (options), TRUE); -} diff --git a/app/gui/tool-options-commands.h b/app/gui/tool-options-commands.h deleted file mode 100644 index ee6a150b4b..0000000000 --- a/app/gui/tool-options-commands.h +++ /dev/null @@ -1,39 +0,0 @@ -/* 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_COMMANDS_H__ -#define __TOOL_OPTIONS_COMMANDS_H__ - - -void tool_options_save_to_cmd_callback (GtkWidget *widget, - gpointer data); -void tool_options_save_new_cmd_callback (GtkWidget *widget, - gpointer data); -void tool_options_restore_from_cmd_callback (GtkWidget *widget, - gpointer data); -void tool_options_rename_saved_cmd_callback (GtkWidget *widget, - gpointer data); -void tool_options_delete_saved_cmd_callback (GtkWidget *widget, - gpointer data); -void tool_options_reset_cmd_callback (GtkWidget *widget, - gpointer data); -void tool_options_reset_all_cmd_callback (GtkWidget *widget, - gpointer data); - - -#endif /* __TOOL_OPTIONS_COMMANDS_H__ */ diff --git a/app/gui/tool-options-menu.c b/app/gui/tool-options-menu.c index 7cbf81e7a9..8cd2a7c837 100644 --- a/app/gui/tool-options-menu.c +++ b/app/gui/tool-options-menu.c @@ -32,8 +32,9 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" +#include "actions/tool-options-commands.h" + #include "menus.h" -#include "tool-options-commands.h" #include "tool-options-menu.h" #include "gimp-intl.h" diff --git a/app/gui/toolbox-menu.c b/app/gui/toolbox-menu.c index cd1195e105..305266395e 100644 --- a/app/gui/toolbox-menu.c +++ b/app/gui/toolbox-menu.c @@ -31,10 +31,11 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" -#include "debug-commands.h" -#include "dialogs-commands.h" -#include "file-commands.h" -#include "help-commands.h" +#include "actions/debug-commands.h" +#include "actions/dialogs-commands.h" +#include "actions/file-commands.h" +#include "actions/help-commands.h" + #include "menus.h" #include "plug-in-menus.h" #include "toolbox-menu.h" diff --git a/app/gui/tools-commands.c b/app/gui/tools-commands.c deleted file mode 100644 index 692c196791..0000000000 --- a/app/gui/tools-commands.c +++ /dev/null @@ -1,108 +0,0 @@ -/* 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 "gui-types.h" - -#include "core/gimp.h" -#include "core/gimpcontainer.h" -#include "core/gimpcontext.h" -#include "core/gimpimage.h" -#include "core/gimptoolinfo.h" - -#include "widgets/gimpdock.h" - -#include "display/gimpdisplay.h" - -#include "tools/gimptool.h" -#include "tools/tool_manager.h" - - -#define return_if_no_gimp(gimp,data) \ - if (GIMP_IS_DISPLAY (data)) \ - gimp = ((GimpDisplay *) data)->gimage->gimp; \ - else if (GIMP_IS_GIMP (data)) \ - gimp = data; \ - else if (GIMP_IS_DOCK (data)) \ - gimp = ((GimpDock *) data)->context->gimp; \ - else \ - gimp = NULL; \ - if (! gimp) \ - return - - -void -tools_default_colors_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - Gimp *gimp; - return_if_no_gimp (gimp, data); - - gimp_context_set_default_colors (gimp_get_user_context (gimp)); -} - -void -tools_swap_colors_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - Gimp *gimp; - return_if_no_gimp (gimp, data); - - gimp_context_swap_colors (gimp_get_user_context (gimp)); -} - -void -tools_select_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - Gimp *gimp; - GimpToolInfo *tool_info; - GimpContext *context; - GimpDisplay *gdisp; - const gchar *identifier; - return_if_no_gimp (gimp, data); - - identifier = g_quark_to_string ((GQuark) action); - - tool_info = (GimpToolInfo *) - gimp_container_get_child_by_name (gimp->tool_info_list, identifier); - - context = gimp_get_user_context (gimp); - - /* always allocate a new tool when selected from the image menu - */ - if (gimp_context_get_tool (context) != tool_info) - { - gimp_context_set_tool (context, tool_info); - } - else - { - gimp_context_tool_changed (context); - } - - gdisp = gimp_context_get_display (context); - - if (gdisp) - tool_manager_initialize_active (gimp, gdisp); -} diff --git a/app/gui/tools-commands.h b/app/gui/tools-commands.h deleted file mode 100644 index e54a835232..0000000000 --- a/app/gui/tools-commands.h +++ /dev/null @@ -1,34 +0,0 @@ -/* 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 __TOOLS_COMMANDS_H__ -#define __TOOLS_COMMANDS_H__ - - -void tools_default_colors_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void tools_swap_colors_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void tools_select_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); - - -#endif /* __TOOLS_COMMANDS_H__ */ diff --git a/app/gui/vectors-commands.c b/app/gui/vectors-commands.c deleted file mode 100644 index 663b183c43..0000000000 --- a/app/gui/vectors-commands.c +++ /dev/null @@ -1,789 +0,0 @@ -/* 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 "core/gimp.h" -#include "core/gimpchannel.h" -#include "core/gimpchannel-select.h" -#include "core/gimpcontainer.h" -#include "core/gimpcontext.h" -#include "core/gimpimage.h" -#include "core/gimpimage-merge.h" -#include "core/gimptoolinfo.h" - -#include "pdb/procedural_db.h" - -#include "plug-in/plug-in-run.h" - -#include "vectors/gimpvectors.h" -#include "vectors/gimpvectors-export.h" -#include "vectors/gimpvectors-import.h" - -#include "widgets/gimpdock.h" -#include "widgets/gimphelp-ids.h" -#include "widgets/gimpitemtreeview.h" -#include "widgets/gimpviewabledialog.h" - -#include "display/gimpdisplay.h" - -#include "tools/gimppainttool.h" -#include "tools/gimpvectortool.h" -#include "tools/tool_manager.h" - -#include "stroke-dialog.h" -#include "vectors-commands.h" - -#include "gimp-intl.h" - - -#define return_if_no_image(gimage,data) \ - if (GIMP_IS_DISPLAY (data)) \ - gimage = ((GimpDisplay *) data)->gimage; \ - else if (GIMP_IS_GIMP (data)) \ - gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \ - else if (GIMP_IS_DOCK (data)) \ - gimage = gimp_context_get_image (((GimpDock *) data)->context); \ - else if (GIMP_IS_ITEM_TREE_VIEW (data)) \ - gimage = ((GimpItemTreeView *) data)->gimage; \ - else \ - gimage = NULL; \ - \ - if (! gimage) \ - return - -#define return_if_no_vectors(gimage,vectors,data) \ - return_if_no_image (gimage,data); \ - vectors = gimp_image_get_active_vectors (gimage); \ - if (! vectors) \ - return - - -static void vectors_import_query (GimpImage *gimage, - GtkWidget *parent); -static void vectors_export_query (GimpImage *gimage, - GimpVectors *vectors, - GtkWidget *parent); - - -/* public functions */ - -void -vectors_new_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - 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) -{ - GimpImage *gimage; - GimpVectors *active_vectors; - return_if_no_vectors (gimage, active_vectors, data); - - gimp_image_raise_vectors (gimage, active_vectors); - gimp_image_flush (gimage); -} - -void -vectors_lower_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpVectors *active_vectors; - return_if_no_vectors (gimage, active_vectors, data); - - gimp_image_lower_vectors (gimage, active_vectors); - 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) -{ - GimpImage *gimage; - GimpVectors *active_vectors; - GimpVectors *new_vectors; - return_if_no_vectors (gimage, active_vectors, data); - - new_vectors = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (active_vectors), - G_TYPE_FROM_INSTANCE (active_vectors), - TRUE)); - gimp_image_add_vectors (gimage, new_vectors, -1); - gimp_image_flush (gimage); -} - -void -vectors_delete_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpVectors *active_vectors; - return_if_no_vectors (gimage, active_vectors, data); - - gimp_image_remove_vectors (gimage, active_vectors); - gimp_image_flush (gimage); -} - -void -vectors_merge_visible_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpVectors *active_vectors; - return_if_no_vectors (gimage, active_vectors, data); - - gimp_image_merge_visible_vectors (gimage); - gimp_image_flush (gimage); -} - -void -vectors_to_selection_cmd_callback (GtkWidget *widget, - gpointer data, - guint action) -{ - GimpChannelOps op; - GimpImage *gimage; - GimpVectors *active_vectors; - return_if_no_vectors (gimage, active_vectors, data); - - op = (GimpChannelOps) action; - - gimp_channel_select_vectors (gimp_image_get_mask (gimage), - _("Path to Selection"), - active_vectors, - op, TRUE, FALSE, 0, 0); - gimp_image_flush (gimage); -} - -void -vectors_selection_to_vectors_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - vectors_selection_to_vectors (gimage, FALSE); -} - -void -vectors_stroke_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpVectors *active_vectors; - return_if_no_vectors (gimage, active_vectors, data); - - vectors_stroke_vectors (GIMP_ITEM (active_vectors), widget); -} - -void -vectors_copy_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpVectors *active_vectors; - return_if_no_vectors (gimage, active_vectors, data); - -#ifdef __GNUC__ -#warning FIXME: need vectors clipboard -#endif -} - -void -vectors_paste_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - -#ifdef __GNUC__ -#warning FIXME: need vectors clipboard -#endif -} - -void -vectors_import_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - return_if_no_image (gimage, data); - - vectors_import_query (gimage, widget); -} - -void -vectors_export_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpVectors *active_vectors; - return_if_no_vectors (gimage, active_vectors, data); - - vectors_export_query (gimage, active_vectors, widget); -} - -void -vectors_vectors_tool_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpVectors *active_vectors; - return_if_no_vectors (gimage, active_vectors, data); - - vectors_vectors_tool (active_vectors); -} - -void -vectors_edit_attributes_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpImage *gimage; - GimpVectors *active_vectors; - return_if_no_vectors (gimage, active_vectors, data); - - vectors_edit_vectors_query (active_vectors, widget); -} - -void -vectors_stroke_vectors (GimpItem *item, - GtkWidget *parent) -{ - GimpImage *gimage; - GimpDrawable *active_drawable; - GtkWidget *dialog; - - g_return_if_fail (GIMP_IS_ITEM (item)); - - gimage = gimp_item_get_image (item); - - active_drawable = gimp_image_active_drawable (gimage); - - if (! active_drawable) - { - g_message (_("There is no active layer or channel to stroke to.")); - return; - } - - dialog = stroke_dialog_new (item, GIMP_STOCK_PATH_STROKE, - GIMP_HELP_PATH_STROKE, - parent); - gtk_widget_show (dialog); -} - -void -vectors_selection_to_vectors (GimpImage *gimage, - gboolean advanced) -{ - ProcRecord *proc_rec; - Argument *args; - GimpDisplay *gdisp; - - g_return_if_fail (GIMP_IS_IMAGE (gimage)); - - if (advanced) - proc_rec = procedural_db_lookup (gimage->gimp, - "plug_in_sel2path_advanced"); - else - proc_rec = procedural_db_lookup (gimage->gimp, - "plug_in_sel2path"); - - if (! proc_rec) - { - g_message ("Selection to path procedure lookup failed."); - return; - } - - gdisp = gimp_context_get_display (gimp_get_user_context (gimage->gimp)); - - /* plug-in arguments as if called by /Filters/... */ - args = g_new (Argument, 3); - - args[0].arg_type = GIMP_PDB_INT32; - args[0].value.pdb_int = GIMP_RUN_INTERACTIVE; - args[1].arg_type = GIMP_PDB_IMAGE; - args[1].value.pdb_int = (gint32) gimp_image_get_ID (gimage); - args[2].arg_type = GIMP_PDB_DRAWABLE; - args[2].value.pdb_int = -1; /* unused */ - - plug_in_run (gimage->gimp, gimp_get_user_context (gimage->gimp), - proc_rec, args, 3, FALSE, TRUE, - gdisp ? gdisp->ID : 0); - - g_free (args); -} - -void -vectors_vectors_tool (GimpVectors *vectors) -{ - GimpImage *gimage; - GimpTool *active_tool; - - g_return_if_fail (GIMP_IS_VECTORS (vectors)); - - gimage = gimp_item_get_image (GIMP_ITEM (vectors)); - - active_tool = tool_manager_get_active (gimage->gimp); - - if (! GIMP_IS_VECTOR_TOOL (active_tool)) - { - GimpContainer *tool_info_list; - GimpToolInfo *tool_info; - - tool_info_list = gimage->gimp->tool_info_list; - - tool_info = (GimpToolInfo *) - gimp_container_get_child_by_name (tool_info_list, - "gimp-vector-tool"); - - if (GIMP_IS_TOOL_INFO (tool_info)) - { - gimp_context_set_tool (gimp_get_user_context (gimage->gimp), - tool_info); - - active_tool = tool_manager_get_active (gimage->gimp); - } - } - - if (GIMP_IS_VECTOR_TOOL (active_tool)) - gimp_vector_tool_set_vectors (GIMP_VECTOR_TOOL (active_tool), vectors); -} - -/**********************************/ -/* The new vectors query dialog */ -/**********************************/ - -typedef struct _NewVectorsOptions NewVectorsOptions; - -struct _NewVectorsOptions -{ - GtkWidget *query_box; - GtkWidget *name_entry; - - GimpImage *gimage; -}; - -static gchar *vectors_name = NULL; - - -static void -new_vectors_query_response (GtkWidget *widget, - gint response_id, - NewVectorsOptions *options) -{ - if (response_id == GTK_RESPONSE_OK) - { - GimpVectors *new_vectors; - GimpImage *gimage; - - if (vectors_name) - g_free (vectors_name); - vectors_name = - g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry))); - - if ((gimage = options->gimage)) - { - new_vectors = gimp_vectors_new (gimage, vectors_name); - - gimp_image_add_vectors (gimage, new_vectors, -1); - - gimp_image_flush (gimage); - } - } - - gtk_widget_destroy (options->query_box); -} - -void -vectors_new_vectors_query (GimpImage *gimage, - GimpVectors *template, - gboolean interactive, - GtkWidget *parent) -{ - NewVectorsOptions *options; - GtkWidget *hbox; - GtkWidget *vbox; - GtkWidget *table; - GtkWidget *label; - - g_return_if_fail (GIMP_IS_IMAGE (gimage)); - g_return_if_fail (! template || GIMP_IS_VECTORS (template)); - - if (template || ! interactive) - { - GimpVectors *new_vectors; - - new_vectors = gimp_vectors_new (gimage, _("Empty Path")); - - gimp_image_add_vectors (gimage, new_vectors, -1); - - return; - } - - /* the new options structure */ - options = g_new (NewVectorsOptions, 1); - options->gimage = gimage; - - /* The dialog */ - options->query_box = - gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage), - _("New Path"), "gimp-vectors-new", - GIMP_STOCK_TOOL_PATH, - _("New Path Options"), - parent, - gimp_standard_help_func, - GIMP_HELP_PATH_NEW, - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - - NULL); - - g_signal_connect (options->query_box, "response", - G_CALLBACK (new_vectors_query_response), - options); - - g_object_weak_ref (G_OBJECT (options->query_box), - (GWeakNotify) g_free, - options); - - /* The main hbox */ - hbox = gtk_hbox_new (FALSE, 4); - gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox), - hbox); - - /* The vbox */ - vbox = gtk_vbox_new (FALSE, 2); - gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); - - /* The table */ - table = gtk_table_new (2, 3, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (table), 4); - gtk_table_set_row_spacings (GTK_TABLE (table), 2); - gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); - - /* The name entry hbox, label and entry */ - label = gtk_label_new (_("Path name:")); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, - GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); - gtk_widget_show (label); - - options->name_entry = gtk_entry_new (); - gtk_widget_set_size_request (options->name_entry, 150, -1); - gtk_table_attach_defaults (GTK_TABLE (table), options->name_entry, - 1, 2, 0, 1); - gtk_entry_set_text (GTK_ENTRY (options->name_entry), - (vectors_name ? vectors_name : _("New Path"))); - gtk_widget_show (options->name_entry); - - gtk_widget_show (table); - gtk_widget_show (vbox); - gtk_widget_show (hbox); - gtk_widget_show (options->query_box); -} - -/****************************************/ -/* The edit vectors attributes dialog */ -/****************************************/ - -typedef struct _EditVectorsOptions EditVectorsOptions; - -struct _EditVectorsOptions -{ - GtkWidget *query_box; - GtkWidget *name_entry; - - GimpVectors *vectors; - GimpImage *gimage; -}; - -static void -edit_vectors_query_response (GtkWidget *widget, - gint response_id, - EditVectorsOptions *options) -{ - if (response_id == GTK_RESPONSE_OK) - { - GimpVectors *vectors = options->vectors; - - if (options->gimage) - { - const gchar *new_name; - - new_name = gtk_entry_get_text (GTK_ENTRY (options->name_entry)); - - if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (vectors)))) - { - gimp_item_rename (GIMP_ITEM (vectors), new_name); - gimp_image_flush (options->gimage); - } - } - } - - gtk_widget_destroy (options->query_box); -} - -void -vectors_edit_vectors_query (GimpVectors *vectors, - GtkWidget *parent) -{ - EditVectorsOptions *options; - GtkWidget *hbox; - GtkWidget *vbox; - GtkWidget *table; - GtkWidget *label; - - g_return_if_fail (GIMP_IS_VECTORS (vectors)); - - options = g_new0 (EditVectorsOptions, 1); - - options->vectors = vectors; - options->gimage = gimp_item_get_image (GIMP_ITEM (vectors)); - - /* The dialog */ - options->query_box = - gimp_viewable_dialog_new (GIMP_VIEWABLE (vectors), - _("Path Attributes"), "gimp-vectors-edit", - GIMP_STOCK_EDIT, - _("Edit Path Attributes"), - parent, - gimp_standard_help_func, - GIMP_HELP_PATH_EDIT, - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - - NULL); - - g_signal_connect (options->query_box, "response", - G_CALLBACK (edit_vectors_query_response), - options); - - g_object_weak_ref (G_OBJECT (options->query_box), - (GWeakNotify) g_free, - options); - - /* The main hbox */ - hbox = gtk_hbox_new (FALSE, 4); - gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox), - hbox); - - /* The vbox */ - vbox = gtk_vbox_new (FALSE, 2); - gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); - - /* The table */ - table = gtk_table_new (2, 3, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (table), 4); - gtk_table_set_row_spacings (GTK_TABLE (table), 2); - gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); - - /* The name entry */ - label = gtk_label_new (_("Path name:")); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_widget_show (label); - - options->name_entry = gtk_entry_new (); - gtk_widget_set_size_request (options->name_entry, 150, -1); - gtk_table_attach_defaults (GTK_TABLE (table), options->name_entry, - 1, 2, 0, 1); - gtk_entry_set_text (GTK_ENTRY (options->name_entry), - gimp_object_get_name (GIMP_OBJECT (vectors))); - gtk_widget_show (options->name_entry); - - gtk_widget_show (table); - gtk_widget_show (vbox); - gtk_widget_show (hbox); - gtk_widget_show (options->query_box); -} - - -/*******************************/ -/* The vectors import dialog */ -/*******************************/ - -static void -vectors_import_response (GtkWidget *dialog, - gint response_id, - GimpImage *gimage) -{ - if (response_id == GTK_RESPONSE_OK) - { - const gchar *filename; - GError *error = NULL; - - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); - - if (gimp_vectors_import_file (gimage, filename, FALSE, FALSE, &error)) - { - gimp_image_flush (gimage); - } - else - { - g_message (error->message); - g_error_free (error); - } - } - - g_object_weak_unref (G_OBJECT (gimage), - (GWeakNotify) gtk_widget_destroy, dialog); - gtk_widget_destroy (dialog); -} - -static void -vectors_import_query (GimpImage *gimage, - GtkWidget *parent) -{ - GtkFileChooser *chooser; - - chooser = GTK_FILE_CHOOSER - (gtk_file_chooser_dialog_new (_("Import Paths from SVG"), NULL, - GTK_FILE_CHOOSER_ACTION_OPEN, - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_OK, - - NULL)); - - g_object_weak_ref (G_OBJECT (gimage), (GWeakNotify) gtk_widget_destroy, - chooser); - - gtk_window_set_screen (GTK_WINDOW (chooser), - gtk_widget_get_screen (parent)); - - gtk_window_set_role (GTK_WINDOW (chooser), "gimp-vectors-import"); - gtk_window_set_position (GTK_WINDOW (chooser), GTK_WIN_POS_MOUSE); - - g_signal_connect (chooser, "response", - G_CALLBACK (vectors_import_response), - gimage); - g_signal_connect (chooser, "delete_event", - G_CALLBACK (gtk_true), - NULL); - - /* FIXME: add a proper file selector - and controls for merge and scale options */ - - gtk_widget_show (GTK_WIDGET (chooser)); -} - - -/*******************************/ -/* The vectors export dialog */ -/*******************************/ - -static void -vectors_export_response (GtkWidget *dialog, - gint response_id, - GimpImage *gimage) -{ - if (response_id == GTK_RESPONSE_OK) - { - const gchar *filename; - GError *error = NULL; - - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); - - if (! gimp_vectors_export_file (gimage, NULL, filename, &error)) - { - g_message (error->message); - g_error_free (error); - } - } - - g_object_weak_unref (G_OBJECT (gimage), - (GWeakNotify) gtk_widget_destroy, dialog); - gtk_widget_destroy (dialog); -} - -static void -vectors_export_query (GimpImage *gimage, - GimpVectors *vectors, - GtkWidget *parent) -{ - GtkFileChooser *chooser; - - chooser = GTK_FILE_CHOOSER - (gtk_file_chooser_dialog_new (_("Export Path to SVG"), NULL, - GTK_FILE_CHOOSER_ACTION_SAVE, - - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_SAVE, GTK_RESPONSE_OK, - - NULL)); - - g_object_weak_ref (G_OBJECT (gimage), (GWeakNotify) gtk_widget_destroy, - chooser); - - gtk_window_set_screen (GTK_WINDOW (chooser), - gtk_widget_get_screen (parent)); - - gtk_window_set_role (GTK_WINDOW (chooser), "gimp-vectors-export"); - gtk_window_set_position (GTK_WINDOW (chooser), GTK_WIN_POS_MOUSE); - - g_signal_connect (chooser, "response", - G_CALLBACK (vectors_export_response), - gimage); - g_signal_connect (chooser, "delete_event", - G_CALLBACK (gtk_true), - NULL); - - gtk_widget_show (GTK_WIDGET (chooser)); -} diff --git a/app/gui/vectors-commands.h b/app/gui/vectors-commands.h deleted file mode 100644 index b31b04f502..0000000000 --- a/app/gui/vectors-commands.h +++ /dev/null @@ -1,72 +0,0 @@ -/* 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_COMMANDS_H__ -#define __VECTORS_COMMANDS_H__ - - -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, - gpointer data); -void vectors_merge_visible_cmd_callback (GtkWidget *widget, - gpointer data); -void vectors_to_selection_cmd_callback (GtkWidget *widget, - gpointer data, - guint action); -void vectors_selection_to_vectors_cmd_callback (GtkWidget *widget, - gpointer data); -void vectors_stroke_cmd_callback (GtkWidget *widget, - gpointer data); -void vectors_copy_cmd_callback (GtkWidget *widget, - gpointer data); -void vectors_paste_cmd_callback (GtkWidget *widget, - gpointer data); -void vectors_import_cmd_callback (GtkWidget *widget, - gpointer data); -void vectors_export_cmd_callback (GtkWidget *widget, - gpointer data); -void vectors_vectors_tool_cmd_callback (GtkWidget *widget, - gpointer data); -void vectors_edit_attributes_cmd_callback (GtkWidget *widget, - gpointer data); - -void vectors_stroke_vectors (GimpItem *item, - GtkWidget *parent); -void vectors_selection_to_vectors (GimpImage *gimage, - gboolean advanced); -void vectors_vectors_tool (GimpVectors *vectors); -void vectors_new_vectors_query (GimpImage *gimage, - GimpVectors *template, - gboolean interactive, - GtkWidget *parent); -void vectors_edit_vectors_query (GimpVectors *vectors, - GtkWidget *parent); - - -#endif /* __VECTORS_COMMANDS_H__ */ diff --git a/app/gui/vectors-menu.c b/app/gui/vectors-menu.c index 91b27a75fb..3ac34eb05a 100644 --- a/app/gui/vectors-menu.c +++ b/app/gui/vectors-menu.c @@ -32,7 +32,8 @@ #include "widgets/gimpitemfactory.h" #include "widgets/gimpitemtreeview.h" -#include "vectors-commands.h" +#include "actions/vectors-commands.h" + #include "vectors-menu.h" #include "menus.h" diff --git a/app/gui/view-commands.c b/app/gui/view-commands.c deleted file mode 100644 index 6071126267..0000000000 --- a/app/gui/view-commands.c +++ /dev/null @@ -1,504 +0,0 @@ -/* 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 "gui-types.h" - -#include "config/gimpguiconfig.h" - -#include "core/gimp.h" -#include "core/gimpcontext.h" -#include "core/gimpimage.h" - -#include "display/gimpdisplay.h" -#include "display/gimpdisplay-foreach.h" -#include "display/gimpdisplayshell.h" -#include "display/gimpdisplayshell-appearance.h" -#include "display/gimpdisplayshell-filter-dialog.h" -#include "display/gimpdisplayshell-scale.h" - -#include "widgets/gimpdock.h" -#include "widgets/gimpdialogfactory.h" -#include "widgets/gimpitemfactory.h" - -#include "dialogs.h" -#include "info-dialog.h" -#include "info-window.h" -#include "view-commands.h" - - -#define return_if_no_display(gdisp, data) \ - if (GIMP_IS_DISPLAY (data)) \ - gdisp = data; \ - else if (GIMP_IS_GIMP (data)) \ - gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \ - else if (GIMP_IS_DOCK (data)) \ - gdisp = gimp_context_get_display (((GimpDock *) data)->context); \ - else \ - gdisp = NULL; \ - if (! gdisp) \ - return - -#define IS_ACTIVE_DISPLAY(gdisp) \ - ((gdisp) == \ - gimp_context_get_display (gimp_get_user_context ((gdisp)->gimage->gimp))) - - -void -view_zoom_out_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - return_if_no_display (gdisp, data); - - gimp_display_shell_scale (GIMP_DISPLAY_SHELL (gdisp->shell), - GIMP_ZOOM_OUT, 0.0); -} - -void -view_zoom_in_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - return_if_no_display (gdisp, data); - - gimp_display_shell_scale (GIMP_DISPLAY_SHELL (gdisp->shell), - GIMP_ZOOM_IN, 0.0); -} - -void -view_zoom_fit_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - return_if_no_display (gdisp, data); - - gimp_display_shell_scale_fit (GIMP_DISPLAY_SHELL (gdisp->shell)); -} - -void -view_zoom_cmd_callback (GtkWidget *widget, - gpointer data, - guint scale) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - if (fabs (scale - shell->scale) > 0.0001) - gimp_display_shell_scale (shell, GIMP_ZOOM_TO, (gdouble) scale / 10000); -} - -void -view_zoom_other_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - if (! GTK_CHECK_MENU_ITEM (widget)->active) - return; - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - /* check if we are activated by the user or from image_menu_set_zoom() */ - if (shell->scale != shell->other_scale) - gimp_display_shell_scale_dialog (shell); -} - -void -view_dot_for_dot_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - if (shell->dot_for_dot != GTK_CHECK_MENU_ITEM (widget)->active) - { - gimp_display_shell_scale_set_dot_for_dot (shell, - GTK_CHECK_MENU_ITEM (widget)->active); - - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Dot for Dot", - shell->dot_for_dot); - - if (IS_ACTIVE_DISPLAY (gdisp)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Dot for Dot", - shell->dot_for_dot); - } -} - -void -view_info_window_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - if (GIMP_GUI_CONFIG (gdisp->gimage->gimp->config)->info_window_per_display) - { - if (! shell->info_dialog) - shell->info_dialog = info_window_create (gdisp); - - /* To update the fields of the info window for the first time. * - * It's no use updating it in info_window_create() because the * - * pointer of the info window is not present in the shell yet. */ - info_window_update (gdisp); - - info_dialog_present (shell->info_dialog); - } - else - { - info_window_follow_auto (gdisp->gimage->gimp); - } -} - -void -view_navigation_window_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - gimp_dialog_factory_dialog_raise (global_dock_factory, - gtk_widget_get_screen (widget), - "gimp-navigation-view", -1); -} - -void -view_display_filters_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - if (! shell->filters_dialog) - { - shell->filters_dialog = gimp_display_shell_filter_dialog_new (shell); - - g_signal_connect (shell->filters_dialog, "destroy", - G_CALLBACK (gtk_widget_destroyed), - &shell->filters_dialog); - } - - gtk_window_present (GTK_WINDOW (shell->filters_dialog)); -} - -void -view_toggle_selection_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - gimp_display_shell_set_show_selection (shell, - GTK_CHECK_MENU_ITEM (widget)->active); -} - -void -view_toggle_layer_boundary_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - gimp_display_shell_set_show_layer (shell, - GTK_CHECK_MENU_ITEM (widget)->active); -} - -void -view_toggle_menubar_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - gimp_display_shell_set_show_menubar (shell, - GTK_CHECK_MENU_ITEM (widget)->active); -} - -void -view_toggle_rulers_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - gimp_display_shell_set_show_rulers (shell, - GTK_CHECK_MENU_ITEM (widget)->active); -} - -void -view_toggle_scrollbars_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - gimp_display_shell_set_show_scrollbars (shell, - GTK_CHECK_MENU_ITEM (widget)->active); -} - -void -view_toggle_statusbar_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - gimp_display_shell_set_show_statusbar (shell, - GTK_CHECK_MENU_ITEM (widget)->active); -} - -void -view_toggle_guides_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - gimp_display_shell_set_show_guides (shell, - GTK_CHECK_MENU_ITEM (widget)->active); -} - -void -view_snap_to_guides_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - if (shell->snap_to_guides != GTK_CHECK_MENU_ITEM (widget)->active) - { - shell->snap_to_guides = GTK_CHECK_MENU_ITEM (widget)->active; - - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Snap to Guides", - shell->snap_to_guides); - - if (IS_ACTIVE_DISPLAY (gdisp)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Snap to Guides", - shell->snap_to_guides); - } -} - - -void -view_toggle_grid_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - gimp_display_shell_set_show_grid (shell, - GTK_CHECK_MENU_ITEM (widget)->active); - -} - -void -view_snap_to_grid_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - return_if_no_display (gdisp, data); - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - if (shell->snap_to_grid != GTK_CHECK_MENU_ITEM (widget)->active) - { - shell->snap_to_grid = GTK_CHECK_MENU_ITEM (widget)->active; - - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Snap to Grid", - shell->snap_to_grid); - - if (IS_ACTIVE_DISPLAY (gdisp)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Snap to Grid", - shell->snap_to_grid); - } -} - -void -view_new_view_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - return_if_no_display (gdisp, data); - - gimp_create_display (gdisp->gimage->gimp, gdisp->gimage, - GIMP_DISPLAY_SHELL (gdisp->shell)->scale); -} - -void -view_shrink_wrap_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - return_if_no_display (gdisp, data); - - gimp_display_shell_scale_shrink_wrap (GIMP_DISPLAY_SHELL (gdisp->shell)); -} - -void -view_fullscreen_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GimpDisplayShell *shell; - gboolean fullscreen; - return_if_no_display (gdisp, data); - - shell = GIMP_DISPLAY_SHELL (gdisp->shell); - - gimp_display_shell_set_fullscreen (shell, - GTK_CHECK_MENU_ITEM (widget)->active); - - fullscreen = (shell->window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0; - - if (fullscreen != GTK_CHECK_MENU_ITEM (widget)->active) - { - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Fullscreen", - fullscreen); - - if (IS_ACTIVE_DISPLAY (gdisp)) - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Fullscreen", - fullscreen); - } -} - -static void -view_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 -view_change_screen_destroy_callback (GtkWidget *query_box, - GtkWidget *shell) -{ - g_object_set_data (G_OBJECT (shell), "gimp-change-screen-dialog", NULL); -} - -void -view_change_screen_cmd_callback (GtkWidget *widget, - gpointer data) -{ - GimpDisplay *gdisp; - GdkScreen *screen; - GdkDisplay *display; - gint cur_screen; - gint num_screens; - GtkWidget *qbox; - return_if_no_display (gdisp, data); - - qbox = g_object_get_data (G_OBJECT (gdisp->shell), - "gimp-change-screen-dialog"); - - if (qbox) - { - gtk_window_present (GTK_WINDOW (qbox)); - return; - } - - screen = gtk_widget_get_screen (gdisp->shell); - display = gtk_widget_get_display (gdisp->shell); - - cur_screen = gdk_screen_get_number (screen); - num_screens = gdk_display_get_n_screens (display); - - qbox = gimp_query_int_box ("Move Display to Screen", - gdisp->shell, - NULL, 0, - "Enter destination screen", - cur_screen, 0, num_screens - 1, - G_OBJECT (gdisp->shell), "destroy", - view_change_screen_confirm_callback, - gdisp->shell); - - g_object_set_data (G_OBJECT (gdisp->shell), "gimp-change-screen-dialog", qbox); - - g_signal_connect (qbox, "destroy", - G_CALLBACK (view_change_screen_destroy_callback), - gdisp->shell); - - gtk_widget_show (qbox); -} diff --git a/app/gui/view-commands.h b/app/gui/view-commands.h deleted file mode 100644 index 5dc8a8ed8e..0000000000 --- a/app/gui/view-commands.h +++ /dev/null @@ -1,73 +0,0 @@ -/* 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_COMMANDS_H__ -#define __VIEW_COMMANDS_H__ - - -void view_zoom_out_cmd_callback (GtkWidget *widget, - gpointer data); -void view_zoom_in_cmd_callback (GtkWidget *widget, - gpointer data); -void view_zoom_fit_cmd_callback (GtkWidget *widget, - gpointer data); -void view_zoom_cmd_callback (GtkWidget *widget, - gpointer data, - guint scale); -void view_zoom_other_cmd_callback (GtkWidget *widget, - gpointer data); -void view_dot_for_dot_cmd_callback (GtkWidget *widget, - gpointer data); -void view_info_window_cmd_callback (GtkWidget *widget, - gpointer data); -void view_navigation_window_cmd_callback (GtkWidget *widget, - gpointer data); -void view_display_filters_cmd_callback (GtkWidget *widget, - gpointer data); -void view_toggle_selection_cmd_callback (GtkWidget *widget, - gpointer data); -void view_toggle_layer_boundary_cmd_callback (GtkWidget *widget, - gpointer data); -void view_toggle_menubar_cmd_callback (GtkWidget *widget, - gpointer data); -void view_toggle_rulers_cmd_callback (GtkWidget *widget, - gpointer data); -void view_toggle_scrollbars_cmd_callback (GtkWidget *widget, - gpointer data); -void view_toggle_statusbar_cmd_callback (GtkWidget *widget, - gpointer data); -void view_toggle_guides_cmd_callback (GtkWidget *widget, - gpointer data); -void view_snap_to_guides_cmd_callback (GtkWidget *widget, - gpointer data); -void view_toggle_grid_cmd_callback (GtkWidget *widget, - gpointer data); -void view_snap_to_grid_cmd_callback (GtkWidget *widget, - gpointer data); -void view_new_view_cmd_callback (GtkWidget *widget, - gpointer data); - -void view_shrink_wrap_cmd_callback (GtkWidget *widget, - gpointer data); -void view_fullscreen_cmd_callback (GtkWidget *widget, - gpointer data); -void view_change_screen_cmd_callback (GtkWidget *widget, - gpointer data); - - -#endif /* __VIEW_COMMANDS_H__ */ diff --git a/app/menus/file-open-menu.c b/app/menus/file-open-menu.c index a0da6a126d..3562261cdf 100644 --- a/app/menus/file-open-menu.c +++ b/app/menus/file-open-menu.c @@ -34,7 +34,8 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" -#include "file-commands.h" +#include "actions/file-commands.h" + #include "file-open-menu.h" #include "menus.h" diff --git a/app/menus/file-save-menu.c b/app/menus/file-save-menu.c index a53573190e..3a43d81b4e 100644 --- a/app/menus/file-save-menu.c +++ b/app/menus/file-save-menu.c @@ -35,7 +35,8 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" -#include "file-commands.h" +#include "actions/file-commands.h" + #include "file-save-menu.h" #include "menus.h" diff --git a/app/menus/image-menu.c b/app/menus/image-menu.c index 18c75ea744..0bd0fd5c75 100644 --- a/app/menus/image-menu.c +++ b/app/menus/image-menu.c @@ -48,20 +48,21 @@ #include "display/gimpdisplayshell-appearance.h" #include "display/gimpdisplayshell-selection.h" -#include "dialogs-commands.h" -#include "drawable-commands.h" -#include "edit-commands.h" -#include "file-commands.h" -#include "image-commands.h" +#include "actions/dialogs-commands.h" +#include "actions/drawable-commands.h" +#include "actions/edit-commands.h" +#include "actions/file-commands.h" +#include "actions/image-commands.h" +#include "actions/layers-commands.h" +#include "actions/plug-in-commands.h" +#include "actions/select-commands.h" +#include "actions/tools-commands.h" +#include "actions/vectors-commands.h" +#include "actions/view-commands.h" + #include "image-menu.h" -#include "layers-commands.h" #include "menus.h" -#include "plug-in-commands.h" #include "plug-in-menus.h" -#include "select-commands.h" -#include "tools-commands.h" -#include "vectors-commands.h" -#include "view-commands.h" #include "gimp-intl.h" diff --git a/app/menus/menus.c b/app/menus/menus.c index cf46963e7b..0d11cb582d 100644 --- a/app/menus/menus.c +++ b/app/menus/menus.c @@ -37,6 +37,8 @@ #include "widgets/gimpitemfactory.h" #include "widgets/gimpmenufactory.h" +#include "actions/file-commands.h" + #include "brushes-menu.h" #include "buffers-menu.h" #include "channels-menu.h" @@ -46,7 +48,6 @@ #include "error-console-menu.h" #include "file-open-menu.h" #include "file-save-menu.h" -#include "file-commands.h" #include "fonts-menu.h" #include "gradient-editor-menu.h" #include "gradients-menu.h" diff --git a/app/menus/plug-in-menus.c b/app/menus/plug-in-menus.c index 5d165514f0..ab221e553f 100644 --- a/app/menus/plug-in-menus.c +++ b/app/menus/plug-in-menus.c @@ -36,7 +36,8 @@ #include "widgets/gimpitemfactory.h" #include "widgets/gimpwidgets-utils.h" -#include "plug-in-commands.h" +#include "actions/plug-in-commands.h" + #include "plug-in-menus.h" #include "gimp-intl.h" diff --git a/app/menus/tool-options-menu.c b/app/menus/tool-options-menu.c index 7cbf81e7a9..8cd2a7c837 100644 --- a/app/menus/tool-options-menu.c +++ b/app/menus/tool-options-menu.c @@ -32,8 +32,9 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" +#include "actions/tool-options-commands.h" + #include "menus.h" -#include "tool-options-commands.h" #include "tool-options-menu.h" #include "gimp-intl.h" diff --git a/app/menus/toolbox-menu.c b/app/menus/toolbox-menu.c index cd1195e105..305266395e 100644 --- a/app/menus/toolbox-menu.c +++ b/app/menus/toolbox-menu.c @@ -31,10 +31,11 @@ #include "widgets/gimphelp-ids.h" #include "widgets/gimpitemfactory.h" -#include "debug-commands.h" -#include "dialogs-commands.h" -#include "file-commands.h" -#include "help-commands.h" +#include "actions/debug-commands.h" +#include "actions/dialogs-commands.h" +#include "actions/file-commands.h" +#include "actions/help-commands.h" + #include "menus.h" #include "plug-in-menus.h" #include "toolbox-menu.h" diff --git a/menus/image-menu.xml b/menus/image-menu.xml index eb8c4e6bdc..3ebe6ea044 100644 --- a/menus/image-menu.xml +++ b/menus/image-menu.xml @@ -212,9 +212,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +