When there are variants of actions with and without dialog, let the

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

	When there are variants of actions with and without dialog, let
	the dialog-less actions try to use the values from the last dialog
	invocation:

	* app/actions/channels-actions.c
	* app/actions/channels-commands.[ch]
	* app/actions/layers-actions.c
	* app/actions/layers-commands.[ch]
	* app/actions/vectors-actions.c
	* app/actions/vectors-commands.[ch]: renamed the foo-new-defaults
	actions to foo-new-last-values and use the last values entered in
	the dialogs.

	* app/widgets/gimpchanneltreeview.c
	* app/widgets/gimpitemtreeview.c
	* app/widgets/gimplayertreeview.c
	* app/widgets/gimpvectorstreeview.c: changed accordingly. Show
	the dialog on clicking "New" and call the last-values action on
	<shift>+click.

	* app/actions/select-actions.c
	* app/actions/vectors-commands.c: renamed the foo-stroke-last-vals
	to -last-values.

	* app/widgets/gimpselectioneditor.c
	* app/widgets/gimpvectorstreeview.c: stroke with last values on
	<shift> clicking the stroke buttons.
This commit is contained in:
Michael Natterer 2004-10-23 00:53:48 +00:00 committed by Michael Natterer
parent 00ff7e3f61
commit fd6d30fd30
16 changed files with 93 additions and 52 deletions

View File

@ -1,3 +1,33 @@
2004-10-23 Michael Natterer <mitch@gimp.org>
When there are variants of actions with and without dialog, let
the dialog-less actions try to use the values from the last dialog
invocation:
* app/actions/channels-actions.c
* app/actions/channels-commands.[ch]
* app/actions/layers-actions.c
* app/actions/layers-commands.[ch]
* app/actions/vectors-actions.c
* app/actions/vectors-commands.[ch]: renamed the foo-new-defaults
actions to foo-new-last-values and use the last values entered in
the dialogs.
* app/widgets/gimpchanneltreeview.c
* app/widgets/gimpitemtreeview.c
* app/widgets/gimplayertreeview.c
* app/widgets/gimpvectorstreeview.c: changed accordingly. Show
the dialog on clicking "New" and call the last-values action on
<shift>+click.
* app/actions/select-actions.c
* app/actions/vectors-commands.c: renamed the foo-stroke-last-vals
to -last-values.
* app/widgets/gimpselectioneditor.c
* app/widgets/gimpvectorstreeview.c: stroke with last values on
<shift> clicking the stroke buttons.
2004-10-23 Sven Neumann <sven@gimp.org>
* libgimpthumb/gimpthumbnail.c (gimp_thumbnail_save): save to a

View File

@ -52,14 +52,14 @@ static GimpActionEntry channels_actions[] =
{ "channels-new", GTK_STOCK_NEW,
N_("_New Channel..."), "",
N_("New channel dialog"),
N_("New channel..."),
G_CALLBACK (channels_new_cmd_callback),
GIMP_HELP_CHANNEL_NEW },
{ "channels-new-default", GTK_STOCK_NEW,
{ "channels-new-last-values", GTK_STOCK_NEW,
N_("_New Channel"), "",
N_("New channel"),
G_CALLBACK (channels_new_default_cmd_callback),
N_("New channel with last values"),
G_CALLBACK (channels_new_last_vals_cmd_callback),
GIMP_HELP_CHANNEL_NEW },
{ "channels-duplicate", GIMP_STOCK_DUPLICATE,
@ -185,7 +185,7 @@ channels_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("channels-edit-attributes", !fs && channel);
SET_SENSITIVE ("channels-new", !fs && gimage);
SET_SENSITIVE ("channels-new-default", !fs && gimage);
SET_SENSITIVE ("channels-new-last-values", !fs && gimage);
SET_SENSITIVE ("channels-duplicate", !fs && (channel || component));
SET_SENSITIVE ("channels-delete", !fs && channel);

View File

@ -130,8 +130,8 @@ channels_new_cmd_callback (GtkAction *action,
}
void
channels_new_default_cmd_callback (GtkAction *action,
gpointer data)
channels_new_last_vals_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpChannel *new_channel;
@ -151,14 +151,15 @@ channels_new_default_cmd_callback (GtkAction *action,
{
width = gimp_image_get_width (gimage);
height = gimp_image_get_height (gimage);
gimp_rgba_set (&color, 0.0, 0.0, 0.0, 0.5);
color = channel_color;
}
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_EDIT_PASTE,
_("New Channel"));
new_channel = gimp_channel_new (gimage, width, height,
_("Empty Channel"), &color);
channel_name ? channel_name :
_("New Channel"), &color);
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_channel),
action_data_get_context (data),

View File

@ -24,7 +24,7 @@ void channels_edit_attributes_cmd_callback (GtkAction *action,
gpointer data);
void channels_new_cmd_callback (GtkAction *action,
gpointer data);
void channels_new_default_cmd_callback (GtkAction *action,
void channels_new_last_vals_cmd_callback (GtkAction *action,
gpointer data);
void channels_raise_cmd_callback (GtkAction *action,

View File

@ -72,14 +72,14 @@ static GimpActionEntry layers_actions[] =
{ "layers-new", GTK_STOCK_NEW,
N_("_New Layer..."), "",
N_("New layer dialog"),
N_("New layer..."),
G_CALLBACK (layers_new_cmd_callback),
GIMP_HELP_LAYER_NEW },
{ "layers-new-default", GTK_STOCK_NEW,
{ "layers-new-last-values", GTK_STOCK_NEW,
N_("_New Layer"), "",
N_("New layer"),
G_CALLBACK (layers_new_default_cmd_callback),
N_("New layer with last values"),
G_CALLBACK (layers_new_last_vals_cmd_callback),
GIMP_HELP_LAYER_NEW },
{ "layers-duplicate", GIMP_STOCK_DUPLICATE,
@ -440,10 +440,10 @@ layers_actions_update (GimpActionGroup *group,
SET_VISIBLE ("layers-text-tool", text_layer && !ac);
SET_SENSITIVE ("layers-edit-attributes", layer && !fs && !ac);
SET_SENSITIVE ("layers-new", gimage);
SET_SENSITIVE ("layers-new-default", gimage);
SET_SENSITIVE ("layers-duplicate", layer && !fs && !ac);
SET_SENSITIVE ("layers-delete", layer && !ac);
SET_SENSITIVE ("layers-new", gimage);
SET_SENSITIVE ("layers-new-last-values", gimage);
SET_SENSITIVE ("layers-duplicate", layer && !fs && !ac);
SET_SENSITIVE ("layers-delete", layer && !ac);
SET_SENSITIVE ("layers-select-top", layer && !fs && !ac && prev);
SET_SENSITIVE ("layers-select-bottom", layer && !fs && !ac && next);

View File

@ -256,8 +256,8 @@ layers_new_cmd_callback (GtkAction *action,
}
void
layers_new_default_cmd_callback (GtkAction *action,
gpointer data)
layers_new_last_vals_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpLayer *floating_sel;
@ -303,11 +303,12 @@ layers_new_default_cmd_callback (GtkAction *action,
new_layer = gimp_layer_new (gimage, width, height,
gimp_image_base_type_with_alpha (gimage),
_("Empty Layer"), opacity, mode);
layer_name ? layer_name : _("New Layer"),
opacity, mode);
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_layer),
action_data_get_context (data),
GIMP_TRANSPARENT_FILL);
fill_type);
gimp_item_translate (GIMP_ITEM (new_layer), off_x, off_y, FALSE);
gimp_image_add_layer (gimage, new_layer, -1);

View File

@ -26,7 +26,7 @@ void layers_edit_attributes_cmd_callback (GtkAction *action,
gpointer data);
void layers_new_cmd_callback (GtkAction *action,
gpointer data);
void layers_new_default_cmd_callback (GtkAction *action,
void layers_new_last_vals_cmd_callback (GtkAction *action,
gpointer data);
void layers_select_cmd_callback (GtkAction *action,

View File

@ -102,12 +102,13 @@ static GimpActionEntry select_actions[] =
{ "select-stroke", GIMP_STOCK_SELECTION_STROKE,
N_("_Stroke Selection..."), NULL,
N_("Stroke selection"),
N_("Stroke selection..."),
G_CALLBACK (select_stroke_cmd_callback),
GIMP_HELP_SELECTION_STROKE },
{ "select-stroke-last-vals", GIMP_STOCK_SELECTION_STROKE,
"Stroke Selection with last Values", NULL, NULL,
{ "select-stroke-last-values", GIMP_STOCK_SELECTION_STROKE,
N_("_Stroke Selection"), NULL,
N_("Stroke selection with last values"),
G_CALLBACK (select_stroke_last_vals_cmd_callback),
GIMP_HELP_SELECTION_STROKE }
};
@ -152,9 +153,9 @@ select_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("select-grow", drawable && sel);
SET_SENSITIVE ("select-border", drawable && sel);
SET_SENSITIVE ("select-save", drawable && !fs);
SET_SENSITIVE ("select-stroke", drawable && sel);
SET_SENSITIVE ("select-stroke-last-vals", drawable && sel);
SET_SENSITIVE ("select-save", drawable && !fs);
SET_SENSITIVE ("select-stroke", drawable && sel);
SET_SENSITIVE ("select-stroke-last-values", drawable && sel);
#undef SET_SENSITIVE
}

View File

@ -57,14 +57,14 @@ static GimpActionEntry vectors_actions[] =
{ "vectors-new", GTK_STOCK_NEW,
N_("_New Path..."), "",
N_("New path dialog"),
N_("New path..."),
G_CALLBACK (vectors_new_cmd_callback),
GIMP_HELP_PATH_NEW },
{ "vectors-new-default", GTK_STOCK_NEW,
{ "vectors-new-last-values", GTK_STOCK_NEW,
N_("_New Path"), "",
N_("New path"),
G_CALLBACK (vectors_new_default_cmd_callback),
N_("New path with last values"),
G_CALLBACK (vectors_new_last_vals_cmd_callback),
GIMP_HELP_PATH_NEW },
{ "vectors-duplicate", GIMP_STOCK_DUPLICATE,
@ -110,12 +110,13 @@ static GimpActionEntry vectors_actions[] =
{ "vectors-stroke", GIMP_STOCK_PATH_STROKE,
N_("Stro_ke Path..."), NULL,
N_("Stroke path"),
N_("Stroke path..."),
G_CALLBACK (vectors_stroke_cmd_callback),
GIMP_HELP_PATH_STROKE },
{ "vectors-stroke-last-vals", GIMP_STOCK_PATH_STROKE,
"Stroke Path with last Values", NULL, NULL,
{ "vectors-stroke-last-values", GIMP_STOCK_PATH_STROKE,
N_("Stro_ke Path"), NULL,
N_("Stroke path with last values"),
G_CALLBACK (vectors_stroke_last_vals_cmd_callback),
GIMP_HELP_PATH_STROKE },
@ -278,11 +279,11 @@ vectors_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("vectors-path-tool", vectors);
SET_SENSITIVE ("vectors-edit-attributes", vectors);
SET_SENSITIVE ("vectors-new", gimage);
SET_SENSITIVE ("vectors-new-default", gimage);
SET_SENSITIVE ("vectors-duplicate", vectors);
SET_SENSITIVE ("vectors-delete", vectors);
SET_SENSITIVE ("vectors-merge-visible", n_vectors > 1);
SET_SENSITIVE ("vectors-new", gimage);
SET_SENSITIVE ("vectors-new-last-values", gimage);
SET_SENSITIVE ("vectors-duplicate", vectors);
SET_SENSITIVE ("vectors-delete", vectors);
SET_SENSITIVE ("vectors-merge-visible", n_vectors > 1);
SET_SENSITIVE ("vectors-raise", vectors && prev);
SET_SENSITIVE ("vectors-raise-to-top", vectors && prev);
@ -304,7 +305,7 @@ vectors_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("vectors-selection-to-vectors-short", gimage && !mask_empty);
SET_SENSITIVE ("vectors-selection-to-vectors-advanced", gimage && !mask_empty);
SET_SENSITIVE ("vectors-stroke", vectors);
SET_SENSITIVE ("vectors-stroke-last-vals", vectors);
SET_SENSITIVE ("vectors-stroke-last-values", vectors);
SET_SENSITIVE ("vectors-selection-replace", vectors);
SET_SENSITIVE ("vectors-selection-from-vectors", vectors);

View File

@ -174,14 +174,15 @@ vectors_new_cmd_callback (GtkAction *action,
}
void
vectors_new_default_cmd_callback (GtkAction *action,
gpointer data)
vectors_new_last_vals_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpVectors *new_vectors;
return_if_no_image (gimage, data);
new_vectors = gimp_vectors_new (gimage, _("Empty Path"));
new_vectors = gimp_vectors_new (gimage,
vectors_name ? vectors_name : _("New Path"));
gimp_image_add_vectors (gimage, new_vectors, -1);

View File

@ -26,7 +26,7 @@ void vectors_edit_attributes_cmd_callback (GtkAction *action,
gpointer data);
void vectors_new_cmd_callback (GtkAction *action,
gpointer data);
void vectors_new_default_cmd_callback (GtkAction *action,
void vectors_new_last_vals_cmd_callback (GtkAction *action,
gpointer data);
void vectors_raise_cmd_callback (GtkAction *action,

View File

@ -127,7 +127,7 @@ gimp_channel_tree_view_class_init (GimpChannelTreeViewClass *klass)
item_view_class->activate_action = "channels-edit-attributes";
item_view_class->edit_action = "channels-edit-attributes";
item_view_class->new_action = "channels-new";
item_view_class->new_default_action = "channels-new-default";
item_view_class->new_default_action = "channels-new-last-values";
item_view_class->raise_action = "channels-raise";
item_view_class->raise_top_action = "channels-raise-to-top";
item_view_class->lower_action = "channels-lower";

View File

@ -418,8 +418,8 @@ gimp_item_tree_view_constructor (GType type,
item_view->new_button =
gimp_editor_add_action_button (editor, item_view_class->action_group,
item_view_class->new_default_action,
item_view_class->new_action,
item_view_class->new_default_action,
GDK_SHIFT_MASK,
NULL);
/* connect "drop to new" manually as it makes a difference whether

View File

@ -240,7 +240,7 @@ gimp_layer_tree_view_class_init (GimpLayerTreeViewClass *klass)
item_view_class->activate_action = "layers-text-tool";
item_view_class->edit_action = "layers-edit-attributes";
item_view_class->new_action = "layers-new";
item_view_class->new_default_action = "layers-new-default";
item_view_class->new_default_action = "layers-new-last-values";
item_view_class->raise_action = "layers-raise";
item_view_class->raise_top_action = "layers-raise-to-top";
item_view_class->lower_action = "layers-lower";

View File

@ -187,7 +187,10 @@ gimp_selection_editor_constructor (GType type,
editor->stroke_button =
gimp_editor_add_action_button (GIMP_EDITOR (editor), "select",
"select-stroke", NULL);
"select-stroke",
"select-stroke-last-values",
GDK_SHIFT_MASK,
NULL);
return object;
}

View File

@ -141,7 +141,7 @@ gimp_vectors_tree_view_class_init (GimpVectorsTreeViewClass *klass)
item_view_class->activate_action = "vectors-path-tool";
item_view_class->edit_action = "vectors-edit-attributes";
item_view_class->new_action = "vectors-new";
item_view_class->new_default_action = "vectors-new-default";
item_view_class->new_default_action = "vectors-new-last-values";
item_view_class->raise_action = "vectors-raise";
item_view_class->raise_top_action = "vectors-raise-to-top";
item_view_class->lower_action = "vectors-lower";
@ -210,7 +210,10 @@ gimp_vectors_tree_view_constructor (GType type,
view->stroke_button =
gimp_editor_add_action_button (editor, "vectors",
"vectors-stroke", NULL);
"vectors-stroke",
"vectors-stroke-last-values",
GDK_SHIFT_MASK,
NULL);
gimp_container_view_enable_dnd (GIMP_CONTAINER_VIEW (editor),
GTK_BUTTON (view->stroke_button),
GIMP_TYPE_VECTORS);