Commit c1e2f4e2 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

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.
parent 4aab2ac3
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
......
......@@ -43,7 +43,6 @@ gimp_SOURCES = \
gimpprogress.h \
gimpui.c \
gimpui.h \
layers_dialogP.h \
lc_dialog.c \
lc_dialog.h \
lc_dialogP.h \
......
......@@ -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 *****/
......
......@@ -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);
......
This diff is collapsed.
/* 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__ */
......@@ -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 */
......
......@@ -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;
gdisplay_origin_menu_position (GTK_MENU (gdisp->ifactory->widget),
&x, &y, widget);
gtk_menu_popup (GTK_MENU (gdisp->popup),
NULL, NULL,
gdisplay_origin_menu_position, widget,
1, event->time);
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
......
......@@ -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;
gdisplay_origin_menu_position (GTK_MENU (gdisp->ifactory->widget),
&x, &y, widget);
gtk_menu_popup (GTK_MENU (gdisp->popup),
NULL, NULL,
gdisplay_origin_menu_position, widget,
1, event->time);
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
......
......@@ -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 */
......
......@@ -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;
gdisplay_origin_menu_position (GTK_MENU (gdisp->ifactory->widget),
&x, &y, widget);
gtk_menu_popup (GTK_MENU (gdisp->popup),
NULL, NULL,
gdisplay_origin_menu_position, widget,
1, event->time);
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
......
......@@ -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,
......
......@@ -24,13 +24,13 @@
#include "apptypes.h"
#include "layer-select.h"
#include "gdisplay.h"
#include "layers-dialog.h"
#include "gimpdrawable.h"