app/core/Makefile.am new files: the QMask stuff stripped from GUI code.

2001-11-30  Michael Natterer  <mitch@gimp.org>

	* app/core/Makefile.am
	* app/core/gimpimage-qmask.[ch]: new files: the QMask stuff
	stripped from GUI code. Added gimp_image_qmask_invert().

	* app/core/gimpimage.[ch]: removed the QMask functions.

	* app/display/Makefile.am
	* app/display/gimpdisplayshell-qmask.[ch]: removed.

	* app/gui/Makefile.am
	* app/gui/qmask-commands.[ch]: new files for the new QMask item
	factory callbacks and the qmask query dialog.

	* app/gui/menus.c: added a context menu for the QMask button.

	* app/display/gimpdisplayshell.c
	* app/display/gimpdisplayshell-handlers.c: don't include the qmask
	stuff.

	* app/display/gimpdisplayshell-callbacks.[ch]: Moved the 2 qmask
	callbacks here. Don't popup the dialog on double_click. Show
	the contect menu on right-click.

	* app/display/gimpdisplayshell-callbacks.[ch]:
	gimp_display_shell_canvas_events(): removed the hack of
	conntecting "key_press_event" to gtk_true() while a tool is
	active. Instead, check for (event & GDK_BUTTON1_MASK) in the
	key_press and key_release handlers and stop signal emission. Save
	the modifier state on "button_press" and restore it after
	"button_release".

	Changed the way context menus are updated/shown:

	- removed GimpContainerContextFunc.
	- pass around item factory identifiers (e.g. "<Brushes>")
	- added voodoo to update the menus before showing them.

	* app/widgets/gimpitemfactory.[ch]: gimp_item_factory_new(): take
	a GimpItemFactoryUpdateFunc parameter, attach it as data to the
	factory and use it to update the menu in
	gimp_item_factory_popup_with_date().

	* app/widgets/gimpwidgets-utils.[ch]: removed
	gimp_item_factory_popup_with_data() here.

	* app/widgets/gimpbrushfactoryview.[ch]
	* app/widgets/gimpbufferview.[ch]
	* app/widgets/gimpcontainereditor.[ch]
	* app/widgets/gimpdatafactoryview.[ch]
	* app/widgets/gimpdocumentview.[ch]
	* app/widgets/gimpdrawablelistview.[ch]: use item_factory
	identifier strings all over the place.

	* app/widgets/gimpdockbook.c: removed the menu update code, it's
	now in gui/dialogs-commands.c.

	* app/gui/brushes-commands.[ch]
	* app/gui/buffers-commands.[c]
	* app/gui/channels-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/layers-commands.[ch]
	* app/gui/palettes-commands.[ch]
	* app/gui/patterns-commands.[ch]: removed all show_context_menu()
	functions and made the update functions public. Changed all
	update functions to use the gimp_item_factory_set_foo() methods
	instead of gimp_menu_item_set_foo().

	* app/gui/menus.c: pass the update functions to the
	gimp_item_factory_new().

	* app/gui/dialogs-constructors.c: pass item factory identifiers to
	all view constructors.

	* app/gui/gradient-editor.c: show the context menu using the new
	method.

	* app/gui/toolbox.c: no need to include "dialogs-commands.h".
This commit is contained in:
Michael Natterer
2001-11-30 14:41:56 +00:00
committed by Michael Natterer
parent 84f148fef0
commit bba8413773
91 changed files with 2099 additions and 2528 deletions

View File

@ -40,7 +40,6 @@
/* local function prototypes */
static void gradient_editor_menu_set_sensitivity (GradientEditor *editor);
static void gradient_editor_left_color_changed (ColorNotebook *cnb,
const GimpRGB *color,
ColorNotebookState state,
@ -915,23 +914,10 @@ gradient_editor_blend_opacity_cmd_callback (GtkWidget *widget,
}
void
gradient_editor_show_context_menu (GradientEditor *editor)
{
GtkItemFactory *item_factory;
gradient_editor_menu_set_sensitivity (editor);
item_factory = gtk_item_factory_from_path ("<GradientEditor>");
gimp_item_factory_popup_with_data (item_factory, editor);
}
/* private functions */
static void
gradient_editor_menu_set_sensitivity (GradientEditor *editor)
gradient_editor_menu_update (GtkItemFactory *factory,
gpointer data)
{
GradientEditor *editor;
GimpGradientSegment *left_seg;
GimpGradientSegment *right_seg;
GimpRGB fg;
@ -941,6 +927,8 @@ gradient_editor_menu_set_sensitivity (GradientEditor *editor)
gboolean selection;
gboolean delete;
editor = (GradientEditor *) data;
if (editor->control_sel_l->prev)
left_seg = editor->control_sel_l->prev;
else
@ -981,161 +969,161 @@ gradient_editor_menu_set_sensitivity (GradientEditor *editor)
delete = (editor->control_sel_l->prev || editor->control_sel_r->next);
#define SET_ACTIVE(menu,active) \
gimp_menu_item_set_active ("<GradientEditor>/" menu, (active))
gimp_item_factory_set_active (factory, menu, (active))
#define SET_COLOR(menu,color,set_label) \
gimp_menu_item_set_color ("<GradientEditor>/" menu, (color), (set_label))
gimp_item_factory_set_color (factory, menu, (color), (set_label))
#define SET_LABEL(menu,label) \
gimp_menu_item_set_label ("<GradientEditor>/" menu, (label))
gimp_item_factory_set_label (factory, menu, (label))
#define SET_SENSITIVE(menu,condition) \
gimp_menu_item_set_sensitive ("<GradientEditor>/" menu, (condition) != 0)
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
#define SET_VISIBLE(menu,condition) \
gimp_menu_item_set_visible ("<GradientEditor>/" menu, (condition) != 0)
gimp_item_factory_set_visible (factory, menu, (condition) != 0)
SET_COLOR ("Left Endpoint's Color...",
SET_COLOR ("/Left Endpoint's Color...",
&editor->control_sel_l->left_color, FALSE);
SET_COLOR ("Load Left Color From/Left Neighbor's Right Endpoint",
SET_COLOR ("/Load Left Color From/Left Neighbor's Right Endpoint",
&left_seg->right_color, FALSE);
SET_COLOR ("Load Left Color From/Right Endpoint",
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/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 ("/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 ("/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...",
SET_COLOR ("/Right Endpoint's Color...",
&editor->control_sel_r->right_color, FALSE);
SET_COLOR ("Load Right Color From/Right Neighbor's Left Endpoint",
SET_COLOR ("/Load Right Color From/Right Neighbor's Left Endpoint",
&right_seg->left_color, FALSE);
SET_COLOR ("Load Right Color From/Left Endpoint",
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/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 ("/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);
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 ("flip", _("Flip Segment"));
SET_LABEL ("replicate", _("Replicate Segment"));
SET_LABEL ("blendingfunction", _("Blending Function for Segment"));
SET_LABEL ("coloringtype", _("Coloring Type for 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"));
SET_LABEL ("/flip", _("Flip Segment"));
SET_LABEL ("/replicate", _("Replicate Segment"));
SET_LABEL ("/blendingfunction", _("Blending Function for Segment"));
SET_LABEL ("/coloringtype", _("Coloring Type for 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 ("flip", _("Flip Selection"));
SET_LABEL ("replicate", _("Replicate Selection"));
SET_LABEL ("blendingfunction", _("Blending Function for Selection"));
SET_LABEL ("coloringtype", _("Coloring Type for 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_LABEL ("/flip", _("Flip Selection"));
SET_LABEL ("/replicate", _("Replicate Selection"));
SET_LABEL ("/blendingfunction", _("Blending Function for Selection"));
SET_LABEL ("/coloringtype", _("Coloring Type for 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);
SET_SENSITIVE ("/blendingfunction/(Varies)", FALSE);
SET_SENSITIVE ("/coloringtype/(Varies)", FALSE);
if (blending_equal)
{
SET_VISIBLE ("blendingfunction/(Varies)", FALSE);
SET_VISIBLE ("/blendingfunction/(Varies)", FALSE);
switch (editor->control_sel_l->type)
{
case GRAD_LINEAR:
SET_ACTIVE ("blendingfunction/Linear", TRUE);
SET_ACTIVE ("/blendingfunction/Linear", TRUE);
break;
case GRAD_CURVED:
SET_ACTIVE ("blendingfunction/Curved", TRUE);
SET_ACTIVE ("/blendingfunction/Curved", TRUE);
break;
case GRAD_SINE:
SET_ACTIVE ("blendingfunction/Sinusodial", TRUE);
SET_ACTIVE ("/blendingfunction/Sinusodial", TRUE);
break;
case GRAD_SPHERE_INCREASING:
SET_ACTIVE ("blendingfunction/Spherical (increasing)", TRUE);
SET_ACTIVE ("/blendingfunction/Spherical (increasing)", TRUE);
break;
case GRAD_SPHERE_DECREASING:
SET_ACTIVE ("blendingfunction/Spherical (decreasing)", TRUE);
SET_ACTIVE ("/blendingfunction/Spherical (decreasing)", TRUE);
break;
}
}
else
{
SET_VISIBLE ("blendingfunction/(Varies)", TRUE);
SET_ACTIVE ("blendingfunction/(Varies)", TRUE);
SET_VISIBLE ("/blendingfunction/(Varies)", TRUE);
SET_ACTIVE ("/blendingfunction/(Varies)", TRUE);
}
if (coloring_equal)
{
SET_VISIBLE ("coloringtype/(Varies)", FALSE);
SET_VISIBLE ("/coloringtype/(Varies)", FALSE);
switch (editor->control_sel_l->color)
{
case GRAD_RGB:
SET_ACTIVE ("coloringtype/RGB", TRUE);
SET_ACTIVE ("/coloringtype/RGB", TRUE);
break;
case GRAD_HSV_CCW:
SET_ACTIVE ("coloringtype/HSV (counter-clockwise hue)", TRUE);
SET_ACTIVE ("/coloringtype/HSV (counter-clockwise hue)", TRUE);
break;
case GRAD_HSV_CW:
SET_ACTIVE ("coloringtype/HSV (clockwise hue)", TRUE);
SET_ACTIVE ("/coloringtype/HSV (clockwise hue)", TRUE);
break;
}
}
else
{
SET_VISIBLE ("coloringtype/(Varies)", TRUE);
SET_ACTIVE ("coloringtype/(Varies)", TRUE);
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);
SET_SENSITIVE ("/Blend Endpoints' Colors", selection);
SET_SENSITIVE ("/Blend Endpoints' Opacity", selection);
SET_SENSITIVE ("/delete", delete);
#undef SET_ACTIVE
#undef SET_COLOR