app/gui/brushes-menu.[ch] app/gui/buffers-menu.[ch]

2003-01-13  Michael Natterer  <mitch@gimp.org>

	* app/gui/brushes-menu.[ch]
	* app/gui/buffers-menu.[ch]
	* app/gui/channels-menu.[ch]
	* app/gui/colormap-editor-menu.[ch]
	* app/gui/dialogs-menu.[ch]
	* app/gui/documents-menu.[ch]
	* app/gui/file-open-menu.[ch]
	* app/gui/file-save-menu.[ch]
	* app/gui/gradient-editor-menu.[ch]
	* app/gui/gradients-menu.[ch]
	* app/gui/image-menu.[ch]
	* app/gui/images-menu.[ch]
	* app/gui/layers-menu.[ch]
	* app/gui/palette-editor-menu.[ch]
	* app/gui/palettes-menu.[ch]
	* app/gui/patterns-menu.[ch]
	* app/gui/qmask-menu.[ch]
	* app/gui/toolbox-menu.[ch]
	* app/gui/vectors-menu.[ch]: new files, one per GimpItemFactory,
	containing the menu entries and their setup and update funcs.

	* app/gui/brushes-commands.[ch]
	* app/gui/patterns-commands.[ch]: removed because they contained
	only update funcs.

	* app/gui/Makefile.am: changed accordingly. Split the huge
	SOURCES list in smaller ones for menus and dialogs.

	* app/gui/menus.[ch]: removed the menu entries and setup funcs.
	Added MENU_SEPARATOR() and MENU_BRANCH() macros to the header.
	Made some utility functions public.

	* app/display/gimpdisplayshell.[ch]
	* app/gui/buffers-commands.[ch]
	* app/gui/channels-commands.[ch]
	* app/gui/colormap-editor-commands.[ch]
	* app/gui/dialogs-commands.[ch]
	* app/gui/documents-commands.[ch]
	* app/gui/gradient-editor-commands.[ch]
	* app/gui/gradients-commands.[ch]
	* app/gui/images-commands.[ch]
	* app/gui/layers-commands.[ch]
	* app/gui/palette-editor-commands.[ch]
	* app/gui/palettes-commands.[ch]
	* app/gui/qmask-commands.[ch]
	* app/gui/vectors-commands.[ch]: removed the update funcs.

	* app/gui/plug-in-menus.[ch]: renamed plug_in_set_menu_sensitivity()
	to plug_in_menus_update(). Cleanup.

	* app/gui/paths-dialog.[ch]: added the <Paths> entries here
	so they will go away together with these files.

	* app/gui/dialogs-constructors.c
	* app/gui/drawable-commands.c: removed useless #includes.
This commit is contained in:
Michael Natterer 2003-01-13 14:08:10 +00:00 committed by Michael Natterer
parent 2e59153487
commit 6f29b766e8
122 changed files with 7266 additions and 7716 deletions

View File

@ -1,3 +1,61 @@
2003-01-13 Michael Natterer <mitch@gimp.org>
* app/gui/brushes-menu.[ch]
* app/gui/buffers-menu.[ch]
* app/gui/channels-menu.[ch]
* app/gui/colormap-editor-menu.[ch]
* app/gui/dialogs-menu.[ch]
* app/gui/documents-menu.[ch]
* app/gui/file-open-menu.[ch]
* app/gui/file-save-menu.[ch]
* app/gui/gradient-editor-menu.[ch]
* app/gui/gradients-menu.[ch]
* app/gui/image-menu.[ch]
* app/gui/images-menu.[ch]
* app/gui/layers-menu.[ch]
* app/gui/palette-editor-menu.[ch]
* app/gui/palettes-menu.[ch]
* app/gui/patterns-menu.[ch]
* app/gui/qmask-menu.[ch]
* app/gui/toolbox-menu.[ch]
* app/gui/vectors-menu.[ch]: new files, one per GimpItemFactory,
containing the menu entries and their setup and update funcs.
* app/gui/brushes-commands.[ch]
* app/gui/patterns-commands.[ch]: removed because they contained
only update funcs.
* app/gui/Makefile.am: changed accordingly. Split the huge
SOURCES list in smaller ones for menus and dialogs.
* app/gui/menus.[ch]: removed the menu entries and setup funcs.
Added MENU_SEPARATOR() and MENU_BRANCH() macros to the header.
Made some utility functions public.
* app/display/gimpdisplayshell.[ch]
* app/gui/buffers-commands.[ch]
* app/gui/channels-commands.[ch]
* app/gui/colormap-editor-commands.[ch]
* app/gui/dialogs-commands.[ch]
* app/gui/documents-commands.[ch]
* app/gui/gradient-editor-commands.[ch]
* app/gui/gradients-commands.[ch]
* app/gui/images-commands.[ch]
* app/gui/layers-commands.[ch]
* app/gui/palette-editor-commands.[ch]
* app/gui/palettes-commands.[ch]
* app/gui/qmask-commands.[ch]
* app/gui/vectors-commands.[ch]: removed the update funcs.
* app/gui/plug-in-menus.[ch]: renamed plug_in_set_menu_sensitivity()
to plug_in_menus_update(). Cleanup.
* app/gui/paths-dialog.[ch]: added the <Paths> entries here
so they will go away together with these files.
* app/gui/dialogs-constructors.c
* app/gui/drawable-commands.c: removed useless #includes.
2003-01-13 Sven Neumann <sven@gimp.org>
Changed my mind again and decided that gimpconfig-dump should

View File

@ -20,18 +20,9 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimpbuffer.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "widgets/gimpbufferview.h"
#include "widgets/gimpcontainerlistview.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimplistitem.h"
#include "buffers-commands.h"
@ -83,25 +74,3 @@ buffers_delete_buffer_cmd_callback (GtkWidget *widget,
gtk_button_clicked (GTK_BUTTON (view->delete_button));
}
void
buffers_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpBuffer *buffer;
editor = GIMP_CONTAINER_EDITOR (data);
buffer = gimp_context_get_buffer (editor->view->context);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Paste Buffer", buffer);
SET_SENSITIVE ("/Paste Buffer Into", buffer);
SET_SENSITIVE ("/Paste Buffer as New", buffer);
SET_SENSITIVE ("/Delete Buffer", buffer);
#undef SET_SENSITIVE
}

View File

@ -29,8 +29,5 @@ void buffers_paste_buffer_as_new_cmd_callback (GtkWidget *widget,
void buffers_delete_buffer_cmd_callback (GtkWidget *widget,
gpointer data);
void buffers_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __BUFFERS_COMMANDS_H__ */

View File

@ -33,10 +33,8 @@
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimpimage-mask-select.h"
#include "core/gimplist.h"
#include "widgets/gimpcolorpanel.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpitemlistview.h"
#include "widgets/gimpviewabledialog.h"
@ -539,52 +537,6 @@ channels_edit_channel_query (GimpChannel *channel)
gtk_widget_show (options->query_box);
}
void
channels_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpImage *gimage;
GimpChannel *channel;
gboolean fs;
GList *list;
GList *next = NULL;
GList *prev = NULL;
gimage = GIMP_ITEM_LIST_VIEW (data)->gimage;
channel = gimp_image_get_active_channel (gimage);
fs = (gimp_image_floating_sel (gimage) != NULL);
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;
}
}
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/New Channel...", !fs);
SET_SENSITIVE ("/Raise Channel", !fs && channel && prev);
SET_SENSITIVE ("/Lower Channel", !fs && channel && next);
SET_SENSITIVE ("/Duplicate Channel", !fs && channel);
SET_SENSITIVE ("/Channel to Selection", !fs && channel);
SET_SENSITIVE ("/Add to Selection", !fs && channel);
SET_SENSITIVE ("/Subtract from Selection", !fs && channel);
SET_SENSITIVE ("/Intersect with Selection", !fs && channel);
SET_SENSITIVE ("/Delete Channel", !fs && channel);
SET_SENSITIVE ("/Edit Channel Attributes...", !fs && channel);
#undef SET_SENSITIVE
}
/* private functions */

View File

@ -46,8 +46,5 @@ void channels_new_channel_query (GimpImage *gimage,
gboolean interactive);
void channels_edit_channel_query (GimpChannel *channel);
void channels_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __CHANNELS_COMMANDS_H__ */

View File

@ -27,11 +27,9 @@
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "widgets/gimpcolormapeditor.h"
#include "widgets/gimpitemfactory.h"
#include "color-notebook.h"
#include "colormap-editor-commands.h"
@ -115,32 +113,6 @@ colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
}
}
void
colormap_editor_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpColormapEditor *editor;
GimpImage *gimage;
gint num_colors = 0;
editor = GIMP_COLORMAP_EDITOR (data);
gimage = editor->gimage;
if (gimage)
{
num_colors = gimage->num_cols;
}
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Add Color", gimage && num_colors < 256);
SET_SENSITIVE ("/Edit Color...", gimage);
#undef SET_SENSITIVE
}
/* private functions */

View File

@ -27,8 +27,5 @@ void colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void colormap_editor_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __COLORMAP_EDITOR_COMMANDS_H__ */

View File

@ -27,11 +27,9 @@
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "widgets/gimpcolormapeditor.h"
#include "widgets/gimpitemfactory.h"
#include "color-notebook.h"
#include "colormap-editor-commands.h"
@ -115,32 +113,6 @@ colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
}
}
void
colormap_editor_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpColormapEditor *editor;
GimpImage *gimage;
gint num_colors = 0;
editor = GIMP_COLORMAP_EDITOR (data);
gimage = editor->gimage;
if (gimage)
{
num_colors = gimage->num_cols;
}
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Add Color", gimage && num_colors < 256);
SET_SENSITIVE ("/Edit Color...", gimage);
#undef SET_SENSITIVE
}
/* private functions */

View File

@ -27,8 +27,5 @@ void colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void colormap_editor_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __COLORMAP_EDITOR_COMMANDS_H__ */

View File

@ -24,15 +24,12 @@
#include "gui-types.h"
#include "core/gimpcontext.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/gimpitemfactory.h"
#include "dialogs.h"
#include "dialogs-commands.h"
@ -398,151 +395,3 @@ dialogs_show_toolbox (void)
}
}
}
void
dialogs_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpDockbook *dockbook;
dockbook = GIMP_DOCKBOOK (data);
if (dockbook)
{
GimpDockable *dockable;
gint page_num;
GimpDialogFactoryEntry *entry;
GimpContainerView *view;
GimpViewType view_type = -1;
gboolean other_view_type = FALSE;
GimpPreviewSize preview_size = GIMP_PREVIEW_SIZE_NONE;
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));
dockable = (GimpDockable *)
gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num);
entry = g_object_get_data (G_OBJECT (dockable),
"gimp-dialog-factory-entry");
if (entry)
{
gchar *identifier;
gchar *substring = NULL;
identifier = g_strdup (entry->identifier);
if ((substring = strstr (identifier, "grid")))
view_type = GIMP_VIEW_TYPE_GRID;
else if ((substring = strstr (identifier, "list")))
view_type = GIMP_VIEW_TYPE_LIST;
if (substring)
{
if (view_type == GIMP_VIEW_TYPE_GRID)
memcpy (substring, "list", 4);
else if (view_type == GIMP_VIEW_TYPE_LIST)
memcpy (substring, "grid", 4);
if (gimp_dialog_factory_find_entry (dockbook->dock->dialog_factory,
identifier))
other_view_type = TRUE;
}
g_free (identifier);
}
view = gimp_container_view_get_by_dockable (dockable);
if (view)
preview_size = view->preview_size;
#define SET_ACTIVE(path,active) \
gimp_item_factory_set_active (factory, (path), (active))
#define SET_VISIBLE(path,active) \
gimp_item_factory_set_visible (factory, (path), (active))
#define SET_SENSITIVE(path,sensitive) \
gimp_item_factory_set_sensitive (factory, (path), (sensitive))
SET_VISIBLE ("/view-type-separator",
preview_size != GIMP_PREVIEW_SIZE_NONE || view_type != -1);
SET_VISIBLE ("/Preview Size", preview_size != GIMP_PREVIEW_SIZE_NONE);
if (preview_size != GIMP_PREVIEW_SIZE_NONE)
{
if (preview_size >= GIMP_PREVIEW_SIZE_GIGANTIC)
{
SET_ACTIVE ("/Preview Size/Gigantic", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_ENORMOUS)
{
SET_ACTIVE ("/Preview Size/Enormous", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_HUGE)
{
SET_ACTIVE ("/Preview Size/Huge", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_LARGE)
{
SET_ACTIVE ("/Preview Size/Extra Large", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_LARGE)
{
SET_ACTIVE ("/Preview Size/Large", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_MEDIUM)
{
SET_ACTIVE ("/Preview Size/Medium", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_SMALL)
{
SET_ACTIVE ("/Preview Size/Small", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_SMALL)
{
SET_ACTIVE ("/Preview Size/Extra Small", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_TINY)
{
SET_ACTIVE ("/Preview Size/Tiny", TRUE);
}
}
SET_VISIBLE ("/View as Grid", view_type != -1);
SET_VISIBLE ("/View as List", view_type != -1);
if (view_type != -1)
{
if (view_type == GIMP_VIEW_TYPE_LIST)
SET_ACTIVE ("/View as List", TRUE);
else
SET_ACTIVE ("/View as Grid", TRUE);
SET_SENSITIVE ("/View as Grid", other_view_type);
SET_SENSITIVE ("/View as List", other_view_type);
}
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
{
SET_VISIBLE ("/image-menu-separator", TRUE);
SET_VISIBLE ("/Show Image Menu", TRUE);
SET_VISIBLE ("/Auto Follow Active Image", TRUE);
SET_ACTIVE ("/Show Image Menu",
GIMP_IMAGE_DOCK (dockbook->dock)->show_image_menu);
SET_ACTIVE ("/Auto Follow Active Image",
GIMP_IMAGE_DOCK (dockbook->dock)->auto_follow_active);
}
else
{
SET_VISIBLE ("/image-menu-separator", FALSE);
SET_VISIBLE ("/Show Image Menu", FALSE);
SET_VISIBLE ("/Auto Follow Active Image", FALSE);
}
#undef SET_ACTIVE
#undef SET_VISIBLE
#undef SET_SENSITIVE
}
}

View File

@ -60,8 +60,5 @@ void dialogs_create_stuff_cmd_callback (GtkWidget *widget,
void dialogs_show_toolbox (void);
void dialogs_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __DIALOGS_COMMANDS_H__ */

View File

@ -24,18 +24,10 @@
#include "gui-types.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimagefile.h"
#include "widgets/gimpcontainerlistview.h"
#include "widgets/gimpdocumentview.h"
#include "widgets/gimpitemfactory.h"
#include "documents-commands.h"
#include "libgimp/gimpintl.h"
/* public functionss */
@ -120,28 +112,3 @@ documents_delete_dangling_documents_cmd_callback (GtkWidget *widget,
gimp_button_extended_clicked (GIMP_BUTTON (view->refresh_button),
GDK_CONTROL_MASK);
}
void
documents_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpImagefile *imagefile;
editor = GIMP_CONTAINER_EDITOR (data);
imagefile = gimp_context_get_imagefile (editor->view->context);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Open Image", imagefile);
SET_SENSITIVE ("/Raise or Open Image", imagefile);
SET_SENSITIVE ("/File Open Dialog...", TRUE);
SET_SENSITIVE ("/Remove Entry", imagefile);
SET_SENSITIVE ("/Recreate Preview", imagefile);
SET_SENSITIVE ("/Reload all Previews", imagefile);
SET_SENSITIVE ("/Remove Dangling Entries", imagefile);
#undef SET_SENSITIVE
}

View File

@ -35,8 +35,5 @@ void documents_reload_previews_cmd_callback (GtkWidget *widget,
void documents_delete_dangling_documents_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __DOCUMENTS_COMMANDS_H__ */

View File

@ -34,7 +34,6 @@
#include "core/gimpdrawable-invert.h"
#include "core/gimpimage.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpitemlistview.h"
#include "display/gimpdisplay.h"

View File

@ -29,7 +29,6 @@
#include "core/gimpgradient.h"
#include "widgets/gimpgradienteditor.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpviewabledialog.h"
#include "color-notebook.h"
@ -908,227 +907,8 @@ gradient_editor_blend_opacity_cmd_callback (GtkWidget *widget,
gimp_gradient_editor_update (editor, GRAD_UPDATE_GRADIENT);
}
void
gradient_editor_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpGradientEditor *editor;
GimpContext *user_context;
GimpGradientSegment *left_seg;
GimpGradientSegment *right_seg;
GimpRGB fg;
GimpRGB bg;
gboolean blending_equal = TRUE;
gboolean coloring_equal = TRUE;
gboolean selection;
gboolean delete;
editor = GIMP_GRADIENT_EDITOR (data);
user_context = gimp_get_user_context (GIMP_DATA_EDITOR (editor)->gimp);
if (editor->control_sel_l->prev)
left_seg = editor->control_sel_l->prev;
else
left_seg = gimp_gradient_segment_get_last (editor->control_sel_l);
if (editor->control_sel_r->next)
right_seg = editor->control_sel_r->next;
else
right_seg = gimp_gradient_segment_get_first (editor->control_sel_r);
gimp_context_get_foreground (user_context, &fg);
gimp_context_get_background (user_context, &bg);
{
GimpGradientSegmentType type;
GimpGradientSegmentColor color;
GimpGradientSegment *seg, *aseg;
type = editor->control_sel_l->type;
color = editor->control_sel_l->color;
seg = editor->control_sel_l;
do
{
blending_equal = blending_equal && (seg->type == type);
coloring_equal = coloring_equal && (seg->color == color);
aseg = seg;
seg = seg->next;
}
while (aseg != editor->control_sel_r);
}
selection = (editor->control_sel_l != editor->control_sel_r);
delete = (editor->control_sel_l->prev || editor->control_sel_r->next);
#define SET_ACTIVE(menu,active) \
gimp_item_factory_set_active (factory, menu, (active))
#define SET_COLOR(menu,color,set_label) \
gimp_item_factory_set_color (factory, menu, (color), (set_label))
#define SET_LABEL(menu,label) \
gimp_item_factory_set_label (factory, menu, (label))
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
#define SET_VISIBLE(menu,condition) \
gimp_item_factory_set_visible (factory, menu, (condition) != 0)
SET_COLOR ("/Left Endpoint's Color...",
&editor->control_sel_l->left_color, FALSE);
SET_COLOR ("/Load Left Color From/Left Neighbor's Right Endpoint",
&left_seg->right_color, FALSE);
SET_COLOR ("/Load Left Color From/Right Endpoint",
&editor->control_sel_r->right_color, FALSE);
SET_COLOR ("/Load Left Color From/FG Color", &fg, FALSE);
SET_COLOR ("/Load Left Color From/BG Color", &bg, FALSE);
SET_COLOR ("/Load Left Color From/01", &editor->saved_colors[0], TRUE);
SET_COLOR ("/Load Left Color From/02", &editor->saved_colors[1], TRUE);
SET_COLOR ("/Load Left Color From/03", &editor->saved_colors[2], TRUE);
SET_COLOR ("/Load Left Color From/04", &editor->saved_colors[3], TRUE);
SET_COLOR ("/Load Left Color From/05", &editor->saved_colors[4], TRUE);
SET_COLOR ("/Load Left Color From/06", &editor->saved_colors[5], TRUE);
SET_COLOR ("/Load Left Color From/07", &editor->saved_colors[6], TRUE);
SET_COLOR ("/Load Left Color From/08", &editor->saved_colors[7], TRUE);
SET_COLOR ("/Load Left Color From/09", &editor->saved_colors[8], TRUE);
SET_COLOR ("/Load Left Color From/10", &editor->saved_colors[9], TRUE);
SET_COLOR ("/Save Left Color To/01", &editor->saved_colors[0], TRUE);
SET_COLOR ("/Save Left Color To/02", &editor->saved_colors[1], TRUE);
SET_COLOR ("/Save Left Color To/03", &editor->saved_colors[2], TRUE);
SET_COLOR ("/Save Left Color To/04", &editor->saved_colors[3], TRUE);
SET_COLOR ("/Save Left Color To/05", &editor->saved_colors[4], TRUE);
SET_COLOR ("/Save Left Color To/06", &editor->saved_colors[5], TRUE);
SET_COLOR ("/Save Left Color To/07", &editor->saved_colors[6], TRUE);
SET_COLOR ("/Save Left Color To/08", &editor->saved_colors[7], TRUE);
SET_COLOR ("/Save Left Color To/09", &editor->saved_colors[8], TRUE);
SET_COLOR ("/Save Left Color To/10", &editor->saved_colors[9], TRUE);
SET_COLOR ("/Right Endpoint's Color...",
&editor->control_sel_r->right_color, FALSE);
SET_COLOR ("/Load Right Color From/Right Neighbor's Left Endpoint",
&right_seg->left_color, FALSE);
SET_COLOR ("/Load Right Color From/Left Endpoint",
&editor->control_sel_l->left_color, FALSE);
SET_COLOR ("/Load Right Color From/FG Color", &fg, FALSE);
SET_COLOR ("/Load Right Color From/BG Color", &bg, FALSE);
SET_COLOR ("/Load Right Color From/01", &editor->saved_colors[0], TRUE);
SET_COLOR ("/Load Right Color From/02", &editor->saved_colors[1], TRUE);
SET_COLOR ("/Load Right Color From/03", &editor->saved_colors[2], TRUE);
SET_COLOR ("/Load Right Color From/04", &editor->saved_colors[3], TRUE);
SET_COLOR ("/Load Right Color From/05", &editor->saved_colors[4], TRUE);
SET_COLOR ("/Load Right Color From/06", &editor->saved_colors[5], TRUE);
SET_COLOR ("/Load Right Color From/07", &editor->saved_colors[6], TRUE);
SET_COLOR ("/Load Right Color From/08", &editor->saved_colors[7], TRUE);
SET_COLOR ("/Load Right Color From/09", &editor->saved_colors[8], TRUE);
SET_COLOR ("/Load Right Color From/10", &editor->saved_colors[9], TRUE);
SET_COLOR ("/Save Right Color To/01", &editor->saved_colors[0], TRUE);
SET_COLOR ("/Save Right Color To/02", &editor->saved_colors[1], TRUE);
SET_COLOR ("/Save Right Color To/03", &editor->saved_colors[2], TRUE);
SET_COLOR ("/Save Right Color To/04", &editor->saved_colors[3], TRUE);
SET_COLOR ("/Save Right Color To/05", &editor->saved_colors[4], TRUE);
SET_COLOR ("/Save Right Color To/06", &editor->saved_colors[5], TRUE);
SET_COLOR ("/Save Right Color To/07", &editor->saved_colors[6], TRUE);
SET_COLOR ("/Save Right Color To/08", &editor->saved_colors[7], TRUE);
SET_COLOR ("/Save Right Color To/09", &editor->saved_colors[8], TRUE);
SET_COLOR ("/Save Right Color To/10", &editor->saved_colors[9], TRUE);
if (! selection)
{
SET_LABEL ("/blendingfunction", _("Blending Function for Segment"));
SET_LABEL ("/coloringtype", _("Coloring Type for Segment"));
SET_LABEL ("/flip", _("Flip Segment"));
SET_LABEL ("/replicate", _("Replicate Segment..."));
SET_LABEL ("/splitmidpoint", _("Split Segment at Midpoint"));
SET_LABEL ("/splituniformly", _("Split Segment Uniformly..."));
SET_LABEL ("/delete", _("Delete Segment"));
SET_LABEL ("/recenter", _("Re-center Segment's Midpoint"));
SET_LABEL ("/redistribute", _("Re-distribute Handles in Segment"));
}
else
{
SET_LABEL ("/blendingfunction", _("Blending Function for Selection"));
SET_LABEL ("/coloringtype", _("Coloring Type for Selection"));
SET_LABEL ("/flip", _("Flip Selection"));
SET_LABEL ("/replicate", _("Replicate Selection..."));
SET_LABEL ("/splitmidpoint", _("Split Segments at Midpoints"));
SET_LABEL ("/splituniformly", _("Split Segments Uniformly..."));
SET_LABEL ("/delete", _("Delete Selection"));
SET_LABEL ("/recenter", _("Re-center Midpoints in Selection"));
SET_LABEL ("/redistribute", _("Re-distribute Handles in Selection"));
}
SET_SENSITIVE ("/blendingfunction/(Varies)", FALSE);
SET_SENSITIVE ("/coloringtype/(Varies)", FALSE);
if (blending_equal)
{
SET_VISIBLE ("/blendingfunction/(Varies)", FALSE);
switch (editor->control_sel_l->type)
{
case GIMP_GRAD_LINEAR:
SET_ACTIVE ("/blendingfunction/Linear", TRUE);
break;
case GIMP_GRAD_CURVED:
SET_ACTIVE ("/blendingfunction/Curved", TRUE);
break;
case GIMP_GRAD_SINE:
SET_ACTIVE ("/blendingfunction/Sinusodial", TRUE);
break;
case GIMP_GRAD_SPHERE_INCREASING:
SET_ACTIVE ("/blendingfunction/Spherical (increasing)", TRUE);
break;
case GIMP_GRAD_SPHERE_DECREASING:
SET_ACTIVE ("/blendingfunction/Spherical (decreasing)", TRUE);
break;
}
}
else
{
SET_VISIBLE ("/blendingfunction/(Varies)", TRUE);
SET_ACTIVE ("/blendingfunction/(Varies)", TRUE);
}
if (coloring_equal)
{
SET_VISIBLE ("/coloringtype/(Varies)", FALSE);
switch (editor->control_sel_l->color)
{
case GIMP_GRAD_RGB:
SET_ACTIVE ("/coloringtype/RGB", TRUE);
break;
case GIMP_GRAD_HSV_CCW:
SET_ACTIVE ("/coloringtype/HSV (counter-clockwise hue)", TRUE);
break;
case GIMP_GRAD_HSV_CW:
SET_ACTIVE ("/coloringtype/HSV (clockwise hue)", TRUE);
break;
}
}
else
{
SET_VISIBLE ("/coloringtype/(Varies)", TRUE);
SET_ACTIVE ("/coloringtype/(Varies)", TRUE);
}
SET_SENSITIVE ("/Blend Endpoints' Colors", selection);
SET_SENSITIVE ("/Blend Endpoints' Opacity", selection);
SET_SENSITIVE ("/delete", delete);
#undef SET_ACTIVE
#undef SET_COLOR
#undef SET_LABEL
#undef SET_SENSITIVE
#undef SET_VISIBLE
}
/* private functions */
static void
gradient_editor_left_color_changed (ColorNotebook *cnb,

View File

@ -76,8 +76,5 @@ void gradient_editor_blend_opacity_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __GRADIENT_EDITOR_COMMANDS_H__ */

View File

@ -18,8 +18,6 @@
#include "config.h"
#include <stdio.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
@ -29,9 +27,8 @@
#include "core/gimpgradient.h"
#include "core/gimpcontext.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimpitemfactory.h"
#include "gradients-commands.h"
@ -58,36 +55,6 @@ gradients_save_as_pov_ray_cmd_callback (GtkWidget *widget,
gradients_save_as_pov_query (editor);
}
void
gradients_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpGradient *gradient;
gboolean internal = FALSE;
editor = GIMP_CONTAINER_EDITOR (data);
gradient = gimp_context_get_gradient (editor->view->context);
if (gradient)
internal = GIMP_DATA (gradient)->internal;
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Duplicate Gradient",
gradient && GIMP_DATA_GET_CLASS (gradient)->duplicate);
SET_SENSITIVE ("/Edit Gradient...",
gradient && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Delete Gradient...",
gradient && ! internal);
SET_SENSITIVE ("/Save as POV-Ray...",
gradient);
#undef SET_SENSITIVE
}
/* private functions */

View File

@ -23,8 +23,5 @@
void gradients_save_as_pov_ray_cmd_callback (GtkWidget *widget,
gpointer data);
void gradients_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __GRADIENTS_COMMANDS_H__ */

View File

@ -20,22 +20,12 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "widgets/gimpcontainerlistview.h"
#include "widgets/gimpimageview.h"
#include "widgets/gimpitemfactory.h"
#include "images-commands.h"
#include "libgimp/gimpintl.h"
/* public functionss */
@ -71,24 +61,3 @@ images_delete_image_cmd_callback (GtkWidget *widget,
gtk_button_clicked (GTK_BUTTON (view->delete_button));
}
void
images_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpImage *image;
editor = GIMP_CONTAINER_EDITOR (data);
image = gimp_context_get_image (editor->view->context);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Raise Displays", image);
SET_SENSITIVE ("/New Display", image);
SET_SENSITIVE ("/Delete Image", image && image->disp_count == 0);
#undef SET_SENSITIVE
}

View File

@ -27,8 +27,5 @@ void images_new_display_cmd_callback (GtkWidget *widget,
void images_delete_image_cmd_callback (GtkWidget *widget,
gpointer data);
void images_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __IMAGES_COMMANDS_H__ */

View File

@ -41,7 +41,6 @@
#include "pdb/procedural_db.h"
#include "widgets/gimpenummenu.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpitemlistview.h"
#include "widgets/gimpviewabledialog.h"
@ -1150,85 +1149,3 @@ layers_resize_layer_query (GimpImage *gimage,
gtk_widget_show (options->resize->resize_shell);
}
void
layers_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpImage *gimage;
GimpLayer *layer;
gboolean fs = FALSE; /* floating sel */
gboolean ac = FALSE; /* active channel */
gboolean lm = FALSE; /* layer mask */
gboolean lp = FALSE; /* layers present */
gboolean alpha = FALSE; /* alpha channel present */
gboolean indexed = FALSE; /* is indexed */
gboolean next_alpha = FALSE;
GList *list;
GList *next = NULL;
GList *prev = NULL;
gimage = GIMP_ITEM_LIST_VIEW (data)->gimage;
layer = gimp_image_get_active_layer (gimage);
if (layer)
lm = (gimp_layer_get_mask (layer)) ? TRUE : FALSE;
fs = (gimp_image_floating_sel (gimage) != NULL);
ac = (gimp_image_get_active_channel (gimage) != NULL);
alpha = layer && gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
lp = ! gimp_image_is_empty (gimage);
indexed = (gimp_image_base_type (gimage) == GIMP_INDEXED);
for (list = GIMP_LIST (gimage->layers)->list;
list;
list = g_list_next (list))
{
if (layer == (GimpLayer *) list->data)
{
prev = g_list_previous (list);
next = g_list_next (list);
break;
}
}
if (next)
next_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (next->data));
else
next_alpha = FALSE;
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/New Layer...", gimage);
SET_SENSITIVE ("/Raise Layer", !fs && !ac && gimage && lp && alpha && prev);
SET_SENSITIVE ("/Layer to Top", !fs && !ac && gimage && lp && alpha && prev);
SET_SENSITIVE ("/Lower Layer", !fs && !ac && gimage && lp && next && next_alpha);
SET_SENSITIVE ("/Layer to Bottom", !fs && !ac && gimage && lp && next && next_alpha);
SET_SENSITIVE ("/Duplicate Layer", !fs && !ac && gimage && lp);
SET_SENSITIVE ("/Anchor Layer", fs && !ac && gimage && lp);
SET_SENSITIVE ("/Merge Down", !fs && !ac && gimage && lp && next);
SET_SENSITIVE ("/Delete Layer", !ac && gimage && lp);
SET_SENSITIVE ("/Layer Boundary Size...", !ac && gimage && lp);
SET_SENSITIVE ("/Layer to Imagesize", !ac && gimage && lp);
SET_SENSITIVE ("/Scale Layer...", !ac && gimage && lp);
SET_SENSITIVE ("/Add Layer Mask...", !fs && !ac && gimage && !lm && lp && alpha && !indexed);
SET_SENSITIVE ("/Apply Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Delete Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Mask to Selection", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Add Alpha Channel", !fs && !alpha);
SET_SENSITIVE ("/Alpha to Selection", !fs && !ac && gimage && lp && alpha);
SET_SENSITIVE ("/Edit Layer Attributes...", !fs && !ac && gimage && lp);
#undef SET_SENSITIVE
}

View File

@ -69,9 +69,6 @@ void layers_add_alpha_channel_cmd_callback (GtkWidget *widet,
void layers_edit_attributes_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_menu_update (GtkItemFactory *factory,
gpointer data);
void layers_remove_layer (GimpImage *gimage,
GimpLayer *layer);
void layers_anchor_layer (GimpLayer *layer);

View File

@ -29,7 +29,6 @@
#include "core/gimppalette.h"
#include "widgets/gimppaletteeditor.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimptoolbox-color-area.h"
#include "color-notebook.h"
@ -137,24 +136,6 @@ palette_editor_delete_color_cmd_callback (GtkWidget *widget,
gimp_palette_delete_entry (palette, editor->color);
}
void
palette_editor_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpPaletteEditor *editor;
editor = GIMP_PALETTE_EDITOR (data);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/New Color", TRUE);
SET_SENSITIVE ("/Edit Color...", editor->color);
SET_SENSITIVE ("/Delete Color", editor->color);
#undef SET_SENSITIVE
}
/* private functions */

View File

@ -30,8 +30,5 @@ void palette_editor_delete_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void palette_editor_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __PALETTE_EDITOR_COMMANDS_H__ */

View File

@ -30,7 +30,6 @@
#include "widgets/gimpcontainerlistview.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimplistitem.h"
#include "widgets/gimppreview.h"
@ -78,36 +77,6 @@ palettes_merge_palettes_cmd_callback (GtkWidget *widget,
palettes_merge_palettes_query (editor);
}
void
palettes_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpPalette *palette;
gboolean internal = FALSE;
editor = GIMP_CONTAINER_EDITOR (data);
palette = gimp_context_get_palette (editor->view->context);
if (palette)
internal = GIMP_DATA (palette)->internal;
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Duplicate Palette",
palette && GIMP_DATA_GET_CLASS (palette)->duplicate);
SET_SENSITIVE ("/Edit Palette...",
palette && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Delete Palette...",
palette && ! internal);
SET_SENSITIVE ("/Merge Palettes...",
FALSE); /* FIXME palette && GIMP_IS_CONTAINER_LIST_VIEW (editor->view)); */
#undef SET_SENSITIVE
}
/* private functions */

View File

@ -25,8 +25,5 @@ void palettes_import_palette_cmd_callback (GtkWidget *widget,
void palettes_merge_palettes_cmd_callback (GtkWidget *widget,
gpointer data);
void palettes_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __PALETTES_COMMANDS_H__ */

View File

@ -31,7 +31,6 @@
#include "core/gimpimage-qmask.h"
#include "widgets/gimpcolorpanel.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpviewabledialog.h"
#include "display/gimpdisplay.h"
@ -118,33 +117,6 @@ qmask_configure_cmd_callback (GtkWidget *widget,
qmask_channel_query (shell);
}
void
qmask_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpDisplayShell *shell;
shell = GIMP_DISPLAY_SHELL (data);
#define SET_ACTIVE(menu,active) \
gimp_item_factory_set_active (factory, "/" menu, (active))
#define SET_COLOR(menu,color) \
gimp_item_factory_set_color (factory, "/" menu, (color), FALSE)
SET_ACTIVE ("QMask Active", shell->gdisp->gimage->qmask_state);
if (shell->gdisp->gimage->qmask_inverted)
SET_ACTIVE ("Mask Selected Areas", TRUE);
else
SET_ACTIVE ("Mask Unselected Areas", TRUE);
SET_COLOR ("Configure Color and Opacity...",
&shell->gdisp->gimage->qmask_color);
#undef SET_SENSITIVE
#undef SET_COLOR
}
/* private functions */

View File

@ -30,8 +30,5 @@ void qmask_configure_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void qmask_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __QMASK_COMMANDS_H__ */

View File

@ -31,7 +31,6 @@
#include "core/gimpimage-qmask.h"
#include "widgets/gimpcolorpanel.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpviewabledialog.h"
#include "display/gimpdisplay.h"
@ -118,33 +117,6 @@ qmask_configure_cmd_callback (GtkWidget *widget,
qmask_channel_query (shell);
}
void
qmask_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpDisplayShell *shell;
shell = GIMP_DISPLAY_SHELL (data);
#define SET_ACTIVE(menu,active) \
gimp_item_factory_set_active (factory, "/" menu, (active))
#define SET_COLOR(menu,color) \
gimp_item_factory_set_color (factory, "/" menu, (color), FALSE)
SET_ACTIVE ("QMask Active", shell->gdisp->gimage->qmask_state);
if (shell->gdisp->gimage->qmask_inverted)
SET_ACTIVE ("Mask Selected Areas", TRUE);
else
SET_ACTIVE ("Mask Unselected Areas", TRUE);
SET_COLOR ("Configure Color and Opacity...",
&shell->gdisp->gimage->qmask_color);
#undef SET_SENSITIVE
#undef SET_COLOR
}
/* private functions */

View File

@ -30,8 +30,5 @@ void qmask_configure_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void qmask_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __QMASK_COMMANDS_H__ */

View File

@ -41,7 +41,6 @@
#include "vectors/gimpvectors.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpitemlistview.h"
#include "widgets/gimpviewabledialog.h"
@ -627,59 +626,3 @@ vectors_edit_vectors_query (GimpVectors *vectors)
gtk_widget_show (hbox);
gtk_widget_show (options->query_box);
}
void
vectors_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpImage *gimage;
GimpVectors *vectors;
gboolean mask_empty;
gboolean global_buf;
GList *list;
GList *next = NULL;
GList *prev = NULL;
gimage = GIMP_ITEM_LIST_VIEW (data)->gimage;
vectors = gimp_image_get_active_vectors (gimage);
mask_empty = gimp_image_mask_is_empty (gimage);
global_buf = FALSE;
for (list = GIMP_LIST (gimage->vectors)->list;
list;
list = g_list_next (list))
{
if (vectors == (GimpVectors *) list->data)
{
prev = g_list_previous (list);
next = g_list_next (list);
break;
}
}
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/New Path...", TRUE);
SET_SENSITIVE ("/Raise Path", vectors && prev);
SET_SENSITIVE ("/Lower Path", vectors && next);
SET_SENSITIVE ("/Duplicate Path", vectors);
SET_SENSITIVE ("/Path to Selection", vectors);
SET_SENSITIVE ("/Add to Selection", vectors);
SET_SENSITIVE ("/Subtract from Selection", vectors);
SET_SENSITIVE ("/Intersect with Selection", vectors);
SET_SENSITIVE ("/Selection to Path", ! mask_empty);
SET_SENSITIVE ("/Stroke Path", vectors);
SET_SENSITIVE ("/Delete Path", vectors);
SET_SENSITIVE ("/Copy Path", vectors);
SET_SENSITIVE ("/Paste Path", global_buf);
SET_SENSITIVE ("/Import Path...", TRUE);
SET_SENSITIVE ("/Export Path...", vectors);
SET_SENSITIVE ("/Path Tool", vectors);
SET_SENSITIVE ("/Edit Path Attributes...", vectors);
#undef SET_SENSITIVE
}

View File

@ -62,8 +62,5 @@ void vectors_new_vectors_query (GimpImage *gimage,
gboolean interactive);
void vectors_edit_vectors_query (GimpVectors *vectors);
void vectors_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __VECTORS_COMMANDS_H__ */

View File

@ -26,7 +26,6 @@
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpbrushgenerated.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpgradient.h"
@ -49,7 +48,6 @@
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpimagedock.h"
#include "widgets/gimpimageview.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpitemlistview.h"
#include "widgets/gimpdockable.h"
#include "widgets/gimpdockbook.h"
@ -70,21 +68,15 @@
#include "display/gimpnavigationview.h"
#include "about-dialog.h"
#include "brushes-commands.h"
#include "buffers-commands.h"
#include "channels-commands.h"
#include "device-status-dialog.h"
#include "dialogs.h"
#include "dialogs-constructors.h"
#include "documents-commands.h"
#include "error-console-dialog.h"
#include "file-commands.h"
#include "gradients-commands.h"
#include "layers-commands.h"
#include "module-browser.h"
#include "palettes-commands.h"
#include "paths-dialog.h"
#include "patterns-commands.h"
#include "preferences-dialog.h"
#include "tips-dialog.h"
#include "tool-options-dialog.h"

View File

@ -18,15 +18,13 @@
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "display-types.h"
#include "tools/tools-types.h"
#ifdef __GNUC__
#warning FIXME #include "gui/gui-types.h"
@ -38,11 +36,9 @@
#include "core/gimp.h"
#include "core/gimpbuffer.h"
#include "core/gimpcontext.h"
#include "core/gimpcontainer.h"
#include "core/gimpimage.h"
#include "core/gimpimage-guides.h"
#include "core/gimpimage-mask.h"
#include "core/gimpimage-new.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "core/gimpmarshal.h"
@ -56,10 +52,6 @@
#include "widgets/gimpmenufactory.h"
#include "gui/info-window.h"
#include "gui/plug-in-menus.h"
#include "gui/menus.h"
#include "tools/tools-types.h"
#include "tools/tool_manager.h"
@ -77,8 +69,6 @@
#include "gimpdisplayshell-transform.h"
#include "gimpstatusbar.h"
#include "undo.h"
#include "libgimp/gimpintl.h"
@ -882,305 +872,6 @@ gimp_display_shell_scrolled (GimpDisplayShell *shell)
g_signal_emit (shell, display_shell_signals[SCROLLED], 0);
}
void
gimp_display_shell_menu_update (GtkItemFactory *item_factory,
gpointer data)
{
Gimp *gimp = NULL;
GimpDisplayShell *shell = NULL;
GimpDisplay *gdisp = NULL;
GimpImage *gimage = NULL;
GimpDrawable *drawable = NULL;
GimpLayer *layer = NULL;
GimpImageType drawable_type = -1;
GimpRGB fg;
GimpRGB bg;
gboolean is_rgb = FALSE;
gboolean is_gray = FALSE;
gboolean is_indexed = FALSE;
gboolean fs = FALSE;
gboolean aux = FALSE;
gboolean lm = FALSE;
gboolean lp = FALSE;
gboolean sel = FALSE;
gboolean alpha = FALSE;
gint lind = -1;
gint lnum = -1;
gimp = GIMP_ITEM_FACTORY (item_factory)->gimp;
if (data)
{
shell = GIMP_DISPLAY_SHELL (data);
gdisp = shell->gdisp;
}
#if 0
if (shell)
{
gdisp = shell->gdisp;
if (popup_only)
item_factory = GTK_ITEM_FACTORY (shell->popup_factory);
else
item_factory = GTK_ITEM_FACTORY (shell->menubar_factory);
}
else if (popup_only)
{
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
}
#endif
if (gdisp)
{
GimpImageBaseType base_type;
gimage = gdisp->gimage;
base_type = gimp_image_base_type (gimage);
is_rgb = (base_type == GIMP_RGB);
is_gray = (base_type == GIMP_GRAY);
is_indexed = (base_type == GIMP_INDEXED);
fs = (gimp_image_floating_sel (gimage) != NULL);
aux = (gimp_image_get_active_channel (gimage) != NULL);
lp = ! gimp_image_is_empty (gimage);
sel = ! gimp_image_mask_is_empty (gimage);
drawable = gimp_image_active_drawable (gimage);
if (drawable)
drawable_type = gimp_drawable_type (drawable);
if (lp)
{
layer = gimp_image_get_active_layer (gimage);
if (layer)
{
lm = gimp_layer_get_mask (layer) ? TRUE : FALSE;
alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
lind = gimp_image_get_layer_index (gimage, layer);
}
lnum = gimp_container_num_children (gimage->layers);
}
}
gimp_context_get_foreground (gimp_get_user_context (gimp), &fg);
gimp_context_get_background (gimp_get_user_context (gimp), &bg);
#define SET_ACTIVE(menu,condition) \
gimp_item_factory_set_active (item_factory, menu, (condition) != 0)
#define SET_LABEL(menu,label) \
gimp_item_factory_set_label (item_factory, menu, (label))
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (item_factory, menu, (condition) != 0)
/* File */
SET_SENSITIVE ("/File/Save", gdisp && drawable);
SET_SENSITIVE ("/File/Save as...", gdisp && drawable);
SET_SENSITIVE ("/File/Save a Copy...", gdisp && drawable);
SET_SENSITIVE ("/File/Revert...", gdisp && GIMP_OBJECT (gimage)->name);
SET_SENSITIVE ("/File/Close", gdisp);
/* Edit */
{
gchar *undo_name = NULL;
gchar *redo_name = NULL;
if (gdisp && gimp_image_undo_is_enabled (gimage))
{
undo_name = (gchar *) undo_get_undo_name (gimage);
redo_name = (gchar *) undo_get_redo_name (gimage);
}
if (undo_name)
undo_name = g_strdup_printf (_("Undo %s"), gettext (undo_name));
if (redo_name)
redo_name = g_strdup_printf (_("Redo %s"), gettext (redo_name));
SET_LABEL ("/Edit/Undo", undo_name ? undo_name : _("Undo"));
SET_LABEL ("/Edit/Redo", redo_name ? redo_name : _("Redo"));
SET_SENSITIVE ("/Edit/Undo", undo_name);
SET_SENSITIVE ("/Edit/Redo", redo_name);
g_free (undo_name);
g_free (redo_name);
}
SET_SENSITIVE ("/Edit/Cut", lp);
SET_SENSITIVE ("/Edit/Copy", lp);
SET_SENSITIVE ("/Edit/Paste", gdisp && gimp->global_buffer);
SET_SENSITIVE ("/Edit/Paste Into", gdisp && gimp->global_buffer);
SET_SENSITIVE ("/Edit/Paste as New", gimp->global_buffer);
SET_SENSITIVE ("/Edit/Buffer/Cut Named...", lp);
SET_SENSITIVE ("/Edit/Buffer/Copy Named...", lp);
SET_SENSITIVE ("/Edit/Buffer/Paste Named...", lp);
SET_SENSITIVE ("/Edit/Clear", lp);
SET_SENSITIVE ("/Edit/Fill with FG Color", lp);
SET_SENSITIVE ("/Edit/Fill with BG Color", lp);
SET_SENSITIVE ("/Edit/Stroke", lp && sel);
/* Select */
SET_SENSITIVE ("/Select/Invert", lp && sel);
SET_SENSITIVE ("/Select/All", lp);
SET_SENSITIVE ("/Select/None", lp && sel);
SET_SENSITIVE ("/Select/Float", lp && sel);
SET_SENSITIVE ("/Select/Feather...", lp && sel);
SET_SENSITIVE ("/Select/Sharpen", lp && sel);
SET_SENSITIVE ("/Select/Shrink...", lp && sel);
SET_SENSITIVE ("/Select/Grow...", lp && sel);
SET_SENSITIVE ("/Select/Border...", lp && sel);
SET_SENSITIVE ("/Select/Toggle QuickMask", gdisp);
SET_SENSITIVE ("/Select/Save to Channel", lp && sel && !fs);
/* View */
SET_SENSITIVE ("/View/Zoom In", gdisp);
SET_SENSITIVE ("/View/Zoom Out", gdisp);
SET_SENSITIVE ("/View/Zoom to Fit Window", gdisp);
SET_SENSITIVE ("/View/Zoom/16:1", gdisp);
SET_SENSITIVE ("/View/Zoom/8:1", gdisp);
SET_SENSITIVE ("/View/Zoom/4:1", gdisp);
SET_SENSITIVE ("/View/Zoom/2:1", gdisp);
SET_SENSITIVE ("/View/Zoom/1:1", gdisp);
SET_SENSITIVE ("/View/Zoom/1:2", gdisp);
SET_SENSITIVE ("/View/Zoom/1:4", gdisp);
SET_SENSITIVE ("/View/Zoom/1:8", gdisp);
SET_SENSITIVE ("/View/Zoom/1:16", gdisp);
SET_SENSITIVE ("/View/Dot for Dot", gdisp);
SET_ACTIVE ("/View/Dot for Dot", gdisp && shell->dot_for_dot);
SET_SENSITIVE ("/View/Info Window...", gdisp);
SET_SENSITIVE ("/View/Navigation Window...", gdisp);
SET_SENSITIVE ("/View/Display Filters...", gdisp);
SET_SENSITIVE ("/View/Show Selection", gdisp);
SET_ACTIVE ("/View/Show Selection", gdisp && ! shell->select->hidden);
SET_SENSITIVE ("/View/Show Layer Boundary", gdisp);
SET_ACTIVE ("/View/Show Layer Boundary", gdisp && ! shell->select->layer_hidden);
SET_SENSITIVE ("/View/Show Guides", gdisp);
SET_ACTIVE ("/View/Show Guides", gdisp && gdisp->draw_guides);
SET_SENSITIVE ("/View/Snap to Guides", gdisp);
SET_ACTIVE ("/View/Snap to Guides", gdisp && gdisp->snap_to_guides);
SET_SENSITIVE ("/View/Show Menubar", gdisp);
SET_ACTIVE ("/View/Show Menubar",
gdisp &&
GTK_WIDGET_VISIBLE (GTK_ITEM_FACTORY (shell->menubar_factory)->widget));
SET_SENSITIVE ("/View/Show Rulers", gdisp);
SET_ACTIVE ("/View/Show Rulers",
gdisp && GTK_WIDGET_VISIBLE (shell->hrule));
SET_SENSITIVE ("/View/Show Statusbar", gdisp);
SET_ACTIVE ("/View/Show Statusbar",
gdisp && GTK_WIDGET_VISIBLE (shell->statusbar));
SET_SENSITIVE ("/View/New View", gdisp);
SET_SENSITIVE ("/View/Shrink Wrap", gdisp);
/* Image */
SET_SENSITIVE ("/Image/Mode/RGB", gdisp && ! is_rgb);
SET_SENSITIVE ("/Image/Mode/Grayscale", gdisp && ! is_gray);
SET_SENSITIVE ("/Image/Mode/Indexed...", gdisp && ! is_indexed);
SET_SENSITIVE ("/Image/Canvas Size...", gdisp);
SET_SENSITIVE ("/Image/Scale Image...", gdisp);
SET_SENSITIVE ("/Image/Crop Image", gdisp && sel);
SET_SENSITIVE ("/Image/Duplicate", gdisp);
SET_SENSITIVE ("/Image/Merge Visible Layers...", gdisp && !fs && !aux && lp);
SET_SENSITIVE ("/Image/Flatten Image", gdisp && !fs && !aux && lp);
SET_SENSITIVE ("/Image/Undo History...", gdisp);
/* Layer */
SET_SENSITIVE ("/Layer/Stack/Previous Layer",
lp && !fs && !aux && lind > 0);
SET_SENSITIVE ("/Layer/Stack/Next Layer",
lp && !fs && !aux && lind < (lnum - 1));
SET_SENSITIVE ("/Layer/Stack/Raise Layer",
lp && !fs && !aux && alpha && lind > 0);
SET_SENSITIVE ("/Layer/Stack/Lower Layer",
lp && !fs && !aux && alpha && lind < (lnum - 1));
SET_SENSITIVE ("/Layer/Stack/Layer to Top",
lp && !fs && !aux && alpha && lind > 0);
SET_SENSITIVE ("/Layer/Stack/Layer to Bottom",
lp && !fs && !aux && alpha && lind < (lnum - 1));
SET_SENSITIVE ("/Layer/New Layer...", gdisp);
SET_SENSITIVE ("/Layer/Duplicate Layer", lp && !fs && !aux);
SET_SENSITIVE ("/Layer/Anchor Layer", lp && fs && !aux);
SET_SENSITIVE ("/Layer/Merge Down", lp && !fs && !aux);
SET_SENSITIVE ("/Layer/Delete Layer", lp && !aux);
SET_SENSITIVE ("/Layer/Layer Boundary Size...", lp && !aux);
SET_SENSITIVE ("/Layer/Layer to Imagesize", lp && !aux);
SET_SENSITIVE ("/Layer/Scale Layer...", lp && !aux);
SET_SENSITIVE ("/Layer/Crop Layer", lp && !aux && sel);
SET_SENSITIVE ("/Layer/Transform/Offset...", lp);
SET_SENSITIVE ("/Layer/Colors/Color Balance...", lp && is_rgb);
SET_SENSITIVE ("/Layer/Colors/Hue-Saturation...", lp && is_rgb);
SET_SENSITIVE ("/Layer/Colors/Brightness-Contrast...", lp && ! is_indexed);
SET_SENSITIVE ("/Layer/Colors/Threshold...", lp && ! is_indexed);
SET_SENSITIVE ("/Layer/Colors/Levels...", lp && ! is_indexed);
SET_SENSITIVE ("/Layer/Colors/Curves...", lp && ! is_indexed);
SET_SENSITIVE ("/Layer/Colors/Desaturate", lp && is_rgb);
SET_SENSITIVE ("/Layer/Colors/Posterize...", lp && ! is_indexed);
SET_SENSITIVE ("/Layer/Colors/Invert", lp && ! is_indexed);
SET_SENSITIVE ("/Layer/Colors/Auto/Equalize", lp && ! is_indexed);
SET_SENSITIVE ("/Layer/Colors/Histogram...", lp);
SET_SENSITIVE ("/Layer/Mask/Add Layer Mask...", lp && !aux && !lm && alpha && ! is_indexed);
SET_SENSITIVE ("/Layer/Mask/Apply Layer Mask", lp && !aux && lm);
SET_SENSITIVE ("/Layer/Mask/Delete Layer Mask", lp && !aux && lm);
SET_SENSITIVE ("/Layer/Mask/Mask to Selection", lp && !aux && lm);
SET_SENSITIVE ("/Layer/Alpha/Alpha to Selection", lp && !aux && alpha);
SET_SENSITIVE ("/Layer/Alpha/Add Alpha Channel", lp && !aux && !fs && !lm && !alpha);
#undef SET_ACTIVE
#undef SET_LABEL
#undef SET_SENSITIVE
plug_in_set_menu_sensitivity (GIMP_ITEM_FACTORY (item_factory), drawable_type);
#if 0
/* update the popup menu */
if (! popup_only)
{
GimpContext *user_context;
user_context = gimp_get_user_context (gimp);
if (shell)
{
if (gimp_context_get_display (user_context) == gdisp)
gimp_display_shell_set_menu_sensitivity (shell, gdisp->gimage->gimp,
TRUE);
}
else
{
gimp_display_shell_set_menu_sensitivity (NULL, gdisp->gimage->gimp,
TRUE);
}
}
#endif
}
GimpGuide *
gimp_display_shell_find_guide (GimpDisplayShell *shell,
gdouble x,

View File

@ -176,9 +176,6 @@ void gimp_display_shell_reconnect (GimpDisplayShell *shell);
void gimp_display_shell_scaled (GimpDisplayShell *shell);
void gimp_display_shell_scrolled (GimpDisplayShell *shell);
void gimp_display_shell_menu_update (GtkItemFactory *item_factory,
gpointer data);
GimpGuide * gimp_display_shell_find_guide (GimpDisplayShell *shell,
gdouble x,
gdouble y);

View File

@ -18,15 +18,13 @@
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "display-types.h"
#include "tools/tools-types.h"
#ifdef __GNUC__
#warning FIXME #include "gui/gui-types.h"
@ -38,11 +36,9 @@
#include "core/gimp.h"
#include "core/gimpbuffer.h"
#include "core/gimpcontext.h"
#include "core/gimpcontainer.h"
#include "core/gimpimage.h"
#include "core/gimpimage-guides.h"
#include "core/gimpimage-mask.h"
#include "core/gimpimage-new.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "core/gimpmarshal.h"
@ -56,10 +52,6 @@
#include "widgets/gimpmenufactory.h"
#include "gui/info-window.h"
#include "gui/plug-in-menus.h"
#include "gui/menus.h"
#include "tools/tools-types.h"
#include "tools/tool_manager.h"
@ -77,8 +69,6 @@
#include "gimpdisplayshell-transform.h"
#include "gimpstatusbar.h"
#include "undo.h"
#include "libgimp/gimpintl.h"
@ -882,305 +872,6 @@ gimp_display_shell_scrolled (GimpDisplayShell *shell)
g_signal_emit (shell, display_shell_signals[SCROLLED], 0);
}
void
gimp_display_shell_menu_update (GtkItemFactory *item_factory,
gpointer data)
{
Gimp *gimp = NULL;
GimpDisplayShell *shell = NULL;
GimpDisplay *gdisp = NULL;
GimpImage *gimage = NULL;
GimpDrawable *drawable = NULL;
GimpLayer *layer = NULL;
GimpImageType drawable_type = -1;
GimpRGB fg;
GimpRGB bg;
gboolean is_rgb = FALSE;
gboolean is_gray = FALSE;
gboolean is_indexed = FALSE;
gboolean fs = FALSE;
gboolean aux = FALSE;
gboolean lm = FALSE;
gboolean lp = FALSE;
gboolean sel = FALSE;
gboolean alpha = FALSE;
gint lind = -1;
gint lnum = -1;
gimp = GIMP_ITEM_FACTORY (item_factory)->gimp;
if (data)
{
shell = GIMP_DISPLAY_SHELL (data);
gdisp = shell->gdisp;
}
#if 0
if (shell)
{
gdisp = shell->gdisp;
if (popup_only)
item_factory = GTK_ITEM_FACTORY (shell->popup_factory);
else
item_factory = GTK_ITEM_FACTORY (shell->menubar_factory);
}
else if (popup_only)
{
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path ("<Image>"));
}
#endif
if (gdisp)
{
GimpImageBaseType base_type;
gimage = gdisp->gimage;
base_type = gimp_image_base_type (gimage);
is_rgb = (base_type == GIMP_RGB);
is_gray = (base_type == GIMP_GRAY);
is_indexed = (base_type == GIMP_INDEXED);
fs = (gimp_image_floating_sel (gimage) != NULL);
aux = (gimp_image_get_active_channel (gimage) != NULL);
lp = ! gimp_image_is_empty (gimage);
sel = ! gimp_image_mask_is_empty (gimage);
drawable = gimp_image_active_drawable (gimage);
if (drawable)
drawable_type = gimp_drawable_type (drawable);
if (lp)
{
layer = gimp_image_get_active_layer (gimage);
if (layer)
{
lm = gimp_layer_get_mask (layer) ? TRUE : FALSE;
alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
lind = gimp_image_get_layer_index (gimage, layer);
}
lnum = gimp_container_num_children (gimage->layers);
}
}
gimp_context_get_foreground (gimp_get_user_context (gimp), &fg);
gimp_context_get_background (gimp_get_user_context (gimp), &bg);
#define SET_ACTIVE(menu,condition) \
gimp_item_factory_set_active (item_factory, menu, (condition) != 0)
#define SET_LABEL(menu,label) \
gimp_item_factory_set_label (item_factory, menu, (label))
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (item_factory, menu, (condition) != 0)
/* File */
SET_SENSITIVE ("/File/Save", gdisp && drawable);
SET_SENSITIVE ("/File/Save as...", gdisp && drawable);
SET_SENSITIVE ("/File/Save a Copy...", gdisp && drawable);
SET_SENSITIVE ("/File/Revert...", gdisp && GIMP_OBJECT (gimage)->name);
SET_SENSITIVE ("/File/Close", gdisp);
/* Edit */
{
gchar *undo_name = NULL;
gchar *redo_name = NULL;
if (gdisp && gimp_image_undo_is_enabled (gimage))
{
undo_name = (gchar *) undo_get_undo_name (gimage);
redo_name = (gchar *) undo_get_redo_name (gimage);
}
if (undo_name)
undo_name = g_strdup_printf (_("Undo %s"), gettext (undo_name));
if (redo_name)
redo_name = g_strdup_printf (_("Redo %s"), gettext (redo_name));
SET_LABEL ("/Edit/Undo", undo_name ? undo_name : _("Undo"));
SET_LABEL ("/Edit/Redo", redo_name ? redo_name : _("Redo"));
SET_SENSITIVE ("/Edit/Undo", undo_name);
SET_SENSITIVE ("/Edit/Redo", redo_name);
g_free (undo_name);
g_free (redo_name);
}
SET_SENSITIVE ("/Edit/Cut", lp);
SET_SENSITIVE ("/Edit/Copy", lp);
SET_SENSITIVE ("/Edit/Paste", gdisp && gimp->global_buffer);
SET_SENSITIVE ("/Edit/Paste Into", gdisp && gimp->global_buffer);
SET_SENSITIVE ("/Edit/Paste as New", gimp->global_buffer);
SET_SENSITIVE ("/Edit/Buffer/Cut Named...", lp);
SET_SENSITIVE ("/Edit/Buffer/Copy Named...", lp);
SET_SENSITIVE ("/Edit/Buffer/Paste Named...", lp);
SET_SENSITIVE ("/Edit/Clear", lp);
SET_SENSITIVE ("/Edit/Fill with FG Color", lp);
SET_SENSITIVE ("/Edit/Fill with BG Color", lp);
SET_SENSITIVE ("/Edit/Stroke", lp && sel);
/* Select */
SET_SENSITIVE ("/Select/Invert", lp && sel);
SET_SENSITIVE ("/Select/All", lp);
SET_SENSITIVE ("/Select/None", lp && sel);
SET_SENSITIVE ("/Select/Float", lp && sel);
SET_SENSITIVE ("/Select/Feather...", lp && sel);
SET_SENSITIVE ("/Select/Sharpen", lp && sel);
SET_SENSITIVE ("/Select/Shrink...", lp && sel);
SET_SENSITIVE ("/Select/Grow...", lp && sel);
SET_SENSITIVE ("/Select/Border...", lp && sel);
SET_SENSITIVE ("/Select/Toggle QuickMask", gdisp);
SET_SENSITIVE ("/Select/Save to Channel", lp && sel && !fs);
/* View */
SET_SENSITIVE ("/View/Zoom In", gdisp);
SET_SENSITIVE ("/View/Zoom Out", gdisp);
SET_SENSITIVE ("/View/Zoom to Fit Window", gdisp);
SET_SENSITIVE ("/View/Zoom/16:1", gdisp);
SET_SENSITIVE ("/View/Zoom/8:1", gdisp);
SET_SENSITIVE ("/View/Zoom/4:1", gdisp);
SET_SENSITIVE ("/View/Zoom/2:1", gdisp);
SET_SENSITIVE ("/View/Zoom/1:1", gdisp);
SET_SENSITIVE ("/View/Zoom/1:2", gdisp);
SET_SENSITIVE ("/View/Zoom/1:4", gdisp);
SET_SENSITIVE ("/View/Zoom/1:8", gdisp);
SET_SENSITIVE ("/View/Zoom/1:16", gdisp);
SET_SENSITIVE ("/View/Dot for Dot", gdisp);
SET_ACTIVE ("/View/Dot for Dot", gdisp && shell->dot_for_dot);
SET_SENSITIVE ("/View/Info Window...", gdisp);
SET_SENSITIVE ("/View/Navigation Window...", gdisp);
SET_SENSITIVE ("/View/Display Filters...", gdisp);
SET_SENSITIVE ("/View/Show Selection", gdisp);
SET_ACTIVE ("/View/Show Selection", gdisp && ! shell->select->hidden);
SET_SENSITIVE ("/View/Show Layer Boundary", gdisp);
SET_ACTIVE ("/View/Show Layer Boundary", gdisp && ! shell->select->layer_hidden);
SET_SENSITIVE ("/View/Show Guides", gdisp);
SET_ACTIVE ("/View/Show Guides", gdisp && gdisp->draw_guides);
SET_SENSITIVE ("/View/Snap to Guides", gdisp);
SET_ACTIVE ("/View/Snap to Guides", gdisp && gdisp->snap_to_guides);
SET_SENSITIVE ("/View/Show Menubar", gdisp);
SET_ACTIVE ("/View/Show Menubar",
gdisp &&
GTK_WIDGET_VISIBLE (GTK_ITEM_FACTORY (shell->menubar_factory)->widget));
SET_SENSITIVE ("/View/Show Rulers", gdisp);
SET_ACTIVE ("/View/Show Rulers",
gdisp && GTK_WIDGET_VISIBLE (shell->hrule));
SET_SENSITIVE ("/View/Show Statusbar", gdisp);
SET_ACTIVE ("/View/Show Statusbar",
gdisp && GTK_WIDGET_VISIBLE (shell->statusbar));
SET_SENSITIVE ("/View/New View", gdisp);
SET_SENSITIVE ("/View/Shrink Wrap", gdisp);
/* Image */
SET_SENSITIVE ("/Image/Mode/RGB", gdisp && ! is_rgb);
SET_SENSITIVE ("/Image/Mode/Grayscale", gdisp && ! is_gray);
SET_SENSITIVE ("/Image/Mode/Indexed...", gdisp && ! is_indexed);
SET_SENSITIVE ("/Image/Canvas Size...", gdisp);
SET_SENSITIVE ("/Image/Scale Image...", gdisp);
SET_SENSITIVE ("/Image/Crop Image", gdisp && sel);
SET_SENSITIVE ("/Image/Duplicate", gdisp);
SET_SENSITIVE ("/Image/Merge Visible Layers...", gdisp && !fs && !aux && lp);
SET_SENSITIVE ("/Image/Flatten Image", gdisp && !fs && !aux && lp);
SET_SENSITIVE ("/Image/Undo History...", gdisp);
/* Layer */
SET_SENSITIVE ("/Layer/Stack/Previous Layer",
lp && !fs && !aux && lind > 0);
SET_SENSITIVE ("/Layer/Stack/Next Layer",
lp && !fs && !aux && lind < (lnum - 1));
SET_SENSITIVE ("/Layer/Stack/Raise Layer",
lp && !fs && !aux && alpha && lind > 0);
SET_SENSITIVE ("/Layer/Stack/Lower Layer",
lp && !fs && !aux && alpha && lind < (lnum - 1));
SET_SENSITIVE ("/Layer/Stack/Layer to Top",
lp && !fs && !aux && alpha && lind > 0);
SET_SENSITIVE ("/Layer/Stack/Layer to Bottom",
lp && !fs && !aux && alpha && lind < (lnum - 1));
SET_SENSITIVE ("/Layer/New Layer...", gdisp);
SET_SENSITIVE ("/Layer/Duplicate Layer", lp && !fs && !aux);
SET_SENSITIVE ("/Layer/Anchor Layer", lp && fs && !aux);
SET_SENSITIVE ("/Layer/Merge Down", lp && !fs && !aux);
SET_SENSITIVE ("/Layer/Delete Layer", lp && !aux);
SET_SENSITIVE ("/Layer/Layer Boundary Size...", lp && !aux);
SET_SENSITIVE ("/Layer/Layer to Imagesize", lp && !aux);
SET_SENSITIVE ("/Layer/Scale Layer...", lp && !aux);
SET_SENSITIVE ("/Layer/Crop Layer", lp && !aux && sel);
SET_SENSITIVE ("/Layer/Transform/Offset...", lp);
SET_SENSITIVE ("/Layer/Colors/Color Balance...", lp && is_rgb);
SET_SENSITIVE ("/Layer/Colors/Hue-Saturation...", lp && is_rgb);
SET_SENSITIVE ("/Layer/Colors/Brightness-Contrast...", lp && ! is_indexed);
SET_SENSITIVE ("/Layer/Colors/Threshold...", lp && ! is_indexed);
SET_SENSITIVE ("/Layer/Colors/Levels...", lp && ! is_indexed);
SET_SENSITIVE ("/Layer/Colors/Curves...", lp && ! is_indexed);
SET_SENSITIVE ("/Layer/Colors/Desaturate", lp && is_rgb);
SET_SENSITIVE ("/Layer/Colors/Posterize...", lp && ! is_indexed);
SET_SENSITIVE ("/Layer/Colors/Invert", lp && ! is_indexed);
SET_SENSITIVE ("/Layer/Colors/Auto/Equalize", lp && ! is_indexed);
SET_SENSITIVE ("/Layer/Colors/Histogram...", lp);
SET_SENSITIVE ("/Layer/Mask/Add Layer Mask...", lp && !aux && !lm && alpha && ! is_indexed);
SET_SENSITIVE ("/Layer/Mask/Apply Layer Mask", lp && !aux && lm);
SET_SENSITIVE ("/Layer/Mask/Delete Layer Mask", lp && !aux && lm);
SET_SENSITIVE ("/Layer/Mask/Mask to Selection", lp && !aux && lm);
SET_SENSITIVE ("/Layer/Alpha/Alpha to Selection", lp && !aux && alpha);
SET_SENSITIVE ("/Layer/Alpha/Add Alpha Channel", lp && !aux && !fs && !lm && !alpha);
#undef SET_ACTIVE
#undef SET_LABEL
#undef SET_SENSITIVE
plug_in_set_menu_sensitivity (GIMP_ITEM_FACTORY (item_factory), drawable_type);
#if 0
/* update the popup menu */
if (! popup_only)
{
GimpContext *user_context;
user_context = gimp_get_user_context (gimp);
if (shell)
{
if (gimp_context_get_display (user_context) == gdisp)
gimp_display_shell_set_menu_sensitivity (shell, gdisp->gimage->gimp,
TRUE);
}
else
{
gimp_display_shell_set_menu_sensitivity (NULL, gdisp->gimage->gimp,
TRUE);
}
}
#endif
}
GimpGuide *
gimp_display_shell_find_guide (GimpDisplayShell *shell,
gdouble x,

View File

@ -176,9 +176,6 @@ void gimp_display_shell_reconnect (GimpDisplayShell *shell);
void gimp_display_shell_scaled (GimpDisplayShell *shell);
void gimp_display_shell_scrolled (GimpDisplayShell *shell);
void gimp_display_shell_menu_update (GtkItemFactory *item_factory,
gpointer data);
GimpGuide * gimp_display_shell_find_guide (GimpDisplayShell *shell,
gdouble x,
gdouble y);

View File

@ -2,48 +2,23 @@
noinst_LIBRARIES = libappgui.a
libappgui_a_SOURCES = \
dialogs_sources = \
about-dialog.c \
about-dialog.h \
authors.h \
brush-select.c \
brush-select.h \
brushes-commands.c \
brushes-commands.h \
buffers-commands.c \
buffers-commands.h \
channels-commands.c \
channels-commands.h \
color-history.c \
color-history.h \
color-notebook.c \
color-notebook.h \
colormap-editor-commands.c \
colormap-editor-commands.h \
convert-dialog.c \
convert-dialog.h \
data-commands.c \
data-commands.h \
debug-commands.c \
debug-commands.h \
device-status-dialog.c \
device-status-dialog.h \
dialogs.c \
dialogs.h \
dialogs-commands.c \
dialogs-commands.h \
dialogs-constructors.c \
dialogs-constructors.h \
documents-commands.c \
documents-commands.h \
drawable-commands.c \
drawable-commands.h \
edit-commands.c \
edit-commands.h \
error-console-dialog.c \
error-console-dialog.h \
file-commands.c \
file-commands.h \
file-dialog-utils.c \
file-dialog-utils.h \
file-new-dialog.c \
@ -52,82 +27,147 @@ libappgui_a_SOURCES = \
file-open-dialog.h \
file-save-dialog.c \
file-save-dialog.h \
gradient-editor-commands.c \
gradient-editor-commands.h \
gradient-select.h \
gradient-select.c \
gradients-commands.c \
gradients-commands.h \
gui.c \
gui.h \
gui-types.h \
help-commands.c \
help-commands.h \
image-commands.c \
image-commands.h \
images-commands.c \
images-commands.h \
gradient-select.h \
info-dialog.c \
info-dialog.h \
info-window.c \
info-window.h \
layers-commands.c \
layers-commands.h \
menus.c \
menus.h \
module-browser.c \
module-browser.h \
offset-dialog.c \
offset-dialog.h \
palette-editor-commands.c \
palette-editor-commands.h \
palette-import-dialog.c \
palette-import-dialog.h \
palette-select.c \
palette-select.h \
palettes-commands.c \
palettes-commands.h \
paths-dialog.c \
paths-dialog.h \
pattern-select.c \
pattern-select.h \
patterns-commands.c \
patterns-commands.h \
plug-in-commands.c \
plug-in-commands.h \
plug-in-menus.c \
plug-in-menus.h \
preferences-dialog.c \
preferences-dialog.h \
qmask-commands.c \
qmask-commands.h \
resize-dialog.c \
resize-dialog.h \
resolution-calibrate-dialog.c \
resolution-calibrate-dialog.h \
select-commands.c \
select-commands.h \
session.c \
session.h \
splash.c \
splash.h \
test-commands.c \
test-commands.h \
tips-dialog.c \
tips-dialog.h \
tips-parser.c \
tips-parser.h \
tool-options-dialog.c \
tool-options-dialog.h \
user-install-dialog.c \
user-install-dialog.h
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 \
documents-commands.c \
documents-commands.h \
documents-menu.c \
documents-menu.h \
drawable-commands.c \
drawable-commands.h \
edit-commands.c \
edit-commands.h \
file-commands.c \
file-commands.h \
file-open-menu.c \
file-open-menu.h \
file-save-menu.c \
file-save-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 \
test-commands.c \
test-commands.h \
toolbox-menu.c \
toolbox-menu.h \
tools-commands.c \
tools-commands.h \
user-install-dialog.c \
user-install-dialog.h \
vectors-commands.c \
vectors-commands.h \
vectors-menu.c \
vectors-menu.h \
view-commands.c \
view-commands.h
libappgui_a_SOURCES = \
$(dialogs_sources) \
$(menus_sources) \
authors.h \
color-history.c \
color-history.h \
gui.c \
gui.h \
gui-types.h \
session.c \
session.h \
splash.c \
splash.h
EXTRA_DIST = makefile.msc
AM_CPPFLAGS = \

View File

@ -20,21 +20,59 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimpbrushgenerated.h"
#include "core/gimpcontext.h"
#include "core/gimpdata.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimpitemfactory.h"
#include "brushes-commands.h"
#include "brushes-menu.h"
#include "data-commands.h"
#include "menus.h"
#include "libgimp/gimpintl.h"
/* public functions */
GimpItemFactoryEntry brushes_menu_entries[] =
{
{ { N_("/New Brush"), NULL,
data_new_data_cmd_callback, 0,
"<StockItem>", GTK_STOCK_NEW },
NULL,
NULL, NULL },
{ { N_("/Duplicate Brush"), NULL,
data_duplicate_data_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_DUPLICATE },
NULL,
NULL, NULL },
{ { N_("/Edit Brush..."), NULL,
data_edit_data_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_EDIT },
NULL,
NULL, NULL },
{ { N_("/Delete Brush..."), NULL,
data_delete_data_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
NULL,
NULL, NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Refresh Brushes"), NULL,
data_refresh_data_cmd_callback, 0,
"<StockItem>", GTK_STOCK_REFRESH },
NULL,
NULL, NULL }
};
gint n_brushes_menu_entries = G_N_ELEMENTS (brushes_menu_entries);
void
brushes_menu_update (GtkItemFactory *factory,

View File

@ -16,12 +16,16 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __BRUSHES_COMMANDS_H__
#define __BRUSHES_COMMANDS_H__
#ifndef __BRUSHES_MENU_H__
#define __BRUSHES_MENU_H__
extern GimpItemFactoryEntry brushes_menu_entries[];
extern gint n_brushes_menu_entries;
void brushes_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __BRUSHES_COMMANDS_H__ */
#endif /* __BRUSHES_MENU_H__ */

View File

@ -20,18 +20,9 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimpbuffer.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "widgets/gimpbufferview.h"
#include "widgets/gimpcontainerlistview.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimplistitem.h"
#include "buffers-commands.h"
@ -83,25 +74,3 @@ buffers_delete_buffer_cmd_callback (GtkWidget *widget,
gtk_button_clicked (GTK_BUTTON (view->delete_button));
}
void
buffers_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpBuffer *buffer;
editor = GIMP_CONTAINER_EDITOR (data);
buffer = gimp_context_get_buffer (editor->view->context);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Paste Buffer", buffer);
SET_SENSITIVE ("/Paste Buffer Into", buffer);
SET_SENSITIVE ("/Paste Buffer as New", buffer);
SET_SENSITIVE ("/Delete Buffer", buffer);
#undef SET_SENSITIVE
}

View File

@ -29,8 +29,5 @@ void buffers_paste_buffer_as_new_cmd_callback (GtkWidget *widget,
void buffers_delete_buffer_cmd_callback (GtkWidget *widget,
gpointer data);
void buffers_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __BUFFERS_COMMANDS_H__ */

86
app/gui/buffers-menu.c Normal file
View File

@ -0,0 +1,86 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimpcontext.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpitemfactory.h"
#include "buffers-commands.h"
#include "buffers-menu.h"
#include "libgimp/gimpintl.h"
GimpItemFactoryEntry buffers_menu_entries[] =
{
{ { N_("/Paste Buffer"), NULL,
buffers_paste_buffer_cmd_callback, 0,
"<StockItem>", GTK_STOCK_PASTE },
NULL,
NULL, NULL },
{ { N_("/Paste Buffer Into"), NULL,
buffers_paste_buffer_into_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_PASTE_INTO },
NULL,
NULL, NULL },
{ { N_("/Paste Buffer as New"), NULL,
buffers_paste_buffer_as_new_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_PASTE_AS_NEW },
NULL,
NULL, NULL },
{ { N_("/Delete Buffer"), NULL,
buffers_delete_buffer_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
NULL,
NULL, NULL }
};
gint n_buffers_menu_entries = G_N_ELEMENTS (buffers_menu_entries);
void
buffers_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpBuffer *buffer;
editor = GIMP_CONTAINER_EDITOR (data);
buffer = gimp_context_get_buffer (editor->view->context);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Paste Buffer", buffer);
SET_SENSITIVE ("/Paste Buffer Into", buffer);
SET_SENSITIVE ("/Paste Buffer as New", buffer);
SET_SENSITIVE ("/Delete Buffer", buffer);
#undef SET_SENSITIVE
}

31
app/gui/buffers-menu.h Normal file
View File

@ -0,0 +1,31 @@
/* 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_MENU_H__
#define __BUFFERS_MENU_H__
extern GimpItemFactoryEntry buffers_menu_entries[];
extern gint n_buffers_menu_entries;
void buffers_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __BUFFERS_MENU_H__ */

View File

@ -33,10 +33,8 @@
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimpimage-mask-select.h"
#include "core/gimplist.h"
#include "widgets/gimpcolorpanel.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpitemlistview.h"
#include "widgets/gimpviewabledialog.h"
@ -539,52 +537,6 @@ channels_edit_channel_query (GimpChannel *channel)
gtk_widget_show (options->query_box);
}
void
channels_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpImage *gimage;
GimpChannel *channel;
gboolean fs;
GList *list;
GList *next = NULL;
GList *prev = NULL;
gimage = GIMP_ITEM_LIST_VIEW (data)->gimage;
channel = gimp_image_get_active_channel (gimage);
fs = (gimp_image_floating_sel (gimage) != NULL);
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;
}
}
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/New Channel...", !fs);
SET_SENSITIVE ("/Raise Channel", !fs && channel && prev);
SET_SENSITIVE ("/Lower Channel", !fs && channel && next);
SET_SENSITIVE ("/Duplicate Channel", !fs && channel);
SET_SENSITIVE ("/Channel to Selection", !fs && channel);
SET_SENSITIVE ("/Add to Selection", !fs && channel);
SET_SENSITIVE ("/Subtract from Selection", !fs && channel);
SET_SENSITIVE ("/Intersect with Selection", !fs && channel);
SET_SENSITIVE ("/Delete Channel", !fs && channel);
SET_SENSITIVE ("/Edit Channel Attributes...", !fs && channel);
#undef SET_SENSITIVE
}
/* private functions */

View File

@ -46,8 +46,5 @@ void channels_new_channel_query (GimpImage *gimage,
gboolean interactive);
void channels_edit_channel_query (GimpChannel *channel);
void channels_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __CHANNELS_COMMANDS_H__ */

150
app/gui/channels-menu.c Normal file
View File

@ -0,0 +1,150 @@
/* 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 "gui-types.h"
#include "core/gimpimage.h"
#include "core/gimplist.h"
#include "widgets/gimpitemlistview.h"
#include "widgets/gimpitemfactory.h"
#include "channels-commands.h"
#include "channels-menu.h"
#include "menus.h"
#include "libgimp/gimpintl.h"
GimpItemFactoryEntry channels_menu_entries[] =
{
{ { N_("/New Channel..."), "<control>N",
channels_new_channel_cmd_callback, 0,
"<StockItem>", GTK_STOCK_NEW },
NULL,
"dialogs/new_channel.html", NULL },
{ { N_("/Raise Channel"), "<control>F",
channels_raise_channel_cmd_callback, 0,
"<StockItem>", GTK_STOCK_GO_UP },
NULL,
"raise_channel.html", NULL },
{ { N_("/Lower Channel"), "<control>B",
channels_lower_channel_cmd_callback, 0,
"<StockItem>", GTK_STOCK_GO_DOWN },
NULL,
"lower_channel.html", NULL },
{ { N_("/Duplicate Channel"), "<control>C",
channels_duplicate_channel_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_DUPLICATE },
NULL,
"duplicate_channel.html", NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Channel to Selection"), "<control>S",
channels_channel_to_sel_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_SELECTION_REPLACE },
NULL,
"channel_to_selection.html", NULL },
{ { N_("/Add to Selection"), NULL,
channels_add_channel_to_sel_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_SELECTION_ADD },
NULL,
"channel_to_selection.html#add", NULL },
{ { N_("/Subtract from Selection"), NULL,
channels_sub_channel_from_sel_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_SELECTION_SUBTRACT },
NULL,
"channel_to_selection.html#subtract", NULL },
{ { N_("/Intersect with Selection"), NULL,
channels_intersect_channel_with_sel_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_SELECTION_INTERSECT },
NULL,
"channel_to_selection.html#intersect", NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Delete Channel"), "<control>X",
channels_delete_channel_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
NULL,
"delete_channel.html", NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Edit Channel Attributes..."), NULL,
channels_edit_channel_attributes_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_EDIT },
NULL,
"dialogs/edit_channel_attributes.html", NULL }
};
gint n_channels_menu_entries = G_N_ELEMENTS (channels_menu_entries);
void
channels_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpImage *gimage;
GimpChannel *channel;
gboolean fs;
GList *list;
GList *next = NULL;
GList *prev = NULL;
gimage = GIMP_ITEM_LIST_VIEW (data)->gimage;
channel = gimp_image_get_active_channel (gimage);
fs = (gimp_image_floating_sel (gimage) != NULL);
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;
}
}
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/New Channel...", !fs);
SET_SENSITIVE ("/Raise Channel", !fs && channel && prev);
SET_SENSITIVE ("/Lower Channel", !fs && channel && next);
SET_SENSITIVE ("/Duplicate Channel", !fs && channel);
SET_SENSITIVE ("/Channel to Selection", !fs && channel);
SET_SENSITIVE ("/Add to Selection", !fs && channel);
SET_SENSITIVE ("/Subtract from Selection", !fs && channel);
SET_SENSITIVE ("/Intersect with Selection", !fs && channel);
SET_SENSITIVE ("/Delete Channel", !fs && channel);
SET_SENSITIVE ("/Edit Channel Attributes...", !fs && channel);
#undef SET_SENSITIVE
}

31
app/gui/channels-menu.h Normal file
View File

@ -0,0 +1,31 @@
/* 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_MENU_H__
#define __CHANNELS_MENU_H__
extern GimpItemFactoryEntry channels_menu_entries[];
extern gint n_channels_menu_entries;
void channels_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __CHANNELS_MENU_H__ */

View File

@ -27,11 +27,9 @@
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "widgets/gimpcolormapeditor.h"
#include "widgets/gimpitemfactory.h"
#include "color-notebook.h"
#include "colormap-editor-commands.h"
@ -115,32 +113,6 @@ colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
}
}
void
colormap_editor_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpColormapEditor *editor;
GimpImage *gimage;
gint num_colors = 0;
editor = GIMP_COLORMAP_EDITOR (data);
gimage = editor->gimage;
if (gimage)
{
num_colors = gimage->num_cols;
}
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Add Color", gimage && num_colors < 256);
SET_SENSITIVE ("/Edit Color...", gimage);
#undef SET_SENSITIVE
}
/* private functions */

View File

@ -27,8 +27,5 @@ void colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void colormap_editor_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __COLORMAP_EDITOR_COMMANDS_H__ */

View File

@ -0,0 +1,79 @@
/* 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 "gui-types.h"
#include "core/gimpimage.h"
#include "widgets/gimpcolormapeditor.h"
#include "widgets/gimpitemfactory.h"
#include "colormap-editor-commands.h"
#include "colormap-editor-menu.h"
#include "libgimp/gimpintl.h"
GimpItemFactoryEntry colormap_editor_menu_entries[] =
{
{ { N_("/Add Color"), NULL,
colormap_editor_add_color_cmd_callback, 0,
"<StockItem>", GTK_STOCK_NEW },
NULL,
NULL, NULL },
{ { N_("/Edit Color..."), NULL,
colormap_editor_edit_color_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_EDIT },
NULL,
NULL, NULL },
};
gint n_colormap_editor_menu_entries = G_N_ELEMENTS (colormap_editor_menu_entries);
void
colormap_editor_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpColormapEditor *editor;
GimpImage *gimage;
gint num_colors = 0;
editor = GIMP_COLORMAP_EDITOR (data);
gimage = editor->gimage;
if (gimage)
{
num_colors = gimage->num_cols;
}
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Add Color", gimage && num_colors < 256);
SET_SENSITIVE ("/Edit Color...", gimage);
#undef SET_SENSITIVE
}

View File

@ -0,0 +1,31 @@
/* 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_MENU_H__
#define __COLORMAP_EDITOR_MENU_H__
extern GimpItemFactoryEntry colormap_editor_menu_entries[];
extern gint n_colormap_editor_menu_entries;
void colormap_editor_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __COLORMAP_EDITOR_MENU_H__ */

View File

@ -24,15 +24,12 @@
#include "gui-types.h"
#include "core/gimpcontext.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/gimpitemfactory.h"
#include "dialogs.h"
#include "dialogs-commands.h"
@ -398,151 +395,3 @@ dialogs_show_toolbox (void)
}
}
}
void
dialogs_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpDockbook *dockbook;
dockbook = GIMP_DOCKBOOK (data);
if (dockbook)
{
GimpDockable *dockable;
gint page_num;
GimpDialogFactoryEntry *entry;
GimpContainerView *view;
GimpViewType view_type = -1;
gboolean other_view_type = FALSE;
GimpPreviewSize preview_size = GIMP_PREVIEW_SIZE_NONE;
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));
dockable = (GimpDockable *)
gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num);
entry = g_object_get_data (G_OBJECT (dockable),
"gimp-dialog-factory-entry");
if (entry)
{
gchar *identifier;
gchar *substring = NULL;
identifier = g_strdup (entry->identifier);
if ((substring = strstr (identifier, "grid")))
view_type = GIMP_VIEW_TYPE_GRID;
else if ((substring = strstr (identifier, "list")))
view_type = GIMP_VIEW_TYPE_LIST;
if (substring)
{
if (view_type == GIMP_VIEW_TYPE_GRID)
memcpy (substring, "list", 4);
else if (view_type == GIMP_VIEW_TYPE_LIST)
memcpy (substring, "grid", 4);
if (gimp_dialog_factory_find_entry (dockbook->dock->dialog_factory,
identifier))
other_view_type = TRUE;
}
g_free (identifier);
}
view = gimp_container_view_get_by_dockable (dockable);
if (view)
preview_size = view->preview_size;
#define SET_ACTIVE(path,active) \
gimp_item_factory_set_active (factory, (path), (active))
#define SET_VISIBLE(path,active) \
gimp_item_factory_set_visible (factory, (path), (active))
#define SET_SENSITIVE(path,sensitive) \
gimp_item_factory_set_sensitive (factory, (path), (sensitive))
SET_VISIBLE ("/view-type-separator",
preview_size != GIMP_PREVIEW_SIZE_NONE || view_type != -1);
SET_VISIBLE ("/Preview Size", preview_size != GIMP_PREVIEW_SIZE_NONE);
if (preview_size != GIMP_PREVIEW_SIZE_NONE)
{
if (preview_size >= GIMP_PREVIEW_SIZE_GIGANTIC)
{
SET_ACTIVE ("/Preview Size/Gigantic", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_ENORMOUS)
{
SET_ACTIVE ("/Preview Size/Enormous", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_HUGE)
{
SET_ACTIVE ("/Preview Size/Huge", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_LARGE)
{
SET_ACTIVE ("/Preview Size/Extra Large", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_LARGE)
{
SET_ACTIVE ("/Preview Size/Large", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_MEDIUM)
{
SET_ACTIVE ("/Preview Size/Medium", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_SMALL)
{
SET_ACTIVE ("/Preview Size/Small", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_SMALL)
{
SET_ACTIVE ("/Preview Size/Extra Small", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_TINY)
{
SET_ACTIVE ("/Preview Size/Tiny", TRUE);
}
}
SET_VISIBLE ("/View as Grid", view_type != -1);
SET_VISIBLE ("/View as List", view_type != -1);
if (view_type != -1)
{
if (view_type == GIMP_VIEW_TYPE_LIST)
SET_ACTIVE ("/View as List", TRUE);
else
SET_ACTIVE ("/View as Grid", TRUE);
SET_SENSITIVE ("/View as Grid", other_view_type);
SET_SENSITIVE ("/View as List", other_view_type);
}
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
{
SET_VISIBLE ("/image-menu-separator", TRUE);
SET_VISIBLE ("/Show Image Menu", TRUE);
SET_VISIBLE ("/Auto Follow Active Image", TRUE);
SET_ACTIVE ("/Show Image Menu",
GIMP_IMAGE_DOCK (dockbook->dock)->show_image_menu);
SET_ACTIVE ("/Auto Follow Active Image",
GIMP_IMAGE_DOCK (dockbook->dock)->auto_follow_active);
}
else
{
SET_VISIBLE ("/image-menu-separator", FALSE);
SET_VISIBLE ("/Show Image Menu", FALSE);
SET_VISIBLE ("/Auto Follow Active Image", FALSE);
}
#undef SET_ACTIVE
#undef SET_VISIBLE
#undef SET_SENSITIVE
}
}

View File

@ -60,8 +60,5 @@ void dialogs_create_stuff_cmd_callback (GtkWidget *widget,
void dialogs_show_toolbox (void);
void dialogs_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __DIALOGS_COMMANDS_H__ */

View File

@ -26,7 +26,6 @@
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpbrushgenerated.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpgradient.h"
@ -49,7 +48,6 @@
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpimagedock.h"
#include "widgets/gimpimageview.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpitemlistview.h"
#include "widgets/gimpdockable.h"
#include "widgets/gimpdockbook.h"
@ -70,21 +68,15 @@
#include "display/gimpnavigationview.h"
#include "about-dialog.h"
#include "brushes-commands.h"
#include "buffers-commands.h"
#include "channels-commands.h"
#include "device-status-dialog.h"
#include "dialogs.h"
#include "dialogs-constructors.h"
#include "documents-commands.h"
#include "error-console-dialog.h"
#include "file-commands.h"
#include "gradients-commands.h"
#include "layers-commands.h"
#include "module-browser.h"
#include "palettes-commands.h"
#include "paths-dialog.h"
#include "patterns-commands.h"
#include "preferences-dialog.h"
#include "tips-dialog.h"
#include "tool-options-dialog.h"

291
app/gui/dialogs-menu.c Normal file
View File

@ -0,0 +1,291 @@
/* 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 <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpcontainerview-utils.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpdockbook.h"
#include "widgets/gimpimagedock.h"
#include "widgets/gimpitemfactory.h"
#include "dialogs-commands.h"
#include "dialogs-menu.h"
#include "menus.h"
#include "libgimp/gimpintl.h"
#define ADD_TAB(path,id,type,stock_id) \
{ { (path), "foo", dialogs_add_tab_cmd_callback, 0, (type), (stock_id) }, \
(id), NULL, NULL }
#define PREVIEW_SIZE(path,size) \
{ { (path), NULL, dialogs_preview_size_cmd_callback, \
(size), "/Preview Size/Tiny" }, NULL, NULL, NULL }
GimpItemFactoryEntry dialogs_menu_entries[] =
{
{ { N_("/Select Tab"), NULL, NULL, 0 },
NULL, NULL, NULL },
ADD_TAB (N_("/Add Tab/Tool Options..."), "gimp-tool-options",
"<StockItem>", GIMP_STOCK_TOOL_OPTIONS),
MENU_SEPARATOR ("/Add Tab/---"),
ADD_TAB (N_("/Add Tab/Layers..."), "gimp-layer-list", NULL, NULL),
ADD_TAB (N_("/Add Tab/Channels..."), "gimp-channel-list", NULL, NULL),
ADD_TAB (N_("/Add Tab/Paths..."), "gimp-vectors-list", NULL, NULL),
ADD_TAB (N_("/Add Tab/Indexed Palette..."), "gimp-indexed-palette",
"<StockItem>", GTK_STOCK_SELECT_COLOR),
ADD_TAB (N_("/Add Tab/Selection Editor..."), "gimp-selection-editor",
"<StockItem>", GIMP_STOCK_TOOL_RECT_SELECT),
ADD_TAB (N_("/Add Tab/Navigation..."), "gimp-navigation-view",
"<StockItem>", GIMP_STOCK_NAVIGATION),
MENU_SEPARATOR ("/Add Tab/---"),
ADD_TAB (N_("/Add Tab/Colors..."), "gimp-color-editor",
"<StockItem>", GTK_STOCK_SELECT_COLOR),
ADD_TAB (N_("/Add Tab/Brushes..."), "gimp-brush-grid",
"<StockItem>", GIMP_STOCK_TOOL_PAINTBRUSH),
ADD_TAB (N_("/Add Tab/Patterns..."), "gimp-pattern-grid",
"<StockItem>", GIMP_STOCK_TOOL_BUCKET_FILL),
ADD_TAB (N_("/Add Tab/Gradients..."), "gimp-gradient-list",
"<StockItem>", GIMP_STOCK_TOOL_BLEND),
ADD_TAB (N_("/Add Tab/Palettes..."), "gimp-palette-list",
"<StockItem>", GTK_STOCK_SELECT_COLOR),
ADD_TAB (N_("/Add Tab/Buffers..."), "gimp-buffer-list",
"<StockItem>", GTK_STOCK_PASTE),
MENU_SEPARATOR ("/Add Tab/---"),
ADD_TAB (N_("/Add Tab/Images..."), "gimp-image-list", NULL, NULL),
ADD_TAB (N_("/Add Tab/Document History..."), "gimp-document-history",
"<StockItem>", GTK_STOCK_OPEN),
ADD_TAB (N_("/Add Tab/Error Console..."), "gimp-error-console",
"<StockItem>", GIMP_STOCK_WARNING),
MENU_SEPARATOR ("/Add Tab/---"),
ADD_TAB (N_("/Add Tab/Tools..."), "gimp-tool-list", NULL, NULL),
ADD_TAB (N_("/Add Tab/Old Paths..."), "gimp-path-list", NULL, NULL),
{ { N_("/Remove Tab"), NULL,
dialogs_remove_tab_cmd_callback, 0,
"<StockItem>", GTK_STOCK_REMOVE },
NULL, NULL, NULL },
MENU_SEPARATOR ("/view-type-separator"),
MENU_BRANCH ("/Preview Size"),
{ { N_("/Preview Size/Tiny"), NULL,
dialogs_preview_size_cmd_callback,
GIMP_PREVIEW_SIZE_TINY, "<RadioItem>" },
NULL, NULL, NULL },
PREVIEW_SIZE (N_("/Preview Size/Extra Small"), GIMP_PREVIEW_SIZE_EXTRA_SMALL),
PREVIEW_SIZE (N_("/Preview Size/Small"), GIMP_PREVIEW_SIZE_SMALL),
PREVIEW_SIZE (N_("/Preview Size/Medium"), GIMP_PREVIEW_SIZE_MEDIUM),
PREVIEW_SIZE (N_("/Preview Size/Large"), GIMP_PREVIEW_SIZE_LARGE),
PREVIEW_SIZE (N_("/Preview Size/Extra Large"), GIMP_PREVIEW_SIZE_EXTRA_LARGE),
PREVIEW_SIZE (N_("/Preview Size/Huge"), GIMP_PREVIEW_SIZE_HUGE),
PREVIEW_SIZE (N_("/Preview Size/Enormous"), GIMP_PREVIEW_SIZE_ENORMOUS),
PREVIEW_SIZE (N_("/Preview Size/Gigantic"), GIMP_PREVIEW_SIZE_GIGANTIC),
{ { N_("/View as List"), NULL,
dialogs_toggle_view_cmd_callback, GIMP_VIEW_TYPE_LIST, "<RadioItem>" },
NULL, NULL, NULL },
{ { N_("/View as Grid"), NULL,
dialogs_toggle_view_cmd_callback, GIMP_VIEW_TYPE_GRID, "/View as List" },
NULL, NULL, NULL },
MENU_SEPARATOR ("/image-menu-separator"),
{ { N_("/Show Image Menu"), NULL,
dialogs_toggle_image_menu_cmd_callback, 0, "<ToggleItem>" },
NULL, NULL, NULL },
{ { N_("/Auto Follow Active Image"), NULL,
dialogs_toggle_auto_cmd_callback, 0, "<ToggleItem>" },
NULL, NULL, NULL }
};
#undef ADD_TAB
#undef PREVIEW_SIZE
gint n_dialogs_menu_entries = G_N_ELEMENTS (dialogs_menu_entries);
void
dialogs_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpDockbook *dockbook;
dockbook = GIMP_DOCKBOOK (data);
if (dockbook)
{
GimpDockable *dockable;
gint page_num;
GimpDialogFactoryEntry *entry;
GimpContainerView *view;
GimpViewType view_type = -1;
gboolean other_view_type = FALSE;
GimpPreviewSize preview_size = GIMP_PREVIEW_SIZE_NONE;
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook));
dockable = (GimpDockable *)
gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num);
entry = g_object_get_data (G_OBJECT (dockable),
"gimp-dialog-factory-entry");
if (entry)
{
gchar *identifier;
gchar *substring = NULL;
identifier = g_strdup (entry->identifier);
if ((substring = strstr (identifier, "grid")))
view_type = GIMP_VIEW_TYPE_GRID;
else if ((substring = strstr (identifier, "list")))
view_type = GIMP_VIEW_TYPE_LIST;
if (substring)
{
if (view_type == GIMP_VIEW_TYPE_GRID)
memcpy (substring, "list", 4);
else if (view_type == GIMP_VIEW_TYPE_LIST)
memcpy (substring, "grid", 4);
if (gimp_dialog_factory_find_entry (dockbook->dock->dialog_factory,
identifier))
other_view_type = TRUE;
}
g_free (identifier);
}
view = gimp_container_view_get_by_dockable (dockable);
if (view)
preview_size = view->preview_size;
#define SET_ACTIVE(path,active) \
gimp_item_factory_set_active (factory, (path), (active))
#define SET_VISIBLE(path,active) \
gimp_item_factory_set_visible (factory, (path), (active))
#define SET_SENSITIVE(path,sensitive) \
gimp_item_factory_set_sensitive (factory, (path), (sensitive))
SET_VISIBLE ("/view-type-separator",
preview_size != GIMP_PREVIEW_SIZE_NONE || view_type != -1);
SET_VISIBLE ("/Preview Size", preview_size != GIMP_PREVIEW_SIZE_NONE);
if (preview_size != GIMP_PREVIEW_SIZE_NONE)
{
if (preview_size >= GIMP_PREVIEW_SIZE_GIGANTIC)
{
SET_ACTIVE ("/Preview Size/Gigantic", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_ENORMOUS)
{
SET_ACTIVE ("/Preview Size/Enormous", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_HUGE)
{
SET_ACTIVE ("/Preview Size/Huge", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_LARGE)
{
SET_ACTIVE ("/Preview Size/Extra Large", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_LARGE)
{
SET_ACTIVE ("/Preview Size/Large", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_MEDIUM)
{
SET_ACTIVE ("/Preview Size/Medium", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_SMALL)
{
SET_ACTIVE ("/Preview Size/Small", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_EXTRA_SMALL)
{
SET_ACTIVE ("/Preview Size/Extra Small", TRUE);
}
else if (preview_size >= GIMP_PREVIEW_SIZE_TINY)
{
SET_ACTIVE ("/Preview Size/Tiny", TRUE);
}
}
SET_VISIBLE ("/View as Grid", view_type != -1);
SET_VISIBLE ("/View as List", view_type != -1);
if (view_type != -1)
{
if (view_type == GIMP_VIEW_TYPE_LIST)
SET_ACTIVE ("/View as List", TRUE);
else
SET_ACTIVE ("/View as Grid", TRUE);
SET_SENSITIVE ("/View as Grid", other_view_type);
SET_SENSITIVE ("/View as List", other_view_type);
}
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
{
SET_VISIBLE ("/image-menu-separator", TRUE);
SET_VISIBLE ("/Show Image Menu", TRUE);
SET_VISIBLE ("/Auto Follow Active Image", TRUE);
SET_ACTIVE ("/Show Image Menu",
GIMP_IMAGE_DOCK (dockbook->dock)->show_image_menu);
SET_ACTIVE ("/Auto Follow Active Image",
GIMP_IMAGE_DOCK (dockbook->dock)->auto_follow_active);
}
else
{
SET_VISIBLE ("/image-menu-separator", FALSE);
SET_VISIBLE ("/Show Image Menu", FALSE);
SET_VISIBLE ("/Auto Follow Active Image", FALSE);
}
#undef SET_ACTIVE
#undef SET_VISIBLE
#undef SET_SENSITIVE
}
}

31
app/gui/dialogs-menu.h Normal file
View File

@ -0,0 +1,31 @@
/* 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_MENU_H__
#define __DIALOGS_MENU_H__
extern GimpItemFactoryEntry dialogs_menu_entries[];
extern gint n_dialogs_menu_entries;
void dialogs_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __DIALOGS_MENU_H__ */

View File

@ -24,18 +24,10 @@
#include "gui-types.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimagefile.h"
#include "widgets/gimpcontainerlistview.h"
#include "widgets/gimpdocumentview.h"
#include "widgets/gimpitemfactory.h"
#include "documents-commands.h"
#include "libgimp/gimpintl.h"
/* public functionss */
@ -120,28 +112,3 @@ documents_delete_dangling_documents_cmd_callback (GtkWidget *widget,
gimp_button_extended_clicked (GIMP_BUTTON (view->refresh_button),
GDK_CONTROL_MASK);
}
void
documents_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpImagefile *imagefile;
editor = GIMP_CONTAINER_EDITOR (data);
imagefile = gimp_context_get_imagefile (editor->view->context);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Open Image", imagefile);
SET_SENSITIVE ("/Raise or Open Image", imagefile);
SET_SENSITIVE ("/File Open Dialog...", TRUE);
SET_SENSITIVE ("/Remove Entry", imagefile);
SET_SENSITIVE ("/Recreate Preview", imagefile);
SET_SENSITIVE ("/Reload all Previews", imagefile);
SET_SENSITIVE ("/Remove Dangling Entries", imagefile);
#undef SET_SENSITIVE
}

View File

@ -35,8 +35,5 @@ void documents_reload_previews_cmd_callback (GtkWidget *widget,
void documents_delete_dangling_documents_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __DOCUMENTS_COMMANDS_H__ */

101
app/gui/documents-menu.c Normal file
View File

@ -0,0 +1,101 @@
/* 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 "gui-types.h"
#include "core/gimpcontext.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpitemfactory.h"
#include "documents-commands.h"
#include "documents-menu.h"
#include "menus.h"
#include "libgimp/gimpintl.h"
GimpItemFactoryEntry documents_menu_entries[] =
{
{ { N_("/Open Image"), NULL,
documents_open_document_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
NULL, NULL, NULL },
{ { N_("/Raise or Open Image"), NULL,
documents_raise_or_open_document_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
NULL, NULL, NULL },
{ { N_("/File Open Dialog..."), NULL,
documents_file_open_dialog_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
NULL, NULL, NULL },
{ { N_("/Remove Entry"), NULL,
documents_remove_document_cmd_callback, 0,
"<StockItem>", GTK_STOCK_REMOVE },
NULL, NULL, NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Recreate Preview"), NULL,
documents_recreate_preview_cmd_callback, 0,
"<StockItem>", GTK_STOCK_REFRESH },
NULL, NULL, NULL },
{ { N_("/Reload all Previews"), NULL,
documents_reload_previews_cmd_callback, 0,
"<StockItem>", GTK_STOCK_REFRESH },
NULL, NULL, NULL },
{ { N_("/Remove Dangling Entries"), NULL,
documents_delete_dangling_documents_cmd_callback, 0,
"<StockItem>", GTK_STOCK_REFRESH },
NULL, NULL, NULL },
};
gint n_documents_menu_entries = G_N_ELEMENTS (documents_menu_entries);
void
documents_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpImagefile *imagefile;
editor = GIMP_CONTAINER_EDITOR (data);
imagefile = gimp_context_get_imagefile (editor->view->context);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Open Image", imagefile);
SET_SENSITIVE ("/Raise or Open Image", imagefile);
SET_SENSITIVE ("/File Open Dialog...", TRUE);
SET_SENSITIVE ("/Remove Entry", imagefile);
SET_SENSITIVE ("/Recreate Preview", imagefile);
SET_SENSITIVE ("/Reload all Previews", imagefile);
SET_SENSITIVE ("/Remove Dangling Entries", imagefile);
#undef SET_SENSITIVE
}

31
app/gui/documents-menu.h Normal file
View File

@ -0,0 +1,31 @@
/* 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_MENU_H__
#define __DOCUMENTS_MENU_H__
extern GimpItemFactoryEntry documents_menu_entries[];
extern gint n_documents_menu_entries;
void documents_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __DOCUMENTS_MENU_H__ */

View File

@ -34,7 +34,6 @@
#include "core/gimpdrawable-invert.h"
#include "core/gimpimage.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpitemlistview.h"
#include "display/gimpdisplay.h"

103
app/gui/file-open-menu.c Normal file
View File

@ -0,0 +1,103 @@
/* 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 <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "plug-in/plug-in-proc.h"
#include "widgets/gimpitemfactory.h"
#include "file-commands.h"
#include "file-open-menu.h"
#include "menus.h"
#include "libgimp/gimpintl.h"
GimpItemFactoryEntry file_open_menu_entries[] =
{
{ { N_("/Automatic"), NULL,
file_open_by_extension_cmd_callback, 0 },
NULL,
"open_by_extension.html", NULL },
MENU_SEPARATOR ("/---")
};
gint n_file_open_menu_entries = G_N_ELEMENTS (file_open_menu_entries);
void
file_open_menu_setup (GimpItemFactory *factory)
{
GimpItemFactoryEntry entry;
PlugInProcDef *file_proc;
GSList *list;
factory->gimp->load_procs = g_slist_reverse (factory->gimp->load_procs);
for (list = factory->gimp->load_procs; list; list = g_slist_next (list))
{
gchar *basename;
gchar *lowercase_basename;
gchar *help_page;
file_proc = (PlugInProcDef *) list->data;
basename = g_path_get_basename (file_proc->prog);
lowercase_basename = g_ascii_strdown (basename, -1);
g_free (basename);
/* NOT g_build_filename() because this is a relative URI */
help_page = g_strconcat ("filters/",
lowercase_basename,
".html",
NULL);
g_free (lowercase_basename);
entry.entry.path = strstr (file_proc->menu_path, "/");
entry.entry.accelerator = NULL;
entry.entry.callback = file_open_type_cmd_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.quark_string = NULL;
entry.help_page = help_page;
entry.description = NULL;
gimp_item_factory_create_item (factory,
&entry,
NULL,
file_proc, 2,
TRUE, FALSE);
g_free (help_page);
}
}

30
app/gui/file-open-menu.h Normal file
View File

@ -0,0 +1,30 @@
/* The GIMP -- an open 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_OPEN_MENU_H__
#define __FILE_OPEN_MENU_H__
extern GimpItemFactoryEntry file_open_menu_entries[];
extern gint n_file_open_menu_entries;
void file_open_menu_setup (GimpItemFactory *factory);
#endif /* __FILE_OPEN_MENU_H__ */

103
app/gui/file-save-menu.c Normal file
View File

@ -0,0 +1,103 @@
/* 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 <string.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "plug-in/plug-in-proc.h"
#include "widgets/gimpitemfactory.h"
#include "file-commands.h"
#include "file-save-menu.h"
#include "menus.h"
#include "libgimp/gimpintl.h"
GimpItemFactoryEntry file_save_menu_entries[] =
{
{ { N_("/By Extension"), NULL,
file_save_by_extension_cmd_callback, 0 },
NULL,
"save_by_extension.html", NULL },
MENU_SEPARATOR ("/---")
};
gint n_file_save_menu_entries = G_N_ELEMENTS (file_save_menu_entries);
void
file_save_menu_setup (GimpItemFactory *factory)
{
GimpItemFactoryEntry entry;
PlugInProcDef *file_proc;
GSList *list;
factory->gimp->save_procs = g_slist_reverse (factory->gimp->save_procs);
for (list = factory->gimp->save_procs; list; list = g_slist_next (list))
{
gchar *basename;
gchar *lowercase_basename;
gchar *help_page;
file_proc = (PlugInProcDef *) list->data;
basename = g_path_get_basename (file_proc->prog);
lowercase_basename = g_ascii_strdown (basename, -1);
g_free (basename);
/* NOT g_build_filename() because this is a relative URI */
help_page = g_strconcat ("filters/",
lowercase_basename,
".html",
NULL);
g_free (lowercase_basename);
entry.entry.path = strstr (file_proc->menu_path, "/");
entry.entry.accelerator = NULL;
entry.entry.callback = file_save_type_cmd_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.quark_string = NULL;
entry.help_page = help_page;
entry.description = NULL;
gimp_item_factory_create_item (factory,
&entry,
NULL,
file_proc, 2,
TRUE, FALSE);
g_free (help_page);
}
}

30
app/gui/file-save-menu.h Normal file
View File

@ -0,0 +1,30 @@
/* The GIMP -- an open 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_SAVE_MENU_H__
#define __FILE_SAVE_MENU_H__
extern GimpItemFactoryEntry file_save_menu_entries[];
extern gint n_file_save_menu_entries;
void file_save_menu_setup (GimpItemFactory *factory);
#endif /* __FILE_SAVE_MENU_H__ */

View File

@ -29,7 +29,6 @@
#include "core/gimpgradient.h"
#include "widgets/gimpgradienteditor.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpviewabledialog.h"
#include "color-notebook.h"
@ -908,227 +907,8 @@ gradient_editor_blend_opacity_cmd_callback (GtkWidget *widget,
gimp_gradient_editor_update (editor, GRAD_UPDATE_GRADIENT);
}
void
gradient_editor_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpGradientEditor *editor;
GimpContext *user_context;
GimpGradientSegment *left_seg;
GimpGradientSegment *right_seg;
GimpRGB fg;
GimpRGB bg;
gboolean blending_equal = TRUE;
gboolean coloring_equal = TRUE;
gboolean selection;
gboolean delete;
editor = GIMP_GRADIENT_EDITOR (data);
user_context = gimp_get_user_context (GIMP_DATA_EDITOR (editor)->gimp);
if (editor->control_sel_l->prev)
left_seg = editor->control_sel_l->prev;
else
left_seg = gimp_gradient_segment_get_last (editor->control_sel_l);
if (editor->control_sel_r->next)
right_seg = editor->control_sel_r->next;
else
right_seg = gimp_gradient_segment_get_first (editor->control_sel_r);
gimp_context_get_foreground (user_context, &fg);
gimp_context_get_background (user_context, &bg);
{
GimpGradientSegmentType type;
GimpGradientSegmentColor color;
GimpGradientSegment *seg, *aseg;
type = editor->control_sel_l->type;
color = editor->control_sel_l->color;
seg = editor->control_sel_l;
do
{
blending_equal = blending_equal && (seg->type == type);
coloring_equal = coloring_equal && (seg->color == color);
aseg = seg;
seg = seg->next;
}
while (aseg != editor->control_sel_r);
}
selection = (editor->control_sel_l != editor->control_sel_r);
delete = (editor->control_sel_l->prev || editor->control_sel_r->next);
#define SET_ACTIVE(menu,active) \
gimp_item_factory_set_active (factory, menu, (active))
#define SET_COLOR(menu,color,set_label) \
gimp_item_factory_set_color (factory, menu, (color), (set_label))
#define SET_LABEL(menu,label) \
gimp_item_factory_set_label (factory, menu, (label))
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
#define SET_VISIBLE(menu,condition) \
gimp_item_factory_set_visible (factory, menu, (condition) != 0)
SET_COLOR ("/Left Endpoint's Color...",
&editor->control_sel_l->left_color, FALSE);
SET_COLOR ("/Load Left Color From/Left Neighbor's Right Endpoint",
&left_seg->right_color, FALSE);
SET_COLOR ("/Load Left Color From/Right Endpoint",
&editor->control_sel_r->right_color, FALSE);
SET_COLOR ("/Load Left Color From/FG Color", &fg, FALSE);
SET_COLOR ("/Load Left Color From/BG Color", &bg, FALSE);
SET_COLOR ("/Load Left Color From/01", &editor->saved_colors[0], TRUE);
SET_COLOR ("/Load Left Color From/02", &editor->saved_colors[1], TRUE);
SET_COLOR ("/Load Left Color From/03", &editor->saved_colors[2], TRUE);
SET_COLOR ("/Load Left Color From/04", &editor->saved_colors[3], TRUE);
SET_COLOR ("/Load Left Color From/05", &editor->saved_colors[4], TRUE);
SET_COLOR ("/Load Left Color From/06", &editor->saved_colors[5], TRUE);
SET_COLOR ("/Load Left Color From/07", &editor->saved_colors[6], TRUE);
SET_COLOR ("/Load Left Color From/08", &editor->saved_colors[7], TRUE);
SET_COLOR ("/Load Left Color From/09", &editor->saved_colors[8], TRUE);
SET_COLOR ("/Load Left Color From/10", &editor->saved_colors[9], TRUE);
SET_COLOR ("/Save Left Color To/01", &editor->saved_colors[0], TRUE);
SET_COLOR ("/Save Left Color To/02", &editor->saved_colors[1], TRUE);
SET_COLOR ("/Save Left Color To/03", &editor->saved_colors[2], TRUE);
SET_COLOR ("/Save Left Color To/04", &editor->saved_colors[3], TRUE);
SET_COLOR ("/Save Left Color To/05", &editor->saved_colors[4], TRUE);
SET_COLOR ("/Save Left Color To/06", &editor->saved_colors[5], TRUE);
SET_COLOR ("/Save Left Color To/07", &editor->saved_colors[6], TRUE);
SET_COLOR ("/Save Left Color To/08", &editor->saved_colors[7], TRUE);
SET_COLOR ("/Save Left Color To/09", &editor->saved_colors[8], TRUE);
SET_COLOR ("/Save Left Color To/10", &editor->saved_colors[9], TRUE);
SET_COLOR ("/Right Endpoint's Color...",
&editor->control_sel_r->right_color, FALSE);
SET_COLOR ("/Load Right Color From/Right Neighbor's Left Endpoint",
&right_seg->left_color, FALSE);
SET_COLOR ("/Load Right Color From/Left Endpoint",
&editor->control_sel_l->left_color, FALSE);
SET_COLOR ("/Load Right Color From/FG Color", &fg, FALSE);
SET_COLOR ("/Load Right Color From/BG Color", &bg, FALSE);
SET_COLOR ("/Load Right Color From/01", &editor->saved_colors[0], TRUE);
SET_COLOR ("/Load Right Color From/02", &editor->saved_colors[1], TRUE);
SET_COLOR ("/Load Right Color From/03", &editor->saved_colors[2], TRUE);
SET_COLOR ("/Load Right Color From/04", &editor->saved_colors[3], TRUE);
SET_COLOR ("/Load Right Color From/05", &editor->saved_colors[4], TRUE);
SET_COLOR ("/Load Right Color From/06", &editor->saved_colors[5], TRUE);
SET_COLOR ("/Load Right Color From/07", &editor->saved_colors[6], TRUE);
SET_COLOR ("/Load Right Color From/08", &editor->saved_colors[7], TRUE);
SET_COLOR ("/Load Right Color From/09", &editor->saved_colors[8], TRUE);
SET_COLOR ("/Load Right Color From/10", &editor->saved_colors[9], TRUE);
SET_COLOR ("/Save Right Color To/01", &editor->saved_colors[0], TRUE);
SET_COLOR ("/Save Right Color To/02", &editor->saved_colors[1], TRUE);
SET_COLOR ("/Save Right Color To/03", &editor->saved_colors[2], TRUE);
SET_COLOR ("/Save Right Color To/04", &editor->saved_colors[3], TRUE);
SET_COLOR ("/Save Right Color To/05", &editor->saved_colors[4], TRUE);
SET_COLOR ("/Save Right Color To/06", &editor->saved_colors[5], TRUE);
SET_COLOR ("/Save Right Color To/07", &editor->saved_colors[6], TRUE);
SET_COLOR ("/Save Right Color To/08", &editor->saved_colors[7], TRUE);
SET_COLOR ("/Save Right Color To/09", &editor->saved_colors[8], TRUE);
SET_COLOR ("/Save Right Color To/10", &editor->saved_colors[9], TRUE);
if (! selection)
{
SET_LABEL ("/blendingfunction", _("Blending Function for Segment"));
SET_LABEL ("/coloringtype", _("Coloring Type for Segment"));
SET_LABEL ("/flip", _("Flip Segment"));
SET_LABEL ("/replicate", _("Replicate Segment..."));
SET_LABEL ("/splitmidpoint", _("Split Segment at Midpoint"));
SET_LABEL ("/splituniformly", _("Split Segment Uniformly..."));
SET_LABEL ("/delete", _("Delete Segment"));
SET_LABEL ("/recenter", _("Re-center Segment's Midpoint"));
SET_LABEL ("/redistribute", _("Re-distribute Handles in Segment"));
}
else
{
SET_LABEL ("/blendingfunction", _("Blending Function for Selection"));
SET_LABEL ("/coloringtype", _("Coloring Type for Selection"));
SET_LABEL ("/flip", _("Flip Selection"));
SET_LABEL ("/replicate", _("Replicate Selection..."));
SET_LABEL ("/splitmidpoint", _("Split Segments at Midpoints"));
SET_LABEL ("/splituniformly", _("Split Segments Uniformly..."));
SET_LABEL ("/delete", _("Delete Selection"));
SET_LABEL ("/recenter", _("Re-center Midpoints in Selection"));
SET_LABEL ("/redistribute", _("Re-distribute Handles in Selection"));
}
SET_SENSITIVE ("/blendingfunction/(Varies)", FALSE);
SET_SENSITIVE ("/coloringtype/(Varies)", FALSE);
if (blending_equal)
{
SET_VISIBLE ("/blendingfunction/(Varies)", FALSE);
switch (editor->control_sel_l->type)
{
case GIMP_GRAD_LINEAR:
SET_ACTIVE ("/blendingfunction/Linear", TRUE);
break;
case GIMP_GRAD_CURVED:
SET_ACTIVE ("/blendingfunction/Curved", TRUE);
break;
case GIMP_GRAD_SINE:
SET_ACTIVE ("/blendingfunction/Sinusodial", TRUE);
break;
case GIMP_GRAD_SPHERE_INCREASING:
SET_ACTIVE ("/blendingfunction/Spherical (increasing)", TRUE);
break;
case GIMP_GRAD_SPHERE_DECREASING:
SET_ACTIVE ("/blendingfunction/Spherical (decreasing)", TRUE);
break;
}
}
else
{
SET_VISIBLE ("/blendingfunction/(Varies)", TRUE);
SET_ACTIVE ("/blendingfunction/(Varies)", TRUE);
}
if (coloring_equal)
{
SET_VISIBLE ("/coloringtype/(Varies)", FALSE);
switch (editor->control_sel_l->color)
{
case GIMP_GRAD_RGB:
SET_ACTIVE ("/coloringtype/RGB", TRUE);
break;
case GIMP_GRAD_HSV_CCW:
SET_ACTIVE ("/coloringtype/HSV (counter-clockwise hue)", TRUE);
break;
case GIMP_GRAD_HSV_CW:
SET_ACTIVE ("/coloringtype/HSV (clockwise hue)", TRUE);
break;
}
}
else
{
SET_VISIBLE ("/coloringtype/(Varies)", TRUE);
SET_ACTIVE ("/coloringtype/(Varies)", TRUE);
}
SET_SENSITIVE ("/Blend Endpoints' Colors", selection);
SET_SENSITIVE ("/Blend Endpoints' Opacity", selection);
SET_SENSITIVE ("/delete", delete);
#undef SET_ACTIVE
#undef SET_COLOR
#undef SET_LABEL
#undef SET_SENSITIVE
#undef SET_VISIBLE
}
/* private functions */
static void
gradient_editor_left_color_changed (ColorNotebook *cnb,

View File

@ -76,8 +76,5 @@ void gradient_editor_blend_opacity_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void gradient_editor_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __GRADIENT_EDITOR_COMMANDS_H__ */

View File

@ -0,0 +1,479 @@
/* 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 "gui-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpgradient.h"
#include "widgets/gimpdataeditor.h"
#include "widgets/gimpgradienteditor.h"
#include "widgets/gimpitemfactory.h"
#include "gradient-editor-commands.h"
#include "gradient-editor-menu.h"
#include "menus.h"
#include "libgimp/gimpintl.h"
#define LOAD_LEFT_FROM(num,magic) \
{ { "/Load Left Color From/" num, NULL, \
gradient_editor_load_left_cmd_callback, (magic) }, NULL, NULL, NULL }
#define SAVE_LEFT_TO(num,magic) \
{ { "/Save Left Color To/" num, NULL, \
gradient_editor_save_left_cmd_callback, (magic) }, NULL, NULL, NULL }
#define LOAD_RIGHT_FROM(num,magic) \
{ { "/Load Right Color From/" num, NULL, \
gradient_editor_load_right_cmd_callback, (magic) }, NULL, NULL, NULL }
#define SAVE_RIGHT_TO(num,magic) \
{ { "/Save Right Color To/" num, NULL, \
gradient_editor_save_right_cmd_callback, (magic) }, NULL, NULL, NULL }
GimpItemFactoryEntry gradient_editor_menu_entries[] =
{
{ { N_("/Left Endpoint's Color..."), NULL,
gradient_editor_left_color_cmd_callback, 0 },
NULL,
NULL, NULL },
{ { N_("/Load Left Color From/Left Neighbor's Right Endpoint"), NULL,
gradient_editor_load_left_cmd_callback, 0 },
NULL,
NULL, NULL },
{ { N_("/Load Left Color From/Right Endpoint"), NULL,
gradient_editor_load_left_cmd_callback, 1 },
NULL,
NULL, NULL },
{ { N_("/Load Left Color From/FG Color"), NULL,
gradient_editor_load_left_cmd_callback, 2 },
NULL,
NULL, NULL },
{ { N_("/Load Left Color From/BG Color"), NULL,
gradient_editor_load_left_cmd_callback, 3 },
NULL,
NULL, NULL },
MENU_SEPARATOR ("/Load Left Color From/---"),
LOAD_LEFT_FROM ("01", 4),
LOAD_LEFT_FROM ("02", 5),
LOAD_LEFT_FROM ("03", 6),
LOAD_LEFT_FROM ("04", 7),
LOAD_LEFT_FROM ("05", 8),
LOAD_LEFT_FROM ("06", 9),
LOAD_LEFT_FROM ("07", 10),
LOAD_LEFT_FROM ("08", 11),
LOAD_LEFT_FROM ("09", 12),
LOAD_LEFT_FROM ("10", 13),
MENU_BRANCH (N_("/Save Left Color To")),
SAVE_LEFT_TO ("01", 0),
SAVE_LEFT_TO ("02", 1),
SAVE_LEFT_TO ("03", 2),
SAVE_LEFT_TO ("04", 3),
SAVE_LEFT_TO ("05", 4),
SAVE_LEFT_TO ("06", 5),
SAVE_LEFT_TO ("07", 6),
SAVE_LEFT_TO ("08", 7),
SAVE_LEFT_TO ("09", 8),
SAVE_LEFT_TO ("10", 9),
MENU_SEPARATOR ("/---"),
{ { N_("/Right Endpoint's Color..."), NULL,
gradient_editor_right_color_cmd_callback, 0 },
NULL,
NULL, NULL },
{ { N_("/Load Right Color From/Right Neighbor's Left Endpoint"), NULL,
gradient_editor_load_right_cmd_callback, 0 },
NULL,
NULL, NULL },
{ { N_("/Load Right Color From/Left Endpoint"), NULL,
gradient_editor_load_right_cmd_callback, 1 },
NULL,
NULL, NULL },
{ { N_("/Load Right Color From/FG Color"), NULL,
gradient_editor_load_right_cmd_callback, 2 },
NULL,
NULL, NULL },
{ { N_("/Load Right Color From/BG Color"), NULL,
gradient_editor_load_right_cmd_callback, 3 },
NULL,
NULL, NULL },
MENU_SEPARATOR ("/Load Right Color From/---"),
LOAD_RIGHT_FROM ("01", 4),
LOAD_RIGHT_FROM ("02", 5),
LOAD_RIGHT_FROM ("03", 6),
LOAD_RIGHT_FROM ("04", 7),
LOAD_RIGHT_FROM ("05", 8),
LOAD_RIGHT_FROM ("06", 9),
LOAD_RIGHT_FROM ("07", 10),
LOAD_RIGHT_FROM ("08", 11),
LOAD_RIGHT_FROM ("09", 12),
LOAD_RIGHT_FROM ("10", 13),
MENU_BRANCH (N_("/Save Right Color To")),
SAVE_RIGHT_TO ("01", 0),
SAVE_RIGHT_TO ("02", 1),
SAVE_RIGHT_TO ("03", 2),
SAVE_RIGHT_TO ("04", 3),
SAVE_RIGHT_TO ("05", 4),
SAVE_RIGHT_TO ("06", 5),
SAVE_RIGHT_TO ("07", 6),
SAVE_RIGHT_TO ("08", 7),
SAVE_RIGHT_TO ("09", 8),
SAVE_RIGHT_TO ("10", 9),
MENU_SEPARATOR ("/---"),
{ { N_("/blendingfunction/Linear"), NULL,
gradient_editor_blending_func_cmd_callback,
GIMP_GRAD_LINEAR, "<RadioItem>" },
NULL,
NULL, NULL },
{ { N_("/blendingfunction/Curved"), NULL,
gradient_editor_blending_func_cmd_callback,
GIMP_GRAD_CURVED, "/blendingfunction/Linear" },
NULL,
NULL, NULL },
{ { N_("/blendingfunction/Sinusodial"), NULL,
gradient_editor_blending_func_cmd_callback,
GIMP_GRAD_SINE, "/blendingfunction/Linear" },
NULL,
NULL, NULL },
{ { N_("/blendingfunction/Spherical (increasing)"), NULL,
gradient_editor_blending_func_cmd_callback,
GIMP_GRAD_SPHERE_INCREASING, "/blendingfunction/Linear" },
NULL,
NULL, NULL },
{ { N_("/blendingfunction/Spherical (decreasing)"), NULL,
gradient_editor_blending_func_cmd_callback,
GIMP_GRAD_SPHERE_DECREASING, "/blendingfunction/Linear" },
NULL,
NULL, NULL },
{ { N_("/blendingfunction/(Varies)"), NULL, NULL,
0, "/blendingfunction/Linear" },
NULL,
NULL, NULL },
{ { N_("/coloringtype/RGB"), NULL,
gradient_editor_coloring_type_cmd_callback,
GIMP_GRAD_RGB, "<RadioItem>" },
NULL,
NULL, NULL },
{ { N_("/coloringtype/HSV (counter-clockwise hue)"), NULL,
gradient_editor_coloring_type_cmd_callback,
GIMP_GRAD_HSV_CCW, "/coloringtype/RGB" },
NULL,
NULL, NULL },
{ { N_("/coloringtype/HSV (clockwise hue)"), NULL,
gradient_editor_coloring_type_cmd_callback,
GIMP_GRAD_HSV_CW, "/coloringtype/RGB" },
NULL,
NULL, NULL },
{ { N_("/coloringtype/(Varies)"), NULL, NULL,
0, "/coloringtype/RGB" },
NULL,
NULL, NULL },
MENU_SEPARATOR ("/---"),
{ { "/flip", "F",
gradient_editor_flip_cmd_callback, 0 },
NULL,
NULL, NULL },
{ { "/replicate", "R",
gradient_editor_replicate_cmd_callback, 0 },
NULL,
NULL, NULL },
{ { "/splitmidpoint", "S",
gradient_editor_split_midpoint_cmd_callback, 0 },
NULL,
NULL, NULL },
{ { "/splituniformly", "U",
gradient_editor_split_uniformly_cmd_callback, 0 },
NULL,
NULL, NULL },
{ { "/delete", "D",
gradient_editor_delete_cmd_callback, 0 },
NULL,
NULL, NULL },
{ { "/recenter", "C",
gradient_editor_recenter_cmd_callback, 0 },
NULL,
NULL, NULL },
{ { "/redistribute", "<control>C",
gradient_editor_redistribute_cmd_callback, 0 },
NULL,
NULL, NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Blend Endpoints' Colors"), "B",
gradient_editor_blend_color_cmd_callback, 0 },
NULL,
NULL, NULL },
{ { N_("/Blend Endpoints' Opacity"), "<control>B",
gradient_editor_blend_opacity_cmd_callback, 0 },
NULL,
NULL, NULL },
};
#undef LOAD_LEFT_FROM
#undef SAVE_LEFT_TO
#undef LOAD_RIGHT_FROM
#undef SAVE_RIGHT_TO
gint n_gradient_editor_menu_entries = G_N_ELEMENTS (gradient_editor_menu_entries);
void
gradient_editor_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpGradientEditor *editor;
GimpContext *user_context;
GimpGradientSegment *left_seg;
GimpGradientSegment *right_seg;
GimpRGB fg;
GimpRGB bg;
gboolean blending_equal = TRUE;
gboolean coloring_equal = TRUE;
gboolean selection;
gboolean delete;
editor = GIMP_GRADIENT_EDITOR (data);
user_context = gimp_get_user_context (GIMP_DATA_EDITOR (editor)->gimp);
if (editor->control_sel_l->prev)
left_seg = editor->control_sel_l->prev;
else
left_seg = gimp_gradient_segment_get_last (editor->control_sel_l);
if (editor->control_sel_r->next)
right_seg = editor->control_sel_r->next;
else
right_seg = gimp_gradient_segment_get_first (editor->control_sel_r);
gimp_context_get_foreground (user_context, &fg);
gimp_context_get_background (user_context, &bg);
{
GimpGradientSegmentType type;
GimpGradientSegmentColor color;
GimpGradientSegment *seg, *aseg;
type = editor->control_sel_l->type;
color = editor->control_sel_l->color;
seg = editor->control_sel_l;
do
{
blending_equal = blending_equal && (seg->type == type);
coloring_equal = coloring_equal && (seg->color == color);
aseg = seg;
seg = seg->next;
}
while (aseg != editor->control_sel_r);
}
selection = (editor->control_sel_l != editor->control_sel_r);
delete = (editor->control_sel_l->prev || editor->control_sel_r->next);
#define SET_ACTIVE(menu,active) \
gimp_item_factory_set_active (factory, menu, (active))
#define SET_COLOR(menu,color,set_label) \
gimp_item_factory_set_color (factory, menu, (color), (set_label))
#define SET_LABEL(menu,label) \
gimp_item_factory_set_label (factory, menu, (label))
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
#define SET_VISIBLE(menu,condition) \
gimp_item_factory_set_visible (factory, menu, (condition) != 0)
SET_COLOR ("/Left Endpoint's Color...",
&editor->control_sel_l->left_color, FALSE);
SET_COLOR ("/Load Left Color From/Left Neighbor's Right Endpoint",
&left_seg->right_color, FALSE);
SET_COLOR ("/Load Left Color From/Right Endpoint",
&editor->control_sel_r->right_color, FALSE);
SET_COLOR ("/Load Left Color From/FG Color", &fg, FALSE);
SET_COLOR ("/Load Left Color From/BG Color", &bg, FALSE);
SET_COLOR ("/Load Left Color From/01", &editor->saved_colors[0], TRUE);
SET_COLOR ("/Load Left Color From/02", &editor->saved_colors[1], TRUE);
SET_COLOR ("/Load Left Color From/03", &editor->saved_colors[2], TRUE);
SET_COLOR ("/Load Left Color From/04", &editor->saved_colors[3], TRUE);
SET_COLOR ("/Load Left Color From/05", &editor->saved_colors[4], TRUE);
SET_COLOR ("/Load Left Color From/06", &editor->saved_colors[5], TRUE);
SET_COLOR ("/Load Left Color From/07", &editor->saved_colors[6], TRUE);
SET_COLOR ("/Load Left Color From/08", &editor->saved_colors[7], TRUE);
SET_COLOR ("/Load Left Color From/09", &editor->saved_colors[8], TRUE);
SET_COLOR ("/Load Left Color From/10", &editor->saved_colors[9], TRUE);
SET_COLOR ("/Save Left Color To/01", &editor->saved_colors[0], TRUE);
SET_COLOR ("/Save Left Color To/02", &editor->saved_colors[1], TRUE);
SET_COLOR ("/Save Left Color To/03", &editor->saved_colors[2], TRUE);
SET_COLOR ("/Save Left Color To/04", &editor->saved_colors[3], TRUE);
SET_COLOR ("/Save Left Color To/05", &editor->saved_colors[4], TRUE);
SET_COLOR ("/Save Left Color To/06", &editor->saved_colors[5], TRUE);
SET_COLOR ("/Save Left Color To/07", &editor->saved_colors[6], TRUE);
SET_COLOR ("/Save Left Color To/08", &editor->saved_colors[7], TRUE);
SET_COLOR ("/Save Left Color To/09", &editor->saved_colors[8], TRUE);
SET_COLOR ("/Save Left Color To/10", &editor->saved_colors[9], TRUE);
SET_COLOR ("/Right Endpoint's Color...",
&editor->control_sel_r->right_color, FALSE);
SET_COLOR ("/Load Right Color From/Right Neighbor's Left Endpoint",
&right_seg->left_color, FALSE);
SET_COLOR ("/Load Right Color From/Left Endpoint",
&editor->control_sel_l->left_color, FALSE);
SET_COLOR ("/Load Right Color From/FG Color", &fg, FALSE);
SET_COLOR ("/Load Right Color From/BG Color", &bg, FALSE);
SET_COLOR ("/Load Right Color From/01", &editor->saved_colors[0], TRUE);
SET_COLOR ("/Load Right Color From/02", &editor->saved_colors[1], TRUE);
SET_COLOR ("/Load Right Color From/03", &editor->saved_colors[2], TRUE);
SET_COLOR ("/Load Right Color From/04", &editor->saved_colors[3], TRUE);
SET_COLOR ("/Load Right Color From/05", &editor->saved_colors[4], TRUE);
SET_COLOR ("/Load Right Color From/06", &editor->saved_colors[5], TRUE);
SET_COLOR ("/Load Right Color From/07", &editor->saved_colors[6], TRUE);
SET_COLOR ("/Load Right Color From/08", &editor->saved_colors[7], TRUE);
SET_COLOR ("/Load Right Color From/09", &editor->saved_colors[8], TRUE);
SET_COLOR ("/Load Right Color From/10", &editor->saved_colors[9], TRUE);
SET_COLOR ("/Save Right Color To/01", &editor->saved_colors[0], TRUE);
SET_COLOR ("/Save Right Color To/02", &editor->saved_colors[1], TRUE);
SET_COLOR ("/Save Right Color To/03", &editor->saved_colors[2], TRUE);
SET_COLOR ("/Save Right Color To/04", &editor->saved_colors[3], TRUE);
SET_COLOR ("/Save Right Color To/05", &editor->saved_colors[4], TRUE);
SET_COLOR ("/Save Right Color To/06", &editor->saved_colors[5], TRUE);
SET_COLOR ("/Save Right Color To/07", &editor->saved_colors[6], TRUE);
SET_COLOR ("/Save Right Color To/08", &editor->saved_colors[7], TRUE);
SET_COLOR ("/Save Right Color To/09", &editor->saved_colors[8], TRUE);
SET_COLOR ("/Save Right Color To/10", &editor->saved_colors[9], TRUE);
if (! selection)
{
SET_LABEL ("/blendingfunction", _("Blending Function for Segment"));
SET_LABEL ("/coloringtype", _("Coloring Type for Segment"));
SET_LABEL ("/flip", _("Flip Segment"));
SET_LABEL ("/replicate", _("Replicate Segment..."));
SET_LABEL ("/splitmidpoint", _("Split Segment at Midpoint"));
SET_LABEL ("/splituniformly", _("Split Segment Uniformly..."));
SET_LABEL ("/delete", _("Delete Segment"));
SET_LABEL ("/recenter", _("Re-center Segment's Midpoint"));
SET_LABEL ("/redistribute", _("Re-distribute Handles in Segment"));
}
else
{
SET_LABEL ("/blendingfunction", _("Blending Function for Selection"));
SET_LABEL ("/coloringtype", _("Coloring Type for Selection"));
SET_LABEL ("/flip", _("Flip Selection"));
SET_LABEL ("/replicate", _("Replicate Selection..."));
SET_LABEL ("/splitmidpoint", _("Split Segments at Midpoints"));
SET_LABEL ("/splituniformly", _("Split Segments Uniformly..."));
SET_LABEL ("/delete", _("Delete Selection"));
SET_LABEL ("/recenter", _("Re-center Midpoints in Selection"));
SET_LABEL ("/redistribute", _("Re-distribute Handles in Selection"));
}
SET_SENSITIVE ("/blendingfunction/(Varies)", FALSE);
SET_SENSITIVE ("/coloringtype/(Varies)", FALSE);
if (blending_equal)
{
SET_VISIBLE ("/blendingfunction/(Varies)", FALSE);
switch (editor->control_sel_l->type)
{
case GIMP_GRAD_LINEAR:
SET_ACTIVE ("/blendingfunction/Linear", TRUE);
break;
case GIMP_GRAD_CURVED:
SET_ACTIVE ("/blendingfunction/Curved", TRUE);
break;
case GIMP_GRAD_SINE:
SET_ACTIVE ("/blendingfunction/Sinusodial", TRUE);
break;
case GIMP_GRAD_SPHERE_INCREASING:
SET_ACTIVE ("/blendingfunction/Spherical (increasing)", TRUE);
break;
case GIMP_GRAD_SPHERE_DECREASING:
SET_ACTIVE ("/blendingfunction/Spherical (decreasing)", TRUE);
break;
}
}
else
{
SET_VISIBLE ("/blendingfunction/(Varies)", TRUE);
SET_ACTIVE ("/blendingfunction/(Varies)", TRUE);
}
if (coloring_equal)
{
SET_VISIBLE ("/coloringtype/(Varies)", FALSE);
switch (editor->control_sel_l->color)
{
case GIMP_GRAD_RGB:
SET_ACTIVE ("/coloringtype/RGB", TRUE);
break;
case GIMP_GRAD_HSV_CCW:
SET_ACTIVE ("/coloringtype/HSV (counter-clockwise hue)", TRUE);
break;
case GIMP_GRAD_HSV_CW:
SET_ACTIVE ("/coloringtype/HSV (clockwise hue)", TRUE);
break;
}
}
else
{
SET_VISIBLE ("/coloringtype/(Varies)", TRUE);
SET_ACTIVE ("/coloringtype/(Varies)", TRUE);
}
SET_SENSITIVE ("/Blend Endpoints' Colors", selection);
SET_SENSITIVE ("/Blend Endpoints' Opacity", selection);
SET_SENSITIVE ("/delete", delete);
#undef SET_ACTIVE
#undef SET_COLOR
#undef SET_LABEL
#undef SET_SENSITIVE
#undef SET_VISIBLE
}

View File

@ -0,0 +1,31 @@
/* 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_MENU_H__
#define __GRADIENT_EDITOR_MENU_H__
extern GimpItemFactoryEntry gradient_editor_menu_entries[];
extern gint n_gradient_editor_menu_entries;
void gradient_editor_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __GRADIENT_EDITOR_MENU_H__ */

View File

@ -18,8 +18,6 @@
#include "config.h"
#include <stdio.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
@ -29,9 +27,8 @@
#include "core/gimpgradient.h"
#include "core/gimpcontext.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimpitemfactory.h"
#include "gradients-commands.h"
@ -58,36 +55,6 @@ gradients_save_as_pov_ray_cmd_callback (GtkWidget *widget,
gradients_save_as_pov_query (editor);
}
void
gradients_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpGradient *gradient;
gboolean internal = FALSE;
editor = GIMP_CONTAINER_EDITOR (data);
gradient = gimp_context_get_gradient (editor->view->context);
if (gradient)
internal = GIMP_DATA (gradient)->internal;
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Duplicate Gradient",
gradient && GIMP_DATA_GET_CLASS (gradient)->duplicate);
SET_SENSITIVE ("/Edit Gradient...",
gradient && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Delete Gradient...",
gradient && ! internal);
SET_SENSITIVE ("/Save as POV-Ray...",
gradient);
#undef SET_SENSITIVE
}
/* private functions */

View File

@ -23,8 +23,5 @@
void gradients_save_as_pov_ray_cmd_callback (GtkWidget *widget,
gpointer data);
void gradients_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __GRADIENTS_COMMANDS_H__ */

114
app/gui/gradients-menu.c Normal file
View File

@ -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 <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimpcontext.h"
#include "core/gimpdata.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimpitemfactory.h"
#include "data-commands.h"
#include "gradients-commands.h"
#include "gradients-menu.h"
#include "menus.h"
#include "libgimp/gimpintl.h"
GimpItemFactoryEntry gradients_menu_entries[] =
{
{ { N_("/New Gradient"), NULL,
data_new_data_cmd_callback, 0,
"<StockItem>", GTK_STOCK_NEW },
NULL,
NULL, NULL },
{ { N_("/Duplicate Gradient"), NULL,
data_duplicate_data_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_DUPLICATE },
NULL,
NULL, NULL },
{ { N_("/Edit Gradient..."), NULL,
data_edit_data_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_EDIT },
NULL,
NULL, NULL },
{ { N_("/Delete Gradient..."), NULL,
data_delete_data_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
NULL,
NULL, NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Refresh Gradients"), NULL,
data_refresh_data_cmd_callback, 0,
"<StockItem>", GTK_STOCK_REFRESH },
NULL,
NULL, NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Save as POV-Ray..."), NULL,
gradients_save_as_pov_ray_cmd_callback, 0,
"<StockItem>", GTK_STOCK_SAVE_AS },
NULL,
NULL, NULL }
};
gint n_gradients_menu_entries = G_N_ELEMENTS (gradients_menu_entries);
void
gradients_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpGradient *gradient;
gboolean internal = FALSE;
editor = GIMP_CONTAINER_EDITOR (data);
gradient = gimp_context_get_gradient (editor->view->context);
if (gradient)
internal = GIMP_DATA (gradient)->internal;
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Duplicate Gradient",
gradient && GIMP_DATA_GET_CLASS (gradient)->duplicate);
SET_SENSITIVE ("/Edit Gradient...",
gradient && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Delete Gradient...",
gradient && ! internal);
SET_SENSITIVE ("/Save as POV-Ray...",
gradient);
#undef SET_SENSITIVE
}

31
app/gui/gradients-menu.h Normal file
View File

@ -0,0 +1,31 @@
/* 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_MENU_H__
#define __GRADIENTS_MENU_H__
extern GimpItemFactoryEntry gradients_menu_entries[];
extern gint n_gradients_menu_entries;
void gradients_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __GRADIENTS_MENU_H__ */

1351
app/gui/image-menu.c Normal file

File diff suppressed because it is too large Load Diff

32
app/gui/image-menu.h Normal file
View File

@ -0,0 +1,32 @@
/* 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_MENU_H__
#define __IMAGE_MENU_H__
extern GimpItemFactoryEntry image_menu_entries[];
extern gint n_image_menu_entries;
void image_menu_setup (GimpItemFactory *factory);
void image_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __IMAGE_MENU_H__ */

View File

@ -20,22 +20,12 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "widgets/gimpcontainerlistview.h"
#include "widgets/gimpimageview.h"
#include "widgets/gimpitemfactory.h"
#include "images-commands.h"
#include "libgimp/gimpintl.h"
/* public functionss */
@ -71,24 +61,3 @@ images_delete_image_cmd_callback (GtkWidget *widget,
gtk_button_clicked (GTK_BUTTON (view->delete_button));
}
void
images_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpImage *image;
editor = GIMP_CONTAINER_EDITOR (data);
image = gimp_context_get_image (editor->view->context);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Raise Displays", image);
SET_SENSITIVE ("/New Display", image);
SET_SENSITIVE ("/Delete Image", image && image->disp_count == 0);
#undef SET_SENSITIVE
}

View File

@ -27,8 +27,5 @@ void images_new_display_cmd_callback (GtkWidget *widget,
void images_delete_image_cmd_callback (GtkWidget *widget,
gpointer data);
void images_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __IMAGES_COMMANDS_H__ */

78
app/gui/images-menu.c Normal file
View File

@ -0,0 +1,78 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpitemfactory.h"
#include "images-commands.h"
#include "images-menu.h"
#include "libgimp/gimpintl.h"
GimpItemFactoryEntry images_menu_entries[] =
{
{ { N_("/Raise Displays"), NULL,
images_raise_displays_cmd_callback, 0,
"<StockItem>", GTK_STOCK_GOTO_TOP },
NULL, NULL, NULL },
{ { N_("/New Display"), NULL,
images_new_display_cmd_callback, 0,
"<StockItem>", GTK_STOCK_NEW },
NULL, NULL, NULL },
{ { N_("/Delete Image"), NULL,
images_delete_image_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
NULL, NULL, NULL }
};
gint n_images_menu_entries = G_N_ELEMENTS (images_menu_entries);
void
images_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpImage *image;
editor = GIMP_CONTAINER_EDITOR (data);
image = gimp_context_get_image (editor->view->context);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Raise Displays", image);
SET_SENSITIVE ("/New Display", image);
SET_SENSITIVE ("/Delete Image", image && image->disp_count == 0);
#undef SET_SENSITIVE
}

31
app/gui/images-menu.h Normal file
View File

@ -0,0 +1,31 @@
/* 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_MENU_H__
#define __IMAGES_MENU_H__
extern GimpItemFactoryEntry images_menu_entries[];
extern gint n_images_menu_entries;
void images_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __IMAGES_MENU_H__ */

View File

@ -41,7 +41,6 @@
#include "pdb/procedural_db.h"
#include "widgets/gimpenummenu.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpitemlistview.h"
#include "widgets/gimpviewabledialog.h"
@ -1150,85 +1149,3 @@ layers_resize_layer_query (GimpImage *gimage,
gtk_widget_show (options->resize->resize_shell);
}
void
layers_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpImage *gimage;
GimpLayer *layer;
gboolean fs = FALSE; /* floating sel */
gboolean ac = FALSE; /* active channel */
gboolean lm = FALSE; /* layer mask */
gboolean lp = FALSE; /* layers present */
gboolean alpha = FALSE; /* alpha channel present */
gboolean indexed = FALSE; /* is indexed */
gboolean next_alpha = FALSE;
GList *list;
GList *next = NULL;
GList *prev = NULL;
gimage = GIMP_ITEM_LIST_VIEW (data)->gimage;
layer = gimp_image_get_active_layer (gimage);
if (layer)
lm = (gimp_layer_get_mask (layer)) ? TRUE : FALSE;
fs = (gimp_image_floating_sel (gimage) != NULL);
ac = (gimp_image_get_active_channel (gimage) != NULL);
alpha = layer && gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
lp = ! gimp_image_is_empty (gimage);
indexed = (gimp_image_base_type (gimage) == GIMP_INDEXED);
for (list = GIMP_LIST (gimage->layers)->list;
list;
list = g_list_next (list))
{
if (layer == (GimpLayer *) list->data)
{
prev = g_list_previous (list);
next = g_list_next (list);
break;
}
}
if (next)
next_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (next->data));
else
next_alpha = FALSE;
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/New Layer...", gimage);
SET_SENSITIVE ("/Raise Layer", !fs && !ac && gimage && lp && alpha && prev);
SET_SENSITIVE ("/Layer to Top", !fs && !ac && gimage && lp && alpha && prev);
SET_SENSITIVE ("/Lower Layer", !fs && !ac && gimage && lp && next && next_alpha);
SET_SENSITIVE ("/Layer to Bottom", !fs && !ac && gimage && lp && next && next_alpha);
SET_SENSITIVE ("/Duplicate Layer", !fs && !ac && gimage && lp);
SET_SENSITIVE ("/Anchor Layer", fs && !ac && gimage && lp);
SET_SENSITIVE ("/Merge Down", !fs && !ac && gimage && lp && next);
SET_SENSITIVE ("/Delete Layer", !ac && gimage && lp);
SET_SENSITIVE ("/Layer Boundary Size...", !ac && gimage && lp);
SET_SENSITIVE ("/Layer to Imagesize", !ac && gimage && lp);
SET_SENSITIVE ("/Scale Layer...", !ac && gimage && lp);
SET_SENSITIVE ("/Add Layer Mask...", !fs && !ac && gimage && !lm && lp && alpha && !indexed);
SET_SENSITIVE ("/Apply Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Delete Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Mask to Selection", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Add Alpha Channel", !fs && !alpha);
SET_SENSITIVE ("/Alpha to Selection", !fs && !ac && gimage && lp && alpha);
SET_SENSITIVE ("/Edit Layer Attributes...", !fs && !ac && gimage && lp);
#undef SET_SENSITIVE
}

View File

@ -69,9 +69,6 @@ void layers_add_alpha_channel_cmd_callback (GtkWidget *widet,
void layers_edit_attributes_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_menu_update (GtkItemFactory *factory,
gpointer data);
void layers_remove_layer (GimpImage *gimage,
GimpLayer *layer);
void layers_anchor_layer (GimpLayer *layer);

234
app/gui/layers-menu.c Normal file
View File

@ -0,0 +1,234 @@
/* 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 "gui-types.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimplist.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpitemlistview.h"
#include "layers-commands.h"
#include "layers-menu.h"
#include "menus.h"
#include "libgimp/gimpintl.h"
GimpItemFactoryEntry layers_menu_entries[] =
{
{ { N_("/New Layer..."), "<control>N",
layers_new_cmd_callback, 0,
"<StockItem>", GTK_STOCK_NEW },
NULL,
"dialogs/new_layer.html", NULL },
{ { N_("/Raise Layer"), "<control>F",
layers_raise_cmd_callback, 0,
"<StockItem>", GTK_STOCK_GO_UP },
NULL,
"stack/stack.html#raise_layer", NULL },
{ { N_("/Layer to Top"), "<control><shift>F",
layers_raise_to_top_cmd_callback, 0,
"<StockItem>", GTK_STOCK_GOTO_TOP },
NULL,
"stack/stack.html#later_to_top", NULL },
{ { N_("/Lower Layer"), "<control>B",
layers_lower_cmd_callback, 0,
"<StockItem>", GTK_STOCK_GO_DOWN },
NULL,
"stack/stack.html#lower_layer", NULL },
{ { N_("/Layer to Bottom"), "<control><shift>B",
layers_lower_to_bottom_cmd_callback, 0,
"<StockItem>", GTK_STOCK_GOTO_BOTTOM },
NULL,
"stack/stack.html#layer_to_bottom", NULL },
{ { N_("/Duplicate Layer"), "<control>C",
layers_duplicate_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_DUPLICATE },
NULL,
"duplicate_layer.html", NULL },
{ { N_("/Anchor Layer"), "<control>H",
layers_anchor_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_ANCHOR },
NULL,
"anchor_layer.html", NULL },
{ { N_("/Merge Down"), "<control><shift>M",
layers_merge_down_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_MERGE_DOWN },
NULL,
"merge_down.html", NULL },
{ { N_("/Delete Layer"), "<control>X",
layers_delete_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
NULL,
"delete_layer.html", NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Layer Boundary Size..."), "<control>R",
layers_resize_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_RESIZE },
NULL,
"dialogs/layer_boundary_size.html", NULL },
{ { N_("/Layer to Imagesize"), NULL,
layers_resize_to_image_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_LAYER_TO_IMAGESIZE },
NULL,
"layer_to_image_size.html", NULL },
{ { N_("/Scale Layer..."), "<control>S",
layers_scale_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_SCALE },
NULL,
"dialogs/scale_layer.html", NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Add Layer Mask..."), NULL,
layers_add_layer_mask_cmd_callback, 0 },
NULL,
"dialogs/add_layer_mask.html", NULL },
{ { N_("/Apply Layer Mask"), NULL,
layers_apply_layer_mask_cmd_callback, 0 },
NULL,
"apply_mask.html", NULL },
{ { N_("/Delete Layer Mask"), NULL,
layers_delete_layer_mask_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
NULL,
"delete_mask.html", NULL },
{ { N_("/Mask to Selection"), NULL,
layers_mask_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_SELECTION_REPLACE },
NULL,
"mask_to_selection.html", NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Add Alpha Channel"), NULL,
layers_add_alpha_channel_cmd_callback, 0 },
NULL,
"add_alpha_channel.html", NULL },
{ { N_("/Alpha to Selection"), NULL,
layers_alpha_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_SELECTION_REPLACE },
NULL,
"alpha_to_selection.html", NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Edit Layer Attributes..."), NULL,
layers_edit_attributes_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_EDIT },
NULL,
"dialogs/edit_layer_attributes.html", NULL }
};
gint n_layers_menu_entries = G_N_ELEMENTS (layers_menu_entries);
void
layers_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpImage *gimage;
GimpLayer *layer;
gboolean fs = FALSE; /* floating sel */
gboolean ac = FALSE; /* active channel */
gboolean lm = FALSE; /* layer mask */
gboolean lp = FALSE; /* layers present */
gboolean alpha = FALSE; /* alpha channel present */
gboolean indexed = FALSE; /* is indexed */
gboolean next_alpha = FALSE;
GList *list;
GList *next = NULL;
GList *prev = NULL;
gimage = GIMP_ITEM_LIST_VIEW (data)->gimage;
layer = gimp_image_get_active_layer (gimage);
if (layer)
lm = (gimp_layer_get_mask (layer)) ? TRUE : FALSE;
fs = (gimp_image_floating_sel (gimage) != NULL);
ac = (gimp_image_get_active_channel (gimage) != NULL);
alpha = layer && gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
lp = ! gimp_image_is_empty (gimage);
indexed = (gimp_image_base_type (gimage) == GIMP_INDEXED);
for (list = GIMP_LIST (gimage->layers)->list;
list;
list = g_list_next (list))
{
if (layer == (GimpLayer *) list->data)
{
prev = g_list_previous (list);
next = g_list_next (list);
break;
}
}
if (next)
next_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (next->data));
else
next_alpha = FALSE;
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/New Layer...", gimage);
SET_SENSITIVE ("/Raise Layer", !fs && !ac && gimage && lp && alpha && prev);
SET_SENSITIVE ("/Layer to Top", !fs && !ac && gimage && lp && alpha && prev);
SET_SENSITIVE ("/Lower Layer", !fs && !ac && gimage && lp && next && next_alpha);
SET_SENSITIVE ("/Layer to Bottom", !fs && !ac && gimage && lp && next && next_alpha);
SET_SENSITIVE ("/Duplicate Layer", !fs && !ac && gimage && lp);
SET_SENSITIVE ("/Anchor Layer", fs && !ac && gimage && lp);
SET_SENSITIVE ("/Merge Down", !fs && !ac && gimage && lp && next);
SET_SENSITIVE ("/Delete Layer", !ac && gimage && lp);
SET_SENSITIVE ("/Layer Boundary Size...", !ac && gimage && lp);
SET_SENSITIVE ("/Layer to Imagesize", !ac && gimage && lp);
SET_SENSITIVE ("/Scale Layer...", !ac && gimage && lp);
SET_SENSITIVE ("/Add Layer Mask...", !fs && !ac && gimage && !lm && lp && alpha && !indexed);
SET_SENSITIVE ("/Apply Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Delete Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Mask to Selection", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Add Alpha Channel", !fs && !alpha);
SET_SENSITIVE ("/Alpha to Selection", !fs && !ac && gimage && lp && alpha);
SET_SENSITIVE ("/Edit Layer Attributes...", !fs && !ac && gimage && lp);
#undef SET_SENSITIVE
}

31
app/gui/layers-menu.h Normal file
View File

@ -0,0 +1,31 @@
/* 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_MENU_H__
#define __LAYERS_MENU_H__
extern GimpItemFactoryEntry layers_menu_entries[];
extern gint n_layers_menu_entries;
void layers_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __LAYERS_MENU_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -20,11 +20,22 @@
#define __MENUS_H__
#define MENU_SEPARATOR(path) \
{ { (path), NULL, NULL, 0, "<Separator>" }, NULL, NULL, NULL }
#define MENU_BRANCH(path) \
{ { (path), NULL, NULL, 0, "<Branch>" }, NULL, NULL, NULL }
extern GimpMenuFactory *global_menu_factory;
void menus_init (Gimp *gimp);
void menus_exit (Gimp *gimp);
void menus_init (Gimp *gimp);
void menus_exit (Gimp *gimp);
void menus_last_opened_add (GimpItemFactory *item_factory,
Gimp *gimp);
void menus_filters_subdirs_to_top (GtkMenu *menu);
#endif /* __MENUS_H__ */

View File

@ -29,7 +29,6 @@
#include "core/gimppalette.h"
#include "widgets/gimppaletteeditor.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimptoolbox-color-area.h"
#include "color-notebook.h"
@ -137,24 +136,6 @@ palette_editor_delete_color_cmd_callback (GtkWidget *widget,
gimp_palette_delete_entry (palette, editor->color);
}
void
palette_editor_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpPaletteEditor *editor;
editor = GIMP_PALETTE_EDITOR (data);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/New Color", TRUE);
SET_SENSITIVE ("/Edit Color...", editor->color);
SET_SENSITIVE ("/Delete Color", editor->color);
#undef SET_SENSITIVE
}
/* private functions */

View File

@ -30,8 +30,5 @@ void palette_editor_delete_color_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void palette_editor_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __PALETTE_EDITOR_COMMANDS_H__ */

View File

@ -0,0 +1,74 @@
/* 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 "gui-types.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimppaletteeditor.h"
#include "palette-editor-commands.h"
#include "palette-editor-menu.h"
#include "libgimp/gimpintl.h"
GimpItemFactoryEntry palette_editor_menu_entries[] =
{
{ { N_("/New Color"), NULL,
palette_editor_new_color_cmd_callback, 0,
"<StockItem>", GTK_STOCK_NEW },
NULL,
NULL, NULL },
{ { N_("/Edit Color..."), NULL,
palette_editor_edit_color_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_EDIT },
NULL,
NULL, NULL },
{ { N_("/Delete Color"), NULL,
palette_editor_delete_color_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
NULL,
NULL, NULL }
};
gint n_palette_editor_menu_entries = G_N_ELEMENTS (palette_editor_menu_entries);
void
palette_editor_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpPaletteEditor *editor;
editor = GIMP_PALETTE_EDITOR (data);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/New Color", TRUE);
SET_SENSITIVE ("/Edit Color...", editor->color);
SET_SENSITIVE ("/Delete Color", editor->color);
#undef SET_SENSITIVE
}

View File

@ -0,0 +1,31 @@
/* 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_MENU_H__
#define __PALETTE_EDITOR_MENU_H__
extern GimpItemFactoryEntry palette_editor_menu_entries[];
extern gint n_palette_editor_menu_entries;
void palette_editor_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __PALETTE_EDITOR_MENU_H__ */

View File

@ -30,7 +30,6 @@
#include "widgets/gimpcontainerlistview.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimplistitem.h"
#include "widgets/gimppreview.h"
@ -78,36 +77,6 @@ palettes_merge_palettes_cmd_callback (GtkWidget *widget,
palettes_merge_palettes_query (editor);
}
void
palettes_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpPalette *palette;
gboolean internal = FALSE;
editor = GIMP_CONTAINER_EDITOR (data);
palette = gimp_context_get_palette (editor->view->context);
if (palette)
internal = GIMP_DATA (palette)->internal;
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Duplicate Palette",
palette && GIMP_DATA_GET_CLASS (palette)->duplicate);
SET_SENSITIVE ("/Edit Palette...",
palette && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Delete Palette...",
palette && ! internal);
SET_SENSITIVE ("/Merge Palettes...",
FALSE); /* FIXME palette && GIMP_IS_CONTAINER_LIST_VIEW (editor->view)); */
#undef SET_SENSITIVE
}
/* private functions */

View File

@ -25,8 +25,5 @@ void palettes_import_palette_cmd_callback (GtkWidget *widget,
void palettes_merge_palettes_cmd_callback (GtkWidget *widget,
gpointer data);
void palettes_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __PALETTES_COMMANDS_H__ */

118
app/gui/palettes-menu.c Normal file
View File

@ -0,0 +1,118 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimpcontext.h"
#include "core/gimpdata.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimpitemfactory.h"
#include "data-commands.h"
#include "palettes-commands.h"
#include "palettes-menu.h"
#include "menus.h"
#include "libgimp/gimpintl.h"
GimpItemFactoryEntry palettes_menu_entries[] =
{
{ { N_("/New Palette"), NULL,
data_new_data_cmd_callback, 0,
"<StockItem>", GTK_STOCK_NEW },
NULL,
NULL, NULL },
{ { N_("/Duplicate Palette"), NULL,
data_duplicate_data_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_DUPLICATE },
NULL,
NULL, NULL },
{ { N_("/Edit Palette..."), NULL,
data_edit_data_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_EDIT },
NULL,
NULL, NULL },
{ { N_("/Delete Palette..."), NULL,
data_delete_data_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
NULL,
NULL, NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Refresh Palettes"), NULL,
data_refresh_data_cmd_callback, 0,
"<StockItem>", GTK_STOCK_REFRESH },
NULL,
NULL, NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Import Palette..."), NULL,
palettes_import_palette_cmd_callback, 0,
"<StockItem>", GTK_STOCK_CONVERT },
NULL,
NULL, NULL },
{ { N_("/Merge Palettes..."), NULL,
palettes_merge_palettes_cmd_callback, 0 },
NULL,
NULL, NULL }
};
gint n_palettes_menu_entries = G_N_ELEMENTS (palettes_menu_entries);
void
palettes_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpPalette *palette;
gboolean internal = FALSE;
editor = GIMP_CONTAINER_EDITOR (data);
palette = gimp_context_get_palette (editor->view->context);
if (palette)
internal = GIMP_DATA (palette)->internal;
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Duplicate Palette",
palette && GIMP_DATA_GET_CLASS (palette)->duplicate);
SET_SENSITIVE ("/Edit Palette...",
palette && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Delete Palette...",
palette && ! internal);
SET_SENSITIVE ("/Merge Palettes...",
FALSE); /* FIXME palette && GIMP_IS_CONTAINER_LIST_VIEW (editor->view)); */
#undef SET_SENSITIVE
}

31
app/gui/palettes-menu.h Normal file
View File

@ -0,0 +1,31 @@
/* 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_MENU_H__
#define __PALETTES_MENU_H__
extern GimpItemFactoryEntry palettes_menu_entries[];
extern gint n_palettes_menu_entries;
void palettes_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __PALETTES_MENU_H__ */

View File

@ -56,6 +56,7 @@
#include "tools/gimpbezierselecttool.h"
#include "paths-dialog.h"
#include "menus.h"
#include "app_procs.h"
#include "ops_buttons.h"
@ -155,6 +156,77 @@ static void paths_dialog_advanced_to_path_callback (GtkWidget *, gpointer);
static void path_close (Path *);
/***** <Paths> *****/
GimpItemFactoryEntry paths_menu_entries[] =
{
{ { N_("/New Path"), "<control>N",
paths_dialog_new_path_callback, 0,
"<StockItem>", GTK_STOCK_NEW },
NULL,
"new_path.html", NULL },
{ { N_("/Duplicate Path"), "<control>U",
paths_dialog_dup_path_callback, 0,
"<StockItem>", GIMP_STOCK_DUPLICATE },
NULL,
"duplicate_path.html", NULL },
{ { N_("/Path to Selection"), "<control>S",
paths_dialog_path_to_sel_callback, 0,
"<StockItem>", GIMP_STOCK_SELECTION_REPLACE },
NULL,
"path_to_selection.html", NULL },
{ { N_("/Selection to Path"), "<control>P",
paths_dialog_sel_to_path_callback, 0,
"<StockItem>", GIMP_STOCK_SELECTION_TO_PATH },
NULL,
"filters/sel2path.html", NULL },
{ { N_("/Stroke Path"), "<control>T",
paths_dialog_stroke_path_callback, 0,
"<StockItem>", GIMP_STOCK_PATH_STROKE },
NULL,
"stroke_path.html", NULL },
{ { N_("/Delete Path"), "<control>X",
paths_dialog_delete_path_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
NULL,
"delete_path.html", NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Copy Path"), "<control>C",
paths_dialog_copy_path_callback, 0,
"<StockItem>", GTK_STOCK_COPY },
NULL,
"copy_path.html", NULL },
{ { N_("/Paste Path"), "<control>V",
paths_dialog_paste_path_callback, 0,
"<StockItem>", GTK_STOCK_PASTE },
NULL,
"paste_path.html", NULL },
{ { N_("/Import Path..."), "<control>I",
paths_dialog_import_path_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
NULL,
"dialogs/import_path.html", NULL },
{ { N_("/Export Path..."), "<control>E",
paths_dialog_export_path_callback, 0,
"<StockItem>", GTK_STOCK_SAVE },
NULL,
"dialogs/export_path.html", NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Edit Path Attributes..."), NULL,
paths_dialog_edit_path_attributes_callback, 0,
"<StockItem>", GIMP_STOCK_EDIT },
NULL,
"dialogs/edit_path_attributes.html", NULL }
};
gint n_paths_menu_entries = G_N_ELEMENTS (paths_menu_entries);
/* the ops buttons */
static GtkSignalFunc to_path_ext_callbacks[] =
{

View File

@ -25,6 +25,10 @@ void paths_dialog_update (GimpImage *gimage);
void paths_dialog_flush (void);
extern GimpItemFactoryEntry paths_menu_entries[];
extern gint n_paths_menu_entries;
void paths_dialog_new_path_callback (GtkWidget *widget,
gpointer data);
void paths_dialog_delete_path_callback (GtkWidget *widget,

View File

@ -20,21 +20,59 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimppattern.h"
#include "core/gimpcontext.h"
#include "core/gimpdata.h"
#include "widgets/gimpcontainereditor.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimpitemfactory.h"
#include "patterns-commands.h"
#include "data-commands.h"
#include "patterns-menu.h"
#include "menus.h"
#include "libgimp/gimpintl.h"
/* public functions */
GimpItemFactoryEntry patterns_menu_entries[] =
{
{ { N_("/New Pattern"), NULL,
data_new_data_cmd_callback, 0,
"<StockItem>", GTK_STOCK_NEW },
NULL,
NULL, NULL },
{ { N_("/Duplicate Pattern"), NULL,
data_duplicate_data_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_DUPLICATE },
NULL,
NULL, NULL },
{ { N_("/Edit Pattern..."), NULL,
data_edit_data_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_EDIT },
NULL,
NULL, NULL },
{ { N_("/Delete Pattern..."), NULL,
data_delete_data_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
NULL,
NULL, NULL },
MENU_SEPARATOR ("/---"),
{ { N_("/Refresh Patterns"), NULL,
data_refresh_data_cmd_callback, 0,
"<StockItem>", GTK_STOCK_REFRESH },
NULL,
NULL, NULL }
};
gint n_patterns_menu_entries = G_N_ELEMENTS (patterns_menu_entries);
void
patterns_menu_update (GtkItemFactory *factory,

View File

@ -16,12 +16,16 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PATTERNS_COMMANDS_H__
#define __PATTERNS_COMMANDS_H__
#ifndef __PATTERNS_MENU_H__
#define __PATTERNS_MENU_H__
extern GimpItemFactoryEntry patterns_menu_entries[];
extern gint n_patterns_menu_entries;
void patterns_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __PATTERNS_COMMANDS_H__ */
#endif /* __PATTERNS_MENU_H__ */

View File

@ -64,9 +64,8 @@ void
plug_in_menus_init (GSList *plug_in_defs,
const gchar *std_plugins_domain)
{
PlugInDef *plug_in_def;
GSList *domains = NULL;
GSList *tmp;
GSList *domains = NULL;
GSList *tmp;
g_return_if_fail (std_plugins_domain != NULL);
@ -77,11 +76,12 @@ plug_in_menus_init (GSList *plug_in_defs,
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
{
PlugInDef *plug_in_def;
const gchar *locale_domain;
const gchar *locale_path;
GSList *list;
plug_in_def = tmp->data;
plug_in_def = (PlugInDef *) tmp->data;
if (! plug_in_def->proc_defs)
continue;
@ -261,8 +261,8 @@ plug_in_delete_menu_entry (const gchar *menu_path)
}
void
plug_in_set_menu_sensitivity (GimpItemFactory *item_factory,
GimpImageType type)
plug_in_menus_update (GimpItemFactory *item_factory,
GimpImageType type)
{
PlugInProcDef *proc_def;
GSList *tmp;

View File

@ -20,18 +20,19 @@
#define __PLUG_IN_MENUS_H__
void plug_in_menus_init (GSList *plug_in_defs,
const gchar *std_plugins_domain);
void plug_in_menus_init (GSList *plug_in_defs,
const gchar *std_plugins_domain);
void plug_in_make_menu (GimpItemFactory *item_factory,
GSList *proc_defs);
void plug_in_make_menu_entry (GimpItemFactory *item_factory,
PlugInProcDef *proc_def,
const gchar *locale_domain,
const gchar *help_path);
void plug_in_delete_menu_entry (const gchar *menu_path);
void plug_in_set_menu_sensitivity (GimpItemFactory *item_factory,
GimpImageType type);
void plug_in_make_menu (GimpItemFactory *item_factory,
GSList *proc_defs);
void plug_in_make_menu_entry (GimpItemFactory *item_factory,
PlugInProcDef *proc_def,
const gchar *locale_domain,
const gchar *help_path);
void plug_in_delete_menu_entry (const gchar *menu_path);
void plug_in_menus_update (GimpItemFactory *item_factory,
GimpImageType type);
#endif /* __PLUG_IN_MENUS_H__ */

Some files were not shown because too many files have changed in this diff Show More