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:

committed by
Michael Natterer

parent
2e59153487
commit
6f29b766e8
@ -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,
|
||||
|
Reference in New Issue
Block a user