2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1999-08-13 06:21:04 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2004-08-26 00:02:10 +08:00
|
|
|
* gimpnavigationeditor.c
|
2002-05-08 00:23:14 +08:00
|
|
|
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
|
|
|
*
|
|
|
|
* partly based on app/nav_window
|
|
|
|
* Copyright (C) 1999 Andy Thomas <alt@gimp.org>
|
|
|
|
*
|
1999-08-13 06:21:04 +08:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2000-12-14 21:52:16 +08:00
|
|
|
|
1999-09-06 08:07:03 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include <gtk/gtk.h>
|
2000-04-28 01:27:28 +08:00
|
|
|
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
#include "display-types.h"
|
2001-05-15 19:25:25 +08:00
|
|
|
|
2002-11-22 01:17:03 +08:00
|
|
|
#include "config/gimpdisplayconfig.h"
|
2002-11-19 04:50:31 +08:00
|
|
|
|
2001-07-05 03:31:35 +08:00
|
|
|
#include "core/gimp.h"
|
2003-10-11 05:24:12 +08:00
|
|
|
#include "core/gimpcontext.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpimage.h"
|
2001-09-26 07:23:09 +08:00
|
|
|
|
2003-10-11 05:24:12 +08:00
|
|
|
#include "widgets/gimpdocked.h"
|
2003-08-25 08:54:15 +08:00
|
|
|
#include "widgets/gimphelp-ids.h"
|
2004-09-26 23:21:44 +08:00
|
|
|
#include "widgets/gimpmenufactory.h"
|
2004-08-27 08:42:46 +08:00
|
|
|
#include "widgets/gimpnavigationview.h"
|
2004-09-26 23:21:44 +08:00
|
|
|
#include "widgets/gimpuimanager.h"
|
2004-08-26 06:31:44 +08:00
|
|
|
#include "widgets/gimpviewrenderer.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
#include "gimpdisplay.h"
|
|
|
|
#include "gimpdisplayshell.h"
|
|
|
|
#include "gimpdisplayshell-scale.h"
|
|
|
|
#include "gimpdisplayshell-scroll.h"
|
2004-08-26 00:02:10 +08:00
|
|
|
#include "gimpnavigationeditor.h"
|
2002-05-08 00:23:14 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2000-04-28 01:27:28 +08:00
|
|
|
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2006-08-30 05:44:51 +08:00
|
|
|
static void gimp_navigation_editor_docked_iface_init (GimpDockedInterface *iface);
|
2004-09-26 23:21:44 +08:00
|
|
|
|
2006-08-30 05:44:51 +08:00
|
|
|
static void gimp_navigation_editor_destroy (GtkObject *object);
|
2004-09-26 23:21:44 +08:00
|
|
|
|
2006-08-30 05:44:51 +08:00
|
|
|
static void gimp_navigation_editor_set_context (GimpDocked *docked,
|
|
|
|
GimpContext *context);
|
|
|
|
|
|
|
|
static GtkWidget * gimp_navigation_editor_new_private (GimpMenuFactory *menu_factory,
|
|
|
|
GimpDisplayShell *shell);
|
2004-09-26 23:21:44 +08:00
|
|
|
|
|
|
|
static void gimp_navigation_editor_set_shell (GimpNavigationEditor *view,
|
|
|
|
GimpDisplayShell *shell);
|
2006-08-30 05:44:51 +08:00
|
|
|
static gboolean gimp_navigation_editor_button_release (GtkWidget *widget,
|
|
|
|
GdkEventButton *bevent,
|
|
|
|
GimpDisplayShell *shell);
|
2004-09-26 23:21:44 +08:00
|
|
|
static void gimp_navigation_editor_marker_changed (GimpNavigationView *view,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y,
|
|
|
|
GimpNavigationEditor *editor);
|
|
|
|
static void gimp_navigation_editor_zoom (GimpNavigationView *view,
|
|
|
|
GimpZoomType direction,
|
|
|
|
GimpNavigationEditor *editor);
|
|
|
|
static void gimp_navigation_editor_scroll (GimpNavigationView *view,
|
|
|
|
GdkScrollDirection direction,
|
|
|
|
GimpNavigationEditor *editor);
|
|
|
|
|
|
|
|
static void gimp_navigation_editor_zoom_adj_changed (GtkAdjustment *adj,
|
|
|
|
GimpNavigationEditor *editor);
|
|
|
|
|
|
|
|
static void gimp_navigation_editor_shell_scaled (GimpDisplayShell *shell,
|
|
|
|
GimpNavigationEditor *editor);
|
|
|
|
static void gimp_navigation_editor_shell_scrolled (GimpDisplayShell *shell,
|
|
|
|
GimpNavigationEditor *editor);
|
|
|
|
static void gimp_navigation_editor_shell_reconnect (GimpDisplayShell *shell,
|
|
|
|
GimpNavigationEditor *editor);
|
|
|
|
static void gimp_navigation_editor_update_marker (GimpNavigationEditor *editor);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
1999-10-21 06:15:13 +08:00
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GimpNavigationEditor, gimp_navigation_editor,
|
|
|
|
GIMP_TYPE_EDITOR,
|
|
|
|
G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED,
|
2006-05-15 17:46:31 +08:00
|
|
|
gimp_navigation_editor_docked_iface_init))
|
2004-09-26 23:21:44 +08:00
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
#define parent_class gimp_navigation_editor_parent_class
|
1999-08-28 03:07:21 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
static void
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_navigation_editor_class_init (GimpNavigationEditorClass *klass)
|
2002-05-08 00:23:14 +08:00
|
|
|
{
|
2004-09-26 23:21:44 +08:00
|
|
|
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
gtk_object_class->destroy = gimp_navigation_editor_destroy;
|
2002-05-08 00:23:14 +08:00
|
|
|
}
|
|
|
|
|
2006-08-30 05:44:51 +08:00
|
|
|
static void
|
|
|
|
gimp_navigation_editor_docked_iface_init (GimpDockedInterface *iface)
|
|
|
|
{
|
|
|
|
iface->set_context = gimp_navigation_editor_set_context;
|
|
|
|
}
|
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
static void
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_navigation_editor_init (GimpNavigationEditor *editor)
|
2002-05-08 00:23:14 +08:00
|
|
|
{
|
|
|
|
GtkWidget *frame;
|
|
|
|
|
2006-08-30 05:44:51 +08:00
|
|
|
editor->context = NULL;
|
|
|
|
editor->shell = NULL;
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
2004-08-26 00:02:10 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (editor), frame, TRUE, TRUE, 0);
|
2002-05-06 03:17:41 +08:00
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2006-08-30 05:44:51 +08:00
|
|
|
editor->view = gimp_view_new_by_types (NULL,
|
|
|
|
GIMP_TYPE_NAVIGATION_VIEW,
|
2004-08-26 01:54:12 +08:00
|
|
|
GIMP_TYPE_IMAGE,
|
2004-08-29 19:58:05 +08:00
|
|
|
GIMP_VIEW_SIZE_MEDIUM, 0, TRUE);
|
2004-08-26 01:54:12 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), editor->view);
|
|
|
|
gtk_widget_show (editor->view);
|
2004-08-26 00:02:10 +08:00
|
|
|
|
2005-05-28 00:51:39 +08:00
|
|
|
g_signal_connect (editor->view, "marker-changed",
|
2004-08-26 00:02:10 +08:00
|
|
|
G_CALLBACK (gimp_navigation_editor_marker_changed),
|
|
|
|
editor);
|
2004-08-26 01:54:12 +08:00
|
|
|
g_signal_connect (editor->view, "zoom",
|
2004-08-26 00:02:10 +08:00
|
|
|
G_CALLBACK (gimp_navigation_editor_zoom),
|
|
|
|
editor);
|
2004-08-26 01:54:12 +08:00
|
|
|
g_signal_connect (editor->view, "scroll",
|
2004-08-26 00:02:10 +08:00
|
|
|
G_CALLBACK (gimp_navigation_editor_scroll),
|
|
|
|
editor);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
|
2002-05-08 00:23:14 +08:00
|
|
|
}
|
2002-05-06 03:17:41 +08:00
|
|
|
|
2003-10-11 05:24:12 +08:00
|
|
|
static void
|
2006-08-30 05:44:51 +08:00
|
|
|
gimp_navigation_editor_destroy (GtkObject *object)
|
2003-10-11 05:24:12 +08:00
|
|
|
{
|
2006-08-30 05:44:51 +08:00
|
|
|
GimpNavigationEditor *editor = GIMP_NAVIGATION_EDITOR (object);
|
|
|
|
|
|
|
|
if (editor->shell)
|
|
|
|
gimp_navigation_editor_set_shell (editor, NULL);
|
|
|
|
|
|
|
|
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
2003-10-11 05:24:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_navigation_editor_context_changed (GimpContext *context,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display,
|
2004-08-26 00:02:10 +08:00
|
|
|
GimpNavigationEditor *editor)
|
2003-10-11 05:24:12 +08:00
|
|
|
{
|
|
|
|
GimpDisplayShell *shell = NULL;
|
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
if (display)
|
|
|
|
shell = GIMP_DISPLAY_SHELL (display->shell);
|
2003-10-11 05:24:12 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_navigation_editor_set_shell (editor, shell);
|
2003-10-11 05:24:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_navigation_editor_set_context (GimpDocked *docked,
|
|
|
|
GimpContext *context)
|
2003-10-11 05:24:12 +08:00
|
|
|
{
|
2004-08-26 00:02:10 +08:00
|
|
|
GimpNavigationEditor *editor = GIMP_NAVIGATION_EDITOR (docked);
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display = NULL;
|
|
|
|
GimpDisplayShell *shell = NULL;
|
2003-10-11 05:24:12 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
if (editor->context)
|
2004-05-23 18:04:41 +08:00
|
|
|
{
|
2004-08-26 00:02:10 +08:00
|
|
|
g_signal_handlers_disconnect_by_func (editor->context,
|
|
|
|
gimp_navigation_editor_context_changed,
|
|
|
|
editor);
|
2004-05-23 18:04:41 +08:00
|
|
|
}
|
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
editor->context = context;
|
2003-10-11 05:24:12 +08:00
|
|
|
|
|
|
|
if (context)
|
|
|
|
{
|
2005-05-28 00:51:39 +08:00
|
|
|
g_signal_connect (context, "display-changed",
|
2004-08-26 00:02:10 +08:00
|
|
|
G_CALLBACK (gimp_navigation_editor_context_changed),
|
|
|
|
editor);
|
2003-10-11 05:24:12 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
display = gimp_context_get_display (context);
|
2003-10-11 05:24:12 +08:00
|
|
|
}
|
|
|
|
|
2006-08-30 05:44:51 +08:00
|
|
|
gimp_view_renderer_set_context (GIMP_VIEW (editor->view)->renderer,
|
|
|
|
context);
|
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
if (display)
|
|
|
|
shell = GIMP_DISPLAY_SHELL (display->shell);
|
2003-10-11 05:24:12 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_navigation_editor_set_shell (editor, shell);
|
2003-10-11 05:24:12 +08:00
|
|
|
}
|
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
/* public functions */
|
2002-05-06 03:17:41 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
GtkWidget *
|
2004-09-26 23:21:44 +08:00
|
|
|
gimp_navigation_editor_new (GimpMenuFactory *menu_factory)
|
2002-05-08 00:23:14 +08:00
|
|
|
{
|
2004-09-26 23:21:44 +08:00
|
|
|
return gimp_navigation_editor_new_private (menu_factory, NULL);
|
2002-05-06 03:17:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_navigation_editor_popup (GimpDisplayShell *shell,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gint click_x,
|
|
|
|
gint click_y)
|
2002-05-06 03:17:41 +08:00
|
|
|
{
|
2004-08-27 08:42:46 +08:00
|
|
|
GimpNavigationEditor *editor;
|
|
|
|
GimpNavigationView *view;
|
|
|
|
GdkScreen *screen;
|
|
|
|
gint x, y;
|
|
|
|
gint x_org, y_org;
|
2002-05-06 03:17:41 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
if (! shell->nav_popup)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
2004-09-26 23:21:44 +08:00
|
|
|
GtkWidget *frame;
|
2002-05-06 03:17:41 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
shell->nav_popup = gtk_window_new (GTK_WINDOW_POPUP);
|
2002-05-06 03:17:41 +08:00
|
|
|
|
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
|
2002-05-08 00:23:14 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (shell->nav_popup), frame);
|
2002-05-06 03:17:41 +08:00
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
editor =
|
2004-09-26 23:21:44 +08:00
|
|
|
GIMP_NAVIGATION_EDITOR (gimp_navigation_editor_new_private (NULL,
|
|
|
|
shell));
|
2004-08-26 00:02:10 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (editor));
|
|
|
|
gtk_widget_show (GTK_WIDGET (editor));
|
2002-05-06 03:17:41 +08:00
|
|
|
|
2005-05-28 00:51:39 +08:00
|
|
|
g_signal_connect (editor->view, "button-release-event",
|
2004-08-26 00:02:10 +08:00
|
|
|
G_CALLBACK (gimp_navigation_editor_button_release),
|
2002-05-08 00:23:14 +08:00
|
|
|
shell);
|
1999-08-13 06:21:04 +08:00
|
|
|
}
|
2002-05-06 03:17:41 +08:00
|
|
|
else
|
|
|
|
{
|
2004-08-26 00:02:10 +08:00
|
|
|
editor = GIMP_NAVIGATION_EDITOR (GTK_BIN (GTK_BIN (shell->nav_popup)->child)->child);
|
2002-05-06 03:17:41 +08:00
|
|
|
}
|
|
|
|
|
2003-11-08 23:29:47 +08:00
|
|
|
screen = gtk_widget_get_screen (widget);
|
|
|
|
|
|
|
|
gtk_window_set_screen (GTK_WINDOW (shell->nav_popup), screen);
|
|
|
|
|
2004-08-27 08:42:46 +08:00
|
|
|
view = GIMP_NAVIGATION_VIEW (editor->view);
|
2002-05-06 03:17:41 +08:00
|
|
|
|
|
|
|
/* decide where to put the popup */
|
|
|
|
gdk_window_get_origin (widget->window, &x_org, &y_org);
|
|
|
|
|
2002-05-10 21:05:09 +08:00
|
|
|
#define BORDER_PEN_WIDTH 3
|
2002-05-08 00:23:14 +08:00
|
|
|
|
|
|
|
x = (x_org + click_x -
|
2004-08-27 08:42:46 +08:00
|
|
|
view->p_x -
|
|
|
|
0.5 * (view->p_width - BORDER_PEN_WIDTH) -
|
2002-05-10 21:05:09 +08:00
|
|
|
2 * widget->style->xthickness);
|
2002-05-06 03:17:41 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
y = (y_org + click_y -
|
2004-08-27 08:42:46 +08:00
|
|
|
view->p_y -
|
|
|
|
0.5 * (view->p_height - BORDER_PEN_WIDTH) -
|
2002-05-10 21:05:09 +08:00
|
|
|
2 * widget->style->ythickness);
|
2002-05-06 03:17:41 +08:00
|
|
|
|
|
|
|
/* If the popup doesn't fit into the screen, we have a problem.
|
|
|
|
* We move the popup onscreen and risk that the pointer is not
|
|
|
|
* in the square representing the viewable area anymore. Moving
|
|
|
|
* the pointer will make the image scroll by a large amount,
|
|
|
|
* but then it works as usual. Probably better than a popup that
|
|
|
|
* is completely unusable in the lower right of the screen.
|
|
|
|
*
|
2003-09-09 19:35:27 +08:00
|
|
|
* Warping the pointer would be another solution ...
|
2002-05-06 03:17:41 +08:00
|
|
|
*/
|
2003-09-09 19:35:27 +08:00
|
|
|
|
|
|
|
x = CLAMP (x, 0, (gdk_screen_get_width (screen) -
|
2004-08-27 08:42:46 +08:00
|
|
|
GIMP_VIEW (view)->renderer->width -
|
2002-05-10 21:05:09 +08:00
|
|
|
4 * widget->style->xthickness));
|
2003-09-09 19:35:27 +08:00
|
|
|
y = CLAMP (y, 0, (gdk_screen_get_height (screen) -
|
2004-08-27 08:42:46 +08:00
|
|
|
GIMP_VIEW (view)->renderer->height -
|
2002-05-10 21:05:09 +08:00
|
|
|
4 * widget->style->ythickness));
|
2002-05-06 03:17:41 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
gtk_window_move (GTK_WINDOW (shell->nav_popup), x, y);
|
|
|
|
gtk_widget_show (shell->nav_popup);
|
2002-05-06 03:17:41 +08:00
|
|
|
|
|
|
|
gdk_flush ();
|
|
|
|
|
|
|
|
/* fill in then grab pointer */
|
2004-08-27 08:42:46 +08:00
|
|
|
view->motion_offset_x = 0.5 * (view->p_width - BORDER_PEN_WIDTH);
|
|
|
|
view->motion_offset_y = 0.5 * (view->p_height - BORDER_PEN_WIDTH);
|
2002-05-06 03:17:41 +08:00
|
|
|
|
2002-05-10 21:05:09 +08:00
|
|
|
#undef BORDER_PEN_WIDTH
|
2002-05-06 03:17:41 +08:00
|
|
|
|
2004-08-27 08:42:46 +08:00
|
|
|
gimp_navigation_view_grab_pointer (view);
|
1999-08-13 06:21:04 +08:00
|
|
|
}
|
|
|
|
|
1999-10-22 03:35:35 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
/* private functions */
|
2000-12-14 21:52:16 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
static GtkWidget *
|
2004-09-26 23:21:44 +08:00
|
|
|
gimp_navigation_editor_new_private (GimpMenuFactory *menu_factory,
|
|
|
|
GimpDisplayShell *shell)
|
2002-05-08 00:23:14 +08:00
|
|
|
{
|
2004-08-26 00:02:10 +08:00
|
|
|
GimpNavigationEditor *editor;
|
2002-05-06 03:17:41 +08:00
|
|
|
|
2004-09-26 23:21:44 +08:00
|
|
|
g_return_val_if_fail (menu_factory == NULL ||
|
|
|
|
GIMP_IS_MENU_FACTORY (menu_factory), NULL);
|
|
|
|
g_return_val_if_fail (shell == NULL || GIMP_IS_DISPLAY_SHELL (shell), NULL);
|
|
|
|
g_return_val_if_fail (menu_factory || shell, NULL);
|
2002-05-06 03:17:41 +08:00
|
|
|
|
2004-09-26 23:21:44 +08:00
|
|
|
if (shell)
|
2002-11-23 06:10:40 +08:00
|
|
|
{
|
2004-09-26 23:21:44 +08:00
|
|
|
GimpDisplayConfig *config;
|
|
|
|
GimpView *view;
|
|
|
|
|
|
|
|
editor = g_object_new (GIMP_TYPE_NAVIGATION_EDITOR, NULL);
|
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
config = GIMP_DISPLAY_CONFIG (shell->display->image->gimp->config);
|
2004-09-26 23:21:44 +08:00
|
|
|
view = GIMP_VIEW (editor->view);
|
2002-11-23 06:10:40 +08:00
|
|
|
|
2004-08-26 06:31:44 +08:00
|
|
|
gimp_view_renderer_set_size (view->renderer,
|
|
|
|
config->nav_preview_size * 3,
|
|
|
|
view->renderer->border_width);
|
2006-08-30 05:44:51 +08:00
|
|
|
gimp_view_renderer_set_context (view->renderer,
|
|
|
|
gimp_get_user_context (shell->display->image->gimp));
|
2004-09-26 23:21:44 +08:00
|
|
|
|
|
|
|
gimp_navigation_editor_set_shell (editor, shell);
|
2006-08-30 05:44:51 +08:00
|
|
|
|
2002-11-23 06:10:40 +08:00
|
|
|
}
|
|
|
|
else
|
2002-05-08 00:23:14 +08:00
|
|
|
{
|
|
|
|
GtkWidget *hscale;
|
2006-08-26 01:04:14 +08:00
|
|
|
GtkWidget *hbox;
|
2002-05-08 00:23:14 +08:00
|
|
|
|
2004-09-26 23:21:44 +08:00
|
|
|
editor = g_object_new (GIMP_TYPE_NAVIGATION_EDITOR,
|
|
|
|
"menu-factory", menu_factory,
|
|
|
|
"menu-identifier", "<NavigationEditor>",
|
|
|
|
NULL);
|
|
|
|
|
2004-08-26 01:54:12 +08:00
|
|
|
gtk_widget_set_size_request (editor->view,
|
2004-08-29 19:58:05 +08:00
|
|
|
GIMP_VIEW_SIZE_HUGE,
|
|
|
|
GIMP_VIEW_SIZE_HUGE);
|
2004-08-26 01:54:12 +08:00
|
|
|
gimp_view_set_expand (GIMP_VIEW (editor->view), TRUE);
|
2003-05-28 23:20:58 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
/* the editor buttons */
|
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
editor->zoom_out_button =
|
2004-09-26 23:21:44 +08:00
|
|
|
gimp_editor_add_action_button (GIMP_EDITOR (editor), "view",
|
|
|
|
"view-zoom-out", NULL);
|
2002-05-08 00:23:14 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
editor->zoom_in_button =
|
2004-09-26 23:21:44 +08:00
|
|
|
gimp_editor_add_action_button (GIMP_EDITOR (editor), "view",
|
|
|
|
"view-zoom-in", NULL);
|
2002-05-08 00:23:14 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
editor->zoom_100_button =
|
2004-09-26 23:21:44 +08:00
|
|
|
gimp_editor_add_action_button (GIMP_EDITOR (editor), "view",
|
|
|
|
"view-zoom-1-1", NULL);
|
2002-05-08 00:23:14 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
editor->zoom_fit_in_button =
|
2004-09-26 23:21:44 +08:00
|
|
|
gimp_editor_add_action_button (GIMP_EDITOR (editor), "view",
|
|
|
|
"view-zoom-fit-in", NULL);
|
2004-06-20 20:09:03 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
editor->zoom_fit_to_button =
|
2004-09-26 23:21:44 +08:00
|
|
|
gimp_editor_add_action_button (GIMP_EDITOR (editor), "view",
|
|
|
|
"view-zoom-fit-to", NULL);
|
2002-05-08 00:23:14 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
editor->shrink_wrap_button =
|
2004-09-26 23:21:44 +08:00
|
|
|
gimp_editor_add_action_button (GIMP_EDITOR (editor), "view",
|
|
|
|
"view-shrink-wrap", NULL);
|
2002-05-08 00:23:14 +08:00
|
|
|
|
|
|
|
/* the zoom scale */
|
|
|
|
|
2006-08-29 16:42:42 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 6);
|
2006-08-26 01:04:14 +08:00
|
|
|
gtk_box_pack_end (GTK_BOX (editor), hbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (hbox);
|
2002-05-08 00:23:14 +08:00
|
|
|
|
2006-08-26 01:04:14 +08:00
|
|
|
editor->zoom_adjustment =
|
|
|
|
GTK_ADJUSTMENT (gtk_adjustment_new (0.0, -8.0, 8.0, 0.5, 1.0, 0.0));
|
|
|
|
|
|
|
|
g_signal_connect (editor->zoom_adjustment, "value-changed",
|
|
|
|
G_CALLBACK (gimp_navigation_editor_zoom_adj_changed),
|
|
|
|
editor);
|
|
|
|
|
|
|
|
hscale = gtk_hscale_new (GTK_ADJUSTMENT (editor->zoom_adjustment));
|
|
|
|
gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_DELAYED);
|
|
|
|
gtk_scale_set_draw_value (GTK_SCALE (hscale), FALSE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), hscale, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (hscale);
|
|
|
|
|
2006-08-29 16:42:42 +08:00
|
|
|
/* the zoom label */
|
|
|
|
|
|
|
|
editor->zoom_label = gtk_label_new ("100%");
|
|
|
|
gtk_label_set_width_chars (GTK_LABEL (editor->zoom_label), 7);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), editor->zoom_label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (editor->zoom_label);
|
2002-05-06 03:17:41 +08:00
|
|
|
}
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2004-08-26 06:31:44 +08:00
|
|
|
gimp_view_renderer_set_background (GIMP_VIEW (editor->view)->renderer,
|
|
|
|
GIMP_STOCK_TEXTURE);
|
2003-04-04 00:13:12 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
return GTK_WIDGET (editor);
|
2001-06-18 21:10:03 +08:00
|
|
|
}
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2004-09-26 23:21:44 +08:00
|
|
|
static void
|
|
|
|
gimp_navigation_editor_set_shell (GimpNavigationEditor *editor,
|
|
|
|
GimpDisplayShell *shell)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_NAVIGATION_EDITOR (editor));
|
|
|
|
g_return_if_fail (! shell || GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
|
|
|
if (shell == editor->shell)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (editor->shell)
|
|
|
|
{
|
|
|
|
g_signal_handlers_disconnect_by_func (editor->shell,
|
|
|
|
gimp_navigation_editor_shell_scaled,
|
|
|
|
editor);
|
|
|
|
g_signal_handlers_disconnect_by_func (editor->shell,
|
|
|
|
gimp_navigation_editor_shell_scrolled,
|
|
|
|
editor);
|
|
|
|
g_signal_handlers_disconnect_by_func (editor->shell,
|
|
|
|
gimp_navigation_editor_shell_reconnect,
|
|
|
|
editor);
|
|
|
|
}
|
|
|
|
else if (shell)
|
|
|
|
{
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
editor->shell = shell;
|
|
|
|
|
|
|
|
if (editor->shell)
|
|
|
|
{
|
|
|
|
gimp_view_set_viewable (GIMP_VIEW (editor->view),
|
2006-03-29 01:55:52 +08:00
|
|
|
GIMP_VIEWABLE (shell->display->image));
|
2004-09-26 23:21:44 +08:00
|
|
|
|
|
|
|
g_signal_connect (editor->shell, "scaled",
|
|
|
|
G_CALLBACK (gimp_navigation_editor_shell_scaled),
|
|
|
|
editor);
|
|
|
|
g_signal_connect (editor->shell, "scrolled",
|
|
|
|
G_CALLBACK (gimp_navigation_editor_shell_scrolled),
|
|
|
|
editor);
|
|
|
|
g_signal_connect (editor->shell, "reconnect",
|
|
|
|
G_CALLBACK (gimp_navigation_editor_shell_reconnect),
|
|
|
|
editor);
|
|
|
|
|
|
|
|
gimp_navigation_editor_shell_scaled (editor->shell, editor);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_view_set_viewable (GIMP_VIEW (editor->view), NULL);
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GIMP_EDITOR (editor)->ui_manager)
|
|
|
|
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
|
|
|
|
GIMP_EDITOR (editor)->popup_data);
|
|
|
|
}
|
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
static gboolean
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_navigation_editor_button_release (GtkWidget *widget,
|
|
|
|
GdkEventButton *bevent,
|
|
|
|
GimpDisplayShell *shell)
|
2001-06-18 21:10:03 +08:00
|
|
|
{
|
2002-05-08 00:23:14 +08:00
|
|
|
if (bevent->button == 1)
|
2001-06-18 21:10:03 +08:00
|
|
|
{
|
2002-05-08 00:23:14 +08:00
|
|
|
gtk_widget_hide (shell->nav_popup);
|
2001-06-18 21:10:03 +08:00
|
|
|
}
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
return FALSE;
|
1999-08-13 06:21:04 +08:00
|
|
|
}
|
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
static void
|
2004-08-27 08:42:46 +08:00
|
|
|
gimp_navigation_editor_marker_changed (GimpNavigationView *view,
|
|
|
|
gdouble x,
|
|
|
|
gdouble y,
|
|
|
|
GimpNavigationEditor *editor)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
2004-08-26 00:02:10 +08:00
|
|
|
if (editor->shell)
|
2001-06-18 21:10:03 +08:00
|
|
|
{
|
2002-05-08 00:23:14 +08:00
|
|
|
gdouble xratio;
|
|
|
|
gdouble yratio;
|
|
|
|
gint xoffset;
|
|
|
|
gint yoffset;
|
Honest, guv, it's not a feature - it's a tightly integrated package of
Mon Sep 20 12:51:30 EDT 1999 Austin Donnelly <austin@gimp.org>
Honest, guv, it's not a feature - it's a tightly integrated
package of undo system cleanups and fixes.
NEW FILES:
* app/undo_history.c: window showing recent undo (and redo) steps
available.
* app/undo_types.h: broken out of undo.h to fix circular includes.
MODIFIED FILES:
* app/Makefile.am: compile undo_history.c
* app/channel.h: use enum for channel undo type, not just magic
numbers.
* app/layer.h: same for layer undos.
* app/commands.c: edit_show_undo_history_cmd_callback() function to
pull up undo history window.
* app/commands.h: prototype for above.
* app/gdisplay.c: make undo / redo menu items sensitive according
to whether they would do anything. Would be easy to change
the text to say what would be undone/redone, but I don't know
the GTK.
* app/gimpimage.c: new signal emitted by gimage:
UNDO_EVENT. gimp_image_undo_event() function to emit it.
* app/gimpimage.h: prototype for above.
* app/gimpimageP.h: pushing_undo_group member is now an undo_type,
not an int. Keep undo history widget here too (if created).
* app/menus.c: add "Edit/Undo history..." to image menu.
* app/undo.c: new types: enums undo_type and undo_state rather than
ints and magic numbers. All undo_pop_* and undo_free_*
functions made static. New static function
undo_type_to_name(). Issue undo event signals on various
important events (eg undo pushed, undo popped etc).
undo_push() now takes a "dirties_image" arg to say whether
image should be dirtied. Layer moves now dirty the image. A
couple of g_return_if_fails () on undo_pop and undo_redo to
assert we're not in the middle of an undo group.
undo_get_{undo,redo}_name() to peek at names of top items on
undo and redo stacks resp. undo_map_over_{undo,redo}_stack()
to run a function for each item or group on stack. Layer and
channel undos use symbolic names rather than 0 or 1. Array
mapping undo types to names.
* app/undo.h: split out undo types to undo_types.h. Prototypes
for functions described above. undo_event_t enum.
undo_history_new() prototype lives here too.
Random other fixes:
* app/gimpdrawable.c
* app/image_render.c: default labels in switches to keep egcs happy.
* app/nav_window.c: some fixes to (sort of) cope with image res !=
screen res. Still needs work to handle non-square pixels
properly.
* app/paths_dialog.c: bad idea to call gimp_image_dirty()
directly. Even though it's currently commented out.
1999-09-21 01:15:20 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
xratio = SCALEFACTOR_X (editor->shell);
|
|
|
|
yratio = SCALEFACTOR_Y (editor->shell);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
xoffset = RINT (x * xratio - editor->shell->offset_x);
|
|
|
|
yoffset = RINT (y * yratio - editor->shell->offset_y);
|
1999-08-24 06:47:36 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_display_shell_scroll (editor->shell, xoffset, yoffset);
|
2002-05-06 03:17:41 +08:00
|
|
|
}
|
2002-05-08 00:23:14 +08:00
|
|
|
}
|
2002-05-06 03:17:41 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
static void
|
2004-08-27 08:42:46 +08:00
|
|
|
gimp_navigation_editor_zoom (GimpNavigationView *view,
|
|
|
|
GimpZoomType direction,
|
|
|
|
GimpNavigationEditor *editor)
|
2002-05-08 00:23:14 +08:00
|
|
|
{
|
2004-01-30 06:22:29 +08:00
|
|
|
g_return_if_fail (direction != GIMP_ZOOM_TO);
|
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
if (editor->shell)
|
2002-05-06 03:17:41 +08:00
|
|
|
{
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_display_shell_scale (editor->shell, direction, 0.0);
|
2002-05-06 03:17:41 +08:00
|
|
|
}
|
1999-08-13 06:21:04 +08:00
|
|
|
}
|
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
static void
|
2004-08-27 08:42:46 +08:00
|
|
|
gimp_navigation_editor_scroll (GimpNavigationView *view,
|
|
|
|
GdkScrollDirection direction,
|
|
|
|
GimpNavigationEditor *editor)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
2004-08-26 00:02:10 +08:00
|
|
|
if (editor->shell)
|
2002-05-08 00:23:14 +08:00
|
|
|
{
|
|
|
|
GtkAdjustment *adj = NULL;
|
|
|
|
gdouble value;
|
2000-12-15 06:29:49 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
switch (direction)
|
|
|
|
{
|
|
|
|
case GDK_SCROLL_LEFT:
|
|
|
|
case GDK_SCROLL_RIGHT:
|
2004-08-26 00:02:10 +08:00
|
|
|
adj = editor->shell->hsbdata;
|
2002-05-08 00:23:14 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_SCROLL_UP:
|
|
|
|
case GDK_SCROLL_DOWN:
|
2004-08-26 00:02:10 +08:00
|
|
|
adj = editor->shell->vsbdata;
|
2002-05-08 00:23:14 +08:00
|
|
|
break;
|
|
|
|
}
|
1999-08-28 03:07:21 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
g_assert (adj != NULL);
|
2000-12-15 23:54:17 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
value = adj->value;
|
2001-11-01 05:18:57 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
switch (direction)
|
|
|
|
{
|
|
|
|
case GDK_SCROLL_LEFT:
|
|
|
|
case GDK_SCROLL_UP:
|
|
|
|
value -= adj->page_increment / 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_SCROLL_RIGHT:
|
|
|
|
case GDK_SCROLL_DOWN:
|
|
|
|
value += adj->page_increment / 2;
|
|
|
|
break;
|
|
|
|
}
|
2000-12-15 23:54:17 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
value = CLAMP (value, adj->lower, adj->upper - adj->page_size);
|
1999-10-21 06:15:13 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
gtk_adjustment_set_value (adj, value);
|
|
|
|
}
|
2002-05-06 03:17:41 +08:00
|
|
|
}
|
2000-12-14 21:52:16 +08:00
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
static void
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_navigation_editor_zoom_adj_changed (GtkAdjustment *adj,
|
|
|
|
GimpNavigationEditor *editor)
|
2002-05-06 03:17:41 +08:00
|
|
|
{
|
2005-09-26 01:03:03 +08:00
|
|
|
gimp_display_shell_scale (editor->shell, GIMP_ZOOM_TO, pow (2.0, adj->value));
|
2002-05-06 03:17:41 +08:00
|
|
|
}
|
1999-10-21 06:15:13 +08:00
|
|
|
|
1999-08-28 03:07:21 +08:00
|
|
|
static void
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_navigation_editor_shell_scaled (GimpDisplayShell *shell,
|
|
|
|
GimpNavigationEditor *editor)
|
1999-08-28 03:07:21 +08:00
|
|
|
{
|
2004-08-26 00:02:10 +08:00
|
|
|
if (editor->zoom_label)
|
1999-08-28 03:07:21 +08:00
|
|
|
{
|
2005-09-26 01:03:03 +08:00
|
|
|
gchar *str;
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2005-09-26 01:03:03 +08:00
|
|
|
g_object_get (shell->zoom,
|
|
|
|
"percentage", &str,
|
|
|
|
NULL);
|
|
|
|
gtk_label_set_text (GTK_LABEL (editor->zoom_label), str);
|
|
|
|
g_free (str);
|
2001-06-18 21:10:03 +08:00
|
|
|
}
|
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
if (editor->zoom_adjustment)
|
2002-05-08 00:23:14 +08:00
|
|
|
{
|
2004-01-30 06:22:29 +08:00
|
|
|
gdouble val;
|
2004-09-26 23:21:44 +08:00
|
|
|
|
2005-09-26 01:03:03 +08:00
|
|
|
val = log (gimp_zoom_model_get_factor (shell->zoom)) / G_LN2;
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
g_signal_handlers_block_by_func (editor->zoom_adjustment,
|
|
|
|
gimp_navigation_editor_zoom_adj_changed,
|
|
|
|
editor);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
gtk_adjustment_set_value (editor->zoom_adjustment, val);
|
1999-11-20 08:46:58 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
g_signal_handlers_unblock_by_func (editor->zoom_adjustment,
|
|
|
|
gimp_navigation_editor_zoom_adj_changed,
|
|
|
|
editor);
|
2002-05-08 00:23:14 +08:00
|
|
|
}
|
1999-11-20 08:46:58 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_navigation_editor_update_marker (editor);
|
2004-09-26 23:21:44 +08:00
|
|
|
|
|
|
|
if (GIMP_EDITOR (editor)->ui_manager)
|
|
|
|
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
|
|
|
|
GIMP_EDITOR (editor)->popup_data);
|
1999-11-20 08:46:58 +08:00
|
|
|
}
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
static void
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_navigation_editor_shell_scrolled (GimpDisplayShell *shell,
|
|
|
|
GimpNavigationEditor *editor)
|
1999-11-20 08:46:58 +08:00
|
|
|
{
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_navigation_editor_update_marker (editor);
|
2004-09-26 23:21:44 +08:00
|
|
|
|
|
|
|
if (GIMP_EDITOR (editor)->ui_manager)
|
|
|
|
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
|
|
|
|
GIMP_EDITOR (editor)->popup_data);
|
1999-08-13 06:21:04 +08:00
|
|
|
}
|
|
|
|
|
2002-09-28 00:17:31 +08:00
|
|
|
static void
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_navigation_editor_shell_reconnect (GimpDisplayShell *shell,
|
|
|
|
GimpNavigationEditor *editor)
|
2002-09-28 00:17:31 +08:00
|
|
|
{
|
2004-08-26 01:54:12 +08:00
|
|
|
gimp_view_set_viewable (GIMP_VIEW (editor->view),
|
2006-03-29 01:55:52 +08:00
|
|
|
GIMP_VIEWABLE (shell->display->image));
|
2004-09-26 23:21:44 +08:00
|
|
|
|
|
|
|
if (GIMP_EDITOR (editor)->ui_manager)
|
|
|
|
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
|
|
|
|
GIMP_EDITOR (editor)->popup_data);
|
2002-09-28 00:17:31 +08:00
|
|
|
}
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
static void
|
2004-08-26 00:02:10 +08:00
|
|
|
gimp_navigation_editor_update_marker (GimpNavigationEditor *editor)
|
1999-09-02 06:39:44 +08:00
|
|
|
{
|
2004-08-26 06:31:44 +08:00
|
|
|
GimpViewRenderer *renderer;
|
|
|
|
gdouble xratio;
|
|
|
|
gdouble yratio;
|
2003-04-11 19:18:12 +08:00
|
|
|
|
2004-08-26 01:54:12 +08:00
|
|
|
renderer = GIMP_VIEW (editor->view)->renderer;
|
2000-02-19 21:19:08 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
xratio = SCALEFACTOR_X (editor->shell);
|
|
|
|
yratio = SCALEFACTOR_Y (editor->shell);
|
1999-09-05 06:27:20 +08:00
|
|
|
|
2004-08-26 00:02:10 +08:00
|
|
|
if (renderer->dot_for_dot != editor->shell->dot_for_dot)
|
2004-08-26 06:31:44 +08:00
|
|
|
gimp_view_renderer_set_dot_for_dot (renderer,
|
|
|
|
editor->shell->dot_for_dot);
|
1999-09-05 06:27:20 +08:00
|
|
|
|
2004-08-27 08:42:46 +08:00
|
|
|
gimp_navigation_view_set_marker (GIMP_NAVIGATION_VIEW (editor->view),
|
|
|
|
editor->shell->offset_x / xratio,
|
|
|
|
editor->shell->offset_y / yratio,
|
|
|
|
editor->shell->disp_width / xratio,
|
|
|
|
editor->shell->disp_height / yratio);
|
1999-09-05 06:27:20 +08:00
|
|
|
}
|