mirror of https://github.com/GNOME/gimp.git
app/commands.c app/disp_callbacks.c app/gdisplay.c app/lc_dialog.c applied
1999-06-20 Michael Natterer <mitschel@cs.tu-berlin.de> * app/commands.c * app/disp_callbacks.c * app/gdisplay.c * app/lc_dialog.c * app/menus.c: applied a patch from <Simon.Budig@unix-ag.org> which implements tear-off-menus(!!!). Modified it to use the GimpContext. The sensitivity of the menu entries is not updated after executing a command. This leaves the sensitivity in the state before the command was executed (which is buggy). Will probably have to update the sensitivity from gdisplays_flush(). Simon called the patch "temporary" but it looks pretty stable to me. Please test it :-) * app/context_manager.[ch]: minor changes. * app/gimpcontext.[ch]: the user context keeps track of the current display and image. The image is set automatically from gimp_context_set_display(). Still have to figure out how this should interact with gdisplay_active() (the current state is a hack). Made the context attributes real GtkObject arguments. Pass the changed attributes to the callbacks which connect to the <attribute>_changed signals. * app/gimpset.[ch] * app/gimpsetF.h * app/gimpsetP.h: made the gimpset properly derivable by adding signal slots to the object class structure. Added copyright headers. * app/gimpsignal.[ch]: new type gimp_sigtype_double, copyright header and my usual indentation fanaticism.
This commit is contained in:
parent
910832363b
commit
142ccb742d
36
ChangeLog
36
ChangeLog
|
@ -1,3 +1,39 @@
|
|||
1999-06-20 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||
|
||||
* app/commands.c
|
||||
* app/disp_callbacks.c
|
||||
* app/gdisplay.c
|
||||
* app/lc_dialog.c
|
||||
* app/menus.c: applied a patch from <Simon.Budig@unix-ag.org>
|
||||
which implements tear-off-menus(!!!). Modified it to use the
|
||||
GimpContext.
|
||||
The sensitivity of the menu entries is not updated after
|
||||
executing a command. This leaves the sensitivity in the state
|
||||
before the command was executed (which is buggy). Will probably
|
||||
have to update the sensitivity from gdisplays_flush().
|
||||
Simon called the patch "temporary" but it looks pretty stable to
|
||||
me. Please test it :-)
|
||||
|
||||
* app/context_manager.[ch]: minor changes.
|
||||
|
||||
* app/gimpcontext.[ch]: the user context keeps track of the
|
||||
current display and image. The image is set automatically from
|
||||
gimp_context_set_display().
|
||||
Still have to figure out how this should interact with
|
||||
gdisplay_active() (the current state is a hack).
|
||||
Made the context attributes real GtkObject arguments.
|
||||
Pass the changed attributes to the callbacks which connect to
|
||||
the <attribute>_changed signals.
|
||||
|
||||
* app/gimpset.[ch]
|
||||
* app/gimpsetF.h
|
||||
* app/gimpsetP.h: made the gimpset properly derivable by adding
|
||||
signal slots to the object class structure. Added copyright
|
||||
headers.
|
||||
|
||||
* app/gimpsignal.[ch]: new type gimp_sigtype_double, copyright
|
||||
header and my usual indentation fanaticism.
|
||||
|
||||
Sun Jun 20 14:55:14 1999 ape@gandalf.spacetec.no (Asbjorn Pettersen)
|
||||
|
||||
* plug-ins/xjt/xjt.c: <sys/types.h> before <sys/stat.h> to
|
||||
|
|
|
@ -68,6 +68,10 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#define return_if_no_display(gdisp) \
|
||||
gdisp = gdisplay_active (); \
|
||||
if (!gdisp) return
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Resize * resize;
|
||||
|
@ -88,10 +92,10 @@ static void gimage_mask_grow_callback (GtkWidget *, gpointer, gpointer);
|
|||
static void gimage_mask_shrink_callback (GtkWidget *, gpointer, gpointer);
|
||||
|
||||
/* local variables */
|
||||
static double selection_feather_radius = 5.0;
|
||||
static int selection_border_radius = 5;
|
||||
static int selection_grow_pixels = 1;
|
||||
static int selection_shrink_pixels = 1;
|
||||
static gdouble selection_feather_radius = 5.0;
|
||||
static gint selection_border_radius = 5;
|
||||
static gint selection_grow_pixels = 1;
|
||||
static gint selection_shrink_pixels = 1;
|
||||
|
||||
|
||||
void
|
||||
|
@ -122,16 +126,13 @@ file_revert_cmd_callback (GtkWidget *widget,
|
|||
file_revert_callback (widget, client_data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
file_close_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_close_window (gdisp, FALSE);
|
||||
}
|
||||
|
@ -149,7 +150,7 @@ edit_cut_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
global_edit_cut (gdisp);
|
||||
}
|
||||
|
@ -160,7 +161,7 @@ edit_copy_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
global_edit_copy (gdisp);
|
||||
}
|
||||
|
@ -171,7 +172,7 @@ edit_paste_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
global_edit_paste (gdisp, 0);
|
||||
}
|
||||
|
@ -182,7 +183,7 @@ edit_paste_into_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
global_edit_paste (gdisp, 1);
|
||||
}
|
||||
|
@ -193,10 +194,9 @@ edit_clear_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
edit_clear (gdisp->gimage, gimage_active_drawable (gdisp->gimage));
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -206,10 +206,9 @@ edit_fill_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
edit_fill (gdisp->gimage, gimage_active_drawable (gdisp->gimage));
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -219,10 +218,9 @@ edit_stroke_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_stroke (gdisp->gimage, gimage_active_drawable (gdisp->gimage));
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -232,7 +230,7 @@ edit_undo_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
undo_pop (gdisp->gimage);
|
||||
}
|
||||
|
@ -243,7 +241,7 @@ edit_redo_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
undo_redo (gdisp->gimage);
|
||||
}
|
||||
|
@ -254,7 +252,7 @@ edit_named_cut_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
named_edit_cut (gdisp);
|
||||
}
|
||||
|
@ -265,7 +263,7 @@ edit_named_copy_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
named_edit_copy (gdisp);
|
||||
}
|
||||
|
@ -276,7 +274,7 @@ edit_named_paste_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
named_edit_paste (gdisp);
|
||||
}
|
||||
|
@ -287,7 +285,7 @@ select_toggle_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
selection_hide (gdisp->select, (void *) gdisp);
|
||||
gdisplays_flush ();
|
||||
|
@ -299,7 +297,7 @@ select_invert_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_invert (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -311,7 +309,7 @@ select_all_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_all (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -323,7 +321,7 @@ select_none_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_none (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -335,9 +333,10 @@ select_float_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_float (gdisp->gimage, gimage_active_drawable (gdisp->gimage), 0, 0);
|
||||
gimage_mask_float (gdisp->gimage, gimage_active_drawable (gdisp->gimage),
|
||||
0, 0);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -347,7 +346,7 @@ select_sharpen_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_sharpen (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -359,7 +358,7 @@ select_border_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
query_size_box (N_("Border Selection"),
|
||||
N_("Border selection by:"),
|
||||
|
@ -378,7 +377,7 @@ select_feather_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
query_size_box (N_("Feather Selection"),
|
||||
N_("Feather selection by:"),
|
||||
|
@ -397,7 +396,7 @@ select_grow_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
query_size_box (N_("Grow Selection"),
|
||||
N_("Grow selection by:"),
|
||||
|
@ -416,7 +415,7 @@ select_shrink_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
query_size_box (N_("Shrink Selection"),
|
||||
N_("Shrink selection by:"),
|
||||
|
@ -435,7 +434,8 @@ select_save_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_save (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ view_dot_for_dot_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_set_dot_for_dot (gdisp, GTK_CHECK_MENU_ITEM (widget)->active);
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ view_zoomin_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, ZOOMIN);
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ view_zoomout_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, ZOOMOUT);
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ view_zoom_val (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, val);
|
||||
}
|
||||
|
@ -554,7 +554,7 @@ view_window_info_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (! gdisp->window_info_dialog)
|
||||
gdisp->window_info_dialog = info_window_create ((void *) gdisp);
|
||||
|
@ -568,7 +568,7 @@ view_toggle_rulers_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
/* This routine use promiscuous knowledge of gtk internals
|
||||
* in order to hide and show the rulers "smoothly". This
|
||||
|
@ -615,7 +615,7 @@ view_toggle_guides_cmd_callback (GtkWidget *widget,
|
|||
GDisplay * gdisp;
|
||||
int old_val;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
old_val = gdisp->draw_guides;
|
||||
gdisp->draw_guides = GTK_CHECK_MENU_ITEM (widget)->active;
|
||||
|
@ -633,7 +633,7 @@ view_snap_to_guides_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisp->snap_to_guides = GTK_CHECK_MENU_ITEM (widget)->active;
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ view_toggle_statusbar_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (!GTK_CHECK_MENU_ITEM (widget)->active)
|
||||
{
|
||||
|
@ -664,7 +664,7 @@ view_new_view_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_new_view (gdisp);
|
||||
}
|
||||
|
@ -675,9 +675,8 @@ view_shrink_wrap_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (gdisp)
|
||||
shrink_wrap_display (gdisp);
|
||||
}
|
||||
|
||||
|
@ -687,7 +686,8 @@ image_equalize_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
image_equalize ((void *) gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
@ -698,7 +698,8 @@ image_invert_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
image_invert ((void *) gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
@ -709,7 +710,8 @@ image_desaturate_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
image_desaturate ((void *) gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
@ -720,7 +722,8 @@ channel_ops_duplicate_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
channel_ops_duplicate ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -730,7 +733,8 @@ channel_ops_offset_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
channel_ops_offset ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -740,7 +744,8 @@ image_convert_rgb_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_rgb ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -750,7 +755,8 @@ image_convert_grayscale_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_grayscale ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -760,7 +766,8 @@ image_convert_indexed_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_indexed ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -770,10 +777,9 @@ image_resize_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
GimpImage * gimage;
|
||||
ImageResize *image_resize;
|
||||
ImageResize * image_resize;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
g_return_if_fail (gdisp != NULL);
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
|
@ -803,10 +809,9 @@ image_scale_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
GimpImage * gimage;
|
||||
ImageResize *image_scale;
|
||||
ImageResize * image_scale;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
g_return_if_fail (gdisp != NULL);
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
|
@ -836,9 +841,9 @@ layers_previous_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
int current_layer;
|
||||
Layer *new_layer;
|
||||
Layer * new_layer;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
current_layer =
|
||||
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
|
@ -862,9 +867,9 @@ layers_next_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
int current_layer;
|
||||
Layer *new_layer;
|
||||
Layer * new_layer;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
current_layer =
|
||||
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
|
@ -888,7 +893,7 @@ layers_raise_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_raise_layer (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -900,7 +905,7 @@ layers_lower_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_lower_layer (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -912,7 +917,7 @@ layers_raise_to_top_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_raise_layer_to_top (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -924,7 +929,7 @@ layers_lower_to_bottom_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_lower_layer_to_bottom (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -936,7 +941,7 @@ layers_anchor_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
floating_sel_anchor (gimage_get_active_layer (gdisp->gimage));
|
||||
gdisplays_flush ();
|
||||
|
@ -948,7 +953,7 @@ layers_merge_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
layers_dialog_layer_merge_query (gdisp->gimage, TRUE);
|
||||
}
|
||||
|
@ -959,7 +964,7 @@ layers_flatten_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_flatten (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -971,7 +976,7 @@ layers_alpha_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_layer_alpha (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -983,7 +988,7 @@ layers_mask_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_layer_mask (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -995,7 +1000,7 @@ layers_add_alpha_channel_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
layer_add_alpha ( gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -1076,13 +1081,13 @@ dialogs_gradient_editor_cmd_callback (GtkWidget *widget,
|
|||
gpointer client_data)
|
||||
{
|
||||
grad_create_gradient_editor ();
|
||||
} /* dialogs_gradient_editor_cmd_callback */
|
||||
}
|
||||
|
||||
void
|
||||
dialogs_lc_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
|
@ -1093,12 +1098,14 @@ dialogs_lc_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
cmap_dlg_sel_cb(ColormapDialog* dlg, gpointer user_data)
|
||||
cmap_dlg_sel_cb (ColormapDialog *dlg,
|
||||
gpointer user_data)
|
||||
{
|
||||
guchar* c;
|
||||
guchar * c;
|
||||
GimpImage * img = colormap_dialog_image(dlg);
|
||||
|
||||
GimpImage* img = colormap_dialog_image(dlg);
|
||||
c = &img->cmap[colormap_dialog_col_index(dlg) * 3];
|
||||
|
||||
if(active_color == FOREGROUND)
|
||||
palette_set_foreground (c[0], c[1], c[2]);
|
||||
else if(active_color == BACKGROUND)
|
||||
|
@ -1109,13 +1116,15 @@ void
|
|||
dialogs_indexed_palette_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
static ColormapDialog* cmap_dlg;
|
||||
if(!cmap_dlg){
|
||||
static ColormapDialog * cmap_dlg;
|
||||
|
||||
if(!cmap_dlg)
|
||||
{
|
||||
cmap_dlg = colormap_dialog_create (image_context);
|
||||
colormap_dialog_connect_selected(cmap_dlg_sel_cb, NULL,
|
||||
cmap_dlg);
|
||||
colormap_dialog_connect_selected (cmap_dlg_sel_cb, NULL, cmap_dlg);
|
||||
}
|
||||
gtk_widget_show(GTK_WIDGET(cmap_dlg));
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (cmap_dlg));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1179,8 +1188,8 @@ static void
|
|||
image_resize_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
{
|
||||
ImageResize *image_resize;
|
||||
GImage *gimage;
|
||||
ImageResize * image_resize;
|
||||
GImage * gimage;
|
||||
|
||||
image_resize = (ImageResize *) client_data;
|
||||
|
||||
|
@ -1211,8 +1220,8 @@ static void
|
|||
image_scale_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
{
|
||||
ImageResize *image_scale;
|
||||
GImage *gimage;
|
||||
ImageResize * image_scale;
|
||||
GImage * gimage;
|
||||
gboolean flush = FALSE;
|
||||
|
||||
image_scale = (ImageResize *) client_data;
|
||||
|
@ -1277,6 +1286,7 @@ image_cancel_callback (GtkWidget *w,
|
|||
gpointer client_data)
|
||||
{
|
||||
ImageResize *image_resize;
|
||||
|
||||
image_resize = (ImageResize *) client_data;
|
||||
|
||||
resize_widget_free (image_resize->resize);
|
||||
|
@ -1290,8 +1300,8 @@ gimage_mask_feather_callback (GtkWidget *w,
|
|||
{
|
||||
GImage *gimage = GIMP_IMAGE (client_data);
|
||||
GUnit unit;
|
||||
double radius_x;
|
||||
double radius_y;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
selection_feather_radius = *(double*) call_data;
|
||||
g_free (call_data);
|
||||
|
@ -1324,8 +1334,8 @@ gimage_mask_border_callback (GtkWidget *w,
|
|||
{
|
||||
GImage *gimage = GIMP_IMAGE (client_data);
|
||||
GUnit unit;
|
||||
double radius_x;
|
||||
double radius_y;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
selection_border_radius = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
|
@ -1358,8 +1368,8 @@ gimage_mask_grow_callback (GtkWidget *w,
|
|||
{
|
||||
GImage *gimage = GIMP_IMAGE (client_data);
|
||||
GUnit unit;
|
||||
double radius_x;
|
||||
double radius_y;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
selection_grow_pixels = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
|
@ -1392,8 +1402,8 @@ gimage_mask_shrink_callback (GtkWidget *w,
|
|||
{
|
||||
GImage *gimage = GIMP_IMAGE (client_data);
|
||||
GUnit unit;
|
||||
int radius_x;
|
||||
int radius_y;
|
||||
gint radius_x;
|
||||
gint radius_y;
|
||||
|
||||
selection_shrink_pixels = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
|
|
204
app/commands.c
204
app/commands.c
|
@ -68,6 +68,10 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#define return_if_no_display(gdisp) \
|
||||
gdisp = gdisplay_active (); \
|
||||
if (!gdisp) return
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Resize * resize;
|
||||
|
@ -88,10 +92,10 @@ static void gimage_mask_grow_callback (GtkWidget *, gpointer, gpointer);
|
|||
static void gimage_mask_shrink_callback (GtkWidget *, gpointer, gpointer);
|
||||
|
||||
/* local variables */
|
||||
static double selection_feather_radius = 5.0;
|
||||
static int selection_border_radius = 5;
|
||||
static int selection_grow_pixels = 1;
|
||||
static int selection_shrink_pixels = 1;
|
||||
static gdouble selection_feather_radius = 5.0;
|
||||
static gint selection_border_radius = 5;
|
||||
static gint selection_grow_pixels = 1;
|
||||
static gint selection_shrink_pixels = 1;
|
||||
|
||||
|
||||
void
|
||||
|
@ -122,16 +126,13 @@ file_revert_cmd_callback (GtkWidget *widget,
|
|||
file_revert_callback (widget, client_data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
file_close_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_close_window (gdisp, FALSE);
|
||||
}
|
||||
|
@ -149,7 +150,7 @@ edit_cut_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
global_edit_cut (gdisp);
|
||||
}
|
||||
|
@ -160,7 +161,7 @@ edit_copy_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
global_edit_copy (gdisp);
|
||||
}
|
||||
|
@ -171,7 +172,7 @@ edit_paste_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
global_edit_paste (gdisp, 0);
|
||||
}
|
||||
|
@ -182,7 +183,7 @@ edit_paste_into_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
global_edit_paste (gdisp, 1);
|
||||
}
|
||||
|
@ -193,10 +194,9 @@ edit_clear_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
edit_clear (gdisp->gimage, gimage_active_drawable (gdisp->gimage));
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -206,10 +206,9 @@ edit_fill_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
edit_fill (gdisp->gimage, gimage_active_drawable (gdisp->gimage));
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -219,10 +218,9 @@ edit_stroke_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_stroke (gdisp->gimage, gimage_active_drawable (gdisp->gimage));
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -232,7 +230,7 @@ edit_undo_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
undo_pop (gdisp->gimage);
|
||||
}
|
||||
|
@ -243,7 +241,7 @@ edit_redo_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
undo_redo (gdisp->gimage);
|
||||
}
|
||||
|
@ -254,7 +252,7 @@ edit_named_cut_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
named_edit_cut (gdisp);
|
||||
}
|
||||
|
@ -265,7 +263,7 @@ edit_named_copy_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
named_edit_copy (gdisp);
|
||||
}
|
||||
|
@ -276,7 +274,7 @@ edit_named_paste_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
named_edit_paste (gdisp);
|
||||
}
|
||||
|
@ -287,7 +285,7 @@ select_toggle_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
selection_hide (gdisp->select, (void *) gdisp);
|
||||
gdisplays_flush ();
|
||||
|
@ -299,7 +297,7 @@ select_invert_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_invert (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -311,7 +309,7 @@ select_all_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_all (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -323,7 +321,7 @@ select_none_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_none (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -335,9 +333,10 @@ select_float_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_float (gdisp->gimage, gimage_active_drawable (gdisp->gimage), 0, 0);
|
||||
gimage_mask_float (gdisp->gimage, gimage_active_drawable (gdisp->gimage),
|
||||
0, 0);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -347,7 +346,7 @@ select_sharpen_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_sharpen (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -359,7 +358,7 @@ select_border_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
query_size_box (N_("Border Selection"),
|
||||
N_("Border selection by:"),
|
||||
|
@ -378,7 +377,7 @@ select_feather_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
query_size_box (N_("Feather Selection"),
|
||||
N_("Feather selection by:"),
|
||||
|
@ -397,7 +396,7 @@ select_grow_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
query_size_box (N_("Grow Selection"),
|
||||
N_("Grow selection by:"),
|
||||
|
@ -416,7 +415,7 @@ select_shrink_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
query_size_box (N_("Shrink Selection"),
|
||||
N_("Shrink selection by:"),
|
||||
|
@ -435,7 +434,8 @@ select_save_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_save (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ view_dot_for_dot_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_set_dot_for_dot (gdisp, GTK_CHECK_MENU_ITEM (widget)->active);
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ view_zoomin_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, ZOOMIN);
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ view_zoomout_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, ZOOMOUT);
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ view_zoom_val (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, val);
|
||||
}
|
||||
|
@ -554,7 +554,7 @@ view_window_info_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (! gdisp->window_info_dialog)
|
||||
gdisp->window_info_dialog = info_window_create ((void *) gdisp);
|
||||
|
@ -568,7 +568,7 @@ view_toggle_rulers_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
/* This routine use promiscuous knowledge of gtk internals
|
||||
* in order to hide and show the rulers "smoothly". This
|
||||
|
@ -615,7 +615,7 @@ view_toggle_guides_cmd_callback (GtkWidget *widget,
|
|||
GDisplay * gdisp;
|
||||
int old_val;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
old_val = gdisp->draw_guides;
|
||||
gdisp->draw_guides = GTK_CHECK_MENU_ITEM (widget)->active;
|
||||
|
@ -633,7 +633,7 @@ view_snap_to_guides_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisp->snap_to_guides = GTK_CHECK_MENU_ITEM (widget)->active;
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ view_toggle_statusbar_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (!GTK_CHECK_MENU_ITEM (widget)->active)
|
||||
{
|
||||
|
@ -664,7 +664,7 @@ view_new_view_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_new_view (gdisp);
|
||||
}
|
||||
|
@ -675,9 +675,8 @@ view_shrink_wrap_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (gdisp)
|
||||
shrink_wrap_display (gdisp);
|
||||
}
|
||||
|
||||
|
@ -687,7 +686,8 @@ image_equalize_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
image_equalize ((void *) gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
@ -698,7 +698,8 @@ image_invert_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
image_invert ((void *) gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
@ -709,7 +710,8 @@ image_desaturate_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
image_desaturate ((void *) gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
@ -720,7 +722,8 @@ channel_ops_duplicate_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
channel_ops_duplicate ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -730,7 +733,8 @@ channel_ops_offset_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
channel_ops_offset ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -740,7 +744,8 @@ image_convert_rgb_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_rgb ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -750,7 +755,8 @@ image_convert_grayscale_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_grayscale ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -760,7 +766,8 @@ image_convert_indexed_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_indexed ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -770,10 +777,9 @@ image_resize_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
GimpImage * gimage;
|
||||
ImageResize *image_resize;
|
||||
ImageResize * image_resize;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
g_return_if_fail (gdisp != NULL);
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
|
@ -803,10 +809,9 @@ image_scale_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
GimpImage * gimage;
|
||||
ImageResize *image_scale;
|
||||
ImageResize * image_scale;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
g_return_if_fail (gdisp != NULL);
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
|
@ -836,9 +841,9 @@ layers_previous_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
int current_layer;
|
||||
Layer *new_layer;
|
||||
Layer * new_layer;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
current_layer =
|
||||
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
|
@ -862,9 +867,9 @@ layers_next_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
int current_layer;
|
||||
Layer *new_layer;
|
||||
Layer * new_layer;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
current_layer =
|
||||
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
|
@ -888,7 +893,7 @@ layers_raise_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_raise_layer (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -900,7 +905,7 @@ layers_lower_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_lower_layer (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -912,7 +917,7 @@ layers_raise_to_top_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_raise_layer_to_top (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -924,7 +929,7 @@ layers_lower_to_bottom_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_lower_layer_to_bottom (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -936,7 +941,7 @@ layers_anchor_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
floating_sel_anchor (gimage_get_active_layer (gdisp->gimage));
|
||||
gdisplays_flush ();
|
||||
|
@ -948,7 +953,7 @@ layers_merge_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
layers_dialog_layer_merge_query (gdisp->gimage, TRUE);
|
||||
}
|
||||
|
@ -959,7 +964,7 @@ layers_flatten_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_flatten (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -971,7 +976,7 @@ layers_alpha_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_layer_alpha (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -983,7 +988,7 @@ layers_mask_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_layer_mask (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -995,7 +1000,7 @@ layers_add_alpha_channel_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
layer_add_alpha ( gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -1076,13 +1081,13 @@ dialogs_gradient_editor_cmd_callback (GtkWidget *widget,
|
|||
gpointer client_data)
|
||||
{
|
||||
grad_create_gradient_editor ();
|
||||
} /* dialogs_gradient_editor_cmd_callback */
|
||||
}
|
||||
|
||||
void
|
||||
dialogs_lc_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
|
@ -1093,12 +1098,14 @@ dialogs_lc_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
cmap_dlg_sel_cb(ColormapDialog* dlg, gpointer user_data)
|
||||
cmap_dlg_sel_cb (ColormapDialog *dlg,
|
||||
gpointer user_data)
|
||||
{
|
||||
guchar* c;
|
||||
guchar * c;
|
||||
GimpImage * img = colormap_dialog_image(dlg);
|
||||
|
||||
GimpImage* img = colormap_dialog_image(dlg);
|
||||
c = &img->cmap[colormap_dialog_col_index(dlg) * 3];
|
||||
|
||||
if(active_color == FOREGROUND)
|
||||
palette_set_foreground (c[0], c[1], c[2]);
|
||||
else if(active_color == BACKGROUND)
|
||||
|
@ -1109,13 +1116,15 @@ void
|
|||
dialogs_indexed_palette_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
static ColormapDialog* cmap_dlg;
|
||||
if(!cmap_dlg){
|
||||
static ColormapDialog * cmap_dlg;
|
||||
|
||||
if(!cmap_dlg)
|
||||
{
|
||||
cmap_dlg = colormap_dialog_create (image_context);
|
||||
colormap_dialog_connect_selected(cmap_dlg_sel_cb, NULL,
|
||||
cmap_dlg);
|
||||
colormap_dialog_connect_selected (cmap_dlg_sel_cb, NULL, cmap_dlg);
|
||||
}
|
||||
gtk_widget_show(GTK_WIDGET(cmap_dlg));
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (cmap_dlg));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1179,8 +1188,8 @@ static void
|
|||
image_resize_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
{
|
||||
ImageResize *image_resize;
|
||||
GImage *gimage;
|
||||
ImageResize * image_resize;
|
||||
GImage * gimage;
|
||||
|
||||
image_resize = (ImageResize *) client_data;
|
||||
|
||||
|
@ -1211,8 +1220,8 @@ static void
|
|||
image_scale_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
{
|
||||
ImageResize *image_scale;
|
||||
GImage *gimage;
|
||||
ImageResize * image_scale;
|
||||
GImage * gimage;
|
||||
gboolean flush = FALSE;
|
||||
|
||||
image_scale = (ImageResize *) client_data;
|
||||
|
@ -1277,6 +1286,7 @@ image_cancel_callback (GtkWidget *w,
|
|||
gpointer client_data)
|
||||
{
|
||||
ImageResize *image_resize;
|
||||
|
||||
image_resize = (ImageResize *) client_data;
|
||||
|
||||
resize_widget_free (image_resize->resize);
|
||||
|
@ -1290,8 +1300,8 @@ gimage_mask_feather_callback (GtkWidget *w,
|
|||
{
|
||||
GImage *gimage = GIMP_IMAGE (client_data);
|
||||
GUnit unit;
|
||||
double radius_x;
|
||||
double radius_y;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
selection_feather_radius = *(double*) call_data;
|
||||
g_free (call_data);
|
||||
|
@ -1324,8 +1334,8 @@ gimage_mask_border_callback (GtkWidget *w,
|
|||
{
|
||||
GImage *gimage = GIMP_IMAGE (client_data);
|
||||
GUnit unit;
|
||||
double radius_x;
|
||||
double radius_y;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
selection_border_radius = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
|
@ -1358,8 +1368,8 @@ gimage_mask_grow_callback (GtkWidget *w,
|
|||
{
|
||||
GImage *gimage = GIMP_IMAGE (client_data);
|
||||
GUnit unit;
|
||||
double radius_x;
|
||||
double radius_y;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
selection_grow_pixels = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
|
@ -1392,8 +1402,8 @@ gimage_mask_shrink_callback (GtkWidget *w,
|
|||
{
|
||||
GImage *gimage = GIMP_IMAGE (client_data);
|
||||
GUnit unit;
|
||||
int radius_x;
|
||||
int radius_y;
|
||||
gint radius_x;
|
||||
gint radius_y;
|
||||
|
||||
selection_shrink_pixels = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "context_manager.h"
|
||||
|
||||
void
|
||||
|
|
|
@ -23,4 +23,4 @@
|
|||
void context_manager_init (void);
|
||||
void context_manager_free (void);
|
||||
|
||||
#endif /* __GIMP_CONTEXT_H__ */
|
||||
#endif /* __CONTEXT_MANAGER_H__ */
|
||||
|
|
|
@ -25,17 +25,25 @@
|
|||
g_return_if_fail ((context) != NULL); \
|
||||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
|
||||
#define context_return_val_if_fail(context, val) \
|
||||
#define context_return_val_if_fail(context,val) \
|
||||
g_return_val_if_fail ((context) != NULL, (val)); \
|
||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), (val));
|
||||
|
||||
#define context_check_current(context) \
|
||||
((context) = (context) ? (context) : current_context)
|
||||
|
||||
#define context_find_defined(context, field_defined) \
|
||||
#define context_find_defined(context,field_defined) \
|
||||
while (!((context)->field_defined) && (context)->parent) \
|
||||
(context) = (context)->parent
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_OPACITY,
|
||||
ARG_PAINT_MODE,
|
||||
ARG_IMAGE,
|
||||
ARG_DISPLAY
|
||||
};
|
||||
|
||||
enum {
|
||||
OPACITY_CHANGED,
|
||||
PAINT_MODE_CHANGED,
|
||||
|
@ -63,6 +71,63 @@ static GimpContext * standard_context = NULL;
|
|||
|
||||
/* private functions ******************************************************/
|
||||
|
||||
static void
|
||||
gimp_context_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
GimpContext *context;
|
||||
|
||||
context = GIMP_CONTEXT (object);
|
||||
|
||||
switch (arg_id)
|
||||
{
|
||||
case ARG_OPACITY:
|
||||
gimp_context_set_opacity (context, GTK_VALUE_DOUBLE (*arg));
|
||||
break;
|
||||
case ARG_PAINT_MODE:
|
||||
gimp_context_set_paint_mode (context, GTK_VALUE_INT (*arg));
|
||||
break;
|
||||
case ARG_IMAGE:
|
||||
gimp_context_set_image (context, GTK_VALUE_POINTER (*arg));
|
||||
break;
|
||||
case ARG_DISPLAY:
|
||||
gimp_context_set_display (context, GTK_VALUE_POINTER (*arg));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_context_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
GimpContext *context;
|
||||
|
||||
context = GIMP_CONTEXT (object);
|
||||
|
||||
switch (arg_id)
|
||||
{
|
||||
case ARG_OPACITY:
|
||||
GTK_VALUE_DOUBLE (*arg) = gimp_context_get_opacity (context);
|
||||
break;
|
||||
case ARG_PAINT_MODE:
|
||||
GTK_VALUE_INT (*arg) = gimp_context_get_paint_mode (context);
|
||||
break;
|
||||
case ARG_IMAGE:
|
||||
GTK_VALUE_POINTER (*arg) = gimp_context_get_image (context);
|
||||
break;
|
||||
case ARG_DISPLAY:
|
||||
GTK_VALUE_POINTER (*arg) = gimp_context_get_display (context);
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_context_destroy (GtkObject *object)
|
||||
{
|
||||
|
@ -86,6 +151,15 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
|
||||
object_class = GTK_OBJECT_CLASS (klass);
|
||||
|
||||
gtk_object_add_arg_type ("GimpContext::opacity",
|
||||
GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_OPACITY);
|
||||
gtk_object_add_arg_type ("GimpContext::paint_mode",
|
||||
GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_PAINT_MODE);
|
||||
gtk_object_add_arg_type ("GimpContext::image",
|
||||
GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_IMAGE);
|
||||
gtk_object_add_arg_type ("GimpContext::display",
|
||||
GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_DISPLAY);
|
||||
|
||||
parent_class = gtk_type_class (gimp_object_get_type ());
|
||||
|
||||
gimp_context_signals[OPACITY_CHANGED] =
|
||||
|
@ -94,7 +168,7 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpContextClass,
|
||||
opacity_changed),
|
||||
gimp_sigtype_void);
|
||||
gimp_sigtype_double);
|
||||
|
||||
gimp_context_signals[PAINT_MODE_CHANGED] =
|
||||
gimp_signal_new ("paint_mode_changed",
|
||||
|
@ -102,7 +176,7 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpContextClass,
|
||||
paint_mode_changed),
|
||||
gimp_sigtype_void);
|
||||
gimp_sigtype_int);
|
||||
|
||||
gimp_context_signals[IMAGE_CHANGED] =
|
||||
gimp_signal_new ("image_changed",
|
||||
|
@ -110,7 +184,7 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpContextClass,
|
||||
image_changed),
|
||||
gimp_sigtype_void);
|
||||
gimp_sigtype_pointer);
|
||||
|
||||
gimp_context_signals[DISPLAY_CHANGED] =
|
||||
gimp_signal_new ("display_changed",
|
||||
|
@ -118,17 +192,19 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpContextClass,
|
||||
display_changed),
|
||||
gimp_sigtype_void);
|
||||
gimp_sigtype_pointer);
|
||||
|
||||
gtk_object_class_add_signals (object_class, gimp_context_signals,
|
||||
LAST_SIGNAL);
|
||||
|
||||
object_class->set_arg = gimp_context_set_arg;
|
||||
object_class->get_arg = gimp_context_get_arg;
|
||||
object_class->destroy = gimp_context_destroy;
|
||||
|
||||
klass->opacity_changed = NULL;
|
||||
klass->paint_mode_changed = NULL;
|
||||
klass->image_changed = NULL;
|
||||
klass->display_changed = NULL;
|
||||
|
||||
object_class->destroy = gimp_context_destroy;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -326,7 +402,8 @@ gimp_context_set_opacity (GimpContext *context,
|
|||
|
||||
context->opacity = opacity;
|
||||
gtk_signal_emit (GTK_OBJECT (context),
|
||||
gimp_context_signals[OPACITY_CHANGED]);
|
||||
gimp_context_signals[OPACITY_CHANGED],
|
||||
opacity);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -371,7 +448,8 @@ gimp_context_set_paint_mode (GimpContext *context,
|
|||
|
||||
context->paint_mode = paint_mode;
|
||||
gtk_signal_emit (GTK_OBJECT(context),
|
||||
gimp_context_signals[PAINT_MODE_CHANGED]);
|
||||
gimp_context_signals[PAINT_MODE_CHANGED],
|
||||
paint_mode);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -414,9 +492,12 @@ gimp_context_set_image (GimpContext *context,
|
|||
context_return_if_fail (context);
|
||||
context_find_defined (context, image_defined);
|
||||
|
||||
if (context->image == image) return;
|
||||
|
||||
context->image = image;
|
||||
gtk_signal_emit (GTK_OBJECT (context),
|
||||
gimp_context_signals[IMAGE_CHANGED]);
|
||||
gimp_context_signals[IMAGE_CHANGED],
|
||||
image);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -455,13 +536,22 @@ void
|
|||
gimp_context_set_display (GimpContext *context,
|
||||
GDisplay *display)
|
||||
{
|
||||
GimpContext *orig = context;
|
||||
|
||||
context_check_current (context);
|
||||
context_return_if_fail (context);
|
||||
context_find_defined (context, display_defined);
|
||||
|
||||
if (context->display == display) return;
|
||||
|
||||
context->display = display;
|
||||
|
||||
/* set the image _before_ emitting the display_changed signal */
|
||||
gimp_context_set_image (orig, display ? display->gimage : NULL);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (context),
|
||||
gimp_context_signals[DISPLAY_CHANGED]);
|
||||
gimp_context_signals[DISPLAY_CHANGED],
|
||||
display);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <glib.h>
|
||||
|
||||
#include "gdisplayF.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gimpimageF.h"
|
||||
#include "gimpobjectP.h"
|
||||
|
||||
|
@ -30,6 +30,22 @@
|
|||
#define GIMP_IS_CONTEXT(obj) (GIMP_CHECK_TYPE ((obj), GIMP_TYPE_CONTEXT))
|
||||
#define GIMP_IS_CONTEXT_CLASS(klass) (GIMP_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONTEXT))
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_CONTEXT_ARG_OPACITY = 1 << 0,
|
||||
GIMP_CONTEXT_ARG_PAINT_MODE = 1 << 1,
|
||||
GIMP_CONTEXT_ARG_IMAGE = 1 << 2,
|
||||
GIMP_CONTEXT_ARG_DISPLAY = 1 << 3,
|
||||
|
||||
/* aliases
|
||||
*/
|
||||
GIMP_CONTEXT_ARG_PAINT = GIMP_CONTEXT_ARG_OPACITY |
|
||||
GIMP_CONTEXT_ARG_PAINT_MODE,
|
||||
GIMP_CONTEXT_ARG_ALL = GIMP_CONTEXT_ARG_PAINT |
|
||||
GIMP_CONTEXT_ARG_IMAGE |
|
||||
GIMP_CONTEXT_ARG_DISPLAY
|
||||
} GimpContextArgs;
|
||||
|
||||
typedef struct _GimpContext GimpContext;
|
||||
typedef struct _GimpContextClass GimpContextClass;
|
||||
|
||||
|
@ -61,11 +77,11 @@ struct _GimpContextClass
|
|||
{
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
void (* opacity_changed) (GimpContext *context);
|
||||
void (* paint_mode_changed) (GimpContext *context);
|
||||
void (* opacity_changed) (GimpContext *context, gdouble opacity);
|
||||
void (* paint_mode_changed) (GimpContext *context, gint paint_mode);
|
||||
|
||||
void (* image_changed) (GimpContext *context);
|
||||
void (* display_changed) (GimpContext *context);
|
||||
void (* image_changed) (GimpContext *context, gpointer image);
|
||||
void (* display_changed) (GimpContext *context, gpointer display);
|
||||
};
|
||||
|
||||
GtkType gimp_context_get_type (void);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "gdisplay_ops.h"
|
||||
#include "general.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimprc.h"
|
||||
#include "gximage.h"
|
||||
#include "image_render.h"
|
||||
|
@ -154,7 +155,6 @@ gdisplay_new (GimpImage *gimage,
|
|||
}
|
||||
|
||||
|
||||
|
||||
static int print (char *, int, int, const char *, ...) G_GNUC_PRINTF (4, 5);
|
||||
|
||||
static int
|
||||
|
@ -283,6 +283,7 @@ static void
|
|||
gdisplay_delete (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *tool_gdisp;
|
||||
GimpContext *context;
|
||||
|
||||
g_hash_table_remove (display_ht, gdisp->shell);
|
||||
g_hash_table_remove (display_ht, gdisp->canvas);
|
||||
|
@ -331,6 +332,11 @@ gdisplay_delete (GDisplay *gdisp)
|
|||
if (popup_shell == gdisp->shell)
|
||||
popup_shell= NULL;
|
||||
|
||||
/* set the active display to NULL */
|
||||
context = gimp_context_get_user ();
|
||||
if (gimp_context_get_display (context) == gdisp)
|
||||
gimp_context_set_display (context, NULL);
|
||||
|
||||
gtk_widget_unref (gdisp->shell);
|
||||
|
||||
g_free (gdisp);
|
||||
|
@ -1520,7 +1526,7 @@ gdisplay_remove_override_cursor (GDisplay *gdisp)
|
|||
}
|
||||
else
|
||||
{
|
||||
/* g_warning ("Tried to remove override-cursor from un-overridden gdisp."); */
|
||||
/* g_warning ("Tried to remove override-cursor from un-overridden gdisp."); */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1676,12 +1682,25 @@ gdisplay_expose_full (GDisplay *gdisp)
|
|||
GDisplay *
|
||||
gdisplay_active ()
|
||||
{
|
||||
/* FIXME: this function may become useless once the GimpContext, which also
|
||||
* has an active display, is properly tested
|
||||
* TODO: ensure that gimp_context_get_display (gimp_context_get_user ())
|
||||
* _always_ return the correct display
|
||||
*
|
||||
* ideally, this function's body should be:
|
||||
* {
|
||||
* return gimp_context_get_display (gimp_context_get_user ());
|
||||
* }
|
||||
*/
|
||||
|
||||
GtkWidget *event_widget;
|
||||
GtkWidget *toplevel_widget;
|
||||
GdkEvent *event;
|
||||
GDisplay *gdisp = NULL;
|
||||
|
||||
/* If the popup shell is valid, then get the gdisplay associated with that shell */
|
||||
/* If the popup shell is valid, then get the gdisplay associated
|
||||
* with that shell
|
||||
*/
|
||||
event = gtk_get_current_event ();
|
||||
event_widget = gtk_get_event_widget (event);
|
||||
if (event != NULL)
|
||||
|
@ -1698,11 +1717,22 @@ gdisplay_active ()
|
|||
if (gdisp)
|
||||
return gdisp;
|
||||
|
||||
if (popup_shell)
|
||||
{
|
||||
gdisp = gtk_object_get_user_data (GTK_OBJECT (popup_shell));
|
||||
/* The following is insane, since the checking if the display is valid
|
||||
* should not be here - this will be corrected, if the active_image stuff
|
||||
* moves to GimpContext. */
|
||||
|
||||
gdisp = gimp_context_get_display (gimp_context_get_user ());
|
||||
|
||||
if (g_slist_index(display_list, gdisp) >= 0)
|
||||
return gdisp;
|
||||
}
|
||||
|
||||
/* disabled, since tear-off menus may have pointers to gone displays...
|
||||
* if (popup_shell)
|
||||
* {
|
||||
* gdisp = gtk_object_get_user_data (GTK_OBJECT (popup_shell));
|
||||
* return gdisp;
|
||||
* }
|
||||
*/
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2018,6 +2048,7 @@ gdisplays_delete ()
|
|||
g_slist_free (display_list);
|
||||
}
|
||||
|
||||
|
||||
GDisplay *
|
||||
gdisplays_check_valid (GDisplay *gtest, GimpImage *gimage)
|
||||
{
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#include "disp_callbacks.h"
|
||||
#include "gdisplay.h"
|
||||
#include "general.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimprc.h"
|
||||
#include "gimpset.h"
|
||||
#include "interface.h"
|
||||
#include "layer_select.h"
|
||||
#include "move.h"
|
||||
|
@ -110,17 +110,22 @@ gdisplay_shell_events (GtkWidget *w,
|
|||
GdkEvent *event,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
/* Set the active Image to the image where the user clicked/typed */
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_KEY_PRESS:
|
||||
gimp_set_set_active(image_context, gdisp->gimage);
|
||||
/* Setting the context's display automatically sets the image, too */
|
||||
gimp_context_set_display (gimp_context_get_user (), gdisp);
|
||||
|
||||
/* Always set the menu sensitivity to ensure the consitency of the
|
||||
* tear-off menus
|
||||
*/
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -280,7 +285,6 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
case 3:
|
||||
state |= GDK_BUTTON3_MASK;
|
||||
popup_shell = gdisp->shell;
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
gtk_menu_popup (GTK_MENU (gdisp->popup), NULL, NULL, NULL, NULL, 3, bevent->time);
|
||||
|
||||
break;
|
||||
|
@ -441,9 +445,6 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* We need this here in case of accelerators */
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
break;
|
||||
|
||||
case GDK_KEY_RELEASE:
|
||||
|
@ -543,7 +544,6 @@ gdisplay_origin_button_press (GtkWidget *widget,
|
|||
{
|
||||
gdisp = data;
|
||||
popup_shell = gdisp->shell;
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
gtk_menu_popup (GTK_MENU (gdisp->popup),
|
||||
NULL, NULL, NULL, NULL, 1, event->time);
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#include "disp_callbacks.h"
|
||||
#include "gdisplay.h"
|
||||
#include "general.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimprc.h"
|
||||
#include "gimpset.h"
|
||||
#include "interface.h"
|
||||
#include "layer_select.h"
|
||||
#include "move.h"
|
||||
|
@ -110,17 +110,22 @@ gdisplay_shell_events (GtkWidget *w,
|
|||
GdkEvent *event,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
/* Set the active Image to the image where the user clicked/typed */
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_KEY_PRESS:
|
||||
gimp_set_set_active(image_context, gdisp->gimage);
|
||||
/* Setting the context's display automatically sets the image, too */
|
||||
gimp_context_set_display (gimp_context_get_user (), gdisp);
|
||||
|
||||
/* Always set the menu sensitivity to ensure the consitency of the
|
||||
* tear-off menus
|
||||
*/
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -280,7 +285,6 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
case 3:
|
||||
state |= GDK_BUTTON3_MASK;
|
||||
popup_shell = gdisp->shell;
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
gtk_menu_popup (GTK_MENU (gdisp->popup), NULL, NULL, NULL, NULL, 3, bevent->time);
|
||||
|
||||
break;
|
||||
|
@ -441,9 +445,6 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* We need this here in case of accelerators */
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
break;
|
||||
|
||||
case GDK_KEY_RELEASE:
|
||||
|
@ -543,7 +544,6 @@ gdisplay_origin_button_press (GtkWidget *widget,
|
|||
{
|
||||
gdisp = data;
|
||||
popup_shell = gdisp->shell;
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
gtk_menu_popup (GTK_MENU (gdisp->popup),
|
||||
NULL, NULL, NULL, NULL, 1, event->time);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "gdisplay_ops.h"
|
||||
#include "general.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimprc.h"
|
||||
#include "gximage.h"
|
||||
#include "image_render.h"
|
||||
|
@ -154,7 +155,6 @@ gdisplay_new (GimpImage *gimage,
|
|||
}
|
||||
|
||||
|
||||
|
||||
static int print (char *, int, int, const char *, ...) G_GNUC_PRINTF (4, 5);
|
||||
|
||||
static int
|
||||
|
@ -283,6 +283,7 @@ static void
|
|||
gdisplay_delete (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *tool_gdisp;
|
||||
GimpContext *context;
|
||||
|
||||
g_hash_table_remove (display_ht, gdisp->shell);
|
||||
g_hash_table_remove (display_ht, gdisp->canvas);
|
||||
|
@ -331,6 +332,11 @@ gdisplay_delete (GDisplay *gdisp)
|
|||
if (popup_shell == gdisp->shell)
|
||||
popup_shell= NULL;
|
||||
|
||||
/* set the active display to NULL */
|
||||
context = gimp_context_get_user ();
|
||||
if (gimp_context_get_display (context) == gdisp)
|
||||
gimp_context_set_display (context, NULL);
|
||||
|
||||
gtk_widget_unref (gdisp->shell);
|
||||
|
||||
g_free (gdisp);
|
||||
|
@ -1520,7 +1526,7 @@ gdisplay_remove_override_cursor (GDisplay *gdisp)
|
|||
}
|
||||
else
|
||||
{
|
||||
/* g_warning ("Tried to remove override-cursor from un-overridden gdisp."); */
|
||||
/* g_warning ("Tried to remove override-cursor from un-overridden gdisp."); */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1676,12 +1682,25 @@ gdisplay_expose_full (GDisplay *gdisp)
|
|||
GDisplay *
|
||||
gdisplay_active ()
|
||||
{
|
||||
/* FIXME: this function may become useless once the GimpContext, which also
|
||||
* has an active display, is properly tested
|
||||
* TODO: ensure that gimp_context_get_display (gimp_context_get_user ())
|
||||
* _always_ return the correct display
|
||||
*
|
||||
* ideally, this function's body should be:
|
||||
* {
|
||||
* return gimp_context_get_display (gimp_context_get_user ());
|
||||
* }
|
||||
*/
|
||||
|
||||
GtkWidget *event_widget;
|
||||
GtkWidget *toplevel_widget;
|
||||
GdkEvent *event;
|
||||
GDisplay *gdisp = NULL;
|
||||
|
||||
/* If the popup shell is valid, then get the gdisplay associated with that shell */
|
||||
/* If the popup shell is valid, then get the gdisplay associated
|
||||
* with that shell
|
||||
*/
|
||||
event = gtk_get_current_event ();
|
||||
event_widget = gtk_get_event_widget (event);
|
||||
if (event != NULL)
|
||||
|
@ -1698,11 +1717,22 @@ gdisplay_active ()
|
|||
if (gdisp)
|
||||
return gdisp;
|
||||
|
||||
if (popup_shell)
|
||||
{
|
||||
gdisp = gtk_object_get_user_data (GTK_OBJECT (popup_shell));
|
||||
/* The following is insane, since the checking if the display is valid
|
||||
* should not be here - this will be corrected, if the active_image stuff
|
||||
* moves to GimpContext. */
|
||||
|
||||
gdisp = gimp_context_get_display (gimp_context_get_user ());
|
||||
|
||||
if (g_slist_index(display_list, gdisp) >= 0)
|
||||
return gdisp;
|
||||
}
|
||||
|
||||
/* disabled, since tear-off menus may have pointers to gone displays...
|
||||
* if (popup_shell)
|
||||
* {
|
||||
* gdisp = gtk_object_get_user_data (GTK_OBJECT (popup_shell));
|
||||
* return gdisp;
|
||||
* }
|
||||
*/
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2018,6 +2048,7 @@ gdisplays_delete ()
|
|||
g_slist_free (display_list);
|
||||
}
|
||||
|
||||
|
||||
GDisplay *
|
||||
gdisplays_check_valid (GDisplay *gtest, GimpImage *gimage)
|
||||
{
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#include "disp_callbacks.h"
|
||||
#include "gdisplay.h"
|
||||
#include "general.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimprc.h"
|
||||
#include "gimpset.h"
|
||||
#include "interface.h"
|
||||
#include "layer_select.h"
|
||||
#include "move.h"
|
||||
|
@ -110,17 +110,22 @@ gdisplay_shell_events (GtkWidget *w,
|
|||
GdkEvent *event,
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
/* Set the active Image to the image where the user clicked/typed */
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_KEY_PRESS:
|
||||
gimp_set_set_active(image_context, gdisp->gimage);
|
||||
/* Setting the context's display automatically sets the image, too */
|
||||
gimp_context_set_display (gimp_context_get_user (), gdisp);
|
||||
|
||||
/* Always set the menu sensitivity to ensure the consitency of the
|
||||
* tear-off menus
|
||||
*/
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -280,7 +285,6 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
case 3:
|
||||
state |= GDK_BUTTON3_MASK;
|
||||
popup_shell = gdisp->shell;
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
gtk_menu_popup (GTK_MENU (gdisp->popup), NULL, NULL, NULL, NULL, 3, bevent->time);
|
||||
|
||||
break;
|
||||
|
@ -441,9 +445,6 @@ gdisplay_canvas_events (GtkWidget *canvas,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* We need this here in case of accelerators */
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
break;
|
||||
|
||||
case GDK_KEY_RELEASE:
|
||||
|
@ -543,7 +544,6 @@ gdisplay_origin_button_press (GtkWidget *widget,
|
|||
{
|
||||
gdisp = data;
|
||||
popup_shell = gdisp->shell;
|
||||
gdisplay_set_menu_sensitivity (gdisp);
|
||||
gtk_menu_popup (GTK_MENU (gdisp->popup),
|
||||
NULL, NULL, NULL, NULL, 1, event->time);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "gdisplay_ops.h"
|
||||
#include "general.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimprc.h"
|
||||
#include "gximage.h"
|
||||
#include "image_render.h"
|
||||
|
@ -154,7 +155,6 @@ gdisplay_new (GimpImage *gimage,
|
|||
}
|
||||
|
||||
|
||||
|
||||
static int print (char *, int, int, const char *, ...) G_GNUC_PRINTF (4, 5);
|
||||
|
||||
static int
|
||||
|
@ -283,6 +283,7 @@ static void
|
|||
gdisplay_delete (GDisplay *gdisp)
|
||||
{
|
||||
GDisplay *tool_gdisp;
|
||||
GimpContext *context;
|
||||
|
||||
g_hash_table_remove (display_ht, gdisp->shell);
|
||||
g_hash_table_remove (display_ht, gdisp->canvas);
|
||||
|
@ -331,6 +332,11 @@ gdisplay_delete (GDisplay *gdisp)
|
|||
if (popup_shell == gdisp->shell)
|
||||
popup_shell= NULL;
|
||||
|
||||
/* set the active display to NULL */
|
||||
context = gimp_context_get_user ();
|
||||
if (gimp_context_get_display (context) == gdisp)
|
||||
gimp_context_set_display (context, NULL);
|
||||
|
||||
gtk_widget_unref (gdisp->shell);
|
||||
|
||||
g_free (gdisp);
|
||||
|
@ -1520,7 +1526,7 @@ gdisplay_remove_override_cursor (GDisplay *gdisp)
|
|||
}
|
||||
else
|
||||
{
|
||||
/* g_warning ("Tried to remove override-cursor from un-overridden gdisp."); */
|
||||
/* g_warning ("Tried to remove override-cursor from un-overridden gdisp."); */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1676,12 +1682,25 @@ gdisplay_expose_full (GDisplay *gdisp)
|
|||
GDisplay *
|
||||
gdisplay_active ()
|
||||
{
|
||||
/* FIXME: this function may become useless once the GimpContext, which also
|
||||
* has an active display, is properly tested
|
||||
* TODO: ensure that gimp_context_get_display (gimp_context_get_user ())
|
||||
* _always_ return the correct display
|
||||
*
|
||||
* ideally, this function's body should be:
|
||||
* {
|
||||
* return gimp_context_get_display (gimp_context_get_user ());
|
||||
* }
|
||||
*/
|
||||
|
||||
GtkWidget *event_widget;
|
||||
GtkWidget *toplevel_widget;
|
||||
GdkEvent *event;
|
||||
GDisplay *gdisp = NULL;
|
||||
|
||||
/* If the popup shell is valid, then get the gdisplay associated with that shell */
|
||||
/* If the popup shell is valid, then get the gdisplay associated
|
||||
* with that shell
|
||||
*/
|
||||
event = gtk_get_current_event ();
|
||||
event_widget = gtk_get_event_widget (event);
|
||||
if (event != NULL)
|
||||
|
@ -1698,11 +1717,22 @@ gdisplay_active ()
|
|||
if (gdisp)
|
||||
return gdisp;
|
||||
|
||||
if (popup_shell)
|
||||
{
|
||||
gdisp = gtk_object_get_user_data (GTK_OBJECT (popup_shell));
|
||||
/* The following is insane, since the checking if the display is valid
|
||||
* should not be here - this will be corrected, if the active_image stuff
|
||||
* moves to GimpContext. */
|
||||
|
||||
gdisp = gimp_context_get_display (gimp_context_get_user ());
|
||||
|
||||
if (g_slist_index(display_list, gdisp) >= 0)
|
||||
return gdisp;
|
||||
}
|
||||
|
||||
/* disabled, since tear-off menus may have pointers to gone displays...
|
||||
* if (popup_shell)
|
||||
* {
|
||||
* gdisp = gtk_object_get_user_data (GTK_OBJECT (popup_shell));
|
||||
* return gdisp;
|
||||
* }
|
||||
*/
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2018,6 +2048,7 @@ gdisplays_delete ()
|
|||
g_slist_free (display_list);
|
||||
}
|
||||
|
||||
|
||||
GDisplay *
|
||||
gdisplays_check_valid (GDisplay *gtest, GimpImage *gimage)
|
||||
{
|
||||
|
|
|
@ -25,17 +25,25 @@
|
|||
g_return_if_fail ((context) != NULL); \
|
||||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
|
||||
#define context_return_val_if_fail(context, val) \
|
||||
#define context_return_val_if_fail(context,val) \
|
||||
g_return_val_if_fail ((context) != NULL, (val)); \
|
||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), (val));
|
||||
|
||||
#define context_check_current(context) \
|
||||
((context) = (context) ? (context) : current_context)
|
||||
|
||||
#define context_find_defined(context, field_defined) \
|
||||
#define context_find_defined(context,field_defined) \
|
||||
while (!((context)->field_defined) && (context)->parent) \
|
||||
(context) = (context)->parent
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_OPACITY,
|
||||
ARG_PAINT_MODE,
|
||||
ARG_IMAGE,
|
||||
ARG_DISPLAY
|
||||
};
|
||||
|
||||
enum {
|
||||
OPACITY_CHANGED,
|
||||
PAINT_MODE_CHANGED,
|
||||
|
@ -63,6 +71,63 @@ static GimpContext * standard_context = NULL;
|
|||
|
||||
/* private functions ******************************************************/
|
||||
|
||||
static void
|
||||
gimp_context_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
GimpContext *context;
|
||||
|
||||
context = GIMP_CONTEXT (object);
|
||||
|
||||
switch (arg_id)
|
||||
{
|
||||
case ARG_OPACITY:
|
||||
gimp_context_set_opacity (context, GTK_VALUE_DOUBLE (*arg));
|
||||
break;
|
||||
case ARG_PAINT_MODE:
|
||||
gimp_context_set_paint_mode (context, GTK_VALUE_INT (*arg));
|
||||
break;
|
||||
case ARG_IMAGE:
|
||||
gimp_context_set_image (context, GTK_VALUE_POINTER (*arg));
|
||||
break;
|
||||
case ARG_DISPLAY:
|
||||
gimp_context_set_display (context, GTK_VALUE_POINTER (*arg));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_context_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id)
|
||||
{
|
||||
GimpContext *context;
|
||||
|
||||
context = GIMP_CONTEXT (object);
|
||||
|
||||
switch (arg_id)
|
||||
{
|
||||
case ARG_OPACITY:
|
||||
GTK_VALUE_DOUBLE (*arg) = gimp_context_get_opacity (context);
|
||||
break;
|
||||
case ARG_PAINT_MODE:
|
||||
GTK_VALUE_INT (*arg) = gimp_context_get_paint_mode (context);
|
||||
break;
|
||||
case ARG_IMAGE:
|
||||
GTK_VALUE_POINTER (*arg) = gimp_context_get_image (context);
|
||||
break;
|
||||
case ARG_DISPLAY:
|
||||
GTK_VALUE_POINTER (*arg) = gimp_context_get_display (context);
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_context_destroy (GtkObject *object)
|
||||
{
|
||||
|
@ -86,6 +151,15 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
|
||||
object_class = GTK_OBJECT_CLASS (klass);
|
||||
|
||||
gtk_object_add_arg_type ("GimpContext::opacity",
|
||||
GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_OPACITY);
|
||||
gtk_object_add_arg_type ("GimpContext::paint_mode",
|
||||
GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_PAINT_MODE);
|
||||
gtk_object_add_arg_type ("GimpContext::image",
|
||||
GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_IMAGE);
|
||||
gtk_object_add_arg_type ("GimpContext::display",
|
||||
GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_DISPLAY);
|
||||
|
||||
parent_class = gtk_type_class (gimp_object_get_type ());
|
||||
|
||||
gimp_context_signals[OPACITY_CHANGED] =
|
||||
|
@ -94,7 +168,7 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpContextClass,
|
||||
opacity_changed),
|
||||
gimp_sigtype_void);
|
||||
gimp_sigtype_double);
|
||||
|
||||
gimp_context_signals[PAINT_MODE_CHANGED] =
|
||||
gimp_signal_new ("paint_mode_changed",
|
||||
|
@ -102,7 +176,7 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpContextClass,
|
||||
paint_mode_changed),
|
||||
gimp_sigtype_void);
|
||||
gimp_sigtype_int);
|
||||
|
||||
gimp_context_signals[IMAGE_CHANGED] =
|
||||
gimp_signal_new ("image_changed",
|
||||
|
@ -110,7 +184,7 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpContextClass,
|
||||
image_changed),
|
||||
gimp_sigtype_void);
|
||||
gimp_sigtype_pointer);
|
||||
|
||||
gimp_context_signals[DISPLAY_CHANGED] =
|
||||
gimp_signal_new ("display_changed",
|
||||
|
@ -118,17 +192,19 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpContextClass,
|
||||
display_changed),
|
||||
gimp_sigtype_void);
|
||||
gimp_sigtype_pointer);
|
||||
|
||||
gtk_object_class_add_signals (object_class, gimp_context_signals,
|
||||
LAST_SIGNAL);
|
||||
|
||||
object_class->set_arg = gimp_context_set_arg;
|
||||
object_class->get_arg = gimp_context_get_arg;
|
||||
object_class->destroy = gimp_context_destroy;
|
||||
|
||||
klass->opacity_changed = NULL;
|
||||
klass->paint_mode_changed = NULL;
|
||||
klass->image_changed = NULL;
|
||||
klass->display_changed = NULL;
|
||||
|
||||
object_class->destroy = gimp_context_destroy;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -326,7 +402,8 @@ gimp_context_set_opacity (GimpContext *context,
|
|||
|
||||
context->opacity = opacity;
|
||||
gtk_signal_emit (GTK_OBJECT (context),
|
||||
gimp_context_signals[OPACITY_CHANGED]);
|
||||
gimp_context_signals[OPACITY_CHANGED],
|
||||
opacity);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -371,7 +448,8 @@ gimp_context_set_paint_mode (GimpContext *context,
|
|||
|
||||
context->paint_mode = paint_mode;
|
||||
gtk_signal_emit (GTK_OBJECT(context),
|
||||
gimp_context_signals[PAINT_MODE_CHANGED]);
|
||||
gimp_context_signals[PAINT_MODE_CHANGED],
|
||||
paint_mode);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -414,9 +492,12 @@ gimp_context_set_image (GimpContext *context,
|
|||
context_return_if_fail (context);
|
||||
context_find_defined (context, image_defined);
|
||||
|
||||
if (context->image == image) return;
|
||||
|
||||
context->image = image;
|
||||
gtk_signal_emit (GTK_OBJECT (context),
|
||||
gimp_context_signals[IMAGE_CHANGED]);
|
||||
gimp_context_signals[IMAGE_CHANGED],
|
||||
image);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -455,13 +536,22 @@ void
|
|||
gimp_context_set_display (GimpContext *context,
|
||||
GDisplay *display)
|
||||
{
|
||||
GimpContext *orig = context;
|
||||
|
||||
context_check_current (context);
|
||||
context_return_if_fail (context);
|
||||
context_find_defined (context, display_defined);
|
||||
|
||||
if (context->display == display) return;
|
||||
|
||||
context->display = display;
|
||||
|
||||
/* set the image _before_ emitting the display_changed signal */
|
||||
gimp_context_set_image (orig, display ? display->gimage : NULL);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (context),
|
||||
gimp_context_signals[DISPLAY_CHANGED]);
|
||||
gimp_context_signals[DISPLAY_CHANGED],
|
||||
display);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <glib.h>
|
||||
|
||||
#include "gdisplayF.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gimpimageF.h"
|
||||
#include "gimpobjectP.h"
|
||||
|
||||
|
@ -30,6 +30,22 @@
|
|||
#define GIMP_IS_CONTEXT(obj) (GIMP_CHECK_TYPE ((obj), GIMP_TYPE_CONTEXT))
|
||||
#define GIMP_IS_CONTEXT_CLASS(klass) (GIMP_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONTEXT))
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_CONTEXT_ARG_OPACITY = 1 << 0,
|
||||
GIMP_CONTEXT_ARG_PAINT_MODE = 1 << 1,
|
||||
GIMP_CONTEXT_ARG_IMAGE = 1 << 2,
|
||||
GIMP_CONTEXT_ARG_DISPLAY = 1 << 3,
|
||||
|
||||
/* aliases
|
||||
*/
|
||||
GIMP_CONTEXT_ARG_PAINT = GIMP_CONTEXT_ARG_OPACITY |
|
||||
GIMP_CONTEXT_ARG_PAINT_MODE,
|
||||
GIMP_CONTEXT_ARG_ALL = GIMP_CONTEXT_ARG_PAINT |
|
||||
GIMP_CONTEXT_ARG_IMAGE |
|
||||
GIMP_CONTEXT_ARG_DISPLAY
|
||||
} GimpContextArgs;
|
||||
|
||||
typedef struct _GimpContext GimpContext;
|
||||
typedef struct _GimpContextClass GimpContextClass;
|
||||
|
||||
|
@ -61,11 +77,11 @@ struct _GimpContextClass
|
|||
{
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
void (* opacity_changed) (GimpContext *context);
|
||||
void (* paint_mode_changed) (GimpContext *context);
|
||||
void (* opacity_changed) (GimpContext *context, gdouble opacity);
|
||||
void (* paint_mode_changed) (GimpContext *context, gint paint_mode);
|
||||
|
||||
void (* image_changed) (GimpContext *context);
|
||||
void (* display_changed) (GimpContext *context);
|
||||
void (* image_changed) (GimpContext *context, gpointer image);
|
||||
void (* display_changed) (GimpContext *context, gpointer display);
|
||||
};
|
||||
|
||||
GtkType gimp_context_get_type (void);
|
||||
|
|
410
app/gimpset.c
410
app/gimpset.c
|
@ -1,18 +1,37 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "gimpsignal.h"
|
||||
#include "gimpsetP.h"
|
||||
|
||||
/* Yep, this can be optimized quite a lot */
|
||||
|
||||
|
||||
typedef struct _GimpSetHandler {
|
||||
const gchar* signame;
|
||||
typedef struct _GimpSetHandler
|
||||
{
|
||||
const gchar *signame;
|
||||
GtkSignalFunc func;
|
||||
gpointer user_data;
|
||||
} GimpSetHandler;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
gpointer object;
|
||||
GArray* handlers;
|
||||
GArray *handlers;
|
||||
guint destroy_handler;
|
||||
} Node;
|
||||
|
||||
|
@ -24,284 +43,355 @@ enum
|
|||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static Node* gimp_set_find_node (GimpSet* set, gpointer ob);
|
||||
static Node* gimp_set_node_new (GimpSet* set, gpointer ob);
|
||||
static void gimp_set_node_free (GimpSet* set, Node* n);
|
||||
|
||||
|
||||
|
||||
|
||||
static Node * gimp_set_find_node (GimpSet* set, gpointer object);
|
||||
static Node * gimp_set_node_new (GimpSet* set, gpointer obbject);
|
||||
static void gimp_set_node_free (GimpSet* set, Node* node);
|
||||
|
||||
static guint gimp_set_signals [LAST_SIGNAL];
|
||||
|
||||
static GimpObjectClass* parent_class;
|
||||
|
||||
static void
|
||||
gimp_set_destroy (GtkObject* ob)
|
||||
gimp_set_destroy (GtkObject* object)
|
||||
{
|
||||
GimpSet* set=GIMP_SET(ob);
|
||||
GSList* l;
|
||||
for(l=set->list;l;l=l->next)
|
||||
gimp_set_node_free(set, l->data);
|
||||
g_slist_free(set->list);
|
||||
g_array_free(set->handlers, TRUE);
|
||||
GTK_OBJECT_CLASS(parent_class)->destroy (ob);
|
||||
GimpSet* set = GIMP_SET (object);
|
||||
GSList* list;
|
||||
|
||||
for (list = set->list; list; list = list->next)
|
||||
gimp_set_node_free (set, list->data);
|
||||
|
||||
g_slist_free (set->list);
|
||||
g_array_free (set->handlers, TRUE);
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_set_init (GimpSet* set)
|
||||
{
|
||||
set->list=NULL;
|
||||
set->type=GTK_TYPE_OBJECT;
|
||||
set->handlers=g_array_new(FALSE, FALSE, sizeof(GimpSetHandler));
|
||||
set->active_element=NULL;
|
||||
set->list = NULL;
|
||||
set->type = GTK_TYPE_OBJECT;
|
||||
set->handlers = g_array_new (FALSE, FALSE, sizeof (GimpSetHandler));
|
||||
set->active_element = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_set_class_init (GimpSetClass* klass)
|
||||
{
|
||||
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
|
||||
GtkType type = object_class->type;
|
||||
GtkObjectClass *object_class;
|
||||
|
||||
parent_class=gtk_type_parent_class(type);
|
||||
object_class = GTK_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = gtk_type_class (gimp_object_get_type ());
|
||||
|
||||
gimp_set_signals[ADD]=
|
||||
gimp_signal_new ("add",
|
||||
GTK_RUN_FIRST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpSetClass,
|
||||
add),
|
||||
gimp_sigtype_pointer);
|
||||
|
||||
gimp_set_signals[REMOVE]=
|
||||
gimp_signal_new ("remove",
|
||||
GTK_RUN_FIRST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpSetClass,
|
||||
remove),
|
||||
gimp_sigtype_pointer);
|
||||
|
||||
gimp_set_signals[ACTIVE_CHANGED]=
|
||||
gimp_signal_new ("active_changed",
|
||||
GTK_RUN_FIRST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpSetClass,
|
||||
active_changed),
|
||||
gimp_sigtype_pointer);
|
||||
|
||||
gtk_object_class_add_signals (object_class, gimp_set_signals, LAST_SIGNAL);
|
||||
|
||||
object_class->destroy = gimp_set_destroy;
|
||||
|
||||
gimp_set_signals[ADD]=
|
||||
gimp_signal_new ("add", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
|
||||
gimp_set_signals[REMOVE]=
|
||||
gimp_signal_new ("remove", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
|
||||
gimp_set_signals[ACTIVE_CHANGED]=
|
||||
gimp_signal_new ("active_changed", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
|
||||
gtk_object_class_add_signals (object_class,
|
||||
gimp_set_signals,
|
||||
LAST_SIGNAL);
|
||||
klass->add = NULL;
|
||||
klass->remove = NULL;
|
||||
klass->active_changed = NULL;
|
||||
}
|
||||
|
||||
GtkType gimp_set_get_type (void)
|
||||
GtkType
|
||||
gimp_set_get_type (void)
|
||||
{
|
||||
static GtkType type;
|
||||
GIMP_TYPE_INIT(type,
|
||||
static GtkType gimpset_type = 0;
|
||||
|
||||
GIMP_TYPE_INIT(gimpset_type,
|
||||
GimpSet,
|
||||
GimpSetClass,
|
||||
gimp_set_init,
|
||||
gimp_set_class_init,
|
||||
GIMP_TYPE_OBJECT);
|
||||
return type;
|
||||
|
||||
return gimpset_type;
|
||||
}
|
||||
|
||||
|
||||
GimpSet*
|
||||
gimp_set_new (GtkType type, gboolean weak){
|
||||
GimpSet* set;
|
||||
GimpSet *
|
||||
gimp_set_new (GtkType type,
|
||||
gboolean weak)
|
||||
{
|
||||
GimpSet *set;
|
||||
|
||||
/* untyped sets must not be weak, since we can't attach a
|
||||
* destroy handler */
|
||||
g_assert(!(type == GTK_TYPE_NONE && weak == TRUE));
|
||||
* destroy handler
|
||||
*/
|
||||
g_assert (!(type == GTK_TYPE_NONE && weak == TRUE));
|
||||
|
||||
set = gtk_type_new (gimp_set_get_type ());
|
||||
set->type = type;
|
||||
set->weak = weak;
|
||||
|
||||
set=gtk_type_new (gimp_set_get_type ());
|
||||
set->type=type;
|
||||
set->weak=weak;
|
||||
return set;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_set_destroy_cb (GtkObject* ob, gpointer data){
|
||||
GimpSet* set=GIMP_SET(data);
|
||||
gimp_set_remove(set, ob);
|
||||
gimp_set_destroy_cb (GtkObject *object,
|
||||
gpointer data)
|
||||
{
|
||||
GimpSet *set = GIMP_SET (data);
|
||||
|
||||
gimp_set_remove (set, object);
|
||||
}
|
||||
|
||||
static Node*
|
||||
gimp_set_find_node (GimpSet* set, gpointer ob)
|
||||
static Node *
|
||||
gimp_set_find_node (GimpSet *set,
|
||||
gpointer object)
|
||||
{
|
||||
GSList* l = set->list;
|
||||
for(l = set->list; l; l = l->next){
|
||||
Node* n = l->data;
|
||||
if (n->object == ob)
|
||||
return n;
|
||||
GSList *list = set->list;
|
||||
|
||||
for(list = set->list; list; list = list->next)
|
||||
{
|
||||
Node *node = list->data;
|
||||
|
||||
if (node->object == object)
|
||||
return node;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Node*
|
||||
gimp_set_node_new (GimpSet* set, gpointer ob)
|
||||
gimp_set_node_new (GimpSet *set,
|
||||
gpointer object)
|
||||
{
|
||||
gint i;
|
||||
Node* n = g_new(Node, 1);
|
||||
n->object = ob;
|
||||
n->handlers = g_array_new(FALSE, FALSE, sizeof(guint));
|
||||
g_array_set_size(n->handlers, set->handlers->len);
|
||||
for(i = 0;i < n->handlers->len; i++){
|
||||
GimpSetHandler* h
|
||||
= &g_array_index(set->handlers, GimpSetHandler, i);
|
||||
if(h->signame)
|
||||
g_array_index(n->handlers, guint, i)
|
||||
= gtk_signal_connect(GTK_OBJECT(ob),
|
||||
h->signame,
|
||||
h->func,
|
||||
h->user_data);
|
||||
Node *node = g_new (Node, 1);
|
||||
|
||||
node->object = object;
|
||||
node->handlers = g_array_new (FALSE, FALSE, sizeof (guint));
|
||||
g_array_set_size (node->handlers, set->handlers->len);
|
||||
|
||||
for (i = 0; i < node->handlers->len; i++)
|
||||
{
|
||||
GimpSetHandler *handler =
|
||||
&g_array_index (set->handlers, GimpSetHandler, i);
|
||||
|
||||
if (handler->signame)
|
||||
g_array_index (node->handlers, guint, i)
|
||||
= gtk_signal_connect (GTK_OBJECT(object),
|
||||
handler->signame,
|
||||
handler->func,
|
||||
handler->user_data);
|
||||
}
|
||||
|
||||
if(set->weak)
|
||||
n->destroy_handler
|
||||
= gtk_signal_connect(GTK_OBJECT(ob),
|
||||
"destroy",
|
||||
GTK_SIGNAL_FUNC(gimp_set_destroy_cb),
|
||||
node->destroy_handler =
|
||||
gtk_signal_connect(GTK_OBJECT (object), "destroy",
|
||||
GTK_SIGNAL_FUNC (gimp_set_destroy_cb),
|
||||
set);
|
||||
return n;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_set_node_free (GimpSet* set, Node* n)
|
||||
gimp_set_node_free (GimpSet *set,
|
||||
Node *node)
|
||||
{
|
||||
gint i;
|
||||
GimpObject* ob = n->object;
|
||||
for(i=0;i < set->handlers->len; i++){
|
||||
GimpSetHandler* h
|
||||
= &g_array_index(set->handlers, GimpSetHandler, i);
|
||||
if(h->signame)
|
||||
gtk_signal_disconnect(GTK_OBJECT(ob),
|
||||
g_array_index(n->handlers,
|
||||
guint,
|
||||
i));
|
||||
GimpObject *object = node->object;
|
||||
|
||||
for (i=0; i < set->handlers->len; i++)
|
||||
{
|
||||
GimpSetHandler* handler =
|
||||
&g_array_index (set->handlers, GimpSetHandler, i);
|
||||
|
||||
if (handler->signame)
|
||||
gtk_signal_disconnect (GTK_OBJECT (object),
|
||||
g_array_index (node->handlers, guint, i));
|
||||
}
|
||||
if(set->weak)
|
||||
gtk_signal_disconnect(GTK_OBJECT(ob),
|
||||
n->destroy_handler);
|
||||
g_array_free(n->handlers, TRUE);
|
||||
g_free(n);
|
||||
|
||||
if (set->weak)
|
||||
gtk_signal_disconnect (GTK_OBJECT (object),
|
||||
node->destroy_handler);
|
||||
|
||||
g_array_free (node->handlers, TRUE);
|
||||
g_free (node);
|
||||
}
|
||||
|
||||
|
||||
gboolean
|
||||
gimp_set_add (GimpSet* set, gpointer val)
|
||||
gimp_set_add (GimpSet *set,
|
||||
gpointer val)
|
||||
{
|
||||
g_return_val_if_fail(set, FALSE);
|
||||
g_return_val_if_fail (set, FALSE);
|
||||
|
||||
if (set->type != GTK_TYPE_NONE)
|
||||
g_return_val_if_fail(GTK_CHECK_TYPE(val, set->type), FALSE);
|
||||
g_return_val_if_fail (GTK_CHECK_TYPE (val, set->type), FALSE);
|
||||
|
||||
if(gimp_set_find_node(set, val))
|
||||
if (gimp_set_find_node (set, val))
|
||||
return FALSE;
|
||||
|
||||
set->list=g_slist_prepend(set->list, gimp_set_node_new(set, val));
|
||||
set->list = g_slist_prepend (set->list, gimp_set_node_new (set, val));
|
||||
gtk_signal_emit (GTK_OBJECT (set), gimp_set_signals[ADD], val);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT(set), gimp_set_signals[ADD], val);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_set_remove (GimpSet* set, gpointer val) {
|
||||
Node* n;
|
||||
gimp_set_remove (GimpSet *set,
|
||||
gpointer val)
|
||||
{
|
||||
Node *node;
|
||||
|
||||
g_return_val_if_fail(set, FALSE);
|
||||
g_return_val_if_fail (set, FALSE);
|
||||
|
||||
n = gimp_set_find_node (set, val);
|
||||
g_return_val_if_fail(n, FALSE);
|
||||
node = gimp_set_find_node (set, val);
|
||||
g_return_val_if_fail (node, FALSE);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT(set), gimp_set_signals[REMOVE], val);
|
||||
gtk_signal_emit (GTK_OBJECT (set), gimp_set_signals[REMOVE], val);
|
||||
|
||||
gimp_set_node_free(set, n);
|
||||
gimp_set_node_free (set, node);
|
||||
set->list = g_slist_remove (set->list, node);
|
||||
|
||||
set->list=g_slist_remove(set->list, n);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_set_have (GimpSet* set, gpointer val) {
|
||||
return !!gimp_set_find_node(set, val);
|
||||
gimp_set_have (GimpSet *set,
|
||||
gpointer val)
|
||||
{
|
||||
return !!gimp_set_find_node (set, val);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_set_foreach(GimpSet* set, GFunc func, gpointer user_data)
|
||||
gimp_set_foreach (GimpSet *set,
|
||||
GFunc func,
|
||||
gpointer user_data)
|
||||
{
|
||||
GSList* l;
|
||||
for(l=set->list; l;l=l->next){
|
||||
Node* n = l->data;
|
||||
func(n->object, user_data);
|
||||
GSList* list;
|
||||
|
||||
for (list = set->list; list; list = list->next)
|
||||
{
|
||||
Node *node = list->data;
|
||||
|
||||
func (node->object, user_data);
|
||||
}
|
||||
}
|
||||
|
||||
GtkType
|
||||
gimp_set_type (GimpSet* set){
|
||||
gimp_set_type (GimpSet* set)
|
||||
{
|
||||
return set->type;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_set_set_active (GimpSet* set, gpointer ob)
|
||||
gimp_set_set_active (GimpSet *set,
|
||||
gpointer object)
|
||||
{
|
||||
if (ob != set->active_element && gimp_set_have(set, ob)) {
|
||||
set->active_element = ob;
|
||||
gtk_signal_emit (GTK_OBJECT(set), gimp_set_signals[ACTIVE_CHANGED], ob);
|
||||
if (object != set->active_element && gimp_set_have (set, object))
|
||||
{
|
||||
set->active_element = object;
|
||||
gtk_signal_emit (GTK_OBJECT (set),
|
||||
gimp_set_signals[ACTIVE_CHANGED],
|
||||
object);
|
||||
}
|
||||
}
|
||||
|
||||
gpointer
|
||||
gimp_set_get_active(GimpSet* set)
|
||||
gimp_set_get_active (GimpSet* set)
|
||||
{
|
||||
if (gimp_set_have(set, set->active_element))
|
||||
if (gimp_set_have (set, set->active_element))
|
||||
return set->active_element;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GimpSetHandlerId
|
||||
gimp_set_add_handler(GimpSet* set, const gchar* signame,
|
||||
GtkSignalFunc handler, gpointer user_data){
|
||||
GimpSetHandler h;
|
||||
GSList* l;
|
||||
gimp_set_add_handler (GimpSet *set,
|
||||
const gchar *signame,
|
||||
GtkSignalFunc handler,
|
||||
gpointer user_data)
|
||||
{
|
||||
GimpSetHandler set_handler;
|
||||
GSList *list;
|
||||
guint a;
|
||||
|
||||
g_assert(signame);
|
||||
g_assert (signame);
|
||||
|
||||
/* you can't set a handler on something that's not a GTK
|
||||
* object */
|
||||
g_assert(set->type != GTK_TYPE_NONE);
|
||||
/* you can't set a handler on something that's not a GTK object */
|
||||
g_assert (set->type != GTK_TYPE_NONE);
|
||||
|
||||
h.signame = signame;
|
||||
h.func = handler;
|
||||
h.user_data = user_data;
|
||||
set_handler.signame = signame;
|
||||
set_handler.func = handler;
|
||||
set_handler.user_data = user_data;
|
||||
|
||||
for(a=0;a<set->handlers->len;a++)
|
||||
if(!g_array_index(set->handlers, GimpSetHandler, a).signame)
|
||||
for (a = 0; a < set->handlers->len; a++)
|
||||
if (! g_array_index (set->handlers, GimpSetHandler, a).signame)
|
||||
break;
|
||||
if(a<set->handlers->len){
|
||||
g_array_index(set->handlers, GimpSetHandler, a) = h;
|
||||
for(l=set->list;l;l=l->next){
|
||||
Node* n = l->data;
|
||||
guint i = gtk_signal_connect(GTK_OBJECT(n->object),
|
||||
signame,
|
||||
|
||||
if (a < set->handlers->len)
|
||||
{
|
||||
g_array_index (set->handlers, GimpSetHandler, a) = set_handler;
|
||||
for (list = set->list; list; list = list->next)
|
||||
{
|
||||
Node *node = list->data;
|
||||
guint i = gtk_signal_connect (GTK_OBJECT (node->object), signame,
|
||||
handler,
|
||||
user_data);
|
||||
g_array_index(n->handlers, guint, a) = i;
|
||||
g_array_index (node->handlers, guint, a) = i;
|
||||
}
|
||||
} else{
|
||||
g_array_append_val(set->handlers, h);
|
||||
for(l=set->list;l;l=l->next){
|
||||
Node* n = l->data;
|
||||
guint i = gtk_signal_connect(GTK_OBJECT(n->object),
|
||||
signame,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_array_append_val (set->handlers, set_handler);
|
||||
|
||||
for (list = set->list; list; list = list->next)
|
||||
{
|
||||
Node* node = list->data;
|
||||
|
||||
guint i = gtk_signal_connect (GTK_OBJECT(node->object), signame,
|
||||
handler,
|
||||
user_data);
|
||||
g_array_append_val(n->handlers, i);
|
||||
g_array_append_val (node->handlers, i);
|
||||
}
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_set_remove_handler(GimpSet* set, GimpSetHandlerId id)
|
||||
gimp_set_remove_handler (GimpSet *set,
|
||||
GimpSetHandlerId id)
|
||||
{
|
||||
GSList* l;
|
||||
GSList* list;
|
||||
|
||||
/* you can't remove a signal handler on something that's not a
|
||||
* GTK object */
|
||||
g_return_if_fail(set->type != GTK_TYPE_NONE);
|
||||
/* you can't remove a signal handler on something that's not a GTK object */
|
||||
g_return_if_fail (set->type != GTK_TYPE_NONE);
|
||||
|
||||
for(l=set->list;l;l=l->next){
|
||||
Node* n = l->data;
|
||||
gtk_signal_disconnect(GTK_OBJECT(n->object),
|
||||
g_array_index(n->handlers, guint, id));
|
||||
for (list = set->list; list; list = list->next)
|
||||
{
|
||||
Node *node = list->data;
|
||||
|
||||
gtk_signal_disconnect (GTK_OBJECT (node->object),
|
||||
g_array_index (node->handlers, guint, id));
|
||||
}
|
||||
g_array_index(set->handlers, GimpSetHandler, id).signame = NULL;
|
||||
|
||||
g_array_index (set->handlers, GimpSetHandler, id).signame = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,26 @@
|
|||
/* 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 __GIMPSET_H__
|
||||
#define __GIMPSET_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include "gimpsetF.h"
|
||||
|
||||
|
||||
/* GimpSet - a (usually) typed set of objects with signals for adding
|
||||
and removing of stuff. If it is weak, destroyed objects get removed
|
||||
automatically. If it is not, it refs them so they won't be freed
|
||||
|
@ -17,11 +33,7 @@
|
|||
*/
|
||||
|
||||
#define GIMP_TYPE_SET gimp_set_get_type()
|
||||
|
||||
#define GIMP_SET(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_SET, GimpSet)
|
||||
|
||||
|
||||
|
||||
#define GIMP_IS_SET(obj) GTK_CHECK_TYPE (obj, gimp_set_get_type())
|
||||
|
||||
/* Signals:
|
||||
|
@ -32,25 +44,33 @@
|
|||
|
||||
typedef guint GimpSetHandlerId;
|
||||
|
||||
guint gimp_set_get_type (void);
|
||||
GtkType gimp_set_get_type (void);
|
||||
GimpSet * gimp_set_new (GtkType type,
|
||||
gboolean weak);
|
||||
|
||||
GimpSet* gimp_set_new (GtkType type, gboolean weak);
|
||||
GtkType gimp_set_type (GimpSet* set);
|
||||
gboolean gimp_set_add (GimpSet* gimpset, gpointer ob);
|
||||
gboolean gimp_set_remove (GimpSet* gimpset, gpointer ob);
|
||||
gboolean gimp_set_have (GimpSet* gimpset, gpointer ob);
|
||||
void gimp_set_foreach(GimpSet* gimpset, GFunc func,
|
||||
GtkType gimp_set_type (GimpSet *set);
|
||||
|
||||
gboolean gimp_set_add (GimpSet *gimpset,
|
||||
gpointer ob);
|
||||
gboolean gimp_set_remove (GimpSet *gimpset,
|
||||
gpointer ob);
|
||||
|
||||
gboolean gimp_set_have (GimpSet *gimpset,
|
||||
gpointer ob);
|
||||
void gimp_set_foreach (GimpSet *gimpset,
|
||||
GFunc func,
|
||||
gpointer user_data);
|
||||
gint gimp_set_size (GimpSet* gimpset);
|
||||
|
||||
void gimp_set_set_active(GimpSet* gimpset, gpointer ob);
|
||||
gpointer gimp_set_get_active(GimpSet* gimpset);
|
||||
void gimp_set_set_active (GimpSet *gimpset,
|
||||
gpointer ob);
|
||||
gpointer gimp_set_get_active (GimpSet *gimpset);
|
||||
|
||||
GimpSetHandlerId gimp_set_add_handler (GimpSet* set,
|
||||
const gchar* signame,
|
||||
GimpSetHandlerId gimp_set_add_handler (GimpSet *set,
|
||||
const gchar *signame,
|
||||
GtkSignalFunc handler,
|
||||
gpointer user_data);
|
||||
void gimp_set_remove_handler (GimpSet* set,
|
||||
void gimp_set_remove_handler (GimpSet *set,
|
||||
GimpSetHandlerId id);
|
||||
|
||||
#endif
|
||||
#endif /* __GIMP_SET_H__ */
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
/* 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 __GIMPSETF_H__
|
||||
#define __GIMPSETF_H__
|
||||
|
||||
|
|
|
@ -1,25 +1,48 @@
|
|||
#ifndef __GIMPSETP_H__
|
||||
#define __GIMPSETP_H__
|
||||
/* 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 __GIMP_SET_P_H__
|
||||
#define __GIMP_SET_P_H__
|
||||
|
||||
#include "gimpobjectP.h"
|
||||
#include "gimpset.h"
|
||||
|
||||
struct _GimpSet{
|
||||
#define GIMP_SET_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gimp_set_get_type(), GimpSetClass)
|
||||
|
||||
typedef struct _GimpSetClass GimpSetClass;
|
||||
|
||||
struct _GimpSet
|
||||
{
|
||||
GimpObject gobject;
|
||||
|
||||
GtkType type;
|
||||
GSList* list;
|
||||
GArray* handlers;
|
||||
GSList *list;
|
||||
GArray *handlers;
|
||||
gboolean weak;
|
||||
gpointer active_element;
|
||||
};
|
||||
|
||||
struct _GimpSetClass{
|
||||
struct _GimpSetClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
|
||||
void (* add) (GimpSet *gimpset, gpointer object);
|
||||
void (* remove) (GimpSet *gimpset, gpointer object);
|
||||
void (* active_changed) (GimpSet *gimpset, gpointer object);
|
||||
};
|
||||
|
||||
typedef struct _GimpSetClass GimpSetClass;
|
||||
|
||||
#define GIMP_SET_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gimp_set_get_type(), GimpSetClass)
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __GIMP_SET_P_H__ */
|
||||
|
|
105
app/gimpsignal.c
105
app/gimpsignal.c
|
@ -1,20 +1,40 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "gimpsignal.h"
|
||||
|
||||
struct _GimpSignalType{
|
||||
struct _GimpSignalType
|
||||
{
|
||||
GtkSignalMarshaller marshaller;
|
||||
GtkType return_type;
|
||||
guint nparams;
|
||||
const GtkType* param_types;
|
||||
const GtkType *param_types;
|
||||
};
|
||||
|
||||
typedef const GtkType TypeArr[];
|
||||
|
||||
GimpSignalID gimp_signal_new(const gchar* name,
|
||||
GimpSignalID gimp_signal_new (const gchar *name,
|
||||
GtkSignalRunType signal_flags,
|
||||
GtkType object_type,
|
||||
guint function_offset,
|
||||
GimpSignalType* sig_type){
|
||||
return gtk_signal_newv(name,
|
||||
GimpSignalType *sig_type)
|
||||
{
|
||||
return gtk_signal_newv (name,
|
||||
signal_flags,
|
||||
object_type,
|
||||
function_offset,
|
||||
|
@ -23,73 +43,104 @@ GimpSignalID gimp_signal_new(const gchar* name,
|
|||
sig_type->nparams,
|
||||
/* Bah. We try to be const correct, but
|
||||
gtk isn't.. */
|
||||
(GtkType*)sig_type->param_types);
|
||||
(GtkType *) sig_type->param_types);
|
||||
}
|
||||
|
||||
static GimpSignalType sigtype_void={
|
||||
static GimpSignalType sigtype_void =
|
||||
{
|
||||
gtk_signal_default_marshaller,
|
||||
GTK_TYPE_NONE,
|
||||
0,
|
||||
NULL
|
||||
};
|
||||
|
||||
GimpSignalType* const gimp_sigtype_void=&sigtype_void;
|
||||
GimpSignalType* const gimp_sigtype_void = &sigtype_void;
|
||||
|
||||
static void
|
||||
gimp_marshaller_pointer (GtkObject* object,
|
||||
gimp_marshaller_pointer (GtkObject *object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg* args)
|
||||
GtkArg *args)
|
||||
{
|
||||
(*(GimpHandlerPointer)func) (object,
|
||||
(* (GimpHandlerPointer) func) (object,
|
||||
GTK_VALUE_POINTER (args[0]),
|
||||
func_data);
|
||||
}
|
||||
|
||||
static TypeArr pointer_types={
|
||||
static TypeArr pointer_types =
|
||||
{
|
||||
GTK_TYPE_POINTER
|
||||
};
|
||||
|
||||
static GimpSignalType sigtype_pointer={
|
||||
static GimpSignalType sigtype_pointer =
|
||||
{
|
||||
gimp_marshaller_pointer,
|
||||
GTK_TYPE_NONE,
|
||||
1,
|
||||
pointer_types
|
||||
};
|
||||
|
||||
GimpSignalType* const gimp_sigtype_pointer=&sigtype_pointer;
|
||||
GimpSignalType* const gimp_sigtype_pointer = &sigtype_pointer;
|
||||
|
||||
static void
|
||||
gimp_marshaller_int (GtkObject* object,
|
||||
gimp_marshaller_int (GtkObject *object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg* args)
|
||||
GtkArg *args)
|
||||
{
|
||||
(*(GimpHandlerInt)func) (object,
|
||||
(* (GimpHandlerInt) func) (object,
|
||||
GTK_VALUE_INT (args[0]),
|
||||
func_data);
|
||||
}
|
||||
|
||||
static TypeArr int_types={
|
||||
static TypeArr int_types =
|
||||
{
|
||||
GTK_TYPE_INT
|
||||
};
|
||||
|
||||
static GimpSignalType sigtype_int={
|
||||
static GimpSignalType sigtype_int =
|
||||
{
|
||||
gimp_marshaller_int,
|
||||
GTK_TYPE_NONE,
|
||||
1,
|
||||
int_types
|
||||
};
|
||||
|
||||
GimpSignalType* const gimp_sigtype_int=&sigtype_int;
|
||||
GimpSignalType* const gimp_sigtype_int = &sigtype_int;
|
||||
|
||||
static void
|
||||
gimp_marshaller_int_int_int_int (GtkObject* object,
|
||||
gimp_marshaller_double (GtkObject *object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg* args)
|
||||
GtkArg *args)
|
||||
{
|
||||
(*(GimpHandlerIntIntIntInt)func) (object,
|
||||
(* (GimpHandlerDouble) func) (object,
|
||||
GTK_VALUE_DOUBLE (args[0]),
|
||||
func_data);
|
||||
}
|
||||
|
||||
static TypeArr double_types =
|
||||
{
|
||||
GTK_TYPE_DOUBLE
|
||||
};
|
||||
|
||||
static GimpSignalType sigtype_double =
|
||||
{
|
||||
gimp_marshaller_double,
|
||||
GTK_TYPE_NONE,
|
||||
1,
|
||||
double_types
|
||||
};
|
||||
|
||||
GimpSignalType* const gimp_sigtype_double = &sigtype_double;
|
||||
|
||||
static void
|
||||
gimp_marshaller_int_int_int_int (GtkObject *object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg *args)
|
||||
{
|
||||
(* (GimpHandlerIntIntIntInt) func) (object,
|
||||
GTK_VALUE_INT (args[0]),
|
||||
GTK_VALUE_INT (args[1]),
|
||||
GTK_VALUE_INT (args[2]),
|
||||
|
@ -97,18 +148,20 @@ gimp_marshaller_int_int_int_int (GtkObject* object,
|
|||
func_data);
|
||||
}
|
||||
|
||||
static TypeArr int_int_int_int_types={
|
||||
static TypeArr int_int_int_int_types =
|
||||
{
|
||||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT,
|
||||
GTK_TYPE_INT
|
||||
};
|
||||
|
||||
static GimpSignalType sigtype_int_int_int_int={
|
||||
static GimpSignalType sigtype_int_int_int_int =
|
||||
{
|
||||
gimp_marshaller_int_int_int_int,
|
||||
GTK_TYPE_NONE,
|
||||
4,
|
||||
int_int_int_int_types
|
||||
};
|
||||
|
||||
GimpSignalType* const gimp_sigtype_int_int_int_int=&sigtype_int_int_int_int;
|
||||
GimpSignalType* const gimp_sigtype_int_int_int_int = &sigtype_int_int_int_int;
|
||||
|
|
|
@ -1,35 +1,52 @@
|
|||
#ifndef __GIMPSIGNAL_H__
|
||||
#define __GIMPSIGNAL_H__
|
||||
/* 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 __GIMP_SIGNAL_H__
|
||||
#define __GIMP_SIGNAL_H__
|
||||
|
||||
#include <gtk/gtksignal.h>
|
||||
|
||||
/* This is the gtk "signal id" */
|
||||
typedef guint GimpSignalID;
|
||||
|
||||
|
||||
typedef const struct _GimpSignalType GimpSignalType;
|
||||
|
||||
/* The arguments are encoded in the names.. */
|
||||
|
||||
extern GimpSignalType* const gimp_sigtype_void;
|
||||
typedef void (*GimpHandlerVoid)(GtkObject*, gpointer);
|
||||
typedef void (*GimpHandlerVoid) (GtkObject*, gpointer);
|
||||
|
||||
extern GimpSignalType* const gimp_sigtype_pointer;
|
||||
typedef void (*GimpHandlerPointer)(GtkObject*, gpointer, gpointer);
|
||||
typedef void (*GimpHandlerPointer) (GtkObject*, gpointer, gpointer);
|
||||
|
||||
extern GimpSignalType* const gimp_sigtype_int;
|
||||
typedef void (*GimpHandlerInt)(GtkObject*, gint, gpointer);
|
||||
typedef void (*GimpHandlerInt) (GtkObject*, gint, gpointer);
|
||||
|
||||
extern GimpSignalType* const gimp_sigtype_double;
|
||||
typedef void (*GimpHandlerDouble) (GtkObject*, gdouble, gpointer);
|
||||
|
||||
extern GimpSignalType* const gimp_sigtype_int_int_int_int;
|
||||
typedef void (*GimpHandlerIntIntIntInt) (GtkObject*, gint, gint, gint, gint,
|
||||
gpointer);
|
||||
|
||||
GimpSignalID gimp_signal_new(const gchar* name,
|
||||
GimpSignalID gimp_signal_new (const gchar *name,
|
||||
GtkSignalRunType signal_flags,
|
||||
GtkType object_type,
|
||||
guint function_offset,
|
||||
GimpSignalType* sig_type);
|
||||
GimpSignalType *sig_type);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __GIMP_SIGNAL_H__ */
|
||||
|
|
|
@ -68,6 +68,10 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#define return_if_no_display(gdisp) \
|
||||
gdisp = gdisplay_active (); \
|
||||
if (!gdisp) return
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Resize * resize;
|
||||
|
@ -88,10 +92,10 @@ static void gimage_mask_grow_callback (GtkWidget *, gpointer, gpointer);
|
|||
static void gimage_mask_shrink_callback (GtkWidget *, gpointer, gpointer);
|
||||
|
||||
/* local variables */
|
||||
static double selection_feather_radius = 5.0;
|
||||
static int selection_border_radius = 5;
|
||||
static int selection_grow_pixels = 1;
|
||||
static int selection_shrink_pixels = 1;
|
||||
static gdouble selection_feather_radius = 5.0;
|
||||
static gint selection_border_radius = 5;
|
||||
static gint selection_grow_pixels = 1;
|
||||
static gint selection_shrink_pixels = 1;
|
||||
|
||||
|
||||
void
|
||||
|
@ -122,16 +126,13 @@ file_revert_cmd_callback (GtkWidget *widget,
|
|||
file_revert_callback (widget, client_data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
file_close_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_close_window (gdisp, FALSE);
|
||||
}
|
||||
|
@ -149,7 +150,7 @@ edit_cut_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
global_edit_cut (gdisp);
|
||||
}
|
||||
|
@ -160,7 +161,7 @@ edit_copy_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
global_edit_copy (gdisp);
|
||||
}
|
||||
|
@ -171,7 +172,7 @@ edit_paste_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
global_edit_paste (gdisp, 0);
|
||||
}
|
||||
|
@ -182,7 +183,7 @@ edit_paste_into_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
global_edit_paste (gdisp, 1);
|
||||
}
|
||||
|
@ -193,10 +194,9 @@ edit_clear_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
edit_clear (gdisp->gimage, gimage_active_drawable (gdisp->gimage));
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -206,10 +206,9 @@ edit_fill_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
edit_fill (gdisp->gimage, gimage_active_drawable (gdisp->gimage));
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -219,10 +218,9 @@ edit_stroke_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_stroke (gdisp->gimage, gimage_active_drawable (gdisp->gimage));
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -232,7 +230,7 @@ edit_undo_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
undo_pop (gdisp->gimage);
|
||||
}
|
||||
|
@ -243,7 +241,7 @@ edit_redo_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
undo_redo (gdisp->gimage);
|
||||
}
|
||||
|
@ -254,7 +252,7 @@ edit_named_cut_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
named_edit_cut (gdisp);
|
||||
}
|
||||
|
@ -265,7 +263,7 @@ edit_named_copy_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
named_edit_copy (gdisp);
|
||||
}
|
||||
|
@ -276,7 +274,7 @@ edit_named_paste_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
named_edit_paste (gdisp);
|
||||
}
|
||||
|
@ -287,7 +285,7 @@ select_toggle_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
selection_hide (gdisp->select, (void *) gdisp);
|
||||
gdisplays_flush ();
|
||||
|
@ -299,7 +297,7 @@ select_invert_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_invert (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -311,7 +309,7 @@ select_all_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_all (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -323,7 +321,7 @@ select_none_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_none (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -335,9 +333,10 @@ select_float_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_float (gdisp->gimage, gimage_active_drawable (gdisp->gimage), 0, 0);
|
||||
gimage_mask_float (gdisp->gimage, gimage_active_drawable (gdisp->gimage),
|
||||
0, 0);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -347,7 +346,7 @@ select_sharpen_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_sharpen (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -359,7 +358,7 @@ select_border_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
query_size_box (N_("Border Selection"),
|
||||
N_("Border selection by:"),
|
||||
|
@ -378,7 +377,7 @@ select_feather_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
query_size_box (N_("Feather Selection"),
|
||||
N_("Feather selection by:"),
|
||||
|
@ -397,7 +396,7 @@ select_grow_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
query_size_box (N_("Grow Selection"),
|
||||
N_("Grow selection by:"),
|
||||
|
@ -416,7 +415,7 @@ select_shrink_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
query_size_box (N_("Shrink Selection"),
|
||||
N_("Shrink selection by:"),
|
||||
|
@ -435,7 +434,8 @@ select_save_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_save (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ view_dot_for_dot_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_set_dot_for_dot (gdisp, GTK_CHECK_MENU_ITEM (widget)->active);
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ view_zoomin_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, ZOOMIN);
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ view_zoomout_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, ZOOMOUT);
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ view_zoom_val (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, val);
|
||||
}
|
||||
|
@ -554,7 +554,7 @@ view_window_info_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (! gdisp->window_info_dialog)
|
||||
gdisp->window_info_dialog = info_window_create ((void *) gdisp);
|
||||
|
@ -568,7 +568,7 @@ view_toggle_rulers_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
/* This routine use promiscuous knowledge of gtk internals
|
||||
* in order to hide and show the rulers "smoothly". This
|
||||
|
@ -615,7 +615,7 @@ view_toggle_guides_cmd_callback (GtkWidget *widget,
|
|||
GDisplay * gdisp;
|
||||
int old_val;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
old_val = gdisp->draw_guides;
|
||||
gdisp->draw_guides = GTK_CHECK_MENU_ITEM (widget)->active;
|
||||
|
@ -633,7 +633,7 @@ view_snap_to_guides_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisp->snap_to_guides = GTK_CHECK_MENU_ITEM (widget)->active;
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ view_toggle_statusbar_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (!GTK_CHECK_MENU_ITEM (widget)->active)
|
||||
{
|
||||
|
@ -664,7 +664,7 @@ view_new_view_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_new_view (gdisp);
|
||||
}
|
||||
|
@ -675,9 +675,8 @@ view_shrink_wrap_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (gdisp)
|
||||
shrink_wrap_display (gdisp);
|
||||
}
|
||||
|
||||
|
@ -687,7 +686,8 @@ image_equalize_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
image_equalize ((void *) gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
@ -698,7 +698,8 @@ image_invert_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
image_invert ((void *) gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
@ -709,7 +710,8 @@ image_desaturate_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
image_desaturate ((void *) gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
@ -720,7 +722,8 @@ channel_ops_duplicate_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
channel_ops_duplicate ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -730,7 +733,8 @@ channel_ops_offset_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
channel_ops_offset ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -740,7 +744,8 @@ image_convert_rgb_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_rgb ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -750,7 +755,8 @@ image_convert_grayscale_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_grayscale ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -760,7 +766,8 @@ image_convert_indexed_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_indexed ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -770,10 +777,9 @@ image_resize_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
GimpImage * gimage;
|
||||
ImageResize *image_resize;
|
||||
ImageResize * image_resize;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
g_return_if_fail (gdisp != NULL);
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
|
@ -803,10 +809,9 @@ image_scale_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
GimpImage * gimage;
|
||||
ImageResize *image_scale;
|
||||
ImageResize * image_scale;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
g_return_if_fail (gdisp != NULL);
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
|
@ -836,9 +841,9 @@ layers_previous_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
int current_layer;
|
||||
Layer *new_layer;
|
||||
Layer * new_layer;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
current_layer =
|
||||
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
|
@ -862,9 +867,9 @@ layers_next_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
int current_layer;
|
||||
Layer *new_layer;
|
||||
Layer * new_layer;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
current_layer =
|
||||
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
|
@ -888,7 +893,7 @@ layers_raise_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_raise_layer (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -900,7 +905,7 @@ layers_lower_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_lower_layer (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -912,7 +917,7 @@ layers_raise_to_top_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_raise_layer_to_top (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -924,7 +929,7 @@ layers_lower_to_bottom_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_lower_layer_to_bottom (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -936,7 +941,7 @@ layers_anchor_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
floating_sel_anchor (gimage_get_active_layer (gdisp->gimage));
|
||||
gdisplays_flush ();
|
||||
|
@ -948,7 +953,7 @@ layers_merge_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
layers_dialog_layer_merge_query (gdisp->gimage, TRUE);
|
||||
}
|
||||
|
@ -959,7 +964,7 @@ layers_flatten_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_flatten (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -971,7 +976,7 @@ layers_alpha_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_layer_alpha (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -983,7 +988,7 @@ layers_mask_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_layer_mask (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -995,7 +1000,7 @@ layers_add_alpha_channel_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
layer_add_alpha ( gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -1076,13 +1081,13 @@ dialogs_gradient_editor_cmd_callback (GtkWidget *widget,
|
|||
gpointer client_data)
|
||||
{
|
||||
grad_create_gradient_editor ();
|
||||
} /* dialogs_gradient_editor_cmd_callback */
|
||||
}
|
||||
|
||||
void
|
||||
dialogs_lc_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
|
@ -1093,12 +1098,14 @@ dialogs_lc_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
cmap_dlg_sel_cb(ColormapDialog* dlg, gpointer user_data)
|
||||
cmap_dlg_sel_cb (ColormapDialog *dlg,
|
||||
gpointer user_data)
|
||||
{
|
||||
guchar* c;
|
||||
guchar * c;
|
||||
GimpImage * img = colormap_dialog_image(dlg);
|
||||
|
||||
GimpImage* img = colormap_dialog_image(dlg);
|
||||
c = &img->cmap[colormap_dialog_col_index(dlg) * 3];
|
||||
|
||||
if(active_color == FOREGROUND)
|
||||
palette_set_foreground (c[0], c[1], c[2]);
|
||||
else if(active_color == BACKGROUND)
|
||||
|
@ -1109,13 +1116,15 @@ void
|
|||
dialogs_indexed_palette_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
static ColormapDialog* cmap_dlg;
|
||||
if(!cmap_dlg){
|
||||
static ColormapDialog * cmap_dlg;
|
||||
|
||||
if(!cmap_dlg)
|
||||
{
|
||||
cmap_dlg = colormap_dialog_create (image_context);
|
||||
colormap_dialog_connect_selected(cmap_dlg_sel_cb, NULL,
|
||||
cmap_dlg);
|
||||
colormap_dialog_connect_selected (cmap_dlg_sel_cb, NULL, cmap_dlg);
|
||||
}
|
||||
gtk_widget_show(GTK_WIDGET(cmap_dlg));
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (cmap_dlg));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1179,8 +1188,8 @@ static void
|
|||
image_resize_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
{
|
||||
ImageResize *image_resize;
|
||||
GImage *gimage;
|
||||
ImageResize * image_resize;
|
||||
GImage * gimage;
|
||||
|
||||
image_resize = (ImageResize *) client_data;
|
||||
|
||||
|
@ -1211,8 +1220,8 @@ static void
|
|||
image_scale_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
{
|
||||
ImageResize *image_scale;
|
||||
GImage *gimage;
|
||||
ImageResize * image_scale;
|
||||
GImage * gimage;
|
||||
gboolean flush = FALSE;
|
||||
|
||||
image_scale = (ImageResize *) client_data;
|
||||
|
@ -1277,6 +1286,7 @@ image_cancel_callback (GtkWidget *w,
|
|||
gpointer client_data)
|
||||
{
|
||||
ImageResize *image_resize;
|
||||
|
||||
image_resize = (ImageResize *) client_data;
|
||||
|
||||
resize_widget_free (image_resize->resize);
|
||||
|
@ -1290,8 +1300,8 @@ gimage_mask_feather_callback (GtkWidget *w,
|
|||
{
|
||||
GImage *gimage = GIMP_IMAGE (client_data);
|
||||
GUnit unit;
|
||||
double radius_x;
|
||||
double radius_y;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
selection_feather_radius = *(double*) call_data;
|
||||
g_free (call_data);
|
||||
|
@ -1324,8 +1334,8 @@ gimage_mask_border_callback (GtkWidget *w,
|
|||
{
|
||||
GImage *gimage = GIMP_IMAGE (client_data);
|
||||
GUnit unit;
|
||||
double radius_x;
|
||||
double radius_y;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
selection_border_radius = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
|
@ -1358,8 +1368,8 @@ gimage_mask_grow_callback (GtkWidget *w,
|
|||
{
|
||||
GImage *gimage = GIMP_IMAGE (client_data);
|
||||
GUnit unit;
|
||||
double radius_x;
|
||||
double radius_y;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
selection_grow_pixels = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
|
@ -1392,8 +1402,8 @@ gimage_mask_shrink_callback (GtkWidget *w,
|
|||
{
|
||||
GImage *gimage = GIMP_IMAGE (client_data);
|
||||
GUnit unit;
|
||||
int radius_x;
|
||||
int radius_y;
|
||||
gint radius_x;
|
||||
gint radius_y;
|
||||
|
||||
selection_shrink_pixels = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
|
|
|
@ -68,6 +68,10 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#define return_if_no_display(gdisp) \
|
||||
gdisp = gdisplay_active (); \
|
||||
if (!gdisp) return
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Resize * resize;
|
||||
|
@ -88,10 +92,10 @@ static void gimage_mask_grow_callback (GtkWidget *, gpointer, gpointer);
|
|||
static void gimage_mask_shrink_callback (GtkWidget *, gpointer, gpointer);
|
||||
|
||||
/* local variables */
|
||||
static double selection_feather_radius = 5.0;
|
||||
static int selection_border_radius = 5;
|
||||
static int selection_grow_pixels = 1;
|
||||
static int selection_shrink_pixels = 1;
|
||||
static gdouble selection_feather_radius = 5.0;
|
||||
static gint selection_border_radius = 5;
|
||||
static gint selection_grow_pixels = 1;
|
||||
static gint selection_shrink_pixels = 1;
|
||||
|
||||
|
||||
void
|
||||
|
@ -122,16 +126,13 @@ file_revert_cmd_callback (GtkWidget *widget,
|
|||
file_revert_callback (widget, client_data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
file_close_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_close_window (gdisp, FALSE);
|
||||
}
|
||||
|
@ -149,7 +150,7 @@ edit_cut_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
global_edit_cut (gdisp);
|
||||
}
|
||||
|
@ -160,7 +161,7 @@ edit_copy_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
global_edit_copy (gdisp);
|
||||
}
|
||||
|
@ -171,7 +172,7 @@ edit_paste_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
global_edit_paste (gdisp, 0);
|
||||
}
|
||||
|
@ -182,7 +183,7 @@ edit_paste_into_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
global_edit_paste (gdisp, 1);
|
||||
}
|
||||
|
@ -193,10 +194,9 @@ edit_clear_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
edit_clear (gdisp->gimage, gimage_active_drawable (gdisp->gimage));
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -206,10 +206,9 @@ edit_fill_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
edit_fill (gdisp->gimage, gimage_active_drawable (gdisp->gimage));
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -219,10 +218,9 @@ edit_stroke_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_stroke (gdisp->gimage, gimage_active_drawable (gdisp->gimage));
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -232,7 +230,7 @@ edit_undo_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
undo_pop (gdisp->gimage);
|
||||
}
|
||||
|
@ -243,7 +241,7 @@ edit_redo_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
undo_redo (gdisp->gimage);
|
||||
}
|
||||
|
@ -254,7 +252,7 @@ edit_named_cut_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
named_edit_cut (gdisp);
|
||||
}
|
||||
|
@ -265,7 +263,7 @@ edit_named_copy_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
named_edit_copy (gdisp);
|
||||
}
|
||||
|
@ -276,7 +274,7 @@ edit_named_paste_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
named_edit_paste (gdisp);
|
||||
}
|
||||
|
@ -287,7 +285,7 @@ select_toggle_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
selection_hide (gdisp->select, (void *) gdisp);
|
||||
gdisplays_flush ();
|
||||
|
@ -299,7 +297,7 @@ select_invert_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_invert (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -311,7 +309,7 @@ select_all_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_all (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -323,7 +321,7 @@ select_none_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_none (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -335,9 +333,10 @@ select_float_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_float (gdisp->gimage, gimage_active_drawable (gdisp->gimage), 0, 0);
|
||||
gimage_mask_float (gdisp->gimage, gimage_active_drawable (gdisp->gimage),
|
||||
0, 0);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -347,7 +346,7 @@ select_sharpen_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_sharpen (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -359,7 +358,7 @@ select_border_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
query_size_box (N_("Border Selection"),
|
||||
N_("Border selection by:"),
|
||||
|
@ -378,7 +377,7 @@ select_feather_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
query_size_box (N_("Feather Selection"),
|
||||
N_("Feather selection by:"),
|
||||
|
@ -397,7 +396,7 @@ select_grow_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
query_size_box (N_("Grow Selection"),
|
||||
N_("Grow selection by:"),
|
||||
|
@ -416,7 +415,7 @@ select_shrink_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
query_size_box (N_("Shrink Selection"),
|
||||
N_("Shrink selection by:"),
|
||||
|
@ -435,7 +434,8 @@ select_save_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_save (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ view_dot_for_dot_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_set_dot_for_dot (gdisp, GTK_CHECK_MENU_ITEM (widget)->active);
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ view_zoomin_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, ZOOMIN);
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ view_zoomout_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, ZOOMOUT);
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ view_zoom_val (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, val);
|
||||
}
|
||||
|
@ -554,7 +554,7 @@ view_window_info_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (! gdisp->window_info_dialog)
|
||||
gdisp->window_info_dialog = info_window_create ((void *) gdisp);
|
||||
|
@ -568,7 +568,7 @@ view_toggle_rulers_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
/* This routine use promiscuous knowledge of gtk internals
|
||||
* in order to hide and show the rulers "smoothly". This
|
||||
|
@ -615,7 +615,7 @@ view_toggle_guides_cmd_callback (GtkWidget *widget,
|
|||
GDisplay * gdisp;
|
||||
int old_val;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
old_val = gdisp->draw_guides;
|
||||
gdisp->draw_guides = GTK_CHECK_MENU_ITEM (widget)->active;
|
||||
|
@ -633,7 +633,7 @@ view_snap_to_guides_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisp->snap_to_guides = GTK_CHECK_MENU_ITEM (widget)->active;
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ view_toggle_statusbar_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (!GTK_CHECK_MENU_ITEM (widget)->active)
|
||||
{
|
||||
|
@ -664,7 +664,7 @@ view_new_view_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_new_view (gdisp);
|
||||
}
|
||||
|
@ -675,9 +675,8 @@ view_shrink_wrap_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (gdisp)
|
||||
shrink_wrap_display (gdisp);
|
||||
}
|
||||
|
||||
|
@ -687,7 +686,8 @@ image_equalize_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
image_equalize ((void *) gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
@ -698,7 +698,8 @@ image_invert_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
image_invert ((void *) gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
@ -709,7 +710,8 @@ image_desaturate_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
image_desaturate ((void *) gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
@ -720,7 +722,8 @@ channel_ops_duplicate_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
channel_ops_duplicate ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -730,7 +733,8 @@ channel_ops_offset_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
channel_ops_offset ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -740,7 +744,8 @@ image_convert_rgb_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_rgb ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -750,7 +755,8 @@ image_convert_grayscale_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_grayscale ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -760,7 +766,8 @@ image_convert_indexed_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_indexed ((void *) gdisp->gimage);
|
||||
}
|
||||
|
||||
|
@ -770,10 +777,9 @@ image_resize_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
GimpImage * gimage;
|
||||
ImageResize *image_resize;
|
||||
ImageResize * image_resize;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
g_return_if_fail (gdisp != NULL);
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
|
@ -803,10 +809,9 @@ image_scale_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
GimpImage * gimage;
|
||||
ImageResize *image_scale;
|
||||
ImageResize * image_scale;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
g_return_if_fail (gdisp != NULL);
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
|
@ -836,9 +841,9 @@ layers_previous_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
int current_layer;
|
||||
Layer *new_layer;
|
||||
Layer * new_layer;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
current_layer =
|
||||
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
|
@ -862,9 +867,9 @@ layers_next_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
int current_layer;
|
||||
Layer *new_layer;
|
||||
Layer * new_layer;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
current_layer =
|
||||
gimage_get_layer_index (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
|
@ -888,7 +893,7 @@ layers_raise_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_raise_layer (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -900,7 +905,7 @@ layers_lower_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_lower_layer (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -912,7 +917,7 @@ layers_raise_to_top_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_raise_layer_to_top (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -924,7 +929,7 @@ layers_lower_to_bottom_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_lower_layer_to_bottom (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -936,7 +941,7 @@ layers_anchor_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
floating_sel_anchor (gimage_get_active_layer (gdisp->gimage));
|
||||
gdisplays_flush ();
|
||||
|
@ -948,7 +953,7 @@ layers_merge_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
layers_dialog_layer_merge_query (gdisp->gimage, TRUE);
|
||||
}
|
||||
|
@ -959,7 +964,7 @@ layers_flatten_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_flatten (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
@ -971,7 +976,7 @@ layers_alpha_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_layer_alpha (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -983,7 +988,7 @@ layers_mask_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_layer_mask (gdisp->gimage, gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -995,7 +1000,7 @@ layers_add_alpha_channel_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
layer_add_alpha ( gdisp->gimage->active_layer);
|
||||
gdisplays_flush ();
|
||||
|
@ -1076,13 +1081,13 @@ dialogs_gradient_editor_cmd_callback (GtkWidget *widget,
|
|||
gpointer client_data)
|
||||
{
|
||||
grad_create_gradient_editor ();
|
||||
} /* dialogs_gradient_editor_cmd_callback */
|
||||
}
|
||||
|
||||
void
|
||||
dialogs_lc_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GDisplay * gdisp;
|
||||
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
|
@ -1093,12 +1098,14 @@ dialogs_lc_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
cmap_dlg_sel_cb(ColormapDialog* dlg, gpointer user_data)
|
||||
cmap_dlg_sel_cb (ColormapDialog *dlg,
|
||||
gpointer user_data)
|
||||
{
|
||||
guchar* c;
|
||||
guchar * c;
|
||||
GimpImage * img = colormap_dialog_image(dlg);
|
||||
|
||||
GimpImage* img = colormap_dialog_image(dlg);
|
||||
c = &img->cmap[colormap_dialog_col_index(dlg) * 3];
|
||||
|
||||
if(active_color == FOREGROUND)
|
||||
palette_set_foreground (c[0], c[1], c[2]);
|
||||
else if(active_color == BACKGROUND)
|
||||
|
@ -1109,13 +1116,15 @@ void
|
|||
dialogs_indexed_palette_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
static ColormapDialog* cmap_dlg;
|
||||
if(!cmap_dlg){
|
||||
static ColormapDialog * cmap_dlg;
|
||||
|
||||
if(!cmap_dlg)
|
||||
{
|
||||
cmap_dlg = colormap_dialog_create (image_context);
|
||||
colormap_dialog_connect_selected(cmap_dlg_sel_cb, NULL,
|
||||
cmap_dlg);
|
||||
colormap_dialog_connect_selected (cmap_dlg_sel_cb, NULL, cmap_dlg);
|
||||
}
|
||||
gtk_widget_show(GTK_WIDGET(cmap_dlg));
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (cmap_dlg));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1179,8 +1188,8 @@ static void
|
|||
image_resize_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
{
|
||||
ImageResize *image_resize;
|
||||
GImage *gimage;
|
||||
ImageResize * image_resize;
|
||||
GImage * gimage;
|
||||
|
||||
image_resize = (ImageResize *) client_data;
|
||||
|
||||
|
@ -1211,8 +1220,8 @@ static void
|
|||
image_scale_callback (GtkWidget *w,
|
||||
gpointer client_data)
|
||||
{
|
||||
ImageResize *image_scale;
|
||||
GImage *gimage;
|
||||
ImageResize * image_scale;
|
||||
GImage * gimage;
|
||||
gboolean flush = FALSE;
|
||||
|
||||
image_scale = (ImageResize *) client_data;
|
||||
|
@ -1277,6 +1286,7 @@ image_cancel_callback (GtkWidget *w,
|
|||
gpointer client_data)
|
||||
{
|
||||
ImageResize *image_resize;
|
||||
|
||||
image_resize = (ImageResize *) client_data;
|
||||
|
||||
resize_widget_free (image_resize->resize);
|
||||
|
@ -1290,8 +1300,8 @@ gimage_mask_feather_callback (GtkWidget *w,
|
|||
{
|
||||
GImage *gimage = GIMP_IMAGE (client_data);
|
||||
GUnit unit;
|
||||
double radius_x;
|
||||
double radius_y;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
selection_feather_radius = *(double*) call_data;
|
||||
g_free (call_data);
|
||||
|
@ -1324,8 +1334,8 @@ gimage_mask_border_callback (GtkWidget *w,
|
|||
{
|
||||
GImage *gimage = GIMP_IMAGE (client_data);
|
||||
GUnit unit;
|
||||
double radius_x;
|
||||
double radius_y;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
selection_border_radius = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
|
@ -1358,8 +1368,8 @@ gimage_mask_grow_callback (GtkWidget *w,
|
|||
{
|
||||
GImage *gimage = GIMP_IMAGE (client_data);
|
||||
GUnit unit;
|
||||
double radius_x;
|
||||
double radius_y;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
selection_grow_pixels = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
|
@ -1392,8 +1402,8 @@ gimage_mask_shrink_callback (GtkWidget *w,
|
|||
{
|
||||
GImage *gimage = GIMP_IMAGE (client_data);
|
||||
GUnit unit;
|
||||
int radius_x;
|
||||
int radius_y;
|
||||
gint radius_x;
|
||||
gint radius_y;
|
||||
|
||||
selection_shrink_pixels = (int) (*(double*) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
|
|
|
@ -53,6 +53,7 @@ static GSList *last_opened_raw_filenames = NULL;
|
|||
|
||||
static const GtkItemFactoryEntry toolbox_entries[] =
|
||||
{
|
||||
{ N_("/File/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/File/New"), "<control>N", file_new_cmd_callback, 0 },
|
||||
{ N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
|
||||
{ N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 },
|
||||
|
@ -68,6 +69,7 @@ static const GtkItemFactoryEntry toolbox_entries[] =
|
|||
{ N_("/File/Dialogs/Device Status..."), NULL, dialogs_device_status_cmd_callback, 0 },
|
||||
{ N_("/File/Dialogs/Document Index..."), NULL, raise_idea_callback, 0 },
|
||||
{ N_("/File/Dialogs/Error Console..."), NULL, dialogs_error_console_cmd_callback, 0 },
|
||||
{ N_("/Xtns/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Xtns/Module Browser"), NULL, dialogs_module_browser_cmd_callback, 0 },
|
||||
{ N_("/File/---"), NULL, NULL, 0, "<Separator>" },
|
||||
{ N_("/File/---"), NULL, NULL, 0, "<Separator>" }
|
||||
|
@ -80,6 +82,8 @@ static const GtkItemFactoryEntry toolbox_end = { N_("/File/Quit"), "<control>Q",
|
|||
|
||||
static const GtkItemFactoryEntry image_entries[] =
|
||||
{
|
||||
{ N_("/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/File/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/File/New"), "<control>N", file_new_cmd_callback, 1 },
|
||||
{ N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
|
||||
{ N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 },
|
||||
|
@ -92,6 +96,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/File/Quit"), "<control>Q", file_quit_cmd_callback, 0 },
|
||||
{ N_("/File/---moved"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Edit/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Edit/Cut"), "<control>X", edit_cut_cmd_callback, 0 },
|
||||
{ N_("/Edit/Copy"), "<control>C", edit_copy_cmd_callback, 0 },
|
||||
{ N_("/Edit/Paste"), "<control>V", edit_paste_cmd_callback, 0 },
|
||||
|
@ -107,6 +112,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/Edit/Paste Named"), "<control><shift>V", edit_named_paste_cmd_callback, 0 },
|
||||
{ N_("/Edit/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Select/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Select/Toggle"), "<control>T", select_toggle_cmd_callback, 0 },
|
||||
{ N_("/Select/Invert"), "<control>I", select_invert_cmd_callback, 0 },
|
||||
{ N_("/Select/All"), "<control>A", select_all_cmd_callback, 0 },
|
||||
|
@ -119,6 +125,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/Select/Shrink"), NULL, select_shrink_cmd_callback, 0 },
|
||||
{ N_("/Select/Save To Channel"), NULL, select_save_cmd_callback, 0 },
|
||||
|
||||
{ N_("/View/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/View/Zoom In"), "equal", view_zoomin_cmd_callback, 0 },
|
||||
{ N_("/View/Zoom Out"), "minus", view_zoomout_cmd_callback, 0 },
|
||||
{ N_("/View/Zoom/16:1"), NULL, view_zoom_16_1_callback, 0 },
|
||||
|
@ -140,6 +147,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/View/New View"), NULL, view_new_view_cmd_callback, 0 },
|
||||
{ N_("/View/Shrink Wrap"), "<control>E", view_shrink_wrap_cmd_callback, 0 },
|
||||
|
||||
{ N_("/Image/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Image/Colors/Equalize"), NULL, image_equalize_cmd_callback, 0 },
|
||||
{ N_("/Image/Colors/Invert"), NULL, image_invert_cmd_callback, 0 },
|
||||
{ N_("/Image/Colors/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
@ -157,6 +165,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/Image/Scale"), NULL, image_scale_cmd_callback, 0 },
|
||||
{ N_("/Image/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Layers/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Layers/Layers & Channels..."), "<control>L", dialogs_lc_cmd_callback, 0 },
|
||||
{ N_("/Layers/Stack/Previous Layer"), "Prior", layers_previous_cmd_callback, 0 },
|
||||
{ N_("/Layers/Stack/Next Layer"), "Next", layers_next_cmd_callback, 0 },
|
||||
|
@ -204,17 +213,21 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/Tools/Swap Colors"), "X", tools_swap_colors_cmd_callback, 0 },
|
||||
*/
|
||||
|
||||
{ N_("/Tools/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Tools/Toolbox"), NULL, toolbox_raise_callback, 0 },
|
||||
{ N_("/Tools/Default Colors"), "D", tools_default_colors_cmd_callback, 0 },
|
||||
{ N_("/Tools/Swap Colors"), "X", tools_swap_colors_cmd_callback, 0 },
|
||||
{ N_("/Tools/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Filters/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Filters/Repeat last"), "<alt>F", filters_repeat_cmd_callback, 0x0 },
|
||||
{ N_("/Filters/Re-show last"), "<alt><shift>F", filters_repeat_cmd_callback, 0x1 },
|
||||
{ N_("/Filters/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Script-Fu/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Script-Fu/"), NULL, NULL, 0 },
|
||||
|
||||
{ N_("/Dialogs/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Dialogs/Brushes..."), "<control><shift>B", dialogs_brushes_cmd_callback, 0 },
|
||||
{ N_("/Dialogs/Patterns..."), "<control><shift>P", dialogs_patterns_cmd_callback, 0 },
|
||||
{ N_("/Dialogs/Palette..."), "<control>P", dialogs_palette_cmd_callback, 0 },
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "buildmenu.h"
|
||||
#include "dialog_handler.h"
|
||||
#include "gimage.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimprc.h"
|
||||
#include "gimpset.h"
|
||||
#include "interface.h"
|
||||
|
@ -38,8 +39,9 @@ static void lc_dialog_auto_callback (GtkWidget *, gpointer);
|
|||
static gint lc_dialog_close_callback (GtkWidget *, gpointer);
|
||||
static void lc_dialog_add_cb (GimpSet *, GimpImage *, gpointer);
|
||||
static void lc_dialog_remove_cb (GimpSet *, GimpImage *, gpointer);
|
||||
static void lc_dialog_change_image (GimpSet *, GimpImage *, gpointer);
|
||||
static void lc_dialog_destroy_cb (GimpImage *, gpointer);
|
||||
static void lc_dialog_change_image (GimpContext *, GimpImage *,
|
||||
gpointer);
|
||||
|
||||
/* FIXME: move these to a better place */
|
||||
static GtkWidget * lc_dialog_create_image_menu (GimpImage **, int *,
|
||||
|
@ -190,7 +192,7 @@ lc_dialog_create (GimpImage* gimage)
|
|||
GTK_SIGNAL_FUNC (lc_dialog_add_cb), NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (image_context), "remove",
|
||||
GTK_SIGNAL_FUNC (lc_dialog_remove_cb), NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (image_context), "active_changed",
|
||||
gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()), "image_changed",
|
||||
GTK_SIGNAL_FUNC (lc_dialog_change_image), NULL);
|
||||
|
||||
lc_dialog_update (gimage);
|
||||
|
@ -408,7 +410,7 @@ static void
|
|||
lc_dialog_auto_callback (GtkWidget *toggle_button,
|
||||
gpointer client_data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpContext *context;
|
||||
|
||||
if (! lc_dialog)
|
||||
return;
|
||||
|
@ -416,10 +418,12 @@ lc_dialog_auto_callback (GtkWidget *toggle_button,
|
|||
lc_dialog->auto_follow_active =
|
||||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle_button));
|
||||
|
||||
gimage = (GimpImage *) gimp_set_get_active (image_context);
|
||||
context = gimp_context_get_user ();
|
||||
|
||||
if (lc_dialog->auto_follow_active && gimage)
|
||||
lc_dialog_change_image (image_context, gimage, NULL);
|
||||
if (lc_dialog->auto_follow_active)
|
||||
lc_dialog_change_image (context,
|
||||
gimp_context_get_image (context),
|
||||
NULL);
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@ -457,18 +461,6 @@ lc_dialog_remove_cb (GimpSet *set,
|
|||
lc_dialog_update_image_list ();
|
||||
}
|
||||
|
||||
static void
|
||||
lc_dialog_change_image (GimpSet *set,
|
||||
GimpImage *gimage,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (lc_dialog && lc_dialog->auto_follow_active && gimage)
|
||||
{
|
||||
lc_dialog_update (gimage);
|
||||
lc_dialog_update_image_list ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
lc_dialog_destroy_cb (GimpImage *gimage,
|
||||
gpointer user_data)
|
||||
|
@ -478,3 +470,19 @@ lc_dialog_destroy_cb (GimpImage *gimage,
|
|||
|
||||
lc_dialog_update_image_list ();
|
||||
}
|
||||
|
||||
static void
|
||||
lc_dialog_change_image (GimpContext *context,
|
||||
GimpImage *gimage,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (! lc_dialog || ! lc_dialog->auto_follow_active)
|
||||
return;
|
||||
|
||||
if (gimage && gimp_set_have (image_context, gimage))
|
||||
{
|
||||
lc_dialog_update (gimage);
|
||||
}
|
||||
|
||||
lc_dialog_update_image_list ();
|
||||
}
|
||||
|
|
13
app/menus.c
13
app/menus.c
|
@ -53,6 +53,7 @@ static GSList *last_opened_raw_filenames = NULL;
|
|||
|
||||
static const GtkItemFactoryEntry toolbox_entries[] =
|
||||
{
|
||||
{ N_("/File/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/File/New"), "<control>N", file_new_cmd_callback, 0 },
|
||||
{ N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
|
||||
{ N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 },
|
||||
|
@ -68,6 +69,7 @@ static const GtkItemFactoryEntry toolbox_entries[] =
|
|||
{ N_("/File/Dialogs/Device Status..."), NULL, dialogs_device_status_cmd_callback, 0 },
|
||||
{ N_("/File/Dialogs/Document Index..."), NULL, raise_idea_callback, 0 },
|
||||
{ N_("/File/Dialogs/Error Console..."), NULL, dialogs_error_console_cmd_callback, 0 },
|
||||
{ N_("/Xtns/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Xtns/Module Browser"), NULL, dialogs_module_browser_cmd_callback, 0 },
|
||||
{ N_("/File/---"), NULL, NULL, 0, "<Separator>" },
|
||||
{ N_("/File/---"), NULL, NULL, 0, "<Separator>" }
|
||||
|
@ -80,6 +82,8 @@ static const GtkItemFactoryEntry toolbox_end = { N_("/File/Quit"), "<control>Q",
|
|||
|
||||
static const GtkItemFactoryEntry image_entries[] =
|
||||
{
|
||||
{ N_("/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/File/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/File/New"), "<control>N", file_new_cmd_callback, 1 },
|
||||
{ N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
|
||||
{ N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 },
|
||||
|
@ -92,6 +96,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/File/Quit"), "<control>Q", file_quit_cmd_callback, 0 },
|
||||
{ N_("/File/---moved"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Edit/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Edit/Cut"), "<control>X", edit_cut_cmd_callback, 0 },
|
||||
{ N_("/Edit/Copy"), "<control>C", edit_copy_cmd_callback, 0 },
|
||||
{ N_("/Edit/Paste"), "<control>V", edit_paste_cmd_callback, 0 },
|
||||
|
@ -107,6 +112,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/Edit/Paste Named"), "<control><shift>V", edit_named_paste_cmd_callback, 0 },
|
||||
{ N_("/Edit/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Select/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Select/Toggle"), "<control>T", select_toggle_cmd_callback, 0 },
|
||||
{ N_("/Select/Invert"), "<control>I", select_invert_cmd_callback, 0 },
|
||||
{ N_("/Select/All"), "<control>A", select_all_cmd_callback, 0 },
|
||||
|
@ -119,6 +125,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/Select/Shrink"), NULL, select_shrink_cmd_callback, 0 },
|
||||
{ N_("/Select/Save To Channel"), NULL, select_save_cmd_callback, 0 },
|
||||
|
||||
{ N_("/View/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/View/Zoom In"), "equal", view_zoomin_cmd_callback, 0 },
|
||||
{ N_("/View/Zoom Out"), "minus", view_zoomout_cmd_callback, 0 },
|
||||
{ N_("/View/Zoom/16:1"), NULL, view_zoom_16_1_callback, 0 },
|
||||
|
@ -140,6 +147,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/View/New View"), NULL, view_new_view_cmd_callback, 0 },
|
||||
{ N_("/View/Shrink Wrap"), "<control>E", view_shrink_wrap_cmd_callback, 0 },
|
||||
|
||||
{ N_("/Image/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Image/Colors/Equalize"), NULL, image_equalize_cmd_callback, 0 },
|
||||
{ N_("/Image/Colors/Invert"), NULL, image_invert_cmd_callback, 0 },
|
||||
{ N_("/Image/Colors/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
@ -157,6 +165,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/Image/Scale"), NULL, image_scale_cmd_callback, 0 },
|
||||
{ N_("/Image/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Layers/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Layers/Layers & Channels..."), "<control>L", dialogs_lc_cmd_callback, 0 },
|
||||
{ N_("/Layers/Stack/Previous Layer"), "Prior", layers_previous_cmd_callback, 0 },
|
||||
{ N_("/Layers/Stack/Next Layer"), "Next", layers_next_cmd_callback, 0 },
|
||||
|
@ -204,17 +213,21 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/Tools/Swap Colors"), "X", tools_swap_colors_cmd_callback, 0 },
|
||||
*/
|
||||
|
||||
{ N_("/Tools/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Tools/Toolbox"), NULL, toolbox_raise_callback, 0 },
|
||||
{ N_("/Tools/Default Colors"), "D", tools_default_colors_cmd_callback, 0 },
|
||||
{ N_("/Tools/Swap Colors"), "X", tools_swap_colors_cmd_callback, 0 },
|
||||
{ N_("/Tools/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Filters/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Filters/Repeat last"), "<alt>F", filters_repeat_cmd_callback, 0x0 },
|
||||
{ N_("/Filters/Re-show last"), "<alt><shift>F", filters_repeat_cmd_callback, 0x1 },
|
||||
{ N_("/Filters/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Script-Fu/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Script-Fu/"), NULL, NULL, 0 },
|
||||
|
||||
{ N_("/Dialogs/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Dialogs/Brushes..."), "<control><shift>B", dialogs_brushes_cmd_callback, 0 },
|
||||
{ N_("/Dialogs/Patterns..."), "<control><shift>P", dialogs_patterns_cmd_callback, 0 },
|
||||
{ N_("/Dialogs/Palette..."), "<control>P", dialogs_palette_cmd_callback, 0 },
|
||||
|
|
|
@ -53,6 +53,7 @@ static GSList *last_opened_raw_filenames = NULL;
|
|||
|
||||
static const GtkItemFactoryEntry toolbox_entries[] =
|
||||
{
|
||||
{ N_("/File/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/File/New"), "<control>N", file_new_cmd_callback, 0 },
|
||||
{ N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
|
||||
{ N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 },
|
||||
|
@ -68,6 +69,7 @@ static const GtkItemFactoryEntry toolbox_entries[] =
|
|||
{ N_("/File/Dialogs/Device Status..."), NULL, dialogs_device_status_cmd_callback, 0 },
|
||||
{ N_("/File/Dialogs/Document Index..."), NULL, raise_idea_callback, 0 },
|
||||
{ N_("/File/Dialogs/Error Console..."), NULL, dialogs_error_console_cmd_callback, 0 },
|
||||
{ N_("/Xtns/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Xtns/Module Browser"), NULL, dialogs_module_browser_cmd_callback, 0 },
|
||||
{ N_("/File/---"), NULL, NULL, 0, "<Separator>" },
|
||||
{ N_("/File/---"), NULL, NULL, 0, "<Separator>" }
|
||||
|
@ -80,6 +82,8 @@ static const GtkItemFactoryEntry toolbox_end = { N_("/File/Quit"), "<control>Q",
|
|||
|
||||
static const GtkItemFactoryEntry image_entries[] =
|
||||
{
|
||||
{ N_("/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/File/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/File/New"), "<control>N", file_new_cmd_callback, 1 },
|
||||
{ N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
|
||||
{ N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 },
|
||||
|
@ -92,6 +96,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/File/Quit"), "<control>Q", file_quit_cmd_callback, 0 },
|
||||
{ N_("/File/---moved"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Edit/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Edit/Cut"), "<control>X", edit_cut_cmd_callback, 0 },
|
||||
{ N_("/Edit/Copy"), "<control>C", edit_copy_cmd_callback, 0 },
|
||||
{ N_("/Edit/Paste"), "<control>V", edit_paste_cmd_callback, 0 },
|
||||
|
@ -107,6 +112,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/Edit/Paste Named"), "<control><shift>V", edit_named_paste_cmd_callback, 0 },
|
||||
{ N_("/Edit/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Select/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Select/Toggle"), "<control>T", select_toggle_cmd_callback, 0 },
|
||||
{ N_("/Select/Invert"), "<control>I", select_invert_cmd_callback, 0 },
|
||||
{ N_("/Select/All"), "<control>A", select_all_cmd_callback, 0 },
|
||||
|
@ -119,6 +125,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/Select/Shrink"), NULL, select_shrink_cmd_callback, 0 },
|
||||
{ N_("/Select/Save To Channel"), NULL, select_save_cmd_callback, 0 },
|
||||
|
||||
{ N_("/View/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/View/Zoom In"), "equal", view_zoomin_cmd_callback, 0 },
|
||||
{ N_("/View/Zoom Out"), "minus", view_zoomout_cmd_callback, 0 },
|
||||
{ N_("/View/Zoom/16:1"), NULL, view_zoom_16_1_callback, 0 },
|
||||
|
@ -140,6 +147,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/View/New View"), NULL, view_new_view_cmd_callback, 0 },
|
||||
{ N_("/View/Shrink Wrap"), "<control>E", view_shrink_wrap_cmd_callback, 0 },
|
||||
|
||||
{ N_("/Image/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Image/Colors/Equalize"), NULL, image_equalize_cmd_callback, 0 },
|
||||
{ N_("/Image/Colors/Invert"), NULL, image_invert_cmd_callback, 0 },
|
||||
{ N_("/Image/Colors/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
@ -157,6 +165,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/Image/Scale"), NULL, image_scale_cmd_callback, 0 },
|
||||
{ N_("/Image/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Layers/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Layers/Layers & Channels..."), "<control>L", dialogs_lc_cmd_callback, 0 },
|
||||
{ N_("/Layers/Stack/Previous Layer"), "Prior", layers_previous_cmd_callback, 0 },
|
||||
{ N_("/Layers/Stack/Next Layer"), "Next", layers_next_cmd_callback, 0 },
|
||||
|
@ -204,17 +213,21 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/Tools/Swap Colors"), "X", tools_swap_colors_cmd_callback, 0 },
|
||||
*/
|
||||
|
||||
{ N_("/Tools/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Tools/Toolbox"), NULL, toolbox_raise_callback, 0 },
|
||||
{ N_("/Tools/Default Colors"), "D", tools_default_colors_cmd_callback, 0 },
|
||||
{ N_("/Tools/Swap Colors"), "X", tools_swap_colors_cmd_callback, 0 },
|
||||
{ N_("/Tools/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Filters/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Filters/Repeat last"), "<alt>F", filters_repeat_cmd_callback, 0x0 },
|
||||
{ N_("/Filters/Re-show last"), "<alt><shift>F", filters_repeat_cmd_callback, 0x1 },
|
||||
{ N_("/Filters/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Script-Fu/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Script-Fu/"), NULL, NULL, 0 },
|
||||
|
||||
{ N_("/Dialogs/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Dialogs/Brushes..."), "<control><shift>B", dialogs_brushes_cmd_callback, 0 },
|
||||
{ N_("/Dialogs/Patterns..."), "<control><shift>P", dialogs_patterns_cmd_callback, 0 },
|
||||
{ N_("/Dialogs/Palette..."), "<control>P", dialogs_palette_cmd_callback, 0 },
|
||||
|
|
|
@ -53,6 +53,7 @@ static GSList *last_opened_raw_filenames = NULL;
|
|||
|
||||
static const GtkItemFactoryEntry toolbox_entries[] =
|
||||
{
|
||||
{ N_("/File/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/File/New"), "<control>N", file_new_cmd_callback, 0 },
|
||||
{ N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
|
||||
{ N_("/File/About..."), NULL, about_dialog_cmd_callback, 0 },
|
||||
|
@ -68,6 +69,7 @@ static const GtkItemFactoryEntry toolbox_entries[] =
|
|||
{ N_("/File/Dialogs/Device Status..."), NULL, dialogs_device_status_cmd_callback, 0 },
|
||||
{ N_("/File/Dialogs/Document Index..."), NULL, raise_idea_callback, 0 },
|
||||
{ N_("/File/Dialogs/Error Console..."), NULL, dialogs_error_console_cmd_callback, 0 },
|
||||
{ N_("/Xtns/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Xtns/Module Browser"), NULL, dialogs_module_browser_cmd_callback, 0 },
|
||||
{ N_("/File/---"), NULL, NULL, 0, "<Separator>" },
|
||||
{ N_("/File/---"), NULL, NULL, 0, "<Separator>" }
|
||||
|
@ -80,6 +82,8 @@ static const GtkItemFactoryEntry toolbox_end = { N_("/File/Quit"), "<control>Q",
|
|||
|
||||
static const GtkItemFactoryEntry image_entries[] =
|
||||
{
|
||||
{ N_("/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/File/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/File/New"), "<control>N", file_new_cmd_callback, 1 },
|
||||
{ N_("/File/Open"), "<control>O", file_open_cmd_callback, 0 },
|
||||
{ N_("/File/Save"), "<control>S", file_save_cmd_callback, 0 },
|
||||
|
@ -92,6 +96,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/File/Quit"), "<control>Q", file_quit_cmd_callback, 0 },
|
||||
{ N_("/File/---moved"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Edit/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Edit/Cut"), "<control>X", edit_cut_cmd_callback, 0 },
|
||||
{ N_("/Edit/Copy"), "<control>C", edit_copy_cmd_callback, 0 },
|
||||
{ N_("/Edit/Paste"), "<control>V", edit_paste_cmd_callback, 0 },
|
||||
|
@ -107,6 +112,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/Edit/Paste Named"), "<control><shift>V", edit_named_paste_cmd_callback, 0 },
|
||||
{ N_("/Edit/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Select/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Select/Toggle"), "<control>T", select_toggle_cmd_callback, 0 },
|
||||
{ N_("/Select/Invert"), "<control>I", select_invert_cmd_callback, 0 },
|
||||
{ N_("/Select/All"), "<control>A", select_all_cmd_callback, 0 },
|
||||
|
@ -119,6 +125,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/Select/Shrink"), NULL, select_shrink_cmd_callback, 0 },
|
||||
{ N_("/Select/Save To Channel"), NULL, select_save_cmd_callback, 0 },
|
||||
|
||||
{ N_("/View/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/View/Zoom In"), "equal", view_zoomin_cmd_callback, 0 },
|
||||
{ N_("/View/Zoom Out"), "minus", view_zoomout_cmd_callback, 0 },
|
||||
{ N_("/View/Zoom/16:1"), NULL, view_zoom_16_1_callback, 0 },
|
||||
|
@ -140,6 +147,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/View/New View"), NULL, view_new_view_cmd_callback, 0 },
|
||||
{ N_("/View/Shrink Wrap"), "<control>E", view_shrink_wrap_cmd_callback, 0 },
|
||||
|
||||
{ N_("/Image/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Image/Colors/Equalize"), NULL, image_equalize_cmd_callback, 0 },
|
||||
{ N_("/Image/Colors/Invert"), NULL, image_invert_cmd_callback, 0 },
|
||||
{ N_("/Image/Colors/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
@ -157,6 +165,7 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/Image/Scale"), NULL, image_scale_cmd_callback, 0 },
|
||||
{ N_("/Image/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Layers/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Layers/Layers & Channels..."), "<control>L", dialogs_lc_cmd_callback, 0 },
|
||||
{ N_("/Layers/Stack/Previous Layer"), "Prior", layers_previous_cmd_callback, 0 },
|
||||
{ N_("/Layers/Stack/Next Layer"), "Next", layers_next_cmd_callback, 0 },
|
||||
|
@ -204,17 +213,21 @@ static const GtkItemFactoryEntry image_entries[] =
|
|||
{ N_("/Tools/Swap Colors"), "X", tools_swap_colors_cmd_callback, 0 },
|
||||
*/
|
||||
|
||||
{ N_("/Tools/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Tools/Toolbox"), NULL, toolbox_raise_callback, 0 },
|
||||
{ N_("/Tools/Default Colors"), "D", tools_default_colors_cmd_callback, 0 },
|
||||
{ N_("/Tools/Swap Colors"), "X", tools_swap_colors_cmd_callback, 0 },
|
||||
{ N_("/Tools/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Filters/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Filters/Repeat last"), "<alt>F", filters_repeat_cmd_callback, 0x0 },
|
||||
{ N_("/Filters/Re-show last"), "<alt><shift>F", filters_repeat_cmd_callback, 0x1 },
|
||||
{ N_("/Filters/---"), NULL, NULL, 0, "<Separator>" },
|
||||
|
||||
{ N_("/Script-Fu/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Script-Fu/"), NULL, NULL, 0 },
|
||||
|
||||
{ N_("/Dialogs/tearoff1"), NULL, NULL, 0, "<Tearoff>" },
|
||||
{ N_("/Dialogs/Brushes..."), "<control><shift>B", dialogs_brushes_cmd_callback, 0 },
|
||||
{ N_("/Dialogs/Patterns..."), "<control><shift>P", dialogs_patterns_cmd_callback, 0 },
|
||||
{ N_("/Dialogs/Palette..."), "<control>P", dialogs_palette_cmd_callback, 0 },
|
||||
|
|
Loading…
Reference in New Issue