app/Makefile.am removed.

2001-04-20  Michael Natterer  <mitch@gimp.org>

	* app/Makefile.am
	* app/layers_dialogP.h: removed.

	* app/gimpui.[ch]: new function gimp_menu_position().

	* app/disp_callbacks.c
	* app/interface.c
	* app/gui/layers-dialog.c: popup the image and layers menu with
	gtk_item_factory_popup_with_data() instead of gtk_menu_popup()
	and pass the GimpImage we're operating on as data.

	For accelerators, which are invoked without context, we catch key
	press events and attach the context to the GtkItemFactory.

	* app/gui/Makefile.am
	* app/gui/layers-commands.[ch]: common layer callbacks (instead of
	separate ones in commands.c and layers-dialog.c

	* app/gui/commands.[ch]
	* app/gui/layers-dialog.[ch]: removed the menu callbacks here.

	* app/gdisplay.h
	* app/lc_dialog.c
	* app/gui/channels-dialog.c
	* app/gui/layer-select.c
	* app/gui/menus.c
	* po/POTFILES.in: changed accordingly.
This commit is contained in:
Michael Natterer 2001-04-20 16:27:44 +00:00 committed by Michael Natterer
parent 4aab2ac339
commit c1e2f4e21c
37 changed files with 3015 additions and 1810 deletions

View File

@ -1,3 +1,33 @@
2001-04-20 Michael Natterer <mitch@gimp.org>
* app/Makefile.am
* app/layers_dialogP.h: removed.
* app/gimpui.[ch]: new function gimp_menu_position().
* app/disp_callbacks.c
* app/interface.c
* app/gui/layers-dialog.c: popup the image and layers menu with
gtk_item_factory_popup_with_data() instead of gtk_menu_popup()
and pass the GimpImage we're operating on as data.
For accelerators, which are invoked without context, we catch key
press events and attach the context to the GtkItemFactory.
* app/gui/Makefile.am
* app/gui/layers-commands.[ch]: common layer callbacks (instead of
separate ones in commands.c and layers-dialog.c
* app/gui/commands.[ch]
* app/gui/layers-dialog.[ch]: removed the menu callbacks here.
* app/gdisplay.h
* app/lc_dialog.c
* app/gui/channels-dialog.c
* app/gui/layer-select.c
* app/gui/menus.c
* po/POTFILES.in: changed accordingly.
2001-04-20 Michael Natterer <mitch@gimp.org>
* app/main.c: set the message handler for all app log domains, not

View File

@ -43,7 +43,6 @@ gimp_SOURCES = \
gimpprogress.h \
gimpui.c \
gimpui.h \
layers_dialogP.h \
lc_dialog.c \
lc_dialog.h \
lc_dialogP.h \

View File

@ -64,7 +64,6 @@
#include "image_render.h"
#include "nav_window.h"
#include "lc_dialog.h"
#include "layers_dialogP.h"
#include "plug_in.h"
#include "resize.h"
#include "scale.h"
@ -942,185 +941,6 @@ image_duplicate_cmd_callback (GtkWidget *widget,
gdisplay_new (gimp_image_duplicate (gdisp->gimage), 0x0101);
}
/***** Layers *****/
void
layers_previous_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
GimpLayer *new_layer;
gint current_layer;
return_if_no_display (gdisp);
current_layer =
gimp_image_get_layer_index (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
new_layer = (GimpLayer *)
gimp_container_get_child_by_index (gdisp->gimage->layers,
current_layer - 1);
if (new_layer)
{
gimp_image_set_active_layer (gdisp->gimage, new_layer);
gdisplays_flush ();
layer_select_init (gdisp->gimage, 0, GDK_CURRENT_TIME);
}
}
void
layers_next_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
GimpLayer *new_layer;
gint current_layer;
return_if_no_display (gdisp);
current_layer =
gimp_image_get_layer_index (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
new_layer = (GimpLayer *)
gimp_container_get_child_by_index (gdisp->gimage->layers,
current_layer + 1);
if (new_layer)
{
gimp_image_set_active_layer (gdisp->gimage, new_layer);
gdisplays_flush ();
layer_select_init (gdisp->gimage, 0, GDK_CURRENT_TIME);
}
}
void
layers_raise_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_image_raise_layer (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_lower_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_image_lower_layer (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_raise_to_top_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_image_raise_layer_to_top (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_lower_to_bottom_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_image_lower_layer_to_bottom (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_anchor_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
floating_sel_anchor (gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_merge_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
layers_dialog_layer_merge_query (gdisp->gimage, TRUE);
}
void
layers_flatten_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_image_flatten (gdisp->gimage);
gdisplays_flush ();
}
void
layers_mask_select_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimage_mask_layer_mask (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_add_alpha_channel_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_layer_add_alpha (gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_alpha_select_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimage_mask_layer_alpha (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_resize_to_image_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_layer_resize_to_image (gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
/***** Tools *****/

View File

@ -90,20 +90,6 @@ void image_resize_cmd_callback (GtkWidget *, gpointer);
void image_scale_cmd_callback (GtkWidget *, gpointer);
void image_duplicate_cmd_callback (GtkWidget *, gpointer);
void layers_previous_cmd_callback (GtkWidget *, gpointer);
void layers_next_cmd_callback (GtkWidget *, gpointer);
void layers_raise_cmd_callback (GtkWidget *, gpointer);
void layers_lower_cmd_callback (GtkWidget *, gpointer);
void layers_raise_to_top_cmd_callback (GtkWidget *, gpointer);
void layers_lower_to_bottom_cmd_callback (GtkWidget *, gpointer);
void layers_anchor_cmd_callback (GtkWidget *, gpointer);
void layers_merge_cmd_callback (GtkWidget *, gpointer);
void layers_flatten_cmd_callback (GtkWidget *, gpointer);
void layers_mask_select_cmd_callback (GtkWidget *, gpointer);
void layers_add_alpha_channel_cmd_callback (GtkWidget *, gpointer);
void layers_alpha_select_cmd_callback (GtkWidget *, gpointer);
void layers_resize_to_image_cmd_callback (GtkWidget *, gpointer);
void tools_default_colors_cmd_callback (GtkWidget *, gpointer);
void tools_swap_colors_cmd_callback (GtkWidget *, gpointer);
void tools_swap_contexts_cmd_callback (GtkWidget *, gpointer);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,76 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __LAYERS_COMMANDS_H__
#define __LAYERS_COMMANDS_H__
void layers_previous_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_next_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_raise_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_lower_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_raise_to_top_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_lower_to_bottom_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_new_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_duplicate_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_delete_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_scale_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_resize_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_resize_to_image_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_add_layer_mask_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_apply_layer_mask_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_delete_layer_mask_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_anchor_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_merge_layers_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_merge_down_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_flatten_image_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_alpha_select_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_select_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_add_alpha_channel_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_edit_attributes_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_new_layer_query (GimpImage *gimage);
void layers_edit_layer_query (GimpLayer *layer);
void layers_layer_merge_query (GimpImage *gimage,
gboolean merge_visible);
#endif /* __LAYERS_COMMANDS_H__ */

View File

@ -94,13 +94,14 @@ struct _GDisplay
{
gint ID; /* unique identifier for this gdisplay */
GtkItemFactory *ifactory; /* factory for popup menu */
GtkWidget *shell; /* shell widget for this gdisplay */
GtkWidget *canvas; /* canvas widget for this gdisplay */
GtkWidget *hsb, *vsb; /* widgets for scroll bars */
GtkWidget *qmaskoff, *qmaskon; /* widgets for qmask buttons */
GtkWidget *hrule, *vrule; /* widgets for rulers */
GtkWidget *origin; /* widgets for rulers */
GtkWidget *popup; /* widget for popup menu */
GtkWidget *statusarea; /* hbox holding the statusbar and stuff */
GtkWidget *statusbar; /* widget for statusbar */
GtkWidget *progressbar; /* widget for progressbar */

View File

@ -50,6 +50,7 @@
#include "gimplayer.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "gimpui.h"
#include "pixel_region.h"
#include "scale.h"
#include "scroll.h"
@ -149,10 +150,15 @@ gdisplay_shell_events (GtkWidget *widget,
{
switch (event->type)
{
case GDK_BUTTON_PRESS:
case GDK_KEY_PRESS:
gtk_object_set_data (GTK_OBJECT (gdisp->ifactory), "gimp-accel-context",
gdisp->gimage);
/* fallthrough */
case GDK_BUTTON_PRESS:
/* Setting the context's display automatically sets the image, too */
gimp_context_set_display (gimp_context_get_user (), gdisp);
break;
default:
break;
@ -332,8 +338,16 @@ gdisplay_canvas_events (GtkWidget *canvas,
case 3:
state |= GDK_BUTTON3_MASK;
gtk_menu_popup (GTK_MENU (gdisp->popup),
NULL, NULL, NULL, NULL, 3, bevent->time);
{
gint x, y;
gimp_menu_position (GTK_MENU (gdisp->ifactory->widget), &x, &y);
gtk_item_factory_popup_with_data (gdisp->ifactory,
gdisp->gimage, NULL,
x, y,
3, bevent->time);
}
return_val = TRUE;
break;
@ -733,14 +747,19 @@ gdisplay_origin_button_press (GtkWidget *widget,
{
GDisplay *gdisp;
gdisp = (GDisplay *) data;
if (!gimp_busy && event->button == 1)
{
gdisp = data;
gint x, y;
gtk_menu_popup (GTK_MENU (gdisp->popup),
NULL, NULL,
gdisplay_origin_menu_position, widget,
1, event->time);
gdisplay_origin_menu_position (GTK_MENU (gdisp->ifactory->widget),
&x, &y, widget);
gtk_item_factory_popup_with_data (gdisp->ifactory,
gdisp->gimage, NULL,
x, y,
1, event->time);
}
/* Stop the signal emission so the button doesn't grab the

View File

@ -50,6 +50,7 @@
#include "gimplayer.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "gimpui.h"
#include "pixel_region.h"
#include "scale.h"
#include "scroll.h"
@ -149,10 +150,15 @@ gdisplay_shell_events (GtkWidget *widget,
{
switch (event->type)
{
case GDK_BUTTON_PRESS:
case GDK_KEY_PRESS:
gtk_object_set_data (GTK_OBJECT (gdisp->ifactory), "gimp-accel-context",
gdisp->gimage);
/* fallthrough */
case GDK_BUTTON_PRESS:
/* Setting the context's display automatically sets the image, too */
gimp_context_set_display (gimp_context_get_user (), gdisp);
break;
default:
break;
@ -332,8 +338,16 @@ gdisplay_canvas_events (GtkWidget *canvas,
case 3:
state |= GDK_BUTTON3_MASK;
gtk_menu_popup (GTK_MENU (gdisp->popup),
NULL, NULL, NULL, NULL, 3, bevent->time);
{
gint x, y;
gimp_menu_position (GTK_MENU (gdisp->ifactory->widget), &x, &y);
gtk_item_factory_popup_with_data (gdisp->ifactory,
gdisp->gimage, NULL,
x, y,
3, bevent->time);
}
return_val = TRUE;
break;
@ -733,14 +747,19 @@ gdisplay_origin_button_press (GtkWidget *widget,
{
GDisplay *gdisp;
gdisp = (GDisplay *) data;
if (!gimp_busy && event->button == 1)
{
gdisp = data;
gint x, y;
gtk_menu_popup (GTK_MENU (gdisp->popup),
NULL, NULL,
gdisplay_origin_menu_position, widget,
1, event->time);
gdisplay_origin_menu_position (GTK_MENU (gdisp->ifactory->widget),
&x, &y, widget);
gtk_item_factory_popup_with_data (gdisp->ifactory,
gdisp->gimage, NULL,
x, y,
1, event->time);
}
/* Stop the signal emission so the button doesn't grab the

View File

@ -94,13 +94,14 @@ struct _GDisplay
{
gint ID; /* unique identifier for this gdisplay */
GtkItemFactory *ifactory; /* factory for popup menu */
GtkWidget *shell; /* shell widget for this gdisplay */
GtkWidget *canvas; /* canvas widget for this gdisplay */
GtkWidget *hsb, *vsb; /* widgets for scroll bars */
GtkWidget *qmaskoff, *qmaskon; /* widgets for qmask buttons */
GtkWidget *hrule, *vrule; /* widgets for rulers */
GtkWidget *origin; /* widgets for rulers */
GtkWidget *popup; /* widget for popup menu */
GtkWidget *statusarea; /* hbox holding the statusbar and stuff */
GtkWidget *statusbar; /* widget for statusbar */
GtkWidget *progressbar; /* widget for progressbar */

View File

@ -50,6 +50,7 @@
#include "gimplayer.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "gimpui.h"
#include "pixel_region.h"
#include "scale.h"
#include "scroll.h"
@ -149,10 +150,15 @@ gdisplay_shell_events (GtkWidget *widget,
{
switch (event->type)
{
case GDK_BUTTON_PRESS:
case GDK_KEY_PRESS:
gtk_object_set_data (GTK_OBJECT (gdisp->ifactory), "gimp-accel-context",
gdisp->gimage);
/* fallthrough */
case GDK_BUTTON_PRESS:
/* Setting the context's display automatically sets the image, too */
gimp_context_set_display (gimp_context_get_user (), gdisp);
break;
default:
break;
@ -332,8 +338,16 @@ gdisplay_canvas_events (GtkWidget *canvas,
case 3:
state |= GDK_BUTTON3_MASK;
gtk_menu_popup (GTK_MENU (gdisp->popup),
NULL, NULL, NULL, NULL, 3, bevent->time);
{
gint x, y;
gimp_menu_position (GTK_MENU (gdisp->ifactory->widget), &x, &y);
gtk_item_factory_popup_with_data (gdisp->ifactory,
gdisp->gimage, NULL,
x, y,
3, bevent->time);
}
return_val = TRUE;
break;
@ -733,14 +747,19 @@ gdisplay_origin_button_press (GtkWidget *widget,
{
GDisplay *gdisp;
gdisp = (GDisplay *) data;
if (!gimp_busy && event->button == 1)
{
gdisp = data;
gint x, y;
gtk_menu_popup (GTK_MENU (gdisp->popup),
NULL, NULL,
gdisplay_origin_menu_position, widget,
1, event->time);
gdisplay_origin_menu_position (GTK_MENU (gdisp->ifactory->widget),
&x, &y, widget);
gtk_item_factory_popup_with_data (gdisp->ifactory,
gdisp->gimage, NULL,
x, y,
1, event->time);
}
/* Stop the signal emission so the button doesn't grab the

View File

@ -86,9 +86,6 @@ create_display_shell (GDisplay *gdisp,
gchar *title,
gint type)
{
static GtkWidget *image_popup_menu = NULL;
static GtkAccelGroup *image_accel_group = NULL;
static GdkPixmap *qmasksel_pixmap = NULL;
static GdkBitmap *qmasksel_mask = NULL;
static GdkPixmap *qmasknosel_pixmap = NULL;
@ -184,21 +181,12 @@ create_display_shell (GDisplay *gdisp,
GIMP_TYPE_PATTERN,
gdisplay_drop_viewable, gdisp);
if (! image_popup_menu)
{
GtkItemFactory *image_factory;
image_factory = menus_get_image_factory ();
image_popup_menu = image_factory->widget;
image_accel_group = image_factory->accel_group;
}
/* the popup menu */
gdisp->popup = image_popup_menu;
gdisp->ifactory = menus_get_image_factory ();
/* The accelerator table for images */
gtk_window_add_accel_group (GTK_WINDOW (gdisp->shell), image_accel_group);
gtk_window_add_accel_group (GTK_WINDOW (gdisp->shell),
gdisp->ifactory->accel_group);
/* connect the "F1" help key */
gimp_help_connect_help_accel (gdisp->shell,

View File

@ -24,13 +24,13 @@
#include "apptypes.h"
#include "layer-select.h"
#include "gdisplay.h"
#include "layers-dialog.h"
#include "gimpdrawable.h"
#include "gimpimage.h"
#include "gimplayer.h"
#include "gimprc.h"
#include "layers_dialogP.h"
#include "temp_buf.h"
#include "libgimp/gimpintl.h"

View File

@ -86,9 +86,6 @@ create_display_shell (GDisplay *gdisp,
gchar *title,
gint type)
{
static GtkWidget *image_popup_menu = NULL;
static GtkAccelGroup *image_accel_group = NULL;
static GdkPixmap *qmasksel_pixmap = NULL;
static GdkBitmap *qmasksel_mask = NULL;
static GdkPixmap *qmasknosel_pixmap = NULL;
@ -184,21 +181,12 @@ create_display_shell (GDisplay *gdisp,
GIMP_TYPE_PATTERN,
gdisplay_drop_viewable, gdisp);
if (! image_popup_menu)
{
GtkItemFactory *image_factory;
image_factory = menus_get_image_factory ();
image_popup_menu = image_factory->widget;
image_accel_group = image_factory->accel_group;
}
/* the popup menu */
gdisp->popup = image_popup_menu;
gdisp->ifactory = menus_get_image_factory ();
/* The accelerator table for images */
gtk_window_add_accel_group (GTK_WINDOW (gdisp->shell), image_accel_group);
gtk_window_add_accel_group (GTK_WINDOW (gdisp->shell),
gdisp->ifactory->accel_group);
/* connect the "F1" help key */
gimp_help_connect_help_accel (gdisp->shell,

View File

@ -94,13 +94,14 @@ struct _GDisplay
{
gint ID; /* unique identifier for this gdisplay */
GtkItemFactory *ifactory; /* factory for popup menu */
GtkWidget *shell; /* shell widget for this gdisplay */
GtkWidget *canvas; /* canvas widget for this gdisplay */
GtkWidget *hsb, *vsb; /* widgets for scroll bars */
GtkWidget *qmaskoff, *qmaskon; /* widgets for qmask buttons */
GtkWidget *hrule, *vrule; /* widgets for rulers */
GtkWidget *origin; /* widgets for rulers */
GtkWidget *popup; /* widget for popup menu */
GtkWidget *statusarea; /* hbox holding the statusbar and stuff */
GtkWidget *statusbar; /* widget for statusbar */
GtkWidget *progressbar; /* widget for progressbar */

View File

@ -196,5 +196,27 @@ gimp_dialog_hide (GtkWidget *dialog)
gdk_window_withdraw (dialog->window);
}
void
gimp_menu_position (GtkMenu *menu,
gint *x,
gint *y)
{
GtkRequisition requisition;
gint pointer_x;
gint pointer_y;
gint screen_width;
gint screen_height;
gdk_window_get_pointer (NULL, &pointer_x, &pointer_y, NULL);
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
screen_width = gdk_screen_width ();
screen_height = gdk_screen_height ();
*x = CLAMP (pointer_x - 2, 0, MAX (0, screen_width - requisition.width));
*y = CLAMP (pointer_y - 2, 0, MAX (0, screen_height - requisition.height));
*x = MAX (*x, 0);
*y = MAX (*y, 0);
}

View File

@ -31,5 +31,9 @@ void gimp_message_box (gchar *message,
void gimp_dialog_hide (GtkWidget *dialog);
void gimp_menu_position (GtkMenu *menu,
gint *x,
gint *y);
#endif /* __GIMP_UI_H__ */

View File

@ -45,6 +45,8 @@ libappgui_la_SOURCES = \
info-window.h \
layer-select.c \
layer-select.h \
layers-commands.c \
layers-commands.h \
layers-dialog.c \
layers-dialog.h \
menus.c \

View File

@ -35,7 +35,7 @@
#include "gdisplay.h"
#include "gimpdnd.h"
#include "gimpui.h"
#include "layers_dialogP.h"
#include "layers-dialog.h"
#include "lc_dialogP.h"
#include "ops_buttons.h"
#include "menus.h"

View File

@ -64,7 +64,6 @@
#include "image_render.h"
#include "nav_window.h"
#include "lc_dialog.h"
#include "layers_dialogP.h"
#include "plug_in.h"
#include "resize.h"
#include "scale.h"
@ -942,185 +941,6 @@ image_duplicate_cmd_callback (GtkWidget *widget,
gdisplay_new (gimp_image_duplicate (gdisp->gimage), 0x0101);
}
/***** Layers *****/
void
layers_previous_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
GimpLayer *new_layer;
gint current_layer;
return_if_no_display (gdisp);
current_layer =
gimp_image_get_layer_index (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
new_layer = (GimpLayer *)
gimp_container_get_child_by_index (gdisp->gimage->layers,
current_layer - 1);
if (new_layer)
{
gimp_image_set_active_layer (gdisp->gimage, new_layer);
gdisplays_flush ();
layer_select_init (gdisp->gimage, 0, GDK_CURRENT_TIME);
}
}
void
layers_next_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
GimpLayer *new_layer;
gint current_layer;
return_if_no_display (gdisp);
current_layer =
gimp_image_get_layer_index (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
new_layer = (GimpLayer *)
gimp_container_get_child_by_index (gdisp->gimage->layers,
current_layer + 1);
if (new_layer)
{
gimp_image_set_active_layer (gdisp->gimage, new_layer);
gdisplays_flush ();
layer_select_init (gdisp->gimage, 0, GDK_CURRENT_TIME);
}
}
void
layers_raise_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_image_raise_layer (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_lower_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_image_lower_layer (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_raise_to_top_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_image_raise_layer_to_top (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_lower_to_bottom_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_image_lower_layer_to_bottom (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_anchor_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
floating_sel_anchor (gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_merge_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
layers_dialog_layer_merge_query (gdisp->gimage, TRUE);
}
void
layers_flatten_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_image_flatten (gdisp->gimage);
gdisplays_flush ();
}
void
layers_mask_select_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimage_mask_layer_mask (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_add_alpha_channel_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_layer_add_alpha (gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_alpha_select_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimage_mask_layer_alpha (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_resize_to_image_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_layer_resize_to_image (gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
/***** Tools *****/

View File

@ -90,20 +90,6 @@ void image_resize_cmd_callback (GtkWidget *, gpointer);
void image_scale_cmd_callback (GtkWidget *, gpointer);
void image_duplicate_cmd_callback (GtkWidget *, gpointer);
void layers_previous_cmd_callback (GtkWidget *, gpointer);
void layers_next_cmd_callback (GtkWidget *, gpointer);
void layers_raise_cmd_callback (GtkWidget *, gpointer);
void layers_lower_cmd_callback (GtkWidget *, gpointer);
void layers_raise_to_top_cmd_callback (GtkWidget *, gpointer);
void layers_lower_to_bottom_cmd_callback (GtkWidget *, gpointer);
void layers_anchor_cmd_callback (GtkWidget *, gpointer);
void layers_merge_cmd_callback (GtkWidget *, gpointer);
void layers_flatten_cmd_callback (GtkWidget *, gpointer);
void layers_mask_select_cmd_callback (GtkWidget *, gpointer);
void layers_add_alpha_channel_cmd_callback (GtkWidget *, gpointer);
void layers_alpha_select_cmd_callback (GtkWidget *, gpointer);
void layers_resize_to_image_cmd_callback (GtkWidget *, gpointer);
void tools_default_colors_cmd_callback (GtkWidget *, gpointer);
void tools_swap_colors_cmd_callback (GtkWidget *, gpointer);
void tools_swap_contexts_cmd_callback (GtkWidget *, gpointer);

View File

@ -64,7 +64,6 @@
#include "image_render.h"
#include "nav_window.h"
#include "lc_dialog.h"
#include "layers_dialogP.h"
#include "plug_in.h"
#include "resize.h"
#include "scale.h"
@ -942,185 +941,6 @@ image_duplicate_cmd_callback (GtkWidget *widget,
gdisplay_new (gimp_image_duplicate (gdisp->gimage), 0x0101);
}
/***** Layers *****/
void
layers_previous_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
GimpLayer *new_layer;
gint current_layer;
return_if_no_display (gdisp);
current_layer =
gimp_image_get_layer_index (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
new_layer = (GimpLayer *)
gimp_container_get_child_by_index (gdisp->gimage->layers,
current_layer - 1);
if (new_layer)
{
gimp_image_set_active_layer (gdisp->gimage, new_layer);
gdisplays_flush ();
layer_select_init (gdisp->gimage, 0, GDK_CURRENT_TIME);
}
}
void
layers_next_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
GimpLayer *new_layer;
gint current_layer;
return_if_no_display (gdisp);
current_layer =
gimp_image_get_layer_index (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
new_layer = (GimpLayer *)
gimp_container_get_child_by_index (gdisp->gimage->layers,
current_layer + 1);
if (new_layer)
{
gimp_image_set_active_layer (gdisp->gimage, new_layer);
gdisplays_flush ();
layer_select_init (gdisp->gimage, 0, GDK_CURRENT_TIME);
}
}
void
layers_raise_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_image_raise_layer (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_lower_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_image_lower_layer (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_raise_to_top_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_image_raise_layer_to_top (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_lower_to_bottom_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_image_lower_layer_to_bottom (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_anchor_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
floating_sel_anchor (gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_merge_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
layers_dialog_layer_merge_query (gdisp->gimage, TRUE);
}
void
layers_flatten_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_image_flatten (gdisp->gimage);
gdisplays_flush ();
}
void
layers_mask_select_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimage_mask_layer_mask (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_add_alpha_channel_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_layer_add_alpha (gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_alpha_select_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimage_mask_layer_alpha (gdisp->gimage,
gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
void
layers_resize_to_image_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
return_if_no_display (gdisp);
gimp_layer_resize_to_image (gimp_image_get_active_layer (gdisp->gimage));
gdisplays_flush ();
}
/***** Tools *****/

View File

@ -90,20 +90,6 @@ void image_resize_cmd_callback (GtkWidget *, gpointer);
void image_scale_cmd_callback (GtkWidget *, gpointer);
void image_duplicate_cmd_callback (GtkWidget *, gpointer);
void layers_previous_cmd_callback (GtkWidget *, gpointer);
void layers_next_cmd_callback (GtkWidget *, gpointer);
void layers_raise_cmd_callback (GtkWidget *, gpointer);
void layers_lower_cmd_callback (GtkWidget *, gpointer);
void layers_raise_to_top_cmd_callback (GtkWidget *, gpointer);
void layers_lower_to_bottom_cmd_callback (GtkWidget *, gpointer);
void layers_anchor_cmd_callback (GtkWidget *, gpointer);
void layers_merge_cmd_callback (GtkWidget *, gpointer);
void layers_flatten_cmd_callback (GtkWidget *, gpointer);
void layers_mask_select_cmd_callback (GtkWidget *, gpointer);
void layers_add_alpha_channel_cmd_callback (GtkWidget *, gpointer);
void layers_alpha_select_cmd_callback (GtkWidget *, gpointer);
void layers_resize_to_image_cmd_callback (GtkWidget *, gpointer);
void tools_default_colors_cmd_callback (GtkWidget *, gpointer);
void tools_swap_colors_cmd_callback (GtkWidget *, gpointer);
void tools_swap_contexts_cmd_callback (GtkWidget *, gpointer);

View File

@ -24,13 +24,13 @@
#include "apptypes.h"
#include "layer-select.h"
#include "gdisplay.h"
#include "layers-dialog.h"
#include "gimpdrawable.h"
#include "gimpimage.h"
#include "gimplayer.h"
#include "gimprc.h"
#include "layers_dialogP.h"
#include "temp_buf.h"
#include "libgimp/gimpintl.h"

1218
app/gui/layers-commands.c Normal file

File diff suppressed because it is too large Load Diff

76
app/gui/layers-commands.h Normal file
View File

@ -0,0 +1,76 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __LAYERS_COMMANDS_H__
#define __LAYERS_COMMANDS_H__
void layers_previous_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_next_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_raise_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_lower_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_raise_to_top_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_lower_to_bottom_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_new_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_duplicate_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_delete_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_scale_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_resize_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_resize_to_image_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_add_layer_mask_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_apply_layer_mask_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_delete_layer_mask_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_anchor_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_merge_layers_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_merge_down_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_flatten_image_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_alpha_select_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_mask_select_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_add_alpha_channel_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_edit_attributes_cmd_callback (GtkWidget *widet,
gpointer data);
void layers_new_layer_query (GimpImage *gimage);
void layers_edit_layer_query (GimpLayer *layer);
void layers_layer_merge_query (GimpImage *gimage,
gboolean merge_visible);
#endif /* __LAYERS_COMMANDS_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -20,52 +20,14 @@
#define __LAYERS_DIALOG_H__
void layers_dialog_previous_layer_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_next_layer_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_raise_layer_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_lower_layer_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_raise_layer_to_top_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_lower_layer_to_bottom_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_new_layer_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_duplicate_layer_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_delete_layer_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_scale_layer_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_resize_layer_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_resize_to_image_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_add_layer_mask_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_apply_layer_mask_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_delete_layer_mask_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_anchor_layer_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_merge_layers_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_merge_down_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_flatten_image_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_alpha_select_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_mask_select_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_add_alpha_channel_callback (GtkWidget *widet,
gpointer data);
void layers_dialog_edit_layer_attributes_callback (GtkWidget *widet,
gpointer data);
void render_fs_preview (GtkWidget *widget,
GdkPixmap *pixmap);
void render_preview (TempBuf *preview_buf,
GtkWidget *preview_widget,
gint width,
gint height,
gint channel);
void layers_dialog_invalidate_previews (GimpImage *gimage);
#endif /* __LAYERS_DIALOG_H__ */

View File

@ -37,7 +37,7 @@
#include "dialog_handler.h"
#include "dialogs-commands.h"
#include "gdisplay.h"
#include "layers-dialog.h"
#include "layers-commands.h"
#include "menus.h"
#include "paths-dialog.h"
#include "test-commands.h"
@ -509,9 +509,9 @@ static GimpItemFactoryEntry image_entries[] =
NULL, NULL },
{ { N_("/Layers/Anchor Layer"), "<control>H", layers_anchor_cmd_callback, 0 },
"layers/anchor_layer.html", NULL },
{ { N_("/Layers/Merge Visible Layers..."), "<control>M", layers_merge_cmd_callback, 0 },
{ { N_("/Layers/Merge Visible Layers..."), "<control>M", layers_merge_layers_cmd_callback, 0 },
"layers/dialogs/merge_visible_layers.html", NULL },
{ { N_("/Layers/Flatten Image"), NULL, layers_flatten_cmd_callback, 0 },
{ { N_("/Layers/Flatten Image"), NULL, layers_flatten_image_cmd_callback, 0 },
"layers/flatten_image.html", NULL },
{ { "/Layers/---", NULL, NULL, 0, "<Separator>" },
@ -676,66 +676,87 @@ static GtkItemFactory *save_factory = NULL;
static GimpItemFactoryEntry layers_entries[] =
{
{ { N_("/New Layer..."), "<control>N", layers_dialog_new_layer_callback, 0 },
{ { N_("/New Layer..."), "<control>N",
layers_new_cmd_callback, 0 },
"dialogs/new_layer.html", NULL },
/* <Layers>/Stack */
{ { N_("/Stack/Raise Layer"), "<control>F", layers_dialog_raise_layer_callback, 0 },
{ { N_("/Stack/Raise Layer"), "<control>F",
layers_raise_cmd_callback, 0 },
"stack/stack.html#raise_layer", NULL },
{ { N_("/Stack/Lower Layer"), "<control>B", layers_dialog_lower_layer_callback, 0 },
{ { N_("/Stack/Lower Layer"), "<control>B",
layers_lower_cmd_callback, 0 },
"stack/stack.html#lower_layer", NULL },
{ { N_("/Stack/Layer to Top"), "<shift><control>F", layers_dialog_raise_layer_to_top_callback, 0 },
{ { N_("/Stack/Layer to Top"), "<shift><control>F",
layers_raise_to_top_cmd_callback, 0 },
"stack/stack.html#later_to_top", NULL },
{ { N_("/Stack/Layer to Bottom"), "<shift><control>B", layers_dialog_lower_layer_to_bottom_callback, 0 },
{ { N_("/Stack/Layer to Bottom"), "<shift><control>B",
layers_lower_to_bottom_cmd_callback, 0 },
"stack/stack.html#layer_to_bottom", NULL },
{ { N_("/Duplicate Layer"), "<control>C", layers_dialog_duplicate_layer_callback, 0 },
{ { N_("/Duplicate Layer"), "<control>C",
layers_duplicate_cmd_callback, 0 },
"duplicate_layer.html", NULL },
{ { N_("/Anchor Layer"), "<control>H", layers_dialog_anchor_layer_callback, 0 },
{ { N_("/Anchor Layer"), "<control>H",
layers_anchor_cmd_callback, 0 },
"anchor_layer.html", NULL },
{ { N_("/Delete Layer"), "<control>X", layers_dialog_delete_layer_callback, 0 },
{ { N_("/Delete Layer"), "<control>X",
layers_delete_cmd_callback, 0 },
"delete_layer.html", NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/Layer Boundary Size..."), "<control>R", layers_dialog_resize_layer_callback, 0 },
{ { N_("/Layer Boundary Size..."), "<control>R",
layers_resize_cmd_callback, 0 },
"dialogs/layer_boundary_size.html", NULL },
{ { N_("/Layer to Imagesize"), NULL, layers_dialog_resize_to_image_callback, 0 },
{ { N_("/Layer to Imagesize"), NULL,
layers_resize_to_image_cmd_callback, 0 },
"layer_to_image_size.html", NULL },
{ { N_("/Scale Layer..."), "<control>S", layers_dialog_scale_layer_callback, 0 },
{ { N_("/Scale Layer..."), "<control>S",
layers_scale_cmd_callback, 0 },
"dialogs/scale_layer.html", NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/Merge Visible Layers..."), "<control>M", layers_dialog_merge_layers_callback, 0 },
{ { N_("/Merge Visible Layers..."), "<control>M",
layers_merge_layers_cmd_callback, 0 },
"dialogs/merge_visible_layers.html", NULL },
{ { N_("/Merge Down"), "<control><shift>M", layers_dialog_merge_down_callback, 0 },
{ { N_("/Merge Down"), "<control><shift>M",
layers_merge_down_cmd_callback, 0 },
"merge_down.html", NULL },
{ { N_("/Flatten Image"), NULL, layers_dialog_flatten_image_callback, 0 },
{ { N_("/Flatten Image"), NULL,
layers_flatten_image_cmd_callback, 0 },
"flatten_image.html", NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/Add Layer Mask..."), NULL, layers_dialog_add_layer_mask_callback, 0 },
{ { N_("/Add Layer Mask..."), NULL,
layers_add_layer_mask_cmd_callback, 0 },
"dialogs/add_layer_mask.html", NULL },
{ { N_("/Apply Layer Mask"), NULL, layers_dialog_apply_layer_mask_callback, 0 },
{ { N_("/Apply Layer Mask"), NULL,
layers_apply_layer_mask_cmd_callback, 0 },
"apply_mask.html", NULL },
{ { N_("/Delete Layer Mask"), NULL, layers_dialog_delete_layer_mask_callback, 0 },
{ { N_("/Delete Layer Mask"), NULL,
layers_delete_layer_mask_cmd_callback, 0 },
"delete_mask.html", NULL },
{ { N_("/Mask to Selection"), NULL, layers_dialog_mask_select_callback, 0 },
{ { N_("/Mask to Selection"), NULL,
layers_mask_select_cmd_callback, 0 },
"mask_to_selection.html", NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/Add Alpha Channel"), NULL, layers_dialog_add_alpha_channel_callback, 0 },
{ { N_("/Add Alpha Channel"), NULL,
layers_add_alpha_channel_cmd_callback, 0 },
"add_alpha_channel.html", NULL },
{ { N_("/Alpha to Selection"), NULL, layers_dialog_alpha_select_callback, 0 },
{ { N_("/Alpha to Selection"), NULL,
layers_alpha_select_cmd_callback, 0 },
"alpha_to_selection.html", NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/Edit Layer Attributes..."), NULL, layers_dialog_edit_layer_attributes_callback, 0 },
{ { N_("/Edit Layer Attributes..."), NULL,
layers_edit_attributes_cmd_callback, 0 },
"dialogs/edit_layer_attributes.html", NULL }
};
static guint n_layers_entries = (sizeof (layers_entries) /

View File

@ -86,9 +86,6 @@ create_display_shell (GDisplay *gdisp,
gchar *title,
gint type)
{
static GtkWidget *image_popup_menu = NULL;
static GtkAccelGroup *image_accel_group = NULL;
static GdkPixmap *qmasksel_pixmap = NULL;
static GdkBitmap *qmasksel_mask = NULL;
static GdkPixmap *qmasknosel_pixmap = NULL;
@ -184,21 +181,12 @@ create_display_shell (GDisplay *gdisp,
GIMP_TYPE_PATTERN,
gdisplay_drop_viewable, gdisp);
if (! image_popup_menu)
{
GtkItemFactory *image_factory;
image_factory = menus_get_image_factory ();
image_popup_menu = image_factory->widget;
image_accel_group = image_factory->accel_group;
}
/* the popup menu */
gdisp->popup = image_popup_menu;
gdisp->ifactory = menus_get_image_factory ();
/* The accelerator table for images */
gtk_window_add_accel_group (GTK_WINDOW (gdisp->shell), image_accel_group);
gtk_window_add_accel_group (GTK_WINDOW (gdisp->shell),
gdisp->ifactory->accel_group);
/* connect the "F1" help key */
gimp_help_connect_help_accel (gdisp->shell,

View File

@ -1,35 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __LAYERS_DIALOG_P_H__
#define __LAYERS_DIALOG_P_H__
void render_fs_preview (GtkWidget *widget,
GdkPixmap *pixmap);
void render_preview (TempBuf *preview_buf,
GtkWidget *preview_widget,
gint width,
gint height,
gint channel);
void layers_dialog_invalidate_previews (GimpImage *gimage);
void layers_dialog_layer_merge_query (GimpImage *gimage,
gboolean merge_visible);
#endif /* __LAYERS_DIALOG_P_H__ */

View File

@ -28,6 +28,7 @@
#include "widgets/gimpdialogfactory.h"
#include "gui/dialogs.h"
#include "gui/layers-dialog.h"
#include "context_manager.h"
#include "dialog_handler.h"
@ -39,7 +40,6 @@
#include "image_render.h"
#include "lc_dialog.h"
#include "lc_dialogP.h"
#include "layers_dialogP.h"
#include "temp_buf.h"
#include "libgimp/gimplimits.h"

View File

@ -37,7 +37,7 @@
#include "dialog_handler.h"
#include "dialogs-commands.h"
#include "gdisplay.h"
#include "layers-dialog.h"
#include "layers-commands.h"
#include "menus.h"
#include "paths-dialog.h"
#include "test-commands.h"
@ -509,9 +509,9 @@ static GimpItemFactoryEntry image_entries[] =
NULL, NULL },
{ { N_("/Layers/Anchor Layer"), "<control>H", layers_anchor_cmd_callback, 0 },
"layers/anchor_layer.html", NULL },
{ { N_("/Layers/Merge Visible Layers..."), "<control>M", layers_merge_cmd_callback, 0 },
{ { N_("/Layers/Merge Visible Layers..."), "<control>M", layers_merge_layers_cmd_callback, 0 },
"layers/dialogs/merge_visible_layers.html", NULL },
{ { N_("/Layers/Flatten Image"), NULL, layers_flatten_cmd_callback, 0 },
{ { N_("/Layers/Flatten Image"), NULL, layers_flatten_image_cmd_callback, 0 },
"layers/flatten_image.html", NULL },
{ { "/Layers/---", NULL, NULL, 0, "<Separator>" },
@ -676,66 +676,87 @@ static GtkItemFactory *save_factory = NULL;
static GimpItemFactoryEntry layers_entries[] =
{
{ { N_("/New Layer..."), "<control>N", layers_dialog_new_layer_callback, 0 },
{ { N_("/New Layer..."), "<control>N",
layers_new_cmd_callback, 0 },
"dialogs/new_layer.html", NULL },
/* <Layers>/Stack */
{ { N_("/Stack/Raise Layer"), "<control>F", layers_dialog_raise_layer_callback, 0 },
{ { N_("/Stack/Raise Layer"), "<control>F",
layers_raise_cmd_callback, 0 },
"stack/stack.html#raise_layer", NULL },
{ { N_("/Stack/Lower Layer"), "<control>B", layers_dialog_lower_layer_callback, 0 },
{ { N_("/Stack/Lower Layer"), "<control>B",
layers_lower_cmd_callback, 0 },
"stack/stack.html#lower_layer", NULL },
{ { N_("/Stack/Layer to Top"), "<shift><control>F", layers_dialog_raise_layer_to_top_callback, 0 },
{ { N_("/Stack/Layer to Top"), "<shift><control>F",
layers_raise_to_top_cmd_callback, 0 },
"stack/stack.html#later_to_top", NULL },
{ { N_("/Stack/Layer to Bottom"), "<shift><control>B", layers_dialog_lower_layer_to_bottom_callback, 0 },
{ { N_("/Stack/Layer to Bottom"), "<shift><control>B",
layers_lower_to_bottom_cmd_callback, 0 },
"stack/stack.html#layer_to_bottom", NULL },
{ { N_("/Duplicate Layer"), "<control>C", layers_dialog_duplicate_layer_callback, 0 },
{ { N_("/Duplicate Layer"), "<control>C",
layers_duplicate_cmd_callback, 0 },
"duplicate_layer.html", NULL },
{ { N_("/Anchor Layer"), "<control>H", layers_dialog_anchor_layer_callback, 0 },
{ { N_("/Anchor Layer"), "<control>H",
layers_anchor_cmd_callback, 0 },
"anchor_layer.html", NULL },
{ { N_("/Delete Layer"), "<control>X", layers_dialog_delete_layer_callback, 0 },
{ { N_("/Delete Layer"), "<control>X",
layers_delete_cmd_callback, 0 },
"delete_layer.html", NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/Layer Boundary Size..."), "<control>R", layers_dialog_resize_layer_callback, 0 },
{ { N_("/Layer Boundary Size..."), "<control>R",
layers_resize_cmd_callback, 0 },
"dialogs/layer_boundary_size.html", NULL },
{ { N_("/Layer to Imagesize"), NULL, layers_dialog_resize_to_image_callback, 0 },
{ { N_("/Layer to Imagesize"), NULL,
layers_resize_to_image_cmd_callback, 0 },
"layer_to_image_size.html", NULL },
{ { N_("/Scale Layer..."), "<control>S", layers_dialog_scale_layer_callback, 0 },
{ { N_("/Scale Layer..."), "<control>S",
layers_scale_cmd_callback, 0 },
"dialogs/scale_layer.html", NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/Merge Visible Layers..."), "<control>M", layers_dialog_merge_layers_callback, 0 },
{ { N_("/Merge Visible Layers..."), "<control>M",
layers_merge_layers_cmd_callback, 0 },
"dialogs/merge_visible_layers.html", NULL },
{ { N_("/Merge Down"), "<control><shift>M", layers_dialog_merge_down_callback, 0 },
{ { N_("/Merge Down"), "<control><shift>M",
layers_merge_down_cmd_callback, 0 },
"merge_down.html", NULL },
{ { N_("/Flatten Image"), NULL, layers_dialog_flatten_image_callback, 0 },
{ { N_("/Flatten Image"), NULL,
layers_flatten_image_cmd_callback, 0 },
"flatten_image.html", NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/Add Layer Mask..."), NULL, layers_dialog_add_layer_mask_callback, 0 },
{ { N_("/Add Layer Mask..."), NULL,
layers_add_layer_mask_cmd_callback, 0 },
"dialogs/add_layer_mask.html", NULL },
{ { N_("/Apply Layer Mask"), NULL, layers_dialog_apply_layer_mask_callback, 0 },
{ { N_("/Apply Layer Mask"), NULL,
layers_apply_layer_mask_cmd_callback, 0 },
"apply_mask.html", NULL },
{ { N_("/Delete Layer Mask"), NULL, layers_dialog_delete_layer_mask_callback, 0 },
{ { N_("/Delete Layer Mask"), NULL,
layers_delete_layer_mask_cmd_callback, 0 },
"delete_mask.html", NULL },
{ { N_("/Mask to Selection"), NULL, layers_dialog_mask_select_callback, 0 },
{ { N_("/Mask to Selection"), NULL,
layers_mask_select_cmd_callback, 0 },
"mask_to_selection.html", NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/Add Alpha Channel"), NULL, layers_dialog_add_alpha_channel_callback, 0 },
{ { N_("/Add Alpha Channel"), NULL,
layers_add_alpha_channel_cmd_callback, 0 },
"add_alpha_channel.html", NULL },
{ { N_("/Alpha to Selection"), NULL, layers_dialog_alpha_select_callback, 0 },
{ { N_("/Alpha to Selection"), NULL,
layers_alpha_select_cmd_callback, 0 },
"alpha_to_selection.html", NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/Edit Layer Attributes..."), NULL, layers_dialog_edit_layer_attributes_callback, 0 },
{ { N_("/Edit Layer Attributes..."), NULL,
layers_edit_attributes_cmd_callback, 0 },
"dialogs/edit_layer_attributes.html", NULL }
};
static guint n_layers_entries = (sizeof (layers_entries) /

View File

@ -37,7 +37,7 @@
#include "dialog_handler.h"
#include "dialogs-commands.h"
#include "gdisplay.h"
#include "layers-dialog.h"
#include "layers-commands.h"
#include "menus.h"
#include "paths-dialog.h"
#include "test-commands.h"
@ -509,9 +509,9 @@ static GimpItemFactoryEntry image_entries[] =
NULL, NULL },
{ { N_("/Layers/Anchor Layer"), "<control>H", layers_anchor_cmd_callback, 0 },
"layers/anchor_layer.html", NULL },
{ { N_("/Layers/Merge Visible Layers..."), "<control>M", layers_merge_cmd_callback, 0 },
{ { N_("/Layers/Merge Visible Layers..."), "<control>M", layers_merge_layers_cmd_callback, 0 },
"layers/dialogs/merge_visible_layers.html", NULL },
{ { N_("/Layers/Flatten Image"), NULL, layers_flatten_cmd_callback, 0 },
{ { N_("/Layers/Flatten Image"), NULL, layers_flatten_image_cmd_callback, 0 },
"layers/flatten_image.html", NULL },
{ { "/Layers/---", NULL, NULL, 0, "<Separator>" },
@ -676,66 +676,87 @@ static GtkItemFactory *save_factory = NULL;
static GimpItemFactoryEntry layers_entries[] =
{
{ { N_("/New Layer..."), "<control>N", layers_dialog_new_layer_callback, 0 },
{ { N_("/New Layer..."), "<control>N",
layers_new_cmd_callback, 0 },
"dialogs/new_layer.html", NULL },
/* <Layers>/Stack */
{ { N_("/Stack/Raise Layer"), "<control>F", layers_dialog_raise_layer_callback, 0 },
{ { N_("/Stack/Raise Layer"), "<control>F",
layers_raise_cmd_callback, 0 },
"stack/stack.html#raise_layer", NULL },
{ { N_("/Stack/Lower Layer"), "<control>B", layers_dialog_lower_layer_callback, 0 },
{ { N_("/Stack/Lower Layer"), "<control>B",
layers_lower_cmd_callback, 0 },
"stack/stack.html#lower_layer", NULL },
{ { N_("/Stack/Layer to Top"), "<shift><control>F", layers_dialog_raise_layer_to_top_callback, 0 },
{ { N_("/Stack/Layer to Top"), "<shift><control>F",
layers_raise_to_top_cmd_callback, 0 },
"stack/stack.html#later_to_top", NULL },
{ { N_("/Stack/Layer to Bottom"), "<shift><control>B", layers_dialog_lower_layer_to_bottom_callback, 0 },
{ { N_("/Stack/Layer to Bottom"), "<shift><control>B",
layers_lower_to_bottom_cmd_callback, 0 },
"stack/stack.html#layer_to_bottom", NULL },
{ { N_("/Duplicate Layer"), "<control>C", layers_dialog_duplicate_layer_callback, 0 },
{ { N_("/Duplicate Layer"), "<control>C",
layers_duplicate_cmd_callback, 0 },
"duplicate_layer.html", NULL },
{ { N_("/Anchor Layer"), "<control>H", layers_dialog_anchor_layer_callback, 0 },
{ { N_("/Anchor Layer"), "<control>H",
layers_anchor_cmd_callback, 0 },
"anchor_layer.html", NULL },
{ { N_("/Delete Layer"), "<control>X", layers_dialog_delete_layer_callback, 0 },
{ { N_("/Delete Layer"), "<control>X",
layers_delete_cmd_callback, 0 },
"delete_layer.html", NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/Layer Boundary Size..."), "<control>R", layers_dialog_resize_layer_callback, 0 },
{ { N_("/Layer Boundary Size..."), "<control>R",
layers_resize_cmd_callback, 0 },
"dialogs/layer_boundary_size.html", NULL },
{ { N_("/Layer to Imagesize"), NULL, layers_dialog_resize_to_image_callback, 0 },
{ { N_("/Layer to Imagesize"), NULL,
layers_resize_to_image_cmd_callback, 0 },
"layer_to_image_size.html", NULL },
{ { N_("/Scale Layer..."), "<control>S", layers_dialog_scale_layer_callback, 0 },
{ { N_("/Scale Layer..."), "<control>S",
layers_scale_cmd_callback, 0 },
"dialogs/scale_layer.html", NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/Merge Visible Layers..."), "<control>M", layers_dialog_merge_layers_callback, 0 },
{ { N_("/Merge Visible Layers..."), "<control>M",
layers_merge_layers_cmd_callback, 0 },
"dialogs/merge_visible_layers.html", NULL },
{ { N_("/Merge Down"), "<control><shift>M", layers_dialog_merge_down_callback, 0 },
{ { N_("/Merge Down"), "<control><shift>M",
layers_merge_down_cmd_callback, 0 },
"merge_down.html", NULL },
{ { N_("/Flatten Image"), NULL, layers_dialog_flatten_image_callback, 0 },
{ { N_("/Flatten Image"), NULL,
layers_flatten_image_cmd_callback, 0 },
"flatten_image.html", NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/Add Layer Mask..."), NULL, layers_dialog_add_layer_mask_callback, 0 },
{ { N_("/Add Layer Mask..."), NULL,
layers_add_layer_mask_cmd_callback, 0 },
"dialogs/add_layer_mask.html", NULL },
{ { N_("/Apply Layer Mask"), NULL, layers_dialog_apply_layer_mask_callback, 0 },
{ { N_("/Apply Layer Mask"), NULL,
layers_apply_layer_mask_cmd_callback, 0 },
"apply_mask.html", NULL },
{ { N_("/Delete Layer Mask"), NULL, layers_dialog_delete_layer_mask_callback, 0 },
{ { N_("/Delete Layer Mask"), NULL,
layers_delete_layer_mask_cmd_callback, 0 },
"delete_mask.html", NULL },
{ { N_("/Mask to Selection"), NULL, layers_dialog_mask_select_callback, 0 },
{ { N_("/Mask to Selection"), NULL,
layers_mask_select_cmd_callback, 0 },
"mask_to_selection.html", NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/Add Alpha Channel"), NULL, layers_dialog_add_alpha_channel_callback, 0 },
{ { N_("/Add Alpha Channel"), NULL,
layers_add_alpha_channel_cmd_callback, 0 },
"add_alpha_channel.html", NULL },
{ { N_("/Alpha to Selection"), NULL, layers_dialog_alpha_select_callback, 0 },
{ { N_("/Alpha to Selection"), NULL,
layers_alpha_select_cmd_callback, 0 },
"alpha_to_selection.html", NULL },
{ { "/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/Edit Layer Attributes..."), NULL, layers_dialog_edit_layer_attributes_callback, 0 },
{ { N_("/Edit Layer Attributes..."), NULL,
layers_edit_attributes_cmd_callback, 0 },
"dialogs/edit_layer_attributes.html", NULL }
};
static guint n_layers_entries = (sizeof (layers_entries) /

View File

@ -196,5 +196,27 @@ gimp_dialog_hide (GtkWidget *dialog)
gdk_window_withdraw (dialog->window);
}
void
gimp_menu_position (GtkMenu *menu,
gint *x,
gint *y)
{
GtkRequisition requisition;
gint pointer_x;
gint pointer_y;
gint screen_width;
gint screen_height;
gdk_window_get_pointer (NULL, &pointer_x, &pointer_y, NULL);
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
screen_width = gdk_screen_width ();
screen_height = gdk_screen_height ();
*x = CLAMP (pointer_x - 2, 0, MAX (0, screen_width - requisition.width));
*y = CLAMP (pointer_y - 2, 0, MAX (0, screen_height - requisition.height));
*x = MAX (*x, 0);
*y = MAX (*y, 0);
}

View File

@ -31,5 +31,9 @@ void gimp_message_box (gchar *message,
void gimp_dialog_hide (GtkWidget *dialog);
void gimp_menu_position (GtkMenu *menu,
gint *x,
gint *y);
#endif /* __GIMP_UI_H__ */

View File

@ -57,6 +57,7 @@ app/gui/indicator-area.c
app/gui/info-dialog.c
app/gui/info-window.c
app/gui/layer-select.c
app/gui/layers-commands.c
app/gui/layers-dialog.c
app/gui/menus.c
app/gui/offset-dialog.h