Commit 8848558f authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

More GtkAction stuff (still unused):

2004-04-19  Michael Natterer  <mitch@gimp.org>

	More GtkAction stuff (still unused):

	* configure.in: added new directories menus/ and app/actions/

	* Makefile.am: build menus/

	* menus/.cvsignore
	* menus/Makefile.am
	* menus/*-menu.xml: new files: XML menu descriptions for each menu
	which is now defined in gui/*-menu.c.

	* app/widgets/widgets-types.h: some typedefs for GimpActionGroup.

	* app/widgets/gimpactiongroup.[ch]: added a "Gimp" construct-only
	property. Added APIs to set actions visible/sensitive/active
	and an unimplemented stub for setting the action's color.

	* app/Makefile.am: build actions/ and link libappactions.a

	* app/actions/.cvsignore
	* app/actions/Makefile.am
	* app/actions/*-actions.[ch]: new files: GtkActions for each
	*-commands.c file in gui/. Ported all "update" functions from the
	*-menu.c files.
	(everything completely unused, untested and partly #if 0'ed)

	* app/core/gimpimage.[ch]: for reasons of (action-) symmetry, added
	API to raise/lower channels/vectors to top/bottom.

	* app/gui/channels-commands.[ch]
	* app/gui/vectors-commands.[ch]: added callbacks for the new
	to top/bottom functions.

	* app/gui/Makefile.am
	* app/gui/dockable-commands.[ch]: new files split out of
	dialogs-commands.[ch].

	* app/gui/dialogs-commands.[ch]
	* app/gui/dialogs-menu.c: changed accordingly.

	* app/gui/edit-commands.[ch]: added edit_paste_into_cmd_callback()
	and remove usage of "guint action".

	* app/gui/image-menu.c: changed accordingly.

	* app/gui/palette-editor-commands.[ch]: split
	+palette_editor_new_color_cmd_callback() into separate callbacks
	for adding from FG and BG.

	* app/gui/palette-editor-menu.c: changed accordingly.
parent c02669ce
2004-04-19 Michael Natterer <mitch@gimp.org>
More GtkAction stuff (still unused):
* configure.in: added new directories menus/ and app/actions/
* Makefile.am: build menus/
* menus/.cvsignore
* menus/Makefile.am
* menus/*-menu.xml: new files: XML menu descriptions for each menu
which is now defined in gui/*-menu.c.
* app/widgets/widgets-types.h: some typedefs for GimpActionGroup.
* app/widgets/gimpactiongroup.[ch]: added a "Gimp" construct-only
property. Added APIs to set actions visible/sensitive/active
and an unimplemented stub for setting the action's color.
* app/Makefile.am: build actions/ and link libappactions.a
* app/actions/.cvsignore
* app/actions/Makefile.am
* app/actions/*-actions.[ch]: new files: GtkActions for each
*-commands.c file in gui/. Ported all "update" functions from the
*-menu.c files.
(everything completely unused, untested and partly #if 0'ed)
* app/core/gimpimage.[ch]: for reasons of (action-) symmetry, added
API to raise/lower channels/vectors to top/bottom.
* app/gui/channels-commands.[ch]
* app/gui/vectors-commands.[ch]: added callbacks for the new
to top/bottom functions.
* app/gui/Makefile.am
* app/gui/dockable-commands.[ch]: new files split out of
dialogs-commands.[ch].
* app/gui/dialogs-commands.[ch]
* app/gui/dialogs-menu.c: changed accordingly.
* app/gui/edit-commands.[ch]: added edit_paste_into_cmd_callback()
and remove usage of "guint action".
* app/gui/image-menu.c: changed accordingly.
* app/gui/palette-editor-commands.[ch]: split
+palette_editor_new_color_cmd_callback() into separate callbacks
for adding from FG and BG.
* app/gui/palette-editor-menu.c: changed accordingly.
2004-04-19 Henrik Brix Andersen <brix@gimp.org>
* plug-ins/script-fu/scripts/gimp-headers.scm
......
......@@ -11,6 +11,7 @@ SUBDIRS = \
po-plug-ins \
po-script-fu \
data \
menus \
tips \
libgimpbase \
libgimpcolor \
......
......@@ -22,6 +22,7 @@ SUBDIRS = \
tools \
widgets \
display \
actions \
gui \
pdb
......@@ -83,6 +84,7 @@ gimp_2_1_LDFLAGS = \
gimp_2_1_LDADD = \
config/libappconfig.a \
gui/libappgui.a \
actions/libappactions.a \
display/libappdisplay.a \
tools/libapptools.a \
widgets/libappwidgets.a \
......
Makefile
Makefile.in
.deps
.libs
*.lo
libappactions.la
## Process this file with automake to produce Makefile.in
noinst_LIBRARIES = libappactions.a
libappactions_a_SOURCES = \
brushes-actions.c \
brushes-actions.h \
buffers-actions.c \
buffers-actions.h \
channels-actions.c \
channels-actions.h \
colormap-editor-actions.c \
colormap-editor-actions.h \
debug-actions.c \
debug-actions.h \
dialogs-actions.c \
dialogs-actions.h \
dockable-actions.c \
dockable-actions.h \
documents-actions.c \
documents-actions.h \
drawable-actions.c \
drawable-actions.h \
edit-actions.c \
edit-actions.h \
error-console-actions.c \
error-console-actions.h \
file-actions.c \
file-actions.h \
fonts-actions.c \
fonts-actions.h \
gradient-editor-actions.c \
gradient-editor-actions.h \
gradients-actions.c \
gradients-actions.h \
help-actions.c \
help-actions.h \
image-actions.c \
image-actions.h \
images-actions.c \
images-actions.h \
layers-actions.c \
layers-actions.h \
palette-editor-actions.c \
palette-editor-actions.h \
palettes-actions.c \
palettes-actions.h \
patterns-actions.c \
patterns-actions.h \
qmask-actions.c \
qmask-actions.h \
select-actions.c \
select-actions.h \
templates-actions.c \
templates-actions.h \
tool-options-actions.c \
tool-options-actions.h \
vectors-actions.c \
vectors-actions.h \
view-actions.c \
view-actions.h
EXTRA_DIST = makefile.msc
AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"Gimp-Actions\" \
@GIMP_THREAD_FLAGS@ \
@GIMP_MP_FLAGS@
INCLUDES = \
-I$(top_builddir) \
-I$(top_srcdir) \
-I$(top_builddir)/app \
-I$(top_srcdir)/app \
$(GTK_CFLAGS) \
-I$(includedir)
/* 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 <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "core/gimpcontext.h"
#include "core/gimpdata.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimphelp-ids.h"
#include "brushes-actions.h"
#include "gui/data-commands.h"
#include "gimp-intl.h"
static GimpActionEntry brushes_actions[] =
{
{ "brushes-edit", GIMP_STOCK_EDIT,
N_("_Edit Brush..."), NULL, NULL,
G_CALLBACK (data_edit_data_cmd_callback),
GIMP_HELP_BRUSH_EDIT },
{ "brushes-new", GTK_STOCK_NEW,
N_("/New Brush"), "", NULL,
G_CALLBACK (data_new_data_cmd_callback),
GIMP_HELP_BRUSH_NEW },
{ "brushes-duplicate", GIMP_STOCK_DUPLICATE,
N_("/D_uplicate Brush"), NULL, NULL,
G_CALLBACK (data_duplicate_data_cmd_callback),
GIMP_HELP_BRUSH_DUPLICATE },
{ "brushes-delete", GTK_STOCK_DELETE,
N_("_Delete Brush"), "", NULL,
G_CALLBACK (data_delete_data_cmd_callback),
GIMP_HELP_BRUSH_DELETE },
{ "brushes-refresh", GTK_STOCK_REFRESH,
N_("_Refresh Brushes"), "", NULL,
G_CALLBACK (data_refresh_data_cmd_callback),
GIMP_HELP_BRUSH_REFRESH }
};
void
brushes_actions_setup (GimpActionGroup *group,
gpointer data)
{
gimp_action_group_add_actions (group,
brushes_actions,
G_N_ELEMENTS (brushes_actions),
data);
}
void
brushes_actions_update (GimpActionGroup *group,
gpointer user_data)
{
GimpContainerEditor *editor;
GimpBrush *brush;
GimpData *data = NULL;
editor = GIMP_CONTAINER_EDITOR (user_data);
brush = gimp_context_get_brush (editor->view->context);
if (brush)
data = GIMP_DATA (brush);
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
SET_SENSITIVE ("brushes-edit",
brush && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("brushes-duplicate",
brush && GIMP_DATA_GET_CLASS (data)->duplicate);
SET_SENSITIVE ("brushes-delete",
brush && data->deletable);
#undef SET_SENSITIVE
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __BRUSHES_ACTIONS_H__
#define __BRUSHES_ACTIONS_H__
void brushes_actions_setup (GimpActionGroup *group,
gpointer data);
void brushes_actions_update (GimpActionGroup *group,
gpointer data);
#endif /* __BRUSHES_ACTIONS_H__ */
/* 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 <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "core/gimpcontext.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimphelp-ids.h"
#include "buffers-actions.h"
#include "gui/buffers-commands.h"
#include "gimp-intl.h"
static GimpActionEntry buffers_actions[] =
{
{ "buffers-paste", GTK_STOCK_PASTE,
N_("_Paste Buffer"), "", NULL,
G_CALLBACK (buffers_paste_buffer_cmd_callback),
GIMP_HELP_BUFFER_PASTE },
{ "buffers-paste-info", GIMP_STOCK_PASTE_INTO,
N_("Paste Buffer _Into"), NULL, NULL,
G_CALLBACK (buffers_paste_buffer_into_cmd_callback),
GIMP_HELP_BUFFER_PASTE_INTO },
{ "buffers-paste-as-new", GIMP_STOCK_PASTE_AS_NEW,
N_("Paste Buffer as _New"), NULL, NULL,
G_CALLBACK (buffers_paste_buffer_as_new_cmd_callback),
GIMP_HELP_BUFFER_PASTE_AS_NEW },
{ "buffers-delete", GTK_STOCK_DELETE,
N_("_Delete Buffer"), "", NULL,
G_CALLBACK (buffers_delete_buffer_cmd_callback),
GIMP_HELP_BUFFER_DELETE }
};
void
buffers_actions_setup (GimpActionGroup *group,
gpointer data)
{
gimp_action_group_add_actions (group,
buffers_actions,
G_N_ELEMENTS (buffers_actions),
data);
}
void
buffers_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpContainerEditor *editor;
GimpBuffer *buffer;
editor = GIMP_CONTAINER_EDITOR (data);
buffer = gimp_context_get_buffer (editor->view->context);
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
SET_SENSITIVE ("buffers-paste", buffer);
SET_SENSITIVE ("buffers-paste-into", buffer);
SET_SENSITIVE ("buffers-paste-as-new", buffer);
SET_SENSITIVE ("buffers-delete", buffer);
#undef SET_SENSITIVE
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __BUFFERS_ACTIONS_H__
#define __BUFFERS_ACTIONS_H__
void buffers_actions_setup (GimpActionGroup *group,
gpointer data);
void buffers_actions_update (GimpActionGroup *group,
gpointer data);
#endif /* __BUFFERS_ACTIONS_H__ */
/* 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 <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "core/gimpimage.h"
#include "core/gimplist.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimpcomponenteditor.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpitemtreeview.h"
#include "channels-actions.h"
#include "gui/channels-commands.h"
#include "gimp-intl.h"
static GimpActionEntry channels_actions[] =
{
{ "channels-edit-attributes", GIMP_STOCK_EDIT,
N_("_Edit Channel Attributes..."), NULL, NULL,
G_CALLBACK (channels_edit_attributes_cmd_callback),
GIMP_HELP_CHANNEL_EDIT },
{ "channels-new", GTK_STOCK_NEW,
N_("/_New Channel..."), "", NULL,
G_CALLBACK (channels_new_cmd_callback),
GIMP_HELP_CHANNEL_NEW },
{ "channels-duplicate", GIMP_STOCK_DUPLICATE,
N_("D_uplicate Channel"), NULL, NULL,
G_CALLBACK (channels_duplicate_cmd_callback),
GIMP_HELP_CHANNEL_DUPLICATE },
{ "channels-delete", GTK_STOCK_DELETE,
N_("_Delete Channel"), "", NULL,
G_CALLBACK (channels_delete_cmd_callback),
GIMP_HELP_CHANNEL_DELETE },
{ "channels-raise", GTK_STOCK_GO_UP,
N_("_Raise Channel"), "", NULL,
G_CALLBACK (channels_raise_cmd_callback),
GIMP_HELP_CHANNEL_RAISE },
{ "channels-raise-to-top", GTK_STOCK_GOTO_TOP,
N_("Raise Channel to _Top"), "", NULL,
G_CALLBACK (channels_raise_to_top_cmd_callback),
GIMP_HELP_CHANNEL_RAISE_TO_TOP },
{ "channels-lower", GTK_STOCK_GO_DOWN,
N_("_Lower Channel"), "", NULL,
G_CALLBACK (channels_lower_cmd_callback),
GIMP_HELP_CHANNEL_LOWER },
{ "channels-lower-to-bottom", GTK_STOCK_GOTO_BOTTOM,
N_("Lower Channel to _Bottom"), "", NULL,
G_CALLBACK (channels_lower_to_bottom_cmd_callback),
GIMP_HELP_CHANNEL_LOWER_TO_BOTTOM }
};
static GimpEnumActionEntry channels_to_selection_actions[] =
{
{ "channels-selection-replace", GIMP_STOCK_SELECTION_REPLACE,
N_("Channel to Sele_ction"), NULL, NULL,
GIMP_CHANNEL_OP_REPLACE,
GIMP_HELP_CHANNEL_SELECTION_REPLACE },
{ "channels-selection-add", GIMP_STOCK_SELECTION_ADD,
N_("_Add to Selection"), NULL, NULL,
GIMP_CHANNEL_OP_ADD,
GIMP_HELP_CHANNEL_SELECTION_ADD },
{ "channels-selection-subtract", GIMP_STOCK_SELECTION_SUBTRACT,
N_("_Subtract from Selection"), NULL, NULL,
GIMP_CHANNEL_OP_SUBTRACT,
GIMP_HELP_CHANNEL_SELECTION_SUBTRACT },
{ "channels-selection-intersect", GIMP_STOCK_SELECTION_INTERSECT,
N_("_Intersect with Selection"), NULL, NULL,
GIMP_CHANNEL_OP_INTERSECT,
GIMP_HELP_CHANNEL_SELECTION_INTERSECT }
};
void
channels_actions_setup (GimpActionGroup *group,
gpointer data)
{
gimp_action_group_add_actions (group,
channels_actions,
G_N_ELEMENTS (channels_actions),
data);
gimp_action_group_add_enum_actions (group,
channels_to_selection_actions,
G_N_ELEMENTS (channels_to_selection_actions),
G_CALLBACK (channels_to_selection_cmd_callback),
data);
}
void
channels_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *gimage = NULL;
GimpChannel *channel = NULL;
gboolean fs = FALSE;
gboolean component = FALSE;
GList *next = NULL;
GList *prev = NULL;
if (GIMP_IS_COMPONENT_EDITOR (data))
{
gimage = GIMP_IMAGE_EDITOR (data)->gimage;
if (gimage)
{
if (GIMP_COMPONENT_EDITOR (data)->clicked_component != -1)
component = TRUE;
}
}
else
{
gimage = GIMP_ITEM_TREE_VIEW (data)->gimage;
if (gimage)
{
GList *list;
channel = gimp_image_get_active_channel (gimage);
for (list = GIMP_LIST (gimage->channels)->list;
list;
list = g_list_next (list))
{
if (channel == (GimpChannel *) list->data)
{
prev = g_list_previous (list);
next = g_list_next (list);
break;
}
}
}
}
if (gimage)
fs = (gimp_image_floating_sel (gimage) != NULL);
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
SET_SENSITIVE ("channels-edit-attributes", !fs && channel);
SET_SENSITIVE ("channels-new", !fs && gimage);
SET_SENSITIVE ("channels-duplicate", !fs && (channel || component));
SET_SENSITIVE ("channels-delete", !fs && channel);
SET_SENSITIVE ("channels-raise", !fs && channel && prev);
SET_SENSITIVE ("channels-raise-to-top", !fs && channel && prev);
SET_SENSITIVE ("channels-lower", !fs && channel && next);
SET_SENSITIVE ("channels-lower-to-bottom", !fs && channel && next);
SET_SENSITIVE ("channels-selection-replace", !fs && (channel || component));
SET_SENSITIVE ("channels-selection-add", !fs && (channel || component));
SET_SENSITIVE ("channels-selection-subtract", !fs && (channel || component));
SET_SENSITIVE ("channels-selection-intersect", !fs && (channel || component));
#undef SET_SENSITIVE
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __CHANNELS_ACTIONS_H__
#define __CHANNELS_ACTIONS_H__
void channels_actions_setup (GimpActionGroup *group,
gpointer data);
void channels_actions_update (GimpActionGroup *group,
gpointer data);
#endif /* __CHANNELS_ACTIONS_H__ */
......@@ -104,6 +104,18 @@ channels_raise_cmd_callback (GtkWidget *widget,
gimp_image_flush (gimage);
}
void
channels_raise_to_top_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpChannel *active_channel;
return_if_no_channel (gimage, active_channel, data);
gimp_image_raise_channel_to_top (gimage, active_channel);
gimp_image_flush (gimage);
}
void
channels_lower_cmd_callback (GtkWidget *widget,
gpointer data)
......@@ -116,6 +128,18 @@ channels_lower_cmd_callback (GtkWidget *widget,
gimp_image_flush (gimage);
}
void
channels_lower_to_bottom_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImage *gimage;
GimpChannel *active_channel;
return_if_no_channel (gimage, active_channel, data);
gimp_image_lower_channel_to_bottom (gimage, active_channel);
gimp_image_flush (gimage);
}
void
channels_duplicate_cmd_callback (GtkWidget *widget,
gpointer data)
......
......@@ -24,8 +24,12 @@ void channels_new_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_raise_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_raise_to_top_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_lower_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_lower_to_bottom_cmd_callback (GtkWidget *widget,
gpointer data);
void channels_duplicate_cmd_callback (GtkWidget *widget,
gpointer data);