Commit 4117fa44 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

changed zoom actions to be GimpEnumActions using the GimpActionSelectType

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

	* app/actions/view-actions.c: changed zoom actions to be
	GimpEnumActions using the GimpActionSelectType enum. Enables
	keyboard shortcuts for useless stuff like "zoom out a lot", and
	makes them better accessible for external controllers.

	* app/actions/view-commands.[ch]: renamed view_zoom_cmd_callback()
	to view_zoom_explicit_cmd_callback(), removed the zoom_in and
	zoom_out callbacks and added a new view_zoom_cmd_callback() for
	the new GimpActionSelectType-based actions. The implementation of
	the new zoom types is questionable but now there is a place where
	nomis can fill in nice formulas...
parent 8431d5f2
2004-10-07 Michael Natterer <mitch@gimp.org>
* app/actions/view-actions.c: changed zoom actions to be
GimpEnumActions using the GimpActionSelectType enum. Enables
keyboard shortcuts for useless stuff like "zoom out a lot", and
makes them better accessible for external controllers.
* app/actions/view-commands.[ch]: renamed view_zoom_cmd_callback()
to view_zoom_explicit_cmd_callback(), removed the zoom_in and
zoom_out callbacks and added a new view_zoom_cmd_callback() for
the new GimpActionSelectType-based actions. The implementation of
the new zoom types is questionable but now there is a place where
nomis can fill in nice formulas...
2004-10-06 Michael Natterer <mitch@gimp.org>
* app/tools/gimpeditselectiontool.[ch]: added new parameter
......
......@@ -74,18 +74,6 @@ static GimpActionEntry view_actions[] =
G_CALLBACK (view_close_view_cmd_callback),
GIMP_HELP_FILE_CLOSE },
{ "view-zoom-out", GTK_STOCK_ZOOM_OUT,
N_("Zoom _Out"), "minus",
N_("Zoom out"),
G_CALLBACK (view_zoom_out_cmd_callback),
GIMP_HELP_VIEW_ZOOM_OUT },
{ "view-zoom-in", GTK_STOCK_ZOOM_IN,
N_("Zoom _In"), "plus",
N_("Zoom in"),
G_CALLBACK (view_zoom_in_cmd_callback),
GIMP_HELP_VIEW_ZOOM_IN },
{ "view-zoom-fit-in", GTK_STOCK_ZOOM_FIT,
N_("_Fit Image in Window"), "<control><shift>E",
N_("Fit image in window"),
......@@ -200,7 +188,45 @@ static GimpToggleActionEntry view_toggle_actions[] =
GIMP_HELP_VIEW_FULLSCREEN }
};
static GimpRadioActionEntry view_zoom_actions[] =
static GimpEnumActionEntry view_zoom_actions[] =
{
{ "view-zoom", NULL,
"Set zoom factor", NULL, NULL,
GIMP_ACTION_SELECT_SET,
NULL },
{ "view-zoom-minimum", NULL,
"Zoom out as far as possible", NULL, NULL,
GIMP_ACTION_SELECT_FIRST,
NULL },
{ "view-zoom-maximum", NULL,
"Zoom in as far as possible", NULL, NULL,
GIMP_ACTION_SELECT_LAST,
NULL },
{ "view-zoom-out", GTK_STOCK_ZOOM_OUT,
N_("Zoom _Out"), "minus",
N_("Zoom out"),
GIMP_ACTION_SELECT_PREVIOUS,
GIMP_HELP_VIEW_ZOOM_OUT },
{ "view-zoom-in", GTK_STOCK_ZOOM_IN,
N_("Zoom _In"), "plus",
N_("Zoom in"),
GIMP_ACTION_SELECT_NEXT,
GIMP_HELP_VIEW_ZOOM_IN },
{ "view-zoom-in", NULL,
"Zoom out", NULL, NULL,
GIMP_ACTION_SELECT_NEXT,
NULL },
{ "view-zoom-out-skip", NULL,
"Zoom in a lot", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_PREVIOUS,
NULL },
{ "view-zoom-in-skip", NULL,
"Zoom out a lot", NULL, NULL,
GIMP_ACTION_SELECT_SKIP_NEXT,
NULL }
};
static GimpRadioActionEntry view_zoom_explicit_actions[] =
{
{ "view-zoom-16-1", NULL,
N_("16:1 (1600%)"), NULL, NULL,
......@@ -360,11 +386,16 @@ view_actions_setup (GimpActionGroup *group)
view_toggle_actions,
G_N_ELEMENTS (view_toggle_actions));
gimp_action_group_add_enum_actions (group,
view_zoom_actions,
G_N_ELEMENTS (view_zoom_actions),
G_CALLBACK (view_zoom_cmd_callback));
gimp_action_group_add_radio_actions (group,
view_zoom_actions,
G_N_ELEMENTS (view_zoom_actions),
view_zoom_explicit_actions,
G_N_ELEMENTS (view_zoom_explicit_actions),
10000,
G_CALLBACK (view_zoom_cmd_callback));
G_CALLBACK (view_zoom_explicit_cmd_callback));
gimp_action_group_add_enum_actions (group,
view_padding_color_actions,
......
......@@ -106,51 +106,94 @@ view_close_view_cmd_callback (GtkAction *action,
}
void
view_zoom_out_cmd_callback (GtkAction *action,
gpointer data)
view_zoom_fit_in_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
gimp_display_shell_scale (GIMP_DISPLAY_SHELL (gdisp->shell),
GIMP_ZOOM_OUT, 0.0);
gimp_display_shell_scale_fit_in (GIMP_DISPLAY_SHELL (gdisp->shell));
}
void
view_zoom_in_cmd_callback (GtkAction *action,
gpointer data)
view_zoom_fit_to_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
gimp_display_shell_scale (GIMP_DISPLAY_SHELL (gdisp->shell),
GIMP_ZOOM_IN, 0.0);
gimp_display_shell_scale_fit_to (GIMP_DISPLAY_SHELL (gdisp->shell));
}
void
view_zoom_fit_in_cmd_callback (GtkAction *action,
gpointer data)
view_zoom_cmd_callback (GtkAction *action,
gint value,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *gdisp;
GimpDisplayShell *shell;
gdouble scale;
return_if_no_display (gdisp, data);
gimp_display_shell_scale_fit_in (GIMP_DISPLAY_SHELL (gdisp->shell));
}
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
void
view_zoom_fit_to_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
scale = shell->scale;
gimp_display_shell_scale_fit_to (GIMP_DISPLAY_SHELL (gdisp->shell));
switch ((GimpActionSelectType) value)
{
case GIMP_ACTION_SELECT_FIRST:
gimp_display_shell_scale (shell, GIMP_ZOOM_TO, 1.0 / 256.0);
break;
case GIMP_ACTION_SELECT_LAST:
gimp_display_shell_scale (shell, GIMP_ZOOM_TO, 256.0);
break;
case GIMP_ACTION_SELECT_PREVIOUS:
gimp_display_shell_scale (shell, GIMP_ZOOM_OUT, 0.0);
break;
case GIMP_ACTION_SELECT_NEXT:
gimp_display_shell_scale (shell, GIMP_ZOOM_IN, 0.0);
break;
case GIMP_ACTION_SELECT_SKIP_PREVIOUS:
scale = gimp_display_shell_scale_zoom_step (GIMP_ZOOM_OUT, scale);
scale = gimp_display_shell_scale_zoom_step (GIMP_ZOOM_OUT, scale);
scale = gimp_display_shell_scale_zoom_step (GIMP_ZOOM_OUT, scale);
gimp_display_shell_scale (shell, GIMP_ZOOM_TO, scale);
break;
case GIMP_ACTION_SELECT_SKIP_NEXT:
scale = gimp_display_shell_scale_zoom_step (GIMP_ZOOM_IN, scale);
scale = gimp_display_shell_scale_zoom_step (GIMP_ZOOM_IN, scale);
scale = gimp_display_shell_scale_zoom_step (GIMP_ZOOM_IN, scale);
gimp_display_shell_scale (shell, GIMP_ZOOM_TO, scale);
break;
default:
scale = (scale >= 1) ? (scale + 256.0) : (scale * 256.0);
scale = action_select_value ((GimpActionSelectType) value,
scale,
1.0, 512.0,
1.0, 16.0,
FALSE);
if (scale > 256.0)
scale -= 256.0;
else
scale /= 256.0;
gimp_display_shell_scale (shell, GIMP_ZOOM_TO, scale);
break;
}
}
void
view_zoom_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data)
view_zoom_explicit_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
......
......@@ -25,15 +25,14 @@ void view_new_view_cmd_callback (GtkAction *action,
void view_close_view_cmd_callback (GtkAction *action,
gpointer data);
void view_zoom_out_cmd_callback (GtkAction *action,
gpointer data);
void view_zoom_in_cmd_callback (GtkAction *action,
gpointer data);
void view_zoom_fit_in_cmd_callback (GtkAction *action,
gpointer data);
void view_zoom_fit_to_cmd_callback (GtkAction *action,
gpointer data);
void view_zoom_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void view_zoom_explicit_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data);
void view_zoom_other_cmd_callback (GtkAction *action,
......
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