Action code review and pre-release consistency cleanup:

2004-10-18  Michael Natterer  <mitch@gimp.org>

	Action code review and pre-release consistency cleanup:

	* app/actions/*-actions.c: added some missing and resolved
	conflicting mnemonics, added missing help IDs. Cleaned up the
	*_actions_update() functions.

	* app/actions/channels-actions.c
	* app/actions/layers-actions.c
	* app/actions/vectors-actions.c (*_actions_update): simplified
	the code that figures the prev and next channel,layer,vectors.

	* app/actions/qmask-actions.c: use the same accelerator for
	"qmask-active" and "qmask-toggle". Fixed action sensitivity.

	* app/actions/channels-commands.c
	* app/actions/dockable-commands.c
	* app/actions/documents-commands.c
	* app/actions/gradients-commands.c
	* app/actions/layers-commands.c
	* app/actions/palettes-commands.c
	* app/actions/image-commands.c
	* app/actions/select-commands.c
	* app/actions/vectors-commands.c: folded tons of private utility
	functions into their only callers (they used to be public and
	called from outside before the switch to action based menus).
	Renamed functions and variables saying "query" or "qbox" to
	"dialog". Moved static functions to the end of the files. Misc
	minor cleanups.

	* app/actions/drawable-actions.c
	* app/actions/drawable-commands.c: made the "drawable-visible" and
	"drawable-linked" actions affect the layer if the active drawable
	is a layer mask.

	* app/actions/select-commands.c: added action to stroke with the
	last values used in an attempt to address bug #135746 but #if 0'ed
	it because the approach is too ugly.

	* app/tools/gimpiscissorstool.c: changed mnemonic from I to S.

	* menus/image-menu-xml.in: added more stuff to the (commented out)
	"context" menu.
This commit is contained in:
Michael Natterer 2004-10-18 11:29:58 +00:00 committed by Michael Natterer
parent c79b64e6c1
commit c49df22eef
44 changed files with 831 additions and 806 deletions

View File

@ -1,3 +1,48 @@
2004-10-18 Michael Natterer <mitch@gimp.org>
Action code review and pre-release consistency cleanup:
* app/actions/*-actions.c: added some missing and resolved
conflicting mnemonics, added missing help IDs. Cleaned up the
*_actions_update() functions.
* app/actions/channels-actions.c
* app/actions/layers-actions.c
* app/actions/vectors-actions.c (*_actions_update): simplified
the code that figures the prev and next channel,layer,vectors.
* app/actions/qmask-actions.c: use the same accelerator for
"qmask-active" and "qmask-toggle". Fixed action sensitivity.
* app/actions/channels-commands.c
* app/actions/dockable-commands.c
* app/actions/documents-commands.c
* app/actions/gradients-commands.c
* app/actions/layers-commands.c
* app/actions/palettes-commands.c
* app/actions/image-commands.c
* app/actions/select-commands.c
* app/actions/vectors-commands.c: folded tons of private utility
functions into their only callers (they used to be public and
called from outside before the switch to action based menus).
Renamed functions and variables saying "query" or "qbox" to
"dialog". Moved static functions to the end of the files. Misc
minor cleanups.
* app/actions/drawable-actions.c
* app/actions/drawable-commands.c: made the "drawable-visible" and
"drawable-linked" actions affect the layer if the active drawable
is a layer mask.
* app/actions/select-commands.c: added action to stroke with the
last values used in an attempt to address bug #135746 but #if 0'ed
it because the approach is too ugly.
* app/tools/gimpiscissorstool.c: changed mnemonic from I to S.
* menus/image-menu-xml.in: added more stuff to the (commented out)
"context" menu.
2004-10-17 DindinX <dindinx@gimp.org>
* libgimp/gimppixelrgn.c: some more clues in the documentation

View File

@ -28,7 +28,6 @@
#include "core/gimpdata.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimphelp-ids.h"
#include "actions.h"
@ -40,11 +39,12 @@
static GimpActionEntry brushes_actions[] =
{
{ "brushes-popup", GIMP_STOCK_BRUSH, N_("Brushes Menu"), NULL, NULL, NULL,
{ "brushes-popup", GIMP_STOCK_BRUSH,
N_("Brushes Menu"), NULL, NULL, NULL,
GIMP_HELP_BRUSH_DIALOG },
{ "brushes-new", GTK_STOCK_NEW,
N_("New Brush"), "",
N_("_New Brush"), "",
N_("New brush"),
G_CALLBACK (data_new_data_cmd_callback),
GIMP_HELP_BRUSH_NEW },
@ -95,11 +95,9 @@ void
brushes_actions_update (GimpActionGroup *group,
gpointer user_data)
{
GimpContext *context;
GimpBrush *brush = NULL;
GimpData *data = NULL;
context = action_data_get_context (user_data);
GimpContext *context = action_data_get_context (user_data);
GimpBrush *brush = NULL;
GimpData *data = NULL;
if (context)
{

View File

@ -38,7 +38,8 @@
static GimpActionEntry buffers_actions[] =
{
{ "buffers-popup", GIMP_STOCK_BUFFER, N_("Buffers Menu"), NULL, NULL, NULL,
{ "buffers-popup", GIMP_STOCK_BUFFER,
N_("Buffers Menu"), NULL, NULL, NULL,
GIMP_HELP_BUFFER_DIALOG },
{ "buffers-paste", GTK_STOCK_PASTE,
@ -79,10 +80,8 @@ void
buffers_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpContext *context;
GimpBuffer *buffer = NULL;
context = action_data_get_context (data);
GimpContext *context = action_data_get_context (data);
GimpBuffer *buffer = NULL;
if (context)
buffer = gimp_context_get_buffer (context);

View File

@ -40,7 +40,8 @@
static GimpActionEntry channels_actions[] =
{
{ "channels-popup", GIMP_STOCK_CHANNELS, N_("Channels Menu"), NULL, NULL, NULL,
{ "channels-popup", GIMP_STOCK_CHANNELS,
N_("Channels Menu"), NULL, NULL, NULL,
GIMP_HELP_CHANNEL_DIALOG },
{ "channels-edit-attributes", GIMP_STOCK_EDIT,
@ -143,15 +144,13 @@ void
channels_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *gimage;
GimpImage *gimage = action_data_get_image (data);
GimpChannel *channel = NULL;
gboolean fs = FALSE;
gboolean component = FALSE;
GList *next = NULL;
GList *prev = NULL;
gimage = action_data_get_image (data);
if (gimage)
{
fs = (gimp_image_floating_sel (gimage) != NULL);
@ -163,19 +162,18 @@ channels_actions_update (GimpActionGroup *group,
}
else
{
GList *list;
channel = gimp_image_get_active_channel (gimage);
for (list = GIMP_LIST (gimage->channels)->list;
list;
list = g_list_next (list))
if (channel)
{
if (channel == (GimpChannel *) list->data)
GList *list;
list = g_list_find (GIMP_LIST (gimage->channels)->list, channel);
if (list)
{
prev = g_list_previous (list);
next = g_list_next (list);
break;
}
}
}

View File

@ -62,19 +62,13 @@ struct _ChannelOptions
/* local function prototypes */
static ChannelOptions * channels_query_new (GimpImage *gimage,
static ChannelOptions * channel_options_new (GimpImage *gimage,
GimpContext *context,
GimpChannel *channel,
GtkWidget *parent);
static void channels_new_channel_query (GimpImage *gimage,
GimpContext *context,
GtkWidget *parent);
static void channels_new_channel_response (GtkWidget *widget,
gint response_id,
ChannelOptions *options);
static void channels_edit_channel_query (GimpChannel *channel,
GimpContext *context,
GtkWidget *parent);
static void channels_edit_channel_response (GtkWidget *widget,
gint response_id,
ChannelOptions *options);
@ -96,26 +90,42 @@ void
channels_edit_attributes_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpChannel *channel;
GtkWidget *widget;
ChannelOptions *options;
GimpImage *gimage;
GimpChannel *channel;
GtkWidget *widget;
return_if_no_channel (gimage, channel, data);
return_if_no_widget (widget, data);
channels_edit_channel_query (channel, action_data_get_context (data),
widget);
options = channel_options_new (gimp_item_get_image (GIMP_ITEM (channel)),
action_data_get_context (data),
channel, widget);
g_signal_connect (options->query_box, "response",
G_CALLBACK (channels_edit_channel_response),
options);
gtk_widget_show (options->query_box);
}
void
channels_new_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GtkWidget *widget;
ChannelOptions *options;
GimpImage *gimage;
GtkWidget *widget;
return_if_no_image (gimage, data);
return_if_no_widget (widget, data);
channels_new_channel_query (gimage, action_data_get_context (data), widget);
options = channel_options_new (gimage, action_data_get_context (data),
NULL, widget);
g_signal_connect (options->query_box, "response",
G_CALLBACK (channels_new_channel_response),
options);
gtk_widget_show (options->query_box);
}
void
@ -310,10 +320,10 @@ channels_to_selection_cmd_callback (GtkAction *action,
/* private functions */
static ChannelOptions *
channels_query_new (GimpImage *gimage,
GimpContext *context,
GimpChannel *channel,
GtkWidget *parent)
channel_options_new (GimpImage *gimage,
GimpContext *context,
GimpChannel *channel,
GtkWidget *parent)
{
ChannelOptions *options;
GtkWidget *hbox;
@ -427,22 +437,6 @@ channels_query_new (GimpImage *gimage,
return options;
}
static void
channels_new_channel_query (GimpImage *gimage,
GimpContext *context,
GtkWidget *parent)
{
ChannelOptions *options;
options = channels_query_new (gimage, context, NULL, parent);
g_signal_connect (options->query_box, "response",
G_CALLBACK (channels_new_channel_response),
options);
gtk_widget_show (options->query_box);
}
static void
channels_new_channel_response (GtkWidget *widget,
gint response_id,
@ -477,26 +471,6 @@ channels_new_channel_response (GtkWidget *widget,
gtk_widget_destroy (options->query_box);
}
static void
channels_edit_channel_query (GimpChannel *channel,
GimpContext *context,
GtkWidget *parent)
{
ChannelOptions *options;
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (GIMP_IS_CONTEXT (context));
options = channels_query_new (gimp_item_get_image (GIMP_ITEM (channel)),
context, channel, parent);
g_signal_connect (options->query_box, "response",
G_CALLBACK (channels_edit_channel_response),
options);
gtk_widget_show (options->query_box);
}
static void
channels_edit_channel_response (GtkWidget *widget,
gint response_id,

View File

@ -82,16 +82,13 @@ void
colormap_editor_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *gimage;
GimpContext *context;
GimpImage *gimage = action_data_get_image (data);
GimpContext *context = action_data_get_context (data);
gboolean indexed = FALSE;
gint num_colors = 0;
GimpRGB fg;
GimpRGB bg;
gimage = action_data_get_image (data);
context = action_data_get_context (data);
if (gimage)
{
indexed = gimp_image_base_type (gimage) == GIMP_INDEXED;

View File

@ -82,16 +82,13 @@ void
colormap_editor_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *gimage;
GimpContext *context;
GimpImage *gimage = action_data_get_image (data);
GimpContext *context = action_data_get_context (data);
gboolean indexed = FALSE;
gint num_colors = 0;
GimpRGB fg;
GimpRGB bg;
gimage = action_data_get_image (data);
context = action_data_get_context (data);
if (gimage)
{
indexed = gimp_image_base_type (gimage) == GIMP_INDEXED;

View File

@ -47,6 +47,7 @@ static GimpActionEntry context_actions[] =
{ "context-colors-menu", GIMP_STOCK_DEFAULT_COLORS, N_("_Colors") },
{ "context-opacity-menu", GIMP_STOCK_TRANSPARENCY, N_("_Opacity") },
{ "context-paint-mode-menu", GIMP_STOCK_TOOL_PENCIL, N_("Paint _Mode") },
{ "context-tool-menu", GIMP_STOCK_TOOLS, N_("_Tool") },
{ "context-brush-menu", GIMP_STOCK_BRUSH, N_("_Brush") },
{ "context-pattern-menu", GIMP_STOCK_PATTERN, N_("_Pattern") },
{ "context-palette-menu", GIMP_STOCK_PALETTE, N_("_Palette") },
@ -709,7 +710,7 @@ void
context_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpContext *context;
GimpContext *context = action_data_get_context (data);
gboolean generated = FALSE;
gdouble radius = 0.0;
gint spikes = 0;
@ -717,8 +718,6 @@ context_actions_update (GimpActionGroup *group,
gdouble aspect = 0.0;
gdouble angle = 0.0;
context = action_data_get_context (data);
if (context)
{
GimpBrush *brush = gimp_context_get_brush (context);

View File

@ -107,7 +107,7 @@ GimpStringActionEntry dialogs_dockable_actions[] =
GIMP_HELP_NAVIGATION_DIALOG },
{ "dialogs-undo-history", GIMP_STOCK_UNDO_HISTORY,
N_("_Undo History"), NULL, NULL,
N_("Undo _History"), NULL, NULL,
"gimp-undo-history",
GIMP_HELP_UNDO_DIALOG },
@ -117,7 +117,7 @@ GimpStringActionEntry dialogs_dockable_actions[] =
GIMP_HELP_COLOR_DIALOG },
{ "dialogs-brushes", GIMP_STOCK_BRUSH,
N_("Brus_hes"), "<control><shift>B", NULL,
N_("_Brushes"), "<control><shift>B", NULL,
"gimp-brush-grid|gimp-brush-list",
GIMP_HELP_BRUSH_DIALOG },
@ -142,7 +142,7 @@ GimpStringActionEntry dialogs_dockable_actions[] =
GIMP_HELP_FONT_DIALOG },
{ "dialogs-buffers", GIMP_STOCK_BUFFER,
N_("_Buffers"), "", NULL,
N_("B_uffers"), "", NULL,
"gimp-buffer-list|gimp-buffer-grid",
GIMP_HELP_BUFFER_DIALOG },

View File

@ -45,12 +45,13 @@
static GimpActionEntry dockable_actions[] =
{
{ "dockable-popup", NULL, N_("Dialogs Menu"), NULL, NULL, NULL,
{ "dockable-popup", NULL,
N_("Dialogs Menu"), NULL, NULL, NULL,
GIMP_HELP_DOCK },
{ "dockable-menu", GTK_STOCK_MISSING_IMAGE, "" },
{ "dockable-add-tab-menu", NULL, N_("_Add Tab") },
{ "dockable-preview-size-menu", NULL, N_("Preview Si_ze") },
{ "dockable-preview-size-menu", NULL, N_("_Preview Size") },
{ "dockable-tab-style-menu", NULL, N_("_Tab Style") },
{ "dockable-close-tab", GTK_STOCK_CLOSE,
@ -64,7 +65,7 @@ static GimpActionEntry dockable_actions[] =
GIMP_HELP_DOCK_TAB_DETACH },
{ "dockable-move-to-screen", GIMP_STOCK_MOVE_TO_SCREEN,
N_("Move to Screen..."), NULL, NULL,
N_("M_ove to Screen..."), NULL, NULL,
G_CALLBACK (dockable_change_screen_cmd_callback),
GIMP_HELP_DOCK_CHANGE_SCREEN }
};
@ -72,13 +73,13 @@ static GimpActionEntry dockable_actions[] =
static GimpToggleActionEntry dockable_toggle_actions[] =
{
{ "dockable-show-image-menu", NULL,
N_("Show Image _Menu"), NULL, NULL,
N_("_Show Image Menu"), NULL, NULL,
G_CALLBACK (dockable_toggle_image_menu_cmd_callback),
TRUE,
GIMP_HELP_DOCK_IMAGE_MENU },
{ "dockable-auto-follow-active", NULL,
N_("Auto Follow Active _Image"), NULL, NULL,
N_("Auto _Follow Active Image"), NULL, NULL,
G_CALLBACK (dockable_toggle_auto_cmd_callback),
TRUE,
GIMP_HELP_DOCK_AUTO_BUTTON }

View File

@ -39,6 +39,15 @@
#include "dockable-commands.h"
/* local function prototypes */
static void dockable_change_screen_confirm_callback (GtkWidget *query_box,
gint value,
gpointer data);
static void dockable_change_screen_destroy_callback (GtkWidget *query_box,
GtkWidget *dock);
/* public functions */
void
@ -295,27 +304,6 @@ dockable_toggle_auto_cmd_callback (GtkAction *action,
active);
}
static void
dockable_change_screen_confirm_callback (GtkWidget *query_box,
gint value,
gpointer data)
{
GdkScreen *screen;
screen = gdk_display_get_screen (gtk_widget_get_display (GTK_WIDGET (data)),
value);
if (screen)
gtk_window_set_screen (GTK_WINDOW (data), screen);
}
static void
dockable_change_screen_destroy_callback (GtkWidget *query_box,
GtkWidget *dock)
{
g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", NULL);
}
void
dockable_change_screen_cmd_callback (GtkAction *action,
gpointer data)
@ -361,3 +349,27 @@ dockable_change_screen_cmd_callback (GtkAction *action,
gtk_widget_show (qbox);
}
/* private functions */
static void
dockable_change_screen_confirm_callback (GtkWidget *query_box,
gint value,
gpointer data)
{
GdkScreen *screen;
screen = gdk_display_get_screen (gtk_widget_get_display (GTK_WIDGET (data)),
value);
if (screen)
gtk_window_set_screen (GTK_WINDOW (data), screen);
}
static void
dockable_change_screen_destroy_callback (GtkWidget *query_box,
GtkWidget *dock)
{
g_object_set_data (G_OBJECT (dock), "gimp-change-screen-dialog", NULL);
}

View File

@ -38,7 +38,8 @@
static GimpActionEntry documents_actions[] =
{
{ "documents-popup", GTK_STOCK_OPEN, N_("Documents Menu"), NULL, NULL, NULL,
{ "documents-popup", GTK_STOCK_OPEN,
N_("Documents Menu"), NULL, NULL, NULL,
GIMP_HELP_DOCUMENT_DIALOG },
{ "documents-open", GTK_STOCK_OPEN,

View File

@ -49,10 +49,21 @@
#include "gimp-intl.h"
typedef struct _RaiseClosure RaiseClosure;
struct _RaiseClosure
{
const gchar *name;
gboolean found;
};
/* local function prototypes */
static void documents_open_image (GimpContext *context,
GimpImagefile *imagefile);
static void documents_open_image (GimpContext *context,
GimpImagefile *imagefile);
static void documents_raise_display (gpointer data,
gpointer user_data);
/* public functions */
@ -81,31 +92,6 @@ documents_open_document_cmd_callback (GtkAction *action,
}
}
typedef struct _RaiseClosure RaiseClosure;
struct _RaiseClosure
{
const gchar *name;
gboolean found;
};
static void
documents_raise_display (gpointer data,
gpointer user_data)
{
GimpDisplay *gdisp = (GimpDisplay *) data;
RaiseClosure *closure = (RaiseClosure *) user_data;
const gchar *uri;
uri = gimp_object_get_name (GIMP_OBJECT (gdisp->gimage));
if (uri && ! strcmp (closure->name, uri))
{
closure->found = TRUE;
gtk_window_present (GTK_WINDOW (gdisp->shell));
}
}
void
documents_raise_or_open_document_cmd_callback (GtkAction *action,
gpointer data)
@ -276,3 +262,20 @@ documents_open_image (GimpContext *context,
g_free (filename);
}
}
static void
documents_raise_display (gpointer data,
gpointer user_data)
{
GimpDisplay *gdisp = data;
RaiseClosure *closure = user_data;
const gchar *uri;
uri = gimp_object_get_name (GIMP_OBJECT (gdisp->gimage));
if (uri && ! strcmp (closure->name, uri))
{
closure->found = TRUE;
gtk_window_present (GTK_WINDOW (gdisp->shell));
}
}

View File

@ -25,10 +25,9 @@
#include "actions-types.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimphelp-ids.h"
@ -152,13 +151,18 @@ drawable_actions_update (GimpActionGroup *group,
if (drawable)
{
GimpItem *item = GIMP_ITEM (drawable);
GimpImageType drawable_type = gimp_drawable_type (drawable);
GimpItem *item;
is_rgb = GIMP_IMAGE_TYPE_IS_RGB (drawable_type);
is_gray = GIMP_IMAGE_TYPE_IS_GRAY (drawable_type);
is_indexed = GIMP_IMAGE_TYPE_IS_INDEXED (drawable_type);
if (GIMP_IS_LAYER_MASK (drawable))
item = GIMP_ITEM (gimp_layer_mask_get_layer (GIMP_LAYER_MASK (drawable)));
else
item = GIMP_ITEM (drawable);
visible = gimp_item_get_visible (item);
linked = gimp_item_get_linked (item);
}

View File

@ -25,7 +25,6 @@
#include "actions-types.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpdrawable-desaturate.h"
#include "core/gimpdrawable-equalize.h"
#include "core/gimpdrawable-invert.h"
@ -33,6 +32,7 @@
#include "core/gimpimage-undo.h"
#include "core/gimpitem-linked.h"
#include "core/gimpitemundo.h"
#include "core/gimplayermask.h"
#include "dialogs/offset-dialog.h"
@ -109,6 +109,10 @@ drawable_visible_cmd_callback (GtkAction *action,
visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (GIMP_IS_LAYER_MASK (drawable))
drawable =
GIMP_DRAWABLE (gimp_layer_mask_get_layer (GIMP_LAYER_MASK (drawable)));
if (visible != gimp_item_get_visible (GIMP_ITEM (drawable)))
{
GimpUndo *undo;
@ -136,6 +140,10 @@ drawable_linked_cmd_callback (GtkAction *action,
linked = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (GIMP_IS_LAYER_MASK (drawable))
drawable =
GIMP_DRAWABLE (gimp_layer_mask_get_layer (GIMP_LAYER_MASK (drawable)));
if (linked != gimp_item_get_linked (GIMP_ITEM (drawable)))
{
GimpUndo *undo;

View File

@ -58,8 +58,8 @@ static void edit_actions_pattern_changed (GimpContext *context,
static GimpActionEntry edit_actions[] =
{
{ "edit-menu", NULL, N_("_Edit") },
{ "edit-buffer-menu", NULL, N_("Buffer") },
{ "edit-menu", NULL, N_("_Edit") },
{ "edit-buffer-menu", NULL, N_("_Buffer") },
{ "edit-undo", GTK_STOCK_UNDO,
N_("_Undo"), "<control>Z",

View File

@ -36,8 +36,8 @@
static GimpActionEntry error_console_actions[] =
{
{ "error-console-popup", GIMP_STOCK_WARNING, N_("Error Console Menu"),
NULL, NULL, NULL,
{ "error-console-popup", GIMP_STOCK_WARNING,
N_("Error Console Menu"), NULL, NULL, NULL,
GIMP_HELP_ERRORS_DIALOG },
{ "error-console-clear", GTK_STOCK_CLEAR,
@ -69,11 +69,9 @@ void
error_console_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpErrorConsole *console;
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
gboolean selection;
console = GIMP_ERROR_CONSOLE (data);
selection = gtk_text_buffer_get_selection_bounds (console->text_buffer,
NULL, NULL);

View File

@ -189,11 +189,9 @@ void
file_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *gimage = NULL;
GimpImage *gimage = action_data_get_image (data);
GimpDrawable *drawable = NULL;
gimage = action_data_get_image (data);
if (gimage)
drawable = gimp_image_active_drawable (gimage);

View File

@ -40,7 +40,8 @@
static GimpActionEntry fonts_actions[] =
{
{ "fonts-popup", GIMP_STOCK_FONT, N_("Fonts Menu"), NULL, NULL, NULL,
{ "fonts-popup", GIMP_STOCK_FONT,
N_("Fonts Menu"), NULL, NULL, NULL,
GIMP_HELP_FONT_DIALOG },
{ "fonts-refresh", GTK_STOCK_REFRESH,
@ -63,10 +64,8 @@ void
fonts_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpContext *context;
GimpFont *font = NULL;
context = action_data_get_context (data);
GimpContext *context = action_data_get_context (data);
GimpFont *font = NULL;
if (context)
font = gimp_context_get_font (context);

View File

@ -42,8 +42,8 @@
static GimpActionEntry gradient_editor_actions[] =
{
{ "gradient-editor-popup", GIMP_STOCK_GRADIENT, N_("Gradient Editor Menu"),
NULL, NULL, NULL,
{ "gradient-editor-popup", GIMP_STOCK_GRADIENT,
N_("Gradient Editor Menu"), NULL, NULL, NULL,
GIMP_HELP_GRADIENT_EDITOR_DIALOG },
{ "gradient-editor-load-left-color", GTK_STOCK_REVERT_TO_SAVED,
@ -341,7 +341,7 @@ void
gradient_editor_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpGradientEditor *editor;
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
GimpContext *context;
GimpGradientSegment *left_seg;
GimpGradientSegment *right_seg;
@ -352,8 +352,6 @@ gradient_editor_actions_update (GimpActionGroup *group,
gboolean selection;
gboolean delete;
editor = GIMP_GRADIENT_EDITOR (data);
context =
gimp_get_user_context (GIMP_DATA_EDITOR (editor)->data_factory->gimp);
@ -397,8 +395,8 @@ gradient_editor_actions_update (GimpActionGroup *group,
selection = (editor->control_sel_l != editor->control_sel_r);
delete = (editor->control_sel_l->prev || editor->control_sel_r->next);
#define SET_ACTIVE(action,active) \
gimp_action_group_set_action_active (group, action, (active))
#define SET_ACTIVE(action,condition) \
gimp_action_group_set_action_active (group, action, (condition) != 0)
#define SET_COLOR(action,color,set_label) \
gimp_action_group_set_action_color (group, action, (color), (set_label))
#define SET_LABEL(action,label) \

View File

@ -40,8 +40,8 @@
static GimpActionEntry gradients_actions[] =
{
{ "gradients-popup", GIMP_STOCK_GRADIENT, N_("Gradients Menu"),
NULL, NULL, NULL,
{ "gradients-popup", GIMP_STOCK_GRADIENT,
N_("Gradients Menu"), NULL, NULL, NULL,
GIMP_HELP_GRADIENT_DIALOG },
{ "gradients-new", GTK_STOCK_NEW,
@ -102,12 +102,10 @@ void
gradients_actions_update (GimpActionGroup *group,
gpointer user_data)
{
GimpContext *context;
GimpContext *context = action_data_get_context (user_data);
GimpGradient *gradient = NULL;
GimpData *data = NULL;
context = action_data_get_context (user_data);
if (context)
{
gradient = gimp_context_get_gradient (context);

View File

@ -38,10 +38,9 @@
/* local function prototypes */
static void gradients_save_as_pov_query (GimpContainerEditor *editor);
static void gradients_save_as_pov_response (GtkWidget *dialog,
gint response_id,
GimpGradient *gradient);
static void gradients_save_as_pov_ray_response (GtkWidget *dialog,
gint response_id,
GimpGradient *gradient);
/* public functions */
@ -51,20 +50,10 @@ gradients_save_as_pov_ray_cmd_callback (GtkAction *action,
gpointer data)
{
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
gradients_save_as_pov_query (editor);
}
/* private functions */
static void
gradients_save_as_pov_query (GimpContainerEditor *editor)
{
GimpContext *context;
GimpGradient *gradient;
GtkFileChooser *chooser;
gchar *title;
GimpContext *context;
GimpGradient *gradient;
GtkFileChooser *chooser;
gchar *title;
context = gimp_container_view_get_context (editor->view);
@ -94,7 +83,7 @@ gradients_save_as_pov_query (GimpContainerEditor *editor)
gtk_window_set_position (GTK_WINDOW (chooser), GTK_WIN_POS_MOUSE);
g_signal_connect (chooser, "response",
G_CALLBACK (gradients_save_as_pov_response),
G_CALLBACK (gradients_save_as_pov_ray_response),
gradient);
g_signal_connect (chooser, "delete_event",
G_CALLBACK (gtk_true),
@ -113,10 +102,13 @@ gradients_save_as_pov_query (GimpContainerEditor *editor)
gtk_widget_show (GTK_WIDGET (chooser));
}
/* private functions */
static void
gradients_save_as_pov_response (GtkWidget *dialog,
gint response_id,
GimpGradient *gradient)
gradients_save_as_pov_ray_response (GtkWidget *dialog,
gint response_id,
GimpGradient *gradient)
{
if (response_id == GTK_RESPONSE_OK)
{

View File

@ -43,13 +43,16 @@
static GimpActionEntry image_actions[] =
{
{ "toolbox-menubar", NULL, N_("Toolbox Menu"), NULL, NULL, NULL,
{ "toolbox-menubar", NULL,
N_("Toolbox Menu"), NULL, NULL, NULL,
GIMP_HELP_TOOLBOX },
{ "image-menubar", NULL, N_("Image Menu"), NULL, NULL, NULL,
{ "image-menubar", NULL,
N_("Image Menu"), NULL, NULL, NULL,
GIMP_HELP_IMAGE_WINDOW },
{ "image-popup", NULL, N_("Image Menu"), NULL, NULL, NULL,
{ "image-popup", NULL,
N_("Image Menu"), NULL, NULL, NULL,
GIMP_HELP_IMAGE_WINDOW },
{ "extensions-menu", NULL, N_("_Xtns") },
@ -199,7 +202,7 @@ void
image_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *gimage;
GimpImage *gimage = action_data_get_image (data);
gboolean is_rgb = FALSE;
gboolean is_gray = FALSE;
gboolean is_indexed = FALSE;
@ -208,8 +211,6 @@ image_actions_update (GimpActionGroup *group,
gboolean lp = FALSE;
gboolean sel = FALSE;
gimage = action_data_get_image (data);
if (gimage)
{
GimpImageBaseType base_type;

View File

@ -349,14 +349,12 @@ image_duplicate_cmd_callback (GtkAction *action,
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
GimpImage *gimage;
GimpImage *new_gimage;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimage = gdisp->gimage;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
new_gimage = gimp_image_duplicate (gimage);
new_gimage = gimp_image_duplicate (gdisp->gimage);
gimp_create_display (new_gimage->gimp,
new_gimage,

View File

@ -39,7 +39,8 @@
static GimpActionEntry images_actions[] =
{
{ "images-popup", GIMP_STOCK_IMAGES, N_("Images Menu"), NULL, NULL, NULL,
{ "images-popup", GIMP_STOCK_IMAGES,
N_("Images Menu"), NULL, NULL, NULL,
GIMP_HELP_IMAGE_DIALOG },
{ "images-raise-views", GTK_STOCK_GOTO_TOP,
@ -74,10 +75,8 @@ void
images_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpContext *context;
GimpImage *image = NULL;
context = action_data_get_context (data);
GimpContext *context = action_data_get_context (data);
GimpImage *image = NULL;
if (context)
image = gimp_context_get_image (context);

View File

@ -44,7 +44,8 @@
static GimpActionEntry layers_actions[] =
{
{ "layers-popup", GIMP_STOCK_LAYERS, N_("Layers Menu"), NULL, NULL, NULL,
{ "layers-popup", GIMP_STOCK_LAYERS,
N_("Layers Menu"), NULL, NULL, NULL,
GIMP_HELP_LAYER_DIALOG },
{ "layers-menu", NULL, N_("_Layer") },
@ -382,7 +383,7 @@ void
layers_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *gimage;
GimpImage *gimage = action_data_get_image (data);
GimpLayer *layer = NULL;
GimpLayerMask *mask = FALSE; /* layer mask */
gboolean fs = FALSE; /* floating sel */
@ -396,48 +397,37 @@ layers_actions_update (GimpActionGroup *group,
GList *next = NULL;
GList *prev = NULL;
gimage = action_data_get_image (data);
if (gimage)
{
GList *list;
fs = (gimp_image_floating_sel (gimage) != NULL);
ac = (gimp_image_get_active_channel (gimage) != NULL);
sel = ! gimp_channel_is_empty (gimp_image_get_mask (gimage));
indexed = (gimp_image_base_type (gimage) == GIMP_INDEXED);
layer = gimp_image_get_active_layer (gimage);
if (layer)
{
mask = gimp_layer_get_mask (layer);
GList *list;
mask = gimp_layer_get_mask (layer);
preserve = gimp_layer_get_preserve_trans (layer);
}
alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
fs = (gimp_image_floating_sel (gimage) != NULL);
ac = (gimp_image_get_active_channel (gimage) != NULL);
sel = ! gimp_channel_is_empty (gimp_image_get_mask (gimage));
list = g_list_find (GIMP_LIST (gimage->layers)->list, layer);
alpha = layer && gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
indexed = (gimp_image_base_type (gimage) == GIMP_INDEXED);
for (list = GIMP_LIST (gimage->layers)->list;
list;
list = g_list_next (list))
{
if (layer == (GimpLayer *) list->data)
if (list)
{
prev = g_list_previous (list);
next = g_list_next (list);
break;
}
if (next)
next_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (next->data));
if (layer)
text_layer = gimp_drawable_is_text_layer (GIMP_DRAWABLE (layer));
}
if (next)
next_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (next->data));
else
next_alpha = FALSE;
text_layer = (layer &&
gimp_drawable_is_text_layer (GIMP_DRAWABLE (layer)));
}
#define SET_VISIBLE(action,condition) \

View File

@ -98,26 +98,84 @@ static const GimpLayerModeEffects layer_modes[] =
};
typedef struct _NewLayerOptions NewLayerOptions;
struct _NewLayerOptions
{
GtkWidget *dialog;
GtkWidget *name_entry;
GtkWidget *size_se;
GimpFillType fill_type;
gint xsize;
gint ysize;
GimpContext *context;
GimpImage *gimage;
};
typedef struct _EditLayerOptions EditLayerOptions;
struct _EditLayerOptions
{
GtkWidget *dialog;
GtkWidget *name_entry;
GtkWidget *toggle;
GimpLayer *layer;
GimpImage *gimage;
};
typedef struct _AddMaskOptions AddMaskOptions;
struct _AddMaskOptions
{
GtkWidget *dialog;
GimpLayer *layer;
GimpAddMaskType add_mask_type;
gboolean invert;
};
typedef struct _ResizeLayerOptions ResizeLayerOptions;
struct _ResizeLayerOptions
{
GimpLayer *layer;
GimpContext *context;
ResizeDialog *dialog;
};
/* local function prototypes */
static void layers_new_layer_query (GimpImage *gimage,
GimpContext *context,
GtkWidget *parent);
static void layers_edit_layer_query (GimpLayer *layer,
GimpContext *context,
GtkWidget *parent);
static void layers_add_mask_query (GimpLayer *layer,
GtkWidget *parent);
static void layers_scale_layer_query (GimpDisplay *gdisp,
GimpImage *gimage,
GimpLayer *layer,
GtkWidget *parent);
static void layers_resize_layer_query (GimpDisplay *gdisp,
GimpImage *gimage,
GimpLayer *layer,
GimpContext *context,
GtkWidget *parent);
static gint layers_mode_index (GimpLayerModeEffects layer_mode);
static void layers_new_layer_dialog (GimpImage *gimage,
GimpContext *context,
GtkWidget *parent);
static void layers_new_layer_response (GtkWidget *widget,
gint response_id,
NewLayerOptions *options);
static void layers_edit_layer_dialog (GimpLayer *layer,
GimpContext *context,
GtkWidget *parent);
static void layers_edit_layer_response (GtkWidget *widget,
gint response_id,
EditLayerOptions *options);
static void layers_add_mask_response (GtkWidget *widget,
gint response_id,
AddMaskOptions *options);
static void layers_scale_layer_callback (GtkWidget *dialog,
GimpViewable *viewable,
gint width,
gint height,
GimpUnit unit,
GimpInterpolationType interpolation,
gpointer data);
static void layers_resize_layer_callback (GtkWidget *widget,
gpointer data);
static gint layers_mode_index (GimpLayerModeEffects layer_mode);
/* private variables */
@ -141,7 +199,7 @@ layers_text_tool_cmd_callback (GtkAction *action,
if (! gimp_drawable_is_text_layer (GIMP_DRAWABLE (layer)))
{
layers_edit_layer_query (layer, action_data_get_context (data), widget);
layers_edit_layer_dialog (layer, action_data_get_context (data), widget);
return;
}
@ -176,7 +234,7 @@ layers_edit_attributes_cmd_callback (GtkAction *action,
return_if_no_layer (gimage, layer, data);
return_if_no_widget (widget, data);
layers_edit_layer_query (layer, action_data_get_context (data), widget);
layers_edit_layer_dialog (layer, action_data_get_context (data), widget);
}
void
@ -199,7 +257,7 @@ layers_new_cmd_callback (GtkAction *action,
return;
}
layers_new_layer_query (gimage, action_data_get_context (data), widget);
layers_new_layer_dialog (gimage, action_data_get_context (data), widget);
}
void
@ -413,15 +471,39 @@ void
layers_resize_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpLayer *layer;
GtkWidget *widget;
ResizeLayerOptions *options;
GimpImage *gimage;
GimpLayer *layer;
GtkWidget *widget;
GimpDisplay *gdisp;
return_if_no_layer (gimage, layer, data);
return_if_no_widget (widget, data);
layers_resize_layer_query (GIMP_IS_DISPLAY (data) ? data : NULL,
gimage, layer, action_data_get_context (data),
widget);
gdisp = GIMP_IS_DISPLAY (data) ? data : NULL;
options = g_new0 (ResizeLayerOptions, 1);
options->context = action_data_get_context (data);
options->layer = layer;
options->dialog =
resize_dialog_new (GIMP_VIEWABLE (layer), widget,
RESIZE_DIALOG,
gimp_item_width (GIMP_ITEM (layer)),
gimp_item_height (GIMP_ITEM (layer)),
gimage->xresolution,
gimage->yresolution,
(gdisp ?
GIMP_DISPLAY_SHELL (gdisp->shell)->unit :
GIMP_UNIT_PIXEL),
G_CALLBACK (layers_resize_layer_callback),
options);
g_object_weak_ref (G_OBJECT (options->dialog->shell),
(GWeakNotify) g_free,
options);
gtk_widget_show (options->dialog->shell);
}
void
@ -440,14 +522,28 @@ void
layers_scale_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpLayer *layer;
GtkWidget *widget;
GimpImage *gimage;
GimpLayer *layer;
GtkWidget *widget;
GimpDisplay *gdisp;
GtkWidget *dialog;
GimpUnit unit;
return_if_no_layer (gimage, layer, data);
return_if_no_widget (widget, data);
layers_scale_layer_query (action_data_get_display (data),
gimage, layer, widget);
gdisp = action_data_get_display (data);
unit = gdisp ? GIMP_DISPLAY_SHELL (gdisp->shell)->unit : GIMP_UNIT_PIXEL;
dialog = scale_dialog_new (GIMP_VIEWABLE (layer),
_("Scale Layer"), "gimp-layer-scale",
widget,
gimp_standard_help_func, GIMP_HELP_LAYER_SCALE,
unit, gimage->gimp->config->interpolation_type,
layers_scale_layer_callback,
gdisp);
gtk_widget_show (dialog);
}
void
@ -487,13 +583,71 @@ void
layers_mask_add_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpLayer *layer;
GtkWidget *widget;
AddMaskOptions *options;
GimpImage *gimage;
GimpLayer *layer;
GtkWidget *widget;
GtkWidget *vbox;
GtkWidget *frame;
GtkWidget *button;
return_if_no_layer (gimage, layer, data);
return_if_no_widget (widget, data);
layers_add_mask_query (layer, widget);
options = g_new0 (AddMaskOptions, 1);
options->layer = layer;
options->add_mask_type = GIMP_ADD_WHITE_MASK;
options->invert = FALSE;
options->dialog =
gimp_viewable_dialog_new (GIMP_VIEWABLE (layer),
_("Add Layer Mask"), "gimp-layer-add-mask",
GIMP_STOCK_LAYER_MASK,
_("Add a Mask to the Layer"),
widget,
gimp_standard_help_func,
GIMP_HELP_LAYER_MASK_ADD,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
g_signal_connect (options->dialog, "response",
G_CALLBACK (layers_add_mask_response),
options);
g_object_weak_ref (G_OBJECT (options->dialog),
(GWeakNotify) g_free, options);
vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->dialog)->vbox),
vbox);
gtk_widget_show (vbox);
frame =
gimp_enum_radio_frame_new (GIMP_TYPE_ADD_MASK_TYPE,
gtk_label_new (_("Initialize Layer Mask to:")),
G_CALLBACK (gimp_radio_button_update),
&options->add_mask_type,
&button);
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button),
options->add_mask_type);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
button = gtk_check_button_new_with_mnemonic (_("In_vert Mask"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), options->invert);
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
g_signal_connect (button, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&options->invert);
gtk_widget_show (options->dialog);
}
void
@ -727,79 +881,12 @@ layers_preserve_trans_cmd_callback (GtkAction *action,
}
/********************************/
/* The new layer query dialog */
/********************************/
typedef struct _NewLayerOptions NewLayerOptions;
struct _NewLayerOptions
{
GtkWidget *query_box;
GtkWidget *name_entry;
GtkWidget *size_se;
GimpFillType fill_type;
gint xsize;
gint ysize;
GimpContext *context;
GimpImage *gimage;
};
/* private functions */
static void
layers_new_layer_response (GtkWidget *widget,
gint response_id,
NewLayerOptions *options)
{
if (response_id == GTK_RESPONSE_OK)
{
GimpLayer *layer;
if (layer_name)
g_free (layer_name);
layer_name =
g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
options->xsize =
RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (options->size_se),
0));
options->ysize =
RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (options->size_se),
1));
fill_type = options->fill_type;
layer = gimp_layer_new (options->gimage,
options->xsize,
options->ysize,
gimp_image_base_type_with_alpha (options->gimage),
layer_name,
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
if (layer)
{
gimp_drawable_fill_by_type (GIMP_DRAWABLE (layer),
options->context,
fill_type);
gimp_image_add_layer (options->gimage, layer, -1);
gimp_image_flush (options->gimage);
}
else
{
g_message ("new_layer_query_response: "
"could not allocate new layer");
}
}
gtk_widget_destroy (options->query_box);
}
static void
layers_new_layer_query (GimpImage *gimage,
GimpContext *context,
GtkWidget *parent)
layers_new_layer_dialog (GimpImage *gimage,
GimpContext *context,
GtkWidget *parent)
{
NewLayerOptions *options;
GtkWidget *vbox;
@ -816,7 +903,7 @@ layers_new_layer_query (GimpImage *gimage,
options->gimage = gimage;
options->context = context;
options->query_box =
options->dialog =
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
_("New Layer"), "gimp-layer-new",
GIMP_STOCK_LAYER,
@ -830,17 +917,17 @@ layers_new_layer_query (GimpImage *gimage,
NULL);
g_signal_connect (options->query_box, "response",
g_signal_connect (options->dialog, "response",
G_CALLBACK (layers_new_layer_response),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
g_object_weak_ref (G_OBJECT (options->dialog),
(GWeakNotify) g_free,
options);
vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->dialog)->vbox),
vbox);
gtk_widget_show (vbox);
@ -931,55 +1018,56 @@ layers_new_layer_query (GimpImage *gimage,
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
gtk_widget_show (options->query_box);
gtk_widget_show (options->dialog);
}
/**************************************/
/* The edit layer attributes dialog */
/**************************************/
typedef struct _EditLayerOptions EditLayerOptions;
struct _EditLayerOptions
{
GtkWidget *query_box;
GtkWidget *name_entry;
GtkWidget *toggle;
GimpLayer *layer;
GimpImage *gimage;
};
static void
layers_edit_layer_response (GtkWidget *widget,
gint response_id,
EditLayerOptions *options)
layers_new_layer_response (GtkWidget *widget,
gint response_id,
NewLayerOptions *options)
{
if (response_id == GTK_RESPONSE_OK)
{
GimpLayer *layer = options->layer;
const gchar *new_name;
GimpLayer *layer;
new_name = gtk_entry_get_text (GTK_ENTRY (options->name_entry));
if (layer_name)
g_free (layer_name);
layer_name =
g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (layer))))
options->xsize =
RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (options->size_se),
0));
options->ysize =
RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (options->size_se),
1));
fill_type = options->fill_type;
layer = gimp_layer_new (options->gimage,
options->xsize,
options->ysize,
gimp_image_base_type_with_alpha (options->gimage),
layer_name,
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
if (layer)
{
gimp_item_rename (GIMP_ITEM (layer), new_name);
gimp_drawable_fill_by_type (GIMP_DRAWABLE (layer),
options->context,
fill_type);
gimp_image_add_layer (options->gimage, layer, -1);
gimp_image_flush (options->gimage);
}
if (options->toggle &&
gimp_drawable_is_text_layer (GIMP_DRAWABLE (layer)))
else
{
g_object_set (layer,
"auto-rename",
GTK_TOGGLE_BUTTON (options->toggle)->active,
NULL);
g_message ("new_layer_query_response: "
"could not allocate new layer");
}
}
gtk_widget_destroy (options->query_box);
gtk_widget_destroy (options->dialog);
}
static void
@ -1004,9 +1092,9 @@ layers_edit_layer_toggle_rename (GtkWidget *widget,
}
static void
layers_edit_layer_query (GimpLayer *layer,
GimpContext *context,
GtkWidget *parent)
layers_edit_layer_dialog (GimpLayer *layer,
GimpContext *context,
GtkWidget *parent)
{
EditLayerOptions *options;
GtkWidget *vbox;
@ -1020,7 +1108,7 @@ layers_edit_layer_query (GimpLayer *layer,
options->layer = layer;
options->gimage = gimp_item_get_image (GIMP_ITEM (layer));
options->query_box =
options->dialog =
gimp_viewable_dialog_new (GIMP_VIEWABLE (layer),
_("Layer Attributes"), "gimp-layer-edit",
GIMP_STOCK_EDIT,
@ -1034,17 +1122,17 @@ layers_edit_layer_query (GimpLayer *layer,
NULL);
g_signal_connect (options->query_box, "response",
g_signal_connect (options->dialog, "response",
G_CALLBACK (layers_edit_layer_response),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
g_object_weak_ref (G_OBJECT (options->dialog),
(GWeakNotify) g_free,
options);
vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->dialog)->vbox),
vbox);
gtk_widget_show (vbox);
@ -1080,23 +1168,39 @@ layers_edit_layer_query (GimpLayer *layer,
options);
}
gtk_widget_show (options->query_box);
gtk_widget_show (options->dialog);
}
/*******************************/
/* The add mask query dialog */
/*******************************/
typedef struct _AddMaskOptions AddMaskOptions;
struct _AddMaskOptions
static void
layers_edit_layer_response (GtkWidget *widget,
gint response_id,
EditLayerOptions *options)
{
GtkWidget *query_box;
GimpLayer *layer;
GimpAddMaskType add_mask_type;
gboolean invert;
};
if (response_id == GTK_RESPONSE_OK)
{
GimpLayer *layer = options->layer;
const gchar *new_name;
new_name = gtk_entry_get_text (GTK_ENTRY (options->name_entry));
if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (layer))))
{
gimp_item_rename (GIMP_ITEM (layer), new_name);
gimp_image_flush (options->gimage);
}
if (options->toggle &&
gimp_drawable_is_text_layer (GIMP_DRAWABLE (layer)))
{
g_object_set (layer,
"auto-rename",
GTK_TOGGLE_BUTTON (options->toggle)->active,
NULL);
}
}
gtk_widget_destroy (options->dialog);
}
static void
layers_add_mask_response (GtkWidget *widget,
@ -1127,84 +1231,9 @@ layers_add_mask_response (GtkWidget *widget,
}
}
gtk_widget_destroy (options->query_box);
gtk_widget_destroy (options->dialog);
}
static void
layers_add_mask_query (GimpLayer *layer,
GtkWidget *parent)
{
AddMaskOptions *options;
GtkWidget *vbox;
GtkWidget *frame;
GtkWidget *button;
GimpImage *gimage;
/* The new options structure */
options = g_new (AddMaskOptions, 1);
options->layer = layer;
options->add_mask_type = GIMP_ADD_WHITE_MASK;
options->invert = FALSE;
gimage = gimp_item_get_image (GIMP_ITEM (layer));
/* The dialog */
options->query_box =
gimp_viewable_dialog_new (GIMP_VIEWABLE (layer),
_("Add Layer Mask"), "gimp-layer-add-mask",
GIMP_STOCK_LAYER_MASK,
_("Add a Mask to the Layer"),
parent,
gimp_standard_help_func,
GIMP_HELP_LAYER_MASK_ADD,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
g_signal_connect (options->query_box, "response",
G_CALLBACK (layers_add_mask_response),
options);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free, options);
vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
vbox);
gtk_widget_show (vbox);
frame =
gimp_enum_radio_frame_new (GIMP_TYPE_ADD_MASK_TYPE,
gtk_label_new (_("Initialize Layer Mask to:")),
G_CALLBACK (gimp_radio_button_update),
&options->add_mask_type,
&button);
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button),
options->add_mask_type);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
button = gtk_check_button_new_with_mnemonic (_("In_vert Mask"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), options->invert);
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
g_signal_connect (button, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&options->invert);
gtk_widget_show (options->query_box);
}
/****************************/
/* The scale layer dialog */
/****************************/
static void
layers_scale_layer_callback (GtkWidget *dialog,
GimpViewable *viewable,
@ -1257,42 +1286,6 @@ layers_scale_layer_callback (GtkWidget *dialog,
}
}
static void
layers_scale_layer_query (GimpDisplay *gdisp,
GimpImage *gimage,
GimpLayer *layer,
GtkWidget *parent)
{
GtkWidget *dialog;
GimpUnit unit;
unit = gdisp ? GIMP_DISPLAY_SHELL (gdisp->shell)->unit : GIMP_UNIT_PIXEL;
dialog = scale_dialog_new (GIMP_VIEWABLE (layer),
_("Scale Layer"), "gimp-layer-scale",
parent,
gimp_standard_help_func, GIMP_HELP_LAYER_SCALE,
unit, gimage->gimp->config->interpolation_type,
layers_scale_layer_callback,
gdisp);
gtk_widget_show (dialog);
}
/*****************************/
/* The resize layer dialog */
/*****************************/
typedef struct _ResizeLayerOptions ResizeLayerOptions;
struct _ResizeLayerOptions
{
GimpLayer *layer;
GimpContext *context;
ResizeDialog *dialog;
};
static void
layers_resize_layer_callback (GtkWidget *widget,
gpointer data)
@ -1322,40 +1315,6 @@ layers_resize_layer_callback (GtkWidget *widget,
}
}
static void
layers_resize_layer_query (GimpDisplay *gdisp,
GimpImage *gimage,
GimpLayer *layer,
GimpContext *context,
GtkWidget *parent)
{
ResizeLayerOptions *options;
options = g_new0 (ResizeLayerOptions, 1);
options->context = context;
options->layer = layer;
options->dialog =
resize_dialog_new (GIMP_VIEWABLE (layer), parent,
RESIZE_DIALOG,
gimp_item_width (GIMP_ITEM (layer)),
gimp_item_height (GIMP_ITEM (layer)),
gimage->xresolution,
gimage->yresolution,
(gdisp ?
GIMP_DISPLAY_SHELL (gdisp->shell)->unit :
GIMP_UNIT_PIXEL),
G_CALLBACK (layers_resize_layer_callback),
options);
g_object_weak_ref (G_OBJECT (options->dialog->shell),
(GWeakNotify) g_free,
options);
gtk_widget_show (options->dialog->shell);
}
static gint
layers_mode_index (GimpLayerModeEffects layer_mode)
{

View File

@ -39,8 +39,8 @@
static GimpActionEntry palette_editor_actions[] =
{
{ "palette-editor-popup", GIMP_STOCK_PALETTE, N_("Palette Editor Menu"),
NULL, NULL, NULL,
{ "palette-editor-popup", GIMP_STOCK_PALETTE,
N_("Palette Editor Menu"), NULL, NULL, NULL,
GIMP_HELP_PALETTE_EDITOR_DIALOG },
{ "palette-editor-edit-color", GIMP_STOCK_EDIT,
@ -92,17 +92,14 @@ void
palette_editor_actions_update (GimpActionGroup *group,
gpointer user_data)
{
GimpPaletteEditor *editor;
GimpDataEditor *data_editor;
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (user_data);
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (user_data);
GimpContext *context;
GimpData *data;
gboolean editable = FALSE;
gboolean editable = FALSE;
GimpRGB fg;
GimpRGB bg;
editor = GIMP_PALETTE_EDITOR (user_data);
data_editor = GIMP_DATA_EDITOR (user_data);
context = gimp_get_user_context (group->gimp);
data = data_editor->data;

View File

@ -40,7 +40,8 @@
static GimpActionEntry palettes_actions[] =
{
{ "palettes-popup", GIMP_STOCK_PALETTE, N_("Palettes Menu"), NULL, NULL, NULL,
{ "palettes-popup", GIMP_STOCK_PALETTE,
N_("Palettes Menu"), NULL, NULL, NULL,
GIMP_HELP_PALETTE_DIALOG },
{ "palettes-new", GTK_STOCK_NEW,
@ -107,12 +108,10 @@ void
palettes_actions_update (GimpActionGroup *group,
gpointer user_data)
{
GimpContext *context;
GimpContext *context = action_data_get_context (user_data);
GimpPalette *palette = NULL;
GimpData *data = NULL;
context = action_data_get_context (user_data);
if (context)
{
palette = gimp_context_get_palette (context);

View File

@ -43,10 +43,9 @@
/* local function prototypes */
static void palettes_merge_palettes_query (GimpContainerEditor *editor);
static void palettes_merge_palettes_callback (GtkWidget *widget,
const gchar *palette_name,
gpointer data);
static void palettes_merge_palettes_callback (GtkWidget *widget,
const gchar *palette_name,
gpointer data);
/* public functionss */
@ -68,17 +67,7 @@ palettes_merge_palettes_cmd_callback (GtkAction *action,
gpointer data)
{
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
palettes_merge_palettes_query (editor);
}
/* private functions */
static void
palettes_merge_palettes_query (GimpContainerEditor *editor)
{
GtkWidget *qbox;
GtkWidget *qbox;
qbox = gimp_query_string_box (_("Merge Palette"),
GTK_WIDGET (editor),
@ -92,6 +81,9 @@ palettes_merge_palettes_query (GimpContainerEditor *editor)
gtk_widget_show (qbox);
}
/* private functions */
static void
palettes_merge_palettes_callback (GtkWidget *widget,
const gchar *palette_name,

View File

@ -39,7 +39,8 @@
static GimpActionEntry patterns_actions[] =
{
{ "patterns-popup", GIMP_STOCK_PATTERN, N_("Patterns Menu"), NULL, NULL, NULL,
{ "patterns-popup", GIMP_STOCK_PATTERN,
N_("Patterns Menu"), NULL, NULL, NULL,
GIMP_HELP_PATTERN_DIALOG },
{ "patterns-new", GTK_STOCK_NEW,
@ -94,12 +95,10 @@ void
patterns_actions_update (GimpActionGroup *group,
gpointer user_data)
{
GimpContext *context;
GimpContext *context = action_data_get_context (user_data);
GimpPattern *pattern = NULL;
GimpData *data = NULL;
context = action_data_get_context (user_data);
if (context)
{
pattern = gimp_context_get_pattern (context);

View File

@ -143,12 +143,10 @@ void
plug_in_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *gimage;
GimpImage *gimage = action_data_get_image (data);
GimpImageType type = -1;
GSList *list;
gimage = action_data_get_image (data);
if (gimage)
{
GimpDrawable *drawable = gimp_image_active_drawable (gimage);

View File

@ -38,7 +38,8 @@
static GimpActionEntry qmask_actions[] =
{
{ "qmask-popup", NULL, N_("Quick Mask Menu"), NULL, NULL, NULL,
{ "qmask-popup", NULL,
N_("Quick Mask Menu"), NULL, NULL, NULL,
GIMP_HELP_QMASK },
{ "qmask-configure", NULL,
@ -80,6 +81,8 @@ static GimpRadioActionEntry qmask_invert_actions[] =
void
qmask_actions_setup (GimpActionGroup *group)
{
GtkAction *action;
gimp_action_group_add_actions (group,
qmask_actions,
G_N_ELEMENTS (qmask_actions));
@ -93,32 +96,51 @@ qmask_actions_setup (GimpActionGroup *group)
G_N_ELEMENTS (qmask_invert_actions),
FALSE,
G_CALLBACK (qmask_invert_cmd_callback));
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
"qmask-active");
gtk_action_set_accel_path (action, "<Actions>/qmask/qmask-toggle");
#ifdef __GNUC__
#warning FIXME: remove accel_path hack
#endif
g_object_set_data (G_OBJECT (action), "gimp-accel-path",
"<Actions>/qmask/qmask-toggle");
}
void
qmask_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *gimage;
gimage = action_data_get_image (data);
GimpImage *gimage = action_data_get_image (data);
#define SET_SENSITIVE(action,sensitive) \
gimp_action_group_set_action_sensitive (group, action, (sensitive) != 0)
#define SET_ACTIVE(action,active) \
gimp_action_group_set_action_active (group, action, (active))
gimp_action_group_set_action_active (group, action, (active) != 0)
#define SET_COLOR(action,color) \
gimp_action_group_set_action_color (group, action, (color), FALSE)
SET_SENSITIVE ("qmask-active", gimage);
SET_SENSITIVE ("qmask-toggle", gimage);
SET_ACTIVE ("qmask-active", gimage && gimage->qmask_state);
SET_ACTIVE ("qmask-toggle", gimage && gimage->qmask_state);
SET_SENSITIVE ("qmask-invert-on", gimage);
SET_SENSITIVE ("qmask-invert-off", gimage);
if (gimage && gimage->qmask_inverted)
SET_ACTIVE ("qmask-invert-on", TRUE);
else
SET_ACTIVE ("qmask-invert-off", TRUE);
SET_SENSITIVE ("qmask-configure", gimage);
if (gimage)
SET_COLOR ("qmask-configure", &gimage->qmask_color);
#undef SET_SENSITIVE
#undef SET_ACTIVE
#undef SET_COLOR
}

View File

@ -38,7 +38,8 @@
static GimpActionEntry qmask_actions[] =
{
{ "qmask-popup", NULL, N_("Quick Mask Menu"), NULL, NULL, NULL,
{ "qmask-popup", NULL,
N_("Quick Mask Menu"), NULL, NULL, NULL,
GIMP_HELP_QMASK },
{ "qmask-configure", NULL,
@ -80,6 +81,8 @@ static GimpRadioActionEntry qmask_invert_actions[] =
void
qmask_actions_setup (GimpActionGroup *group)
{
GtkAction *action;
gimp_action_group_add_actions (group,
qmask_actions,
G_N_ELEMENTS (qmask_actions));
@ -93,32 +96,51 @@ qmask_actions_setup (GimpActionGroup *group)
G_N_ELEMENTS (qmask_invert_actions),
FALSE,
G_CALLBACK (qmask_invert_cmd_callback));
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
"qmask-active");
gtk_action_set_accel_path (action, "<Actions>/qmask/qmask-toggle");
#ifdef __GNUC__
#warning FIXME: remove accel_path hack
#endif
g_object_set_data (G_OBJECT (action), "gimp-accel-path",
"<Actions>/qmask/qmask-toggle");
}
void
qmask_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *gimage;
gimage = action_data_get_image (data);
GimpImage *gimage = action_data_get_image (data);
#define SET_SENSITIVE(action,sensitive) \
gimp_action_group_set_action_sensitive (group, action, (sensitive) != 0)
#define SET_ACTIVE(action,active) \
gimp_action_group_set_action_active (group, action, (active))
gimp_action_group_set_action_active (group, action, (active) != 0)
#define SET_COLOR(action,color) \
gimp_action_group_set_action_color (group, action, (color), FALSE)
SET_SENSITIVE ("qmask-active", gimage);
SET_SENSITIVE ("qmask-toggle", gimage);
SET_ACTIVE ("qmask-active", gimage && gimage->qmask_state);
SET_ACTIVE ("qmask-toggle", gimage && gimage->qmask_state);
SET_SENSITIVE ("qmask-invert-on", gimage);
SET_SENSITIVE ("qmask-invert-off", gimage);
if (gimage && gimage->qmask_inverted)
SET_ACTIVE ("qmask-invert-on", TRUE);
else
SET_ACTIVE ("qmask-invert-off", TRUE);
SET_SENSITIVE ("qmask-configure", gimage);
if (gimage)
SET_COLOR ("qmask-configure", &gimage->qmask_color);
#undef SET_SENSITIVE
#undef SET_ACTIVE
#undef SET_COLOR
}

View File

@ -120,13 +120,11 @@ void
select_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *gimage;
GimpImage *gimage = action_data_get_image (data);
GimpDrawable *drawable = NULL;
gboolean fs = FALSE;
gboolean sel = FALSE;
gimage = action_data_get_image (data);
if (gimage)
{
drawable = gimp_image_active_drawable (gimage);

View File

@ -25,10 +25,12 @@
#include "actions-types.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpchannel-select.h"
#include "core/gimpimage.h"
#include "core/gimpselection.h"
#include "core/gimpstrokeoptions.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpdialogfactory.h"
@ -47,22 +49,22 @@
/* local function prototypes */
static void gimp_image_mask_feather_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data);
static void gimp_image_mask_border_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data);
static void gimp_image_mask_grow_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data);
static void gimp_image_mask_shrink_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data);
static void select_feather_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data);
static void select_border_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data);
static void select_grow_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data);
static void select_shrink_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data);
/* local variables */
@ -126,22 +128,22 @@ select_feather_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GtkWidget *qbox;
GtkWidget *dialog;
return_if_no_display (gdisp, data);
qbox = gimp_query_size_box (_("Feather Selection"),
gdisp->shell,
gimp_standard_help_func,
GIMP_HELP_SELECTION_FEATHER,
_("Feather selection by"),
selection_feather_radius, 0, 32767, 3,
GIMP_DISPLAY_SHELL (gdisp->shell)->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
FALSE,
G_OBJECT (gdisp->gimage), "disconnect",
gimp_image_mask_feather_callback, gdisp->gimage);
gtk_widget_show (qbox);
dialog = gimp_query_size_box (_("Feather Selection"),
gdisp->shell,
gimp_standard_help_func,
GIMP_HELP_SELECTION_FEATHER,
_("Feather selection by"),
selection_feather_radius, 0, 32767, 3,
GIMP_DISPLAY_SHELL (gdisp->shell)->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
FALSE,
G_OBJECT (gdisp->gimage), "disconnect",
select_feather_callback, gdisp->gimage);
gtk_widget_show (dialog);
}
void
@ -160,35 +162,34 @@ select_shrink_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GtkWidget *shrink_dialog;
GtkWidget *dialog;
GtkWidget *edge_lock;
return_if_no_display (gdisp, data);
shrink_dialog =
gimp_query_size_box (_("Shrink Selection"),
gdisp->shell,
gimp_standard_help_func,
GIMP_HELP_SELECTION_SHRINK,
_("Shrink selection by"),
selection_shrink_pixels, 1, 32767, 0,
GIMP_DISPLAY_SHELL (gdisp->shell)->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
FALSE,
G_OBJECT (gdisp->gimage), "disconnect",
gimp_image_mask_shrink_callback, gdisp->gimage);
dialog = gimp_query_size_box (_("Shrink Selection"),
gdisp->shell,
gimp_standard_help_func,
GIMP_HELP_SELECTION_SHRINK,
_("Shrink selection by"),
selection_shrink_pixels, 1, 32767, 0,
GIMP_DISPLAY_SHELL (gdisp->shell)->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
FALSE,
G_OBJECT (gdisp->gimage), "disconnect",
select_shrink_callback, gdisp->gimage);
edge_lock = gtk_check_button_new_with_label (_("Shrink from image border"));
gtk_box_pack_start (GTK_BOX (GIMP_QUERY_BOX_VBOX (shrink_dialog)), edge_lock,
gtk_box_pack_start (GTK_BOX (GIMP_QUERY_BOX_VBOX (dialog)), edge_lock,
FALSE, FALSE, 0);
g_object_set_data (G_OBJECT (shrink_dialog), "edge_lock_toggle", edge_lock);
g_object_set_data (G_OBJECT (dialog), "edge_lock_toggle", edge_lock);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (edge_lock),
! selection_shrink_edge_lock);
gtk_widget_show (edge_lock);
gtk_widget_show (shrink_dialog);
gtk_widget_show (dialog);
}
void
@ -196,22 +197,22 @@ select_grow_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GtkWidget *qbox;
GtkWidget *dialog;
return_if_no_display (gdisp, data);
qbox = gimp_query_size_box (_("Grow Selection"),
gdisp->shell,
gimp_standard_help_func,
GIMP_HELP_SELECTION_GROW,
_("Grow selection by"),
selection_grow_pixels, 1, 32767, 0,
GIMP_DISPLAY_SHELL (gdisp->shell)->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
FALSE,
G_OBJECT (gdisp->gimage), "disconnect",
gimp_image_mask_grow_callback, gdisp->gimage);
gtk_widget_show (qbox);
dialog = gimp_query_size_box (_("Grow Selection"),
gdisp->shell,
gimp_standard_help_func,
GIMP_HELP_SELECTION_GROW,
_("Grow selection by"),
selection_grow_pixels, 1, 32767, 0,
GIMP_DISPLAY_SHELL (gdisp->shell)->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
FALSE,
G_OBJECT (gdisp->gimage), "disconnect",
select_grow_callback, gdisp->gimage);
gtk_widget_show (dialog);
}
void
@ -219,22 +220,22 @@ select_border_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GtkWidget *qbox;
GtkWidget *dialog;
return_if_no_display (gdisp, data);
qbox = gimp_query_size_box (_("Border Selection"),
gdisp->shell,
gimp_standard_help_func,
GIMP_HELP_SELECTION_BORDER,
_("Border selection by"),
selection_border_radius, 1, 32767, 0,
GIMP_DISPLAY_SHELL (gdisp->shell)->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
FALSE,
G_OBJECT (gdisp->gimage), "disconnect",
gimp_image_mask_border_callback, gdisp->gimage);
gtk_widget_show (qbox);
dialog = gimp_query_size_box (_("Border Selection"),
gdisp->shell,
gimp_standard_help_func,
GIMP_HELP_SELECTION_BORDER,
_("Border selection by"),
selection_border_radius, 1, 32767, 0,
GIMP_DISPLAY_SHELL (gdisp->shell)->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
FALSE,
G_OBJECT (gdisp->gimage), "disconnect",
select_border_callback, gdisp->gimage);
gtk_widget_show (dialog);
}
void
@ -280,14 +281,70 @@ select_stroke_cmd_callback (GtkAction *action,
gtk_widget_show (dialog);
}
void
select_stroke_last_vals_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpDrawable *drawable;
GimpContext *context;
GimpObject *options;
GimpItem *item;
gboolean libart_stroking;
return_if_no_image (image, data);
drawable = gimp_image_active_drawable (image);
if (! drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
return;
}
context = gimp_get_user_context (image->gimp);
options = g_object_get_data (G_OBJECT (context), "saved-stroke-options");
if (options)
{
g_object_ref (options);
libart_stroking = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (options),
"libart-stroking"));
}
else
{
options = g_object_new (GIMP_TYPE_STROKE_OPTIONS,
"gimp", image->gimp,
NULL);
libart_stroking = TRUE;
}
item = GIMP_ITEM (gimp_image_get_mask (image));
if (libart_stroking)
{
gimp_item_stroke (item, drawable, context, options, FALSE);
}
else
{
gimp_item_stroke (item, drawable, context,
g_object_get_data (G_OBJECT (options),
"gimp-paint-info"), FALSE);
}
gimp_image_flush (image);
g_object_unref (options);
}
/* private functions */
static void
gimp_image_mask_feather_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data)
select_feather_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data)
{
GimpImage *gimage = GIMP_IMAGE (data);
gdouble radius_x;
@ -315,10 +372,10 @@ gimp_image_mask_feather_callback (GtkWidget *widget,
}
static void
gimp_image_mask_border_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data)
select_border_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data)
{
GimpImage *gimage = GIMP_IMAGE (data);
gdouble radius_x;
@ -346,10 +403,10 @@ gimp_image_mask_border_callback (GtkWidget *widget,
}
static void
gimp_image_mask_grow_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data)
select_grow_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data)
{
GimpImage *gimage = GIMP_IMAGE (data);
gdouble radius_x;
@ -377,10 +434,10 @@ gimp_image_mask_grow_callback (GtkWidget *widget,
}
static void
gimp_image_mask_shrink_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data)
select_shrink_callback (GtkWidget *widget,
gdouble size,
GimpUnit unit,
gpointer data)
{
GimpImage *gimage = GIMP_IMAGE (data);
gint radius_x;

View File

@ -38,8 +38,8 @@
static GimpActionEntry templates_actions[] =
{
{ "templates-popup", GIMP_STOCK_TEMPLATE, N_("Templates Menu"),
NULL, NULL, NULL,
{ "templates-popup", GIMP_STOCK_TEMPLATE,
N_("Templates Menu"), NULL, NULL, NULL,
GIMP_HELP_TEMPLATE_DIALOG },
{ "templates-create-image", GIMP_STOCK_IMAGE,
@ -86,11 +86,9 @@ void
templates_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpContext *context;
GimpContext *context = action_data_get_context (data);
GimpTemplate *template = NULL;
context = action_data_get_context (data);
if (context)
template = gimp_context_get_template (context);
@ -98,7 +96,7 @@ templates_actions_update (GimpActionGroup *group,
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
SET_SENSITIVE ("templates-create-image", template);
SET_SENSITIVE ("templates-new", TRUE);
SET_SENSITIVE ("templates-new", context);
SET_SENSITIVE ("templates-duplicate", template);
SET_SENSITIVE ("templates-edit", template);
SET_SENSITIVE ("templates-delete", template);

View File

@ -52,18 +52,25 @@ static void tool_options_actions_update_presets (GimpActionGroup *group,
static GimpActionEntry tool_options_actions[] =
{
{ "tool-options-popup", GIMP_STOCK_TOOL_OPTIONS, N_("Tool Options Menu"),
NULL, NULL, NULL,
{ "tool-options-popup", GIMP_STOCK_TOOL_OPTIONS,
N_("Tool Options Menu"), NULL, NULL, NULL,
GIMP_HELP_TOOL_OPTIONS_DIALOG },
{ "tool-options-save-menu", GTK_STOCK_SAVE,
N_("_Save Options to"), "", NULL },
N_("_Save Options to"), "", NULL, NULL,
GIMP_HELP_TOOL_OPTIONS_SAVE },
{ "tool-options-restore-menu", GTK_STOCK_REVERT_TO_SAVED,
N_("_Restore Options from"), "", NULL },
N_("_Restore Options from"), "", NULL, NULL,
GIMP_HELP_TOOL_OPTIONS_RESTORE },
{ "tool-options-rename-menu", GIMP_STOCK_EDIT,
N_("Re_name Saved Options"), NULL, NULL },
N_("Re_name Saved Options"), NULL, NULL, NULL,
GIMP_HELP_TOOL_OPTIONS_RENAME },
{ "tool-options-delete-menu", GTK_STOCK_DELETE,
N_("_Delete Saved Options"), "", NULL },
N_("_Delete Saved Options"), "", NULL, NULL,
GIMP_HELP_TOOL_OPTIONS_DELETE },
{ "tool-options-save-new", GTK_STOCK_NEW,
N_("_New Entry..."), "", NULL,
@ -107,11 +114,8 @@ void
tool_options_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpContext *context;
GimpToolInfo *tool_info;
context = gimp_get_user_context (group->gimp);
tool_info = gimp_context_get_tool (context);
GimpContext *context = gimp_get_user_context (group->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
SET_VISIBLE ("tool-options-save-menu", tool_info->options_presets);
SET_VISIBLE ("tool-options-restore-menu", tool_info->options_presets);

View File

@ -43,7 +43,8 @@
static GimpActionEntry tools_actions[] =
{
{ "tools-popup", GIMP_STOCK_TOOLS, N_("Tools Menu"), NULL, NULL, NULL,
{ "tools-popup", GIMP_STOCK_TOOLS,
N_("Tools Menu"), NULL, NULL, NULL,
GIMP_HELP_TOOLS_DIALOG },
{ "tools-menu", NULL, N_("_Tools") },
@ -62,7 +63,7 @@ static GimpActionEntry tools_actions[] =
static GimpToggleActionEntry tools_toggle_actions[] =
{
{ "tools-visibility", GIMP_STOCK_VISIBLE,
N_("Show in Toolbox"), NULL, NULL,
N_("_Show in Toolbox"), NULL, NULL,
G_CALLBACK (tools_toggle_visibility_cmd_callback),
TRUE,
NULL /* FIXME */ }
@ -164,13 +165,8 @@ void
tools_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpContext *context;
GimpToolInfo *tool_info = NULL;
context = gimp_get_user_context (group->gimp);
if (context)
tool_info = gimp_context_get_tool (context);
GimpContext *context = gimp_get_user_context (group->gimp);
GimpToolInfo *tool_info = gimp_context_get_tool (context);
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)

View File

@ -40,7 +40,8 @@
static GimpActionEntry vectors_actions[] =
{
{ "vectors-popup", GIMP_STOCK_PATHS, N_("Paths Menu"), NULL, NULL, NULL,
{ "vectors-popup", GIMP_STOCK_PATHS,
N_("Paths Menu"), NULL, NULL, NULL,
GIMP_HELP_PATH_DIALOG },
{ "vectors-path-tool", GIMP_STOCK_TOOL_PATH,
@ -228,7 +229,7 @@ void
vectors_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpImage *gimage;
GimpImage *gimage = action_data_get_image (data);
GimpVectors *vectors = NULL;
gint n_vectors = 0;
gboolean mask_empty = TRUE;
@ -238,37 +239,28 @@ vectors_actions_update (GimpActionGroup *group,
GList *next = NULL;
GList *prev = NULL;
gimage = action_data_get_image (data);
if (gimage)
{
GList *list;
n_vectors = gimp_container_num_children (gimage->vectors);
mask_empty = gimp_channel_is_empty (gimp_image_get_mask (gimage));
global_buf = FALSE;
vectors = gimp_image_get_active_vectors (gimage);
n_vectors = gimp_container_num_children (gimage->vectors);
mask_empty = gimp_channel_is_empty (gimp_image_get_mask (gimage));
global_buf = FALSE;
if (vectors)
{
GimpItem *item = GIMP_ITEM (vectors);
GList *list;
visible = gimp_item_get_visible (item);
linked = gimp_item_get_linked (item);
}
for (list = GIMP_LIST (gimage->vectors)->list;
list;
list = g_list_next (list))
{
if (vectors == (GimpVectors *) list->data)
list = g_list_find (GIMP_LIST (gimage->vectors)->list, vectors);
if (list)
{
prev = g_list_previous (list);
next = g_list_next (list);
break;
}
}
}

View File

@ -77,28 +77,21 @@ struct _VectorsOptions
/* local function prototypes */
static VectorsOptions * vectors_query_new (GimpImage *gimage,
GimpContext *context,
static VectorsOptions * vectors_options_new (GimpImage *gimage,
GimpVectors *vectors,
GtkWidget *parent);
static void vectors_new_vectors_query (GimpImage *gimage,
GimpContext *context,
GtkWidget *parent);
static void vectors_new_vectors_response (GtkWidget *widget,
gint response_id,
VectorsOptions *options);
static void vectors_edit_vectors_query (GimpVectors *vectors,
GimpContext *context,
GtkWidget *parent);
static void vectors_edit_vectors_response (GtkWidget *widget,
gint response_id,
VectorsOptions *options);
static void vectors_import_query (GimpImage *gimage,
static void vectors_import_dialog (GimpImage *gimage,
GtkWidget *parent);
static void vectors_import_response (GtkWidget *dialog,
gint response_id,
GimpImage *gimage);
static void vectors_export_query (GimpImage *gimage,
static void vectors_export_dialog (GimpImage *gimage,
GimpVectors *vectors,
GtkWidget *parent);
static void vectors_export_response (GtkWidget *dialog,
@ -147,25 +140,40 @@ void
vectors_edit_attributes_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpVectors *vectors;
GtkWidget *widget;
VectorsOptions *options;
GimpImage *gimage;
GimpVectors *vectors;
GtkWidget *widget;
return_if_no_vectors (gimage, vectors, data);
return_if_no_widget (widget, data);
vectors_edit_vectors_query (vectors, action_data_get_context (data), widget);
options = vectors_options_new (gimp_item_get_image (GIMP_ITEM (vectors)),
vectors, widget);
g_signal_connect (options->query_box, "response",
G_CALLBACK (vectors_edit_vectors_response),
options);
gtk_widget_show (options->query_box);
}
void
vectors_new_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GtkWidget *widget;
VectorsOptions *options;
GimpImage *gimage;
GtkWidget *widget;
return_if_no_image (gimage, data);
return_if_no_widget (widget, data);
vectors_new_vectors_query (gimage, action_data_get_context (data), widget);
options = vectors_options_new (gimage, NULL, widget);
g_signal_connect (options->query_box, "response",
G_CALLBACK (vectors_new_vectors_response),
options);
gtk_widget_show (options->query_box);
}
void
@ -396,7 +404,7 @@ vectors_import_cmd_callback (GtkAction *action,
return_if_no_image (gimage, data);
return_if_no_widget (widget, data);
vectors_import_query (gimage, widget);
vectors_import_dialog (gimage, widget);
}
void
@ -409,7 +417,7 @@ vectors_export_cmd_callback (GtkAction *action,
return_if_no_vectors (gimage, vectors, data);
return_if_no_widget (widget, data);
vectors_export_query (gimage, vectors, widget);
vectors_export_dialog (gimage, vectors, widget);
}
void
@ -470,10 +478,9 @@ vectors_linked_cmd_callback (GtkAction *action,
/* private functions */
static VectorsOptions *
vectors_query_new (GimpImage *gimage,
GimpContext *context,
GimpVectors *vectors,
GtkWidget *parent)
vectors_options_new (GimpImage *gimage,
GimpVectors *vectors,
GtkWidget *parent)
{
VectorsOptions *options;
GtkWidget *hbox;
@ -555,22 +562,6 @@ vectors_query_new (GimpImage *gimage,
return options;
}
static void
vectors_new_vectors_query (GimpImage *gimage,
GimpContext *context,
GtkWidget *parent)
{
VectorsOptions *options;
options = vectors_query_new (gimage, context, NULL, parent);
g_signal_connect (options->query_box, "response",
G_CALLBACK (vectors_new_vectors_response),
options);
gtk_widget_show (options->query_box);
}
static void
vectors_new_vectors_response (GtkWidget *widget,
gint response_id,
@ -596,22 +587,6 @@ vectors_new_vectors_response (GtkWidget *widget,
gtk_widget_destroy (options->query_box);
}
static void
vectors_edit_vectors_query (GimpVectors *vectors,
GimpContext *context,
GtkWidget *parent)
{
VectorsOptions *options;
options = vectors_query_new (gimp_item_get_image (GIMP_ITEM (vectors)),
context, vectors, parent);
g_signal_connect (options->query_box, "response",
G_CALLBACK (vectors_edit_vectors_response),
options);
gtk_widget_show (options->query_box);
}
static void
vectors_edit_vectors_response (GtkWidget *widget,
gint response_id,
@ -635,8 +610,8 @@ vectors_edit_vectors_response (GtkWidget *widget,
}
static void
vectors_import_query (GimpImage *gimage,
GtkWidget *parent)
vectors_import_dialog (GimpImage *gimage,
GtkWidget *parent)
{
GtkWidget *dialog;
GtkFileFilter *filter;
@ -671,7 +646,7 @@ vectors_import_query (GimpImage *gimage,
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("Scalable SVG image (*.svg)"));
gtk_file_filter_add_pattern (filter, "*.svg");
gtk_file_filter_add_pattern (filter, "*.[Ss][Vv][Gg]");
gtk_file_filter_add_mime_type (filter, "image/svg+xml");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
@ -711,9 +686,9 @@ vectors_import_response (GtkWidget *dialog,
}
static void
vectors_export_query (GimpImage *gimage,
GimpVectors *vectors,
GtkWidget *parent)
vectors_export_dialog (GimpImage *gimage,
GimpVectors *vectors,
GtkWidget *parent)
{
GtkWidget *dialog;

View File

@ -446,15 +446,13 @@ void
view_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpDisplay *gdisp = NULL;
GimpDisplay *gdisp = action_data_get_display (data);
GimpDisplayShell *shell = NULL;
GimpDisplayOptions *options = NULL;
GimpImage *gimage = NULL;
gboolean fullscreen = FALSE;
gint n_screens = 1;
gdisp = action_data_get_display (data);
if (gdisp)
{
shell = GIMP_DISPLAY_SHELL (gdisp->shell);

View File

@ -276,7 +276,7 @@ gimp_iscissors_tool_register (GimpToolRegisterCallback callback,
"gimp-iscissors-tool",
_("Scissors"),
_("Select shapes from image"),
N_("_Intelligent Scissors"),
N_("Intelligent _Scissors"),
"I",
NULL, GIMP_HELP_TOOL_ISCISSORS,
GIMP_STOCK_TOOL_ISCISSORS,

View File

@ -46,6 +46,8 @@
<menuitem action="context-opacity-opaque" />
<menuitem action="context-opacity-decrease" />
<menuitem action="context-opacity-increase" />
<menuitem action="context-opacity-decrease-skip" />
<menuitem action="context-opacity-increase-skip" />
</menu>
<menu action="context-paint-mode-menu" name="Paint Mode">
<menuitem action="context-paint-mode-first" />
@ -53,6 +55,12 @@
<menuitem action="context-paint-mode-previous" />
<menuitem action="context-paint-mode-next" />
</menu>
<menu action="context-tool-menu" name="Tool">
<menuitem action="context-tool-select-first" />
<menuitem action="context-tool-select-last" />
<menuitem action="context-tool-select-previous" />
<menuitem action="context-tool-select-next" />
</menu>
<separator />
<menu action="context-brush-menu" name="Brush">
<menuitem action="context-brush-select-first" />
@ -132,7 +140,7 @@
</menu>
</menu>
-->
-->
<menu action="edit-menu" name="Edit">
<placeholder name="Undo">
@ -392,7 +400,9 @@
<separator />
<menuitem action="drawable-offset" />
</menu>
<!--
<!-- Layer Properties
<menu action="layers-properties-menu" name="Properties">
<menuitem action="layers-edit-attributes" />
<menu action="layers-opacity-menu" name="Opacity">
@ -411,7 +421,9 @@
<menuitem action="drawable-linked" />
<menuitem action="layers-preserve-transparency" />
</menu>
-->
<separator />
<placeholder name="Resize">
<menuitem action="layers-resize" />