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

don't g_return_if_fail() if there is no active drawable, just silently

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

	* app/actions/file-commands.c (file_save_cmd_callback): don't
	g_return_if_fail() if there is no active drawable, just silently
	return.

	* app/actions/image-commands.c: remember the last merge_type of
	the "Merge Visible Layers" dialog.

	* app/actions/layers-commands.c: remeber the last values of the
	"Add Layer Mask" dialog.

	* app/actions/select-commands.c: renamed a bunch of static
	variables to be consistent with other variables used to remember
	dialog values.

	* app/actions/view-commands.c (view_fullscreen_cmd_callback): it's
	useless to update the "view-fullscreen" actions here because the
	"fullscreen" state of the shell changes asynchronously
parent a01c6883
2004-10-23 Michael Natterer <mitch@gimp.org>
* app/actions/file-commands.c (file_save_cmd_callback): don't
g_return_if_fail() if there is no active drawable, just silently
return.
* app/actions/image-commands.c: remember the last merge_type of
the "Merge Visible Layers" dialog.
* app/actions/layers-commands.c: remeber the last values of the
"Add Layer Mask" dialog.
* app/actions/select-commands.c: renamed a bunch of static
variables to be consistent with other variables used to remember
dialog values.
* app/actions/view-commands.c (view_fullscreen_cmd_callback): it's
useless to update the "view-fullscreen" actions here because the
"fullscreen" state of the shell changes asynchronously
2004-10-23 Michael Natterer <mitch@gimp.org>
* app/dialogs/image-merge-layers-dialog.c
......
......@@ -177,7 +177,8 @@ file_save_cmd_callback (GtkAction *action,
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
g_return_if_fail (gimp_image_active_drawable (gdisp->gimage));
if (! gimp_image_active_drawable (gdisp->gimage))
return;
/* Only save if the gimage has been modified */
if (gdisp->gimage->dirty ||
......
......@@ -96,6 +96,11 @@ static void image_merge_layers_response (GtkWidget *widget,
ImageMergeLayersDialog *dialog);
/* private variables */
static GimpMergeType image_merge_layers_type = GIMP_EXPAND_AS_NECESSARY;
/* public functions */
void
......@@ -366,7 +371,7 @@ image_merge_layers_cmd_callback (GtkAction *action,
dialog = image_merge_layers_dialog_new (gimage,
action_data_get_context (data),
widget,
GIMP_EXPAND_AS_NECESSARY);
image_merge_layers_type);
g_signal_connect (dialog->dialog, "response",
G_CALLBACK (image_merge_layers_response),
......@@ -634,9 +639,11 @@ image_merge_layers_response (GtkWidget *widget,
{
if (response_id == GTK_RESPONSE_OK)
{
image_merge_layers_type = dialog->merge_type;
gimp_image_merge_visible_layers (dialog->gimage,
dialog->context,
dialog->merge_type);
image_merge_layers_type);
gimp_image_flush (dialog->gimage);
}
......
......@@ -131,8 +131,10 @@ static gint layers_mode_index (GimpLayerModeEffects layer_mode);
/* private variables */
static GimpFillType fill_type = GIMP_TRANSPARENT_FILL;
static gchar *layer_name = NULL;
static GimpFillType layer_fill_type = GIMP_TRANSPARENT_FILL;
static gchar *layer_name = NULL;
static GimpAddMaskType layer_add_mask_type = GIMP_ADD_WHITE_MASK;
static gboolean layer_mask_invert = FALSE;
/* public functions */
......@@ -190,7 +192,7 @@ layers_edit_attributes_cmd_callback (GtkAction *action,
action_data_get_context (data),
layer, widget,
gimp_object_get_name (GIMP_OBJECT (layer)),
fill_type,
layer_fill_type,
_("Layer Attributes"),
"gimp-layer-edit",
GIMP_STOCK_EDIT,
......@@ -228,7 +230,7 @@ layers_new_cmd_callback (GtkAction *action,
dialog = layer_options_dialog_new (gimage, action_data_get_context (data),
NULL, widget,
layer_name ? layer_name : _("New Layer"),
fill_type,
layer_fill_type,
_("New Layer"),
"gimp-layer-new",
GIMP_STOCK_LAYER,
......@@ -295,7 +297,7 @@ layers_new_last_vals_cmd_callback (GtkAction *action,
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_layer),
action_data_get_context (data),
fill_type);
layer_fill_type);
gimp_item_translate (GIMP_ITEM (new_layer), off_x, off_y, FALSE);
gimp_image_add_layer (gimage, new_layer, -1);
......@@ -574,7 +576,7 @@ layers_mask_add_cmd_callback (GtkAction *action,
return_if_no_widget (widget, data);
dialog = layer_add_mask_dialog_new (layer, widget,
GIMP_ADD_WHITE_MASK, FALSE);
layer_add_mask_type, layer_mask_invert);
g_signal_connect (dialog->dialog, "response",
G_CALLBACK (layers_add_mask_response),
......@@ -830,7 +832,7 @@ layers_new_layer_response (GtkWidget *widget,
layer_name =
g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->name_entry)));
fill_type = dialog->fill_type;
layer_fill_type = dialog->fill_type;
dialog->xsize =
RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (dialog->size_se),
......@@ -850,7 +852,7 @@ layers_new_layer_response (GtkWidget *widget,
{
gimp_drawable_fill_by_type (GIMP_DRAWABLE (layer),
dialog->context,
fill_type);
layer_fill_type);
gimp_image_add_layer (dialog->gimage, layer, -1);
gimp_image_flush (dialog->gimage);
......@@ -907,12 +909,15 @@ layers_add_mask_response (GtkWidget *widget,
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (layer));
GimpLayerMask *mask;
layer_add_mask_type = dialog->add_mask_type;
layer_mask_invert = dialog->invert;
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_LAYER_ADD_MASK,
_("Add Layer Mask"));
mask = gimp_layer_create_mask (layer, dialog->add_mask_type);
mask = gimp_layer_create_mask (layer, layer_add_mask_type);
if (dialog->invert)
if (layer_mask_invert)
gimp_channel_invert (GIMP_CHANNEL (mask), FALSE);
gimp_layer_add_mask (layer, mask, TRUE);
......
......@@ -67,15 +67,17 @@ static void select_shrink_callback (GtkWidget *widget,
gpointer data);
/* local variables */
/* private variables */
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;
static gboolean selection_shrink_edge_lock = FALSE;
static gdouble select_feather_radius = 5.0;
static gint select_border_radius = 5;
static gint select_grow_pixels = 1;
static gint select_shrink_pixels = 1;
static gboolean select_shrink_edge_lock = FALSE;
/* public functions */
void
select_invert_cmd_callback (GtkAction *action,
gpointer data)
......@@ -136,7 +138,7 @@ select_feather_cmd_callback (GtkAction *action,
gimp_standard_help_func,
GIMP_HELP_SELECTION_FEATHER,
_("Feather selection by"),
selection_feather_radius, 0, 32767, 3,
select_feather_radius, 0, 32767, 3,
GIMP_DISPLAY_SHELL (gdisp->shell)->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
......@@ -171,7 +173,7 @@ select_shrink_cmd_callback (GtkAction *action,
gimp_standard_help_func,
GIMP_HELP_SELECTION_SHRINK,
_("Shrink selection by"),
selection_shrink_pixels, 1, 32767, 0,
select_shrink_pixels, 1, 32767, 0,
GIMP_DISPLAY_SHELL (gdisp->shell)->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
......@@ -186,7 +188,7 @@ select_shrink_cmd_callback (GtkAction *action,
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);
! select_shrink_edge_lock);
gtk_widget_show (edge_lock);
gtk_widget_show (dialog);
......@@ -205,7 +207,7 @@ select_grow_cmd_callback (GtkAction *action,
gimp_standard_help_func,
GIMP_HELP_SELECTION_GROW,
_("Grow selection by"),
selection_grow_pixels, 1, 32767, 0,
select_grow_pixels, 1, 32767, 0,
GIMP_DISPLAY_SHELL (gdisp->shell)->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
......@@ -228,7 +230,7 @@ select_border_cmd_callback (GtkAction *action,
gimp_standard_help_func,
GIMP_HELP_SELECTION_BORDER,
_("Border selection by"),
selection_border_radius, 1, 32767, 0,
select_border_radius, 1, 32767, 0,
GIMP_DISPLAY_SHELL (gdisp->shell)->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
......@@ -330,9 +332,9 @@ select_feather_callback (GtkWidget *widget,
gdouble radius_x;
gdouble radius_y;
selection_feather_radius = size;
select_feather_radius = size;
radius_x = radius_y = selection_feather_radius;
radius_x = radius_y = select_feather_radius;
if (unit != GIMP_UNIT_PIXEL)
{
......@@ -361,9 +363,9 @@ select_border_callback (GtkWidget *widget,
gdouble radius_x;
gdouble radius_y;
selection_border_radius = ROUND (size);
select_border_radius = ROUND (size);
radius_x = radius_y = selection_border_radius;
radius_x = radius_y = select_border_radius;
if (unit != GIMP_UNIT_PIXEL)
{
......@@ -392,9 +394,9 @@ select_grow_callback (GtkWidget *widget,
gdouble radius_x;
gdouble radius_y;
selection_grow_pixels = ROUND (size);
select_grow_pixels = ROUND (size);
radius_x = radius_y = selection_grow_pixels;
radius_x = radius_y = select_grow_pixels;
if (unit != GIMP_UNIT_PIXEL)
{
......@@ -423,11 +425,11 @@ select_shrink_callback (GtkWidget *widget,
gint radius_x;
gint radius_y;
selection_shrink_pixels = ROUND (size);
select_shrink_pixels = ROUND (size);
radius_x = radius_y = selection_shrink_pixels;
radius_x = radius_y = select_shrink_pixels;
selection_shrink_edge_lock =
select_shrink_edge_lock =
! GTK_TOGGLE_BUTTON (g_object_get_data (G_OBJECT (widget),
"edge_lock_toggle"))->active;
......@@ -445,6 +447,6 @@ select_shrink_callback (GtkWidget *widget,
}
gimp_channel_shrink (gimp_image_get_mask (gimage), radius_x, radius_y,
selection_shrink_edge_lock, TRUE);
select_shrink_edge_lock, TRUE);
gimp_image_flush (gimage);
}
......@@ -631,7 +631,6 @@ view_fullscreen_cmd_callback (GtkAction *action,
GimpDisplay *gdisp;
GimpDisplayShell *shell;
gboolean active;
gboolean fullscreen;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
......@@ -639,18 +638,6 @@ view_fullscreen_cmd_callback (GtkAction *action,
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
gimp_display_shell_set_fullscreen (shell, active);
fullscreen = (shell->window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
if (active != fullscreen)
{
SET_ACTIVE (shell->menubar_manager, "view-fullscreen",
fullscreen);
if (IS_ACTIVE_DISPLAY (gdisp))
SET_ACTIVE (shell->popup_manager, "view-fullscreen",
fullscreen);
}
}
void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment