GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit b4ea222c authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Ported GimpNavigationView to use actions for its buttons:

2004-09-26  Michael Natterer  <mitch@gimp.org>

	Ported GimpNavigationView to use actions for its buttons:

	* app/menus/menus.c (menus_init): register a <GimpNaviagaionEditor>
	UI manager containing the "view" action group.

	* app/actions/actions.c (action_data_get_foo): handle "data" being
	a GimpNavigationEditor.

	* app/actions/view-actions.c (view_actions): added tooltips for
	the actions used in the editor.

	(view_actions_update): use action_data_get_display() instead of
	checking the type of "data" manually.

	* app/widgets/gimpeditor.c (gimp_editor_add_action_button): use
	a GtkToggleButton instead of GimpButton for GtkToggleActions.

	* app/display/gimpnavigationeditor.[ch]: added a GimpMenuFactory
	parameter to the public constructor and removed all other
	parameters. Simplified gimp_navigation_editor_new_private() and
	use gimp_editor_add_action_button() instead of just add_button()
	for creating the buttons. Made gimp_navigation_view_set_shell()
	private. Update the UI manager when the shell zooms or scrolls.

	* app/dialogs/dialogs-constructors.c (dialogs_navigation_view_new):
	pass the menu_factory to gimp_navigation_editor_new().

	Removed #includes which are not needed any more.
parent 5c6e0c8e
2004-09-26 Michael Natterer <mitch@gimp.org>
Ported GimpNavigationView to use actions for its buttons:
* app/menus/menus.c (menus_init): register a <GimpNaviagaionEditor>
UI manager containing the "view" action group.
* app/actions/actions.c (action_data_get_foo): handle "data" being
a GimpNavigationEditor.
* app/actions/view-actions.c (view_actions): added tooltips for
the actions used in the editor.
(view_actions_update): use action_data_get_display() instead of
checking the type of "data" manually.
* app/widgets/gimpeditor.c (gimp_editor_add_action_button): use
a GtkToggleButton instead of GimpButton for GtkToggleActions.
* app/display/gimpnavigationeditor.[ch]: added a GimpMenuFactory
parameter to the public constructor and removed all other
parameters. Simplified gimp_navigation_editor_new_private() and
use gimp_editor_add_action_button() instead of just add_button()
for creating the buttons. Made gimp_navigation_view_set_shell()
private. Update the UI manager when the shell zooms or scrolls.
* app/dialogs/dialogs-constructors.c (dialogs_navigation_view_new):
pass the menu_factory to gimp_navigation_editor_new().
Removed #includes which are not needed any more.
2004-09-26 DindinX <dindinx@gimp.org>
* plug-ins/common/exchange.c: use the same preview as in all other
......
......@@ -41,6 +41,7 @@
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpnavigationeditor.h"
#include "dialogs/dialogs.h"
......@@ -234,6 +235,8 @@ action_data_get_gimp (gpointer data)
return ((GimpItemTreeView *) data)->context->gimp;
else if (GIMP_IS_IMAGE_EDITOR (data))
return ((GimpImageEditor *) data)->context->gimp;
else if (GIMP_IS_NAVIGATION_EDITOR (data))
return ((GimpNavigationEditor *) data)->context->gimp;
else if (GIMP_IS_GIMP (data))
return data;
else if (GIMP_IS_DOCK (data))
......@@ -260,6 +263,8 @@ action_data_get_context (gpointer data)
return gimp_container_view_get_context (((GimpContainerEditor *) data)->view);
else if (GIMP_IS_IMAGE_EDITOR (data))
return ((GimpImageEditor *) data)->context;
else if (GIMP_IS_NAVIGATION_EDITOR (data))
return ((GimpNavigationEditor *) data)->context;
else if (GIMP_IS_GIMP (data))
return gimp_get_user_context (data);
else if (GIMP_IS_DOCK (data))
......@@ -282,6 +287,8 @@ action_data_get_image (gpointer data)
return ((GimpItemTreeView *) data)->gimage;
else if (GIMP_IS_IMAGE_EDITOR (data))
return ((GimpImageEditor *) data)->gimage;
else if (GIMP_IS_NAVIGATION_EDITOR (data))
return gimp_context_get_image (((GimpNavigationEditor *) data)->context);
else if (GIMP_IS_GIMP (data))
return gimp_context_get_image (gimp_get_user_context (data));
else if (GIMP_IS_DOCK (data))
......@@ -300,6 +307,8 @@ action_data_get_display (gpointer data)
return data;
else if (GIMP_IS_DISPLAY_SHELL (data))
return ((GimpDisplayShell *) data)->gdisp;
else if (GIMP_IS_NAVIGATION_EDITOR (data))
return gimp_context_get_display (((GimpNavigationEditor *) data)->context);
else if (GIMP_IS_GIMP (data))
return gimp_context_get_display (gimp_get_user_context (data));
else if (GIMP_IS_DOCK (data))
......
......@@ -42,6 +42,7 @@
#include "display/gimpdisplayshell-render.h"
#include "display/gimpdisplayshell-selection.h"
#include "actions.h"
#include "view-actions.h"
#include "view-commands.h"
......@@ -74,22 +75,26 @@ static GimpActionEntry view_actions[] =
GIMP_HELP_FILE_CLOSE },
{ "view-zoom-out", GTK_STOCK_ZOOM_OUT,
N_("Zoom _Out"), "minus", NULL,
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", NULL,
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", NULL,
N_("_Fit Image in Window"), "<control><shift>E",
N_("Fit image in window"),
G_CALLBACK (view_zoom_fit_in_cmd_callback),
GIMP_HELP_VIEW_ZOOM_FIT_IN },
{ "view-zoom-fit-to", GTK_STOCK_ZOOM_FIT,
N_("Fit Image to Window"), NULL, NULL,
N_("Fit Image to Window"), NULL,
N_("Fit image to window"),
G_CALLBACK (view_zoom_fit_to_cmd_callback),
GIMP_HELP_VIEW_ZOOM_FIT_TO },
......@@ -108,8 +113,9 @@ static GimpActionEntry view_actions[] =
G_CALLBACK (view_display_filters_cmd_callback),
GIMP_HELP_DISPLAY_FILTER_DIALOG },
{ "view-shrink-wrap", NULL,
N_("Shrink _Wrap"), "<control>E", NULL,
{ "view-shrink-wrap", GTK_STOCK_ZOOM_FIT,
N_("Shrink _Wrap"), "<control>E",
N_("Shrink wrap"),
G_CALLBACK (view_shrink_wrap_cmd_callback),
GIMP_HELP_VIEW_SHRINK_WRAP },
......@@ -217,7 +223,8 @@ static GimpRadioActionEntry view_zoom_actions[] =
GIMP_HELP_VIEW_ZOOM_IN },
{ "view-zoom-1-1", GTK_STOCK_ZOOM_100,
N_("1:1 (100%)"), "1", NULL,
N_("1:1 (100%)"), "1",
N_("Zoom 1:1"),
10000,
GIMP_HELP_VIEW_ZOOM_100 },
......@@ -401,19 +408,11 @@ view_actions_update (GimpActionGroup *group,
gboolean fullscreen = FALSE;
gint n_screens = 1;
if (GIMP_IS_DISPLAY_SHELL (data))
{
shell = GIMP_DISPLAY_SHELL (data);
gdisp = shell->gdisp;
}
else if (GIMP_IS_DISPLAY (data))
{
gdisp = GIMP_DISPLAY (data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
}
gdisp = action_data_get_display (data);
if (gdisp)
{
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimage = gdisp->gimage;
fullscreen = gimp_display_shell_get_fullscreen (shell);
......
......@@ -33,7 +33,7 @@
#include "vectors/gimpvectors.h"
#include "config/gimpdisplayconfig.h"
#include "config/gimpguiconfig.h"
#include "widgets/gimpbrusheditor.h"
#include "widgets/gimpbrushfactoryview.h"
......@@ -67,8 +67,6 @@
#include "widgets/gimpundoeditor.h"
#include "widgets/gimpvectorstreeview.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpnavigationeditor.h"
#include "actions/channels-commands.h"
......@@ -820,17 +818,9 @@ dialogs_navigation_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell = NULL;
GtkWidget *view;
gdisp = gimp_context_get_display (context);
if (gdisp)
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
GtkWidget *view;
view = gimp_navigation_editor_new (shell,
GIMP_DISPLAY_CONFIG (context->gimp->config));
view = gimp_navigation_editor_new (factory->menu_factory);
return dialogs_dockable_new (view,
_("Navigation"), _("Display Navigation"),
......
This diff is collapsed.
......@@ -66,15 +66,11 @@ struct _GimpNavigationEditorClass
GType gimp_navigation_editor_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_navigation_editor_new (GimpDisplayShell *shell,
GimpDisplayConfig *config);
void gimp_navigation_editor_set_shell (GimpNavigationEditor *view,
GimpDisplayShell *shell);
void gimp_navigation_editor_popup (GimpDisplayShell *shell,
GtkWidget *widget,
gint click_x,
gint click_y);
GtkWidget * gimp_navigation_editor_new (GimpMenuFactory *menu_factory);
void gimp_navigation_editor_popup (GimpDisplayShell *shell,
GtkWidget *widget,
gint click_x,
gint click_y);
#endif /* __GIMP_NAVIGATION_EDITOR_H__ */
......@@ -255,6 +255,11 @@ menus_init (Gimp *gimp,
"selection-editor-menu.xml", NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<NavigationEditor>",
"view",
NULL,
NULL);
gimp_menu_factory_manager_register (global_menu_factory, "<UndoEditor>",
"edit",
NULL,
......
......@@ -566,7 +566,16 @@ gimp_editor_add_action_button (GimpEditor *editor,
button_icon_size = gimp_editor_ensure_button_box (editor);
button = gimp_button_new ();
if (GTK_IS_TOGGLE_ACTION (action))
{
button = gtk_toggle_button_new ();
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
}
else
{
button = gimp_button_new ();
}
gtk_action_connect_proxy (action, button);
gtk_box_pack_start (GTK_BOX (editor->button_box), button, TRUE, TRUE, 0);
gtk_widget_show (button);
......
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