1999-08-13 06:21:04 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* 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"
|
|
|
|
|
1999-08-24 06:47:36 +08:00
|
|
|
#include <stdlib.h>
|
1999-10-27 02:27:27 +08:00
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include <gtk/gtk.h>
|
2000-04-28 01:27:28 +08:00
|
|
|
#include <gdk/gdkkeysyms.h>
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
#include "widgets/widgets-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-05-15 19:25:25 +08:00
|
|
|
#include "base/temp-buf.h"
|
|
|
|
|
2001-07-05 03:31:35 +08:00
|
|
|
#include "core/gimp.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpcontainer.h"
|
|
|
|
#include "core/gimpcontext.h"
|
|
|
|
#include "core/gimpimage.h"
|
2001-06-18 21:10:03 +08:00
|
|
|
#include "core/gimplist.h"
|
|
|
|
|
2002-04-15 01:28:58 +08:00
|
|
|
#include "file/file-utils.h"
|
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
2001-10-13 20:52:30 +08:00
|
|
|
#include "display/gimpdisplay-foreach.h"
|
2001-11-01 05:18:57 +08:00
|
|
|
#include "display/gimpdisplayshell.h"
|
2001-11-02 17:31:21 +08:00
|
|
|
#include "display/gimpdisplayshell-scroll.h"
|
|
|
|
#include "display/gimpdisplayshell-scale.h"
|
2001-09-26 07:23:09 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
#include "widgets/gimpnavigationpreview.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2001-07-05 03:31:35 +08:00
|
|
|
#include "app_procs.h"
|
1999-09-05 06:27:20 +08:00
|
|
|
#include "gimprc.h"
|
2002-05-06 03:17:41 +08:00
|
|
|
#include "nav_window.h"
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2000-04-28 01:27:28 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
#define BORDER_PEN_WIDTH 3
|
|
|
|
#define MAX_SCALE_BUF 20
|
1999-08-28 03:07:21 +08:00
|
|
|
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
struct _NavigationDialog
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
GtkWidget *shell;
|
1999-08-28 03:07:21 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
GtkWidget *preview;
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
GtkWidget *zoom_label;
|
|
|
|
GtkObject *zoom_adjustment;
|
|
|
|
GimpDisplayShell *disp_shell;
|
1999-08-24 06:47:36 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
gboolean block_adj_sig;
|
|
|
|
gboolean frozen;
|
|
|
|
};
|
2001-06-18 21:10:03 +08:00
|
|
|
|
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
static NavigationDialog * nav_dialog_new (GimpDisplayShell *shell);
|
|
|
|
|
|
|
|
static gchar * nav_dialog_title (GimpDisplayShell *shell);
|
|
|
|
static GtkWidget * nav_dialog_create_preview (NavigationDialog *nav_dialog,
|
|
|
|
GimpImage *gimage);
|
|
|
|
static void nav_dialog_update_marker (NavigationDialog *nav_dialog);
|
|
|
|
static void nav_dialog_close_callback (GtkWidget *widget,
|
|
|
|
NavigationDialog *nav_dialog);
|
|
|
|
static void nav_dialog_marker_changed (GimpNavigationPreview *preview,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
NavigationDialog *nav_dialog);
|
|
|
|
static void nav_dialog_zoom (GimpNavigationPreview *preview,
|
|
|
|
GimpZoomType direction,
|
|
|
|
NavigationDialog *nav_dialog);
|
|
|
|
static void nav_dialog_scroll (GimpNavigationPreview *preview,
|
|
|
|
GdkScrollDirection direction,
|
|
|
|
NavigationDialog *nav_dialog);
|
|
|
|
static gboolean nav_dialog_button_release (GtkWidget *widget,
|
|
|
|
GdkEventButton *bevent,
|
|
|
|
NavigationDialog *nav_dialog);
|
|
|
|
static void nav_dialog_zoom_in (GtkWidget *widget,
|
|
|
|
NavigationDialog *nav_dialog);
|
|
|
|
static void nav_dialog_zoom_out (GtkWidget *widget,
|
|
|
|
NavigationDialog *nav_dialog);
|
|
|
|
static void nav_dialog_zoom_adj_changed (GtkAdjustment *adj,
|
|
|
|
NavigationDialog *nav_dialog);
|
|
|
|
static void nav_dialog_display_changed (GimpContext *context,
|
|
|
|
GimpDisplay *gdisp,
|
|
|
|
NavigationDialog *nav_dialog);
|
2001-06-18 21:10:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
static NavigationDialog *nav_window_auto = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
NavigationDialog *
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_create (GimpDisplayShell *shell)
|
2001-06-18 21:10:03 +08:00
|
|
|
{
|
|
|
|
NavigationDialog *nav_dialog;
|
|
|
|
GtkWidget *abox;
|
2002-05-06 03:17:41 +08:00
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *image;
|
|
|
|
GtkWidget *hscale;
|
2001-06-18 21:10:03 +08:00
|
|
|
gchar *title;
|
2002-05-06 03:17:41 +08:00
|
|
|
gchar scale_str[MAX_SCALE_BUF];
|
1999-10-21 06:15:13 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
title = nav_dialog_title (shell);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog = nav_dialog_new (shell);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
nav_dialog->shell = gimp_dialog_new (title, "navigation_dialog",
|
|
|
|
gimp_standard_help_func,
|
|
|
|
"dialogs/navigation_window.html",
|
|
|
|
GTK_WIN_POS_MOUSE,
|
|
|
|
FALSE, TRUE, TRUE,
|
1999-08-28 03:07:21 +08:00
|
|
|
|
2001-08-01 17:33:12 +08:00
|
|
|
"_delete_event_",
|
|
|
|
nav_dialog_close_callback,
|
2001-06-18 21:10:03 +08:00
|
|
|
nav_dialog, NULL, NULL, TRUE, TRUE,
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
g_free (title);
|
|
|
|
|
2001-08-01 17:33:12 +08:00
|
|
|
gtk_dialog_set_has_separator (GTK_DIALOG (nav_dialog->shell), FALSE);
|
2001-06-18 21:10:03 +08:00
|
|
|
gtk_widget_hide (GTK_DIALOG (nav_dialog->shell)->action_area);
|
|
|
|
|
2001-08-01 17:33:12 +08:00
|
|
|
g_object_weak_ref (G_OBJECT (nav_dialog->shell),
|
2001-08-30 01:48:28 +08:00
|
|
|
(GWeakNotify) g_free,
|
2001-08-01 17:33:12 +08:00
|
|
|
nav_dialog);
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
/* the preview */
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (nav_dialog->shell)->vbox), abox,
|
|
|
|
TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (abox);
|
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
|
|
|
gtk_container_add (GTK_CONTAINER (abox), frame);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
nav_dialog->preview = nav_dialog_create_preview (nav_dialog,
|
|
|
|
shell->gdisp->gimage);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), nav_dialog->preview);
|
|
|
|
gtk_widget_show (nav_dialog->preview);
|
|
|
|
|
|
|
|
nav_dialog_update_marker (nav_dialog);
|
|
|
|
|
|
|
|
/* the zoom scale */
|
|
|
|
|
|
|
|
nav_dialog->zoom_adjustment =
|
|
|
|
gtk_adjustment_new (0.0, -15.0, 16.0, 1.0, 1.0, 1.0);
|
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (nav_dialog->zoom_adjustment), "value_changed",
|
|
|
|
G_CALLBACK (nav_dialog_zoom_adj_changed),
|
|
|
|
nav_dialog);
|
|
|
|
|
|
|
|
hscale = gtk_hscale_new (GTK_ADJUSTMENT (nav_dialog->zoom_adjustment));
|
|
|
|
gtk_scale_set_draw_value (GTK_SCALE (hscale), FALSE);
|
|
|
|
gtk_scale_set_digits (GTK_SCALE (hscale), 0);
|
|
|
|
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (nav_dialog->shell)->vbox), hscale,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (hscale);
|
|
|
|
|
|
|
|
/* the zoom buttons */
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (nav_dialog->shell)->vbox), hbox,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
button = gtk_button_new ();
|
|
|
|
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
image = gtk_image_new_from_stock (GTK_STOCK_ZOOM_OUT, GTK_ICON_SIZE_MENU);
|
|
|
|
gtk_container_add (GTK_CONTAINER (button), image);
|
|
|
|
gtk_widget_show (image);
|
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (button), "clicked",
|
|
|
|
G_CALLBACK (nav_dialog_zoom_out),
|
|
|
|
nav_dialog);
|
|
|
|
|
|
|
|
/* user zoom ratio */
|
|
|
|
g_snprintf (scale_str, sizeof (scale_str), "%d:%d",
|
|
|
|
SCALEDEST (nav_dialog->disp_shell->gdisp),
|
|
|
|
SCALESRC (nav_dialog->disp_shell->gdisp));
|
|
|
|
|
|
|
|
nav_dialog->zoom_label = gtk_label_new (scale_str);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), nav_dialog->zoom_label, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (nav_dialog->zoom_label);
|
|
|
|
|
|
|
|
button = gtk_button_new ();
|
|
|
|
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
image = gtk_image_new_from_stock (GTK_STOCK_ZOOM_IN, GTK_ICON_SIZE_MENU);
|
|
|
|
gtk_container_add (GTK_CONTAINER (button), image);
|
|
|
|
gtk_widget_show (image);
|
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (button), "clicked",
|
|
|
|
G_CALLBACK (nav_dialog_zoom_in),
|
|
|
|
nav_dialog);
|
|
|
|
|
|
|
|
return nav_dialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nav_dialog_create_popup (GimpDisplayShell *shell,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gint button_x,
|
|
|
|
gint button_y)
|
|
|
|
{
|
|
|
|
NavigationDialog *nav_dialog;
|
|
|
|
GimpNavigationPreview *preview;
|
|
|
|
gint x, y;
|
|
|
|
gint x_org, y_org;
|
|
|
|
gint scr_w, scr_h;
|
|
|
|
|
|
|
|
if (! shell->nav_popup)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *preview_frame;
|
2001-08-01 17:33:12 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
shell->nav_popup = nav_dialog = nav_dialog_new (shell);
|
|
|
|
|
|
|
|
nav_dialog->shell = gtk_window_new (GTK_WINDOW_POPUP);
|
|
|
|
|
|
|
|
g_object_weak_ref (G_OBJECT (nav_dialog->shell),
|
|
|
|
(GWeakNotify) g_free,
|
2001-07-25 08:27:41 +08:00
|
|
|
nav_dialog);
|
2002-05-06 03:17:41 +08:00
|
|
|
|
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
|
|
|
|
gtk_container_add (GTK_CONTAINER (nav_dialog->shell), frame);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
preview_frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (preview_frame), GTK_SHADOW_IN);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), preview_frame);
|
|
|
|
gtk_widget_show (preview_frame);
|
|
|
|
|
|
|
|
nav_dialog->preview = nav_dialog_create_preview (nav_dialog,
|
|
|
|
shell->gdisp->gimage);
|
|
|
|
gtk_container_add (GTK_CONTAINER (preview_frame), nav_dialog->preview);
|
|
|
|
gtk_widget_show (nav_dialog->preview);
|
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (nav_dialog->preview), "button_release_event",
|
|
|
|
G_CALLBACK (nav_dialog_button_release),
|
|
|
|
nav_dialog);
|
1999-08-13 06:21:04 +08:00
|
|
|
}
|
2002-05-06 03:17:41 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
nav_dialog = shell->nav_popup;
|
|
|
|
|
|
|
|
gtk_widget_hide (nav_dialog->shell);
|
|
|
|
}
|
|
|
|
|
|
|
|
nav_dialog_update_marker (nav_dialog);
|
|
|
|
|
|
|
|
preview = GIMP_NAVIGATION_PREVIEW (nav_dialog->preview);
|
|
|
|
|
|
|
|
/* decide where to put the popup */
|
|
|
|
gdk_window_get_origin (widget->window, &x_org, &y_org);
|
|
|
|
|
|
|
|
scr_w = gdk_screen_width ();
|
|
|
|
scr_h = gdk_screen_height ();
|
|
|
|
|
|
|
|
x = (x_org + button_x -
|
|
|
|
preview->p_x -
|
|
|
|
((preview->p_width - BORDER_PEN_WIDTH + 1) * 0.5) - 2);
|
|
|
|
|
|
|
|
y = (y_org + button_y -
|
|
|
|
preview->p_y -
|
|
|
|
((preview->p_height - BORDER_PEN_WIDTH + 1) * 0.5) - 2);
|
|
|
|
|
|
|
|
/* 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.
|
|
|
|
*
|
|
|
|
* Warping the pointer would be another solution ...
|
|
|
|
*/
|
|
|
|
x = (x < 0) ? 0 : x;
|
|
|
|
y = (y < 0) ? 0 : y;
|
|
|
|
x = (x + preview->p_width > scr_w) ? scr_w - preview->p_width - 2 : x;
|
|
|
|
y = (y + preview->p_height > scr_h) ? scr_h - preview->p_height - 2 : y;
|
|
|
|
|
|
|
|
gtk_window_move (GTK_WINDOW (nav_dialog->shell), x, y);
|
|
|
|
gtk_widget_show (nav_dialog->shell);
|
|
|
|
|
|
|
|
gdk_flush ();
|
|
|
|
|
|
|
|
/* fill in then grab pointer */
|
|
|
|
preview->motion_offset_x =
|
|
|
|
(preview->p_width - BORDER_PEN_WIDTH + 1) * 0.5;
|
|
|
|
|
|
|
|
preview->motion_offset_y =
|
|
|
|
(preview->p_height - BORDER_PEN_WIDTH + 1) * 0.5;
|
|
|
|
|
|
|
|
gimp_navigation_preview_grab_pointer (preview);
|
1999-08-13 06:21:04 +08:00
|
|
|
}
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
void
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_free (GimpDisplayShell *del_shell,
|
2001-06-18 21:10:03 +08:00
|
|
|
NavigationDialog *nav_dialog)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
2001-06-18 21:10:03 +08:00
|
|
|
/* So this functions works both ways..
|
|
|
|
* it will come in here with nav_dialog == null
|
|
|
|
* if the auto mode is on...
|
|
|
|
*/
|
1999-10-22 03:35:35 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
if (nav_dialog)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
gtk_widget_destroy (nav_dialog->shell);
|
2001-06-18 21:10:03 +08:00
|
|
|
}
|
2002-05-06 03:17:41 +08:00
|
|
|
else if (nav_window_auto)
|
2000-12-14 21:52:16 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
GimpDisplay *gdisp = NULL;
|
|
|
|
GList *list;
|
2000-12-14 21:52:16 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
/* Only freeze if we are displaying the image we have deleted */
|
|
|
|
if (nav_window_auto->disp_shell != del_shell)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (list = GIMP_LIST (the_gimp->images)->list;
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
|
|
|
gdisp = gdisplays_check_valid (NULL, GIMP_IMAGE (list->data));
|
|
|
|
|
|
|
|
if (gdisp)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gdisp)
|
|
|
|
{
|
|
|
|
nav_dialog_display_changed (NULL, gdisp, nav_window_auto);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Clear window and freeze */
|
|
|
|
nav_window_auto->frozen = TRUE;
|
|
|
|
gtk_window_set_title (GTK_WINDOW (nav_window_auto->shell),
|
|
|
|
_("Navigation: No Image"));
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (nav_window_auto->shell, FALSE);
|
|
|
|
nav_window_auto->disp_shell = NULL;
|
|
|
|
gtk_widget_hide (GTK_WIDGET (nav_window_auto->shell));
|
|
|
|
}
|
|
|
|
}
|
1999-08-13 06:21:04 +08:00
|
|
|
}
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
void
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_show (NavigationDialog *nav_dialog)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
g_return_if_fail (nav_dialog != NULL);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
if (! GTK_WIDGET_VISIBLE (nav_dialog->shell))
|
|
|
|
{
|
|
|
|
gtk_widget_show (nav_dialog->shell);
|
|
|
|
}
|
2002-05-06 03:17:41 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
gdk_window_raise (nav_dialog->shell->window);
|
|
|
|
}
|
2001-06-18 21:10:03 +08:00
|
|
|
}
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
void
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_show_auto (Gimp *gimp)
|
2001-06-18 21:10:03 +08:00
|
|
|
{
|
|
|
|
GimpContext *context;
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpDisplay *gdisp;
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
context = gimp_get_user_context (gimp);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
gdisp = gimp_context_get_display (context);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
if (! gdisp)
|
|
|
|
return;
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
if (! nav_window_auto)
|
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_window_auto = nav_dialog_create (GIMP_DISPLAY_SHELL (gdisp->shell));
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-08-01 17:33:12 +08:00
|
|
|
g_signal_connect (G_OBJECT (context), "display_changed",
|
|
|
|
G_CALLBACK (nav_dialog_display_changed),
|
|
|
|
nav_window_auto);
|
2001-06-18 21:10:03 +08:00
|
|
|
}
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_show (nav_window_auto);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
gtk_widget_set_sensitive (nav_window_auto->shell, TRUE);
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
nav_window_auto->frozen = FALSE;
|
1999-08-13 06:21:04 +08:00
|
|
|
}
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
void
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_update (NavigationDialog *nav_dialog)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
2001-06-18 21:10:03 +08:00
|
|
|
/* So this functions works both ways..
|
|
|
|
* it will come in here with info_win == null
|
|
|
|
* if the auto mode is on...
|
|
|
|
*/
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
if (! nav_dialog)
|
2001-06-18 21:10:03 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
if (nav_window_auto && ! nav_window_auto->frozen)
|
|
|
|
{
|
|
|
|
nav_dialog_update (nav_window_auto);
|
|
|
|
}
|
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
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
return;
|
1999-08-24 06:47:36 +08:00
|
|
|
}
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
if (! GTK_WIDGET_VISIBLE (nav_dialog->shell))
|
|
|
|
return;
|
1999-08-24 06:47:36 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
if (nav_dialog->zoom_label)
|
|
|
|
{
|
|
|
|
gchar scale_str[MAX_SCALE_BUF];
|
|
|
|
|
|
|
|
/* Update the zoom scale string */
|
|
|
|
g_snprintf (scale_str, sizeof (scale_str), "%d:%d",
|
|
|
|
SCALEDEST (nav_dialog->disp_shell->gdisp),
|
|
|
|
SCALESRC (nav_dialog->disp_shell->gdisp));
|
|
|
|
|
|
|
|
gtk_label_set_text (GTK_LABEL (nav_dialog->zoom_label), scale_str);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nav_dialog->zoom_adjustment)
|
|
|
|
{
|
|
|
|
GtkAdjustment *adj;
|
|
|
|
gdouble f;
|
|
|
|
gdouble val;
|
|
|
|
|
|
|
|
adj = GTK_ADJUSTMENT (nav_dialog->zoom_adjustment);
|
1999-08-24 06:47:36 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
f = (((gdouble) SCALEDEST (nav_dialog->disp_shell->gdisp)) /
|
|
|
|
((gdouble) SCALESRC (nav_dialog->disp_shell->gdisp)));
|
|
|
|
|
|
|
|
if (f < 1.0)
|
|
|
|
val = -1.0 / f;
|
|
|
|
else
|
|
|
|
val = f;
|
1999-08-24 06:47:36 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
if (abs ((gint) adj->value) != (gint) (val - 1) &&
|
|
|
|
! nav_dialog->block_adj_sig)
|
|
|
|
{
|
|
|
|
adj->value = val;
|
|
|
|
|
|
|
|
gtk_adjustment_changed (GTK_ADJUSTMENT (nav_dialog->zoom_adjustment));
|
|
|
|
}
|
|
|
|
}
|
1999-10-21 06:15:13 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_update_marker (nav_dialog);
|
1999-08-13 06:21:04 +08:00
|
|
|
}
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
void
|
|
|
|
nav_dialog_preview_resized (NavigationDialog *nav_dialog)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
2001-06-18 21:10:03 +08:00
|
|
|
if (! nav_dialog)
|
|
|
|
return;
|
2002-05-06 03:17:41 +08:00
|
|
|
}
|
1999-08-21 07:20:23 +08:00
|
|
|
|
2000-12-15 06:29:49 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
/* private functions */
|
1999-08-28 03:07:21 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
static NavigationDialog *
|
|
|
|
nav_dialog_new (GimpDisplayShell *shell)
|
2001-06-18 21:10:03 +08:00
|
|
|
{
|
|
|
|
NavigationDialog *nav_dialog;
|
2000-12-15 23:54:17 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog = g_new0 (NavigationDialog, 1);
|
2001-11-01 05:18:57 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog->shell = NULL;
|
|
|
|
nav_dialog->preview = NULL;
|
|
|
|
nav_dialog->zoom_label = NULL;
|
|
|
|
nav_dialog->zoom_adjustment = NULL;
|
|
|
|
nav_dialog->disp_shell = shell;
|
2000-12-15 23:54:17 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog->block_adj_sig = FALSE;
|
|
|
|
nav_dialog->frozen = FALSE;
|
1999-10-21 06:15:13 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
return nav_dialog;
|
|
|
|
}
|
2000-12-14 21:52:16 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
static gchar *
|
|
|
|
nav_dialog_title (GimpDisplayShell *shell)
|
|
|
|
{
|
|
|
|
gchar *basename;
|
|
|
|
gchar *title;
|
1999-10-21 06:15:13 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
basename = file_utils_uri_to_utf8_basename (gimp_image_get_uri (shell->gdisp->gimage));
|
1999-10-21 06:15:13 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
title = g_strdup_printf (_("Navigation: %s-%d.%d"),
|
|
|
|
basename,
|
|
|
|
gimp_image_get_ID (shell->gdisp->gimage),
|
|
|
|
shell->gdisp->instance);
|
2000-12-14 21:52:16 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
g_free (basename);
|
1999-10-21 06:15:13 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
return title;
|
|
|
|
}
|
1999-10-21 06:15:13 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
static GtkWidget *
|
|
|
|
nav_dialog_create_preview (NavigationDialog *nav_dialog,
|
|
|
|
GimpImage *gimage)
|
2001-06-18 21:10:03 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
GtkWidget *preview;
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
preview = gimp_navigation_preview_new (gimage, gimprc.nav_preview_size);
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
g_signal_connect (G_OBJECT (preview), "marker_changed",
|
|
|
|
G_CALLBACK (nav_dialog_marker_changed),
|
|
|
|
nav_dialog);
|
|
|
|
g_signal_connect (G_OBJECT (preview), "zoom",
|
|
|
|
G_CALLBACK (nav_dialog_zoom),
|
|
|
|
nav_dialog);
|
|
|
|
g_signal_connect (G_OBJECT (preview), "scroll",
|
|
|
|
G_CALLBACK (nav_dialog_scroll),
|
|
|
|
nav_dialog);
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
return preview;
|
2001-06-18 21:10:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_update_marker (NavigationDialog *nav_dialog)
|
2001-06-18 21:10:03 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
GimpImage *gimage;
|
|
|
|
gdouble xratio;
|
|
|
|
gdouble yratio; /* Screen res ratio */
|
2001-06-18 21:10:03 +08:00
|
|
|
|
|
|
|
/* Calculate preview size */
|
2002-05-06 03:17:41 +08:00
|
|
|
gimage = nav_dialog->disp_shell->gdisp->gimage;
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
xratio = SCALEFACTOR_X (nav_dialog->disp_shell->gdisp);
|
|
|
|
yratio = SCALEFACTOR_Y (nav_dialog->disp_shell->gdisp);
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
if (GIMP_PREVIEW (nav_dialog->preview)->dot_for_dot !=
|
|
|
|
nav_dialog->disp_shell->gdisp->dot_for_dot)
|
|
|
|
gimp_preview_set_dot_for_dot (GIMP_PREVIEW (nav_dialog->preview),
|
|
|
|
nav_dialog->disp_shell->gdisp->dot_for_dot);
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
gimp_navigation_preview_set_marker
|
|
|
|
(GIMP_NAVIGATION_PREVIEW (nav_dialog->preview),
|
|
|
|
RINT (nav_dialog->disp_shell->offset_x / xratio),
|
|
|
|
RINT (nav_dialog->disp_shell->offset_y / yratio),
|
|
|
|
RINT (nav_dialog->disp_shell->disp_width / xratio),
|
|
|
|
RINT (nav_dialog->disp_shell->disp_height / yratio));
|
2001-06-18 21:10:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_close_callback (GtkWidget *widget,
|
|
|
|
NavigationDialog *nav_dialog)
|
2001-06-18 21:10:03 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
gtk_widget_hide (nav_dialog->shell);
|
2001-06-18 21:10:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_marker_changed (GimpNavigationPreview *nav_preview,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
NavigationDialog *nav_dialog)
|
2001-06-18 21:10:03 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
gdouble xratio;
|
|
|
|
gdouble yratio;
|
|
|
|
gint xoffset;
|
|
|
|
gint yoffset;
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
xratio = SCALEFACTOR_X (nav_dialog->disp_shell->gdisp);
|
|
|
|
yratio = SCALEFACTOR_Y (nav_dialog->disp_shell->gdisp);
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
xoffset = x * xratio - nav_dialog->disp_shell->offset_x;
|
|
|
|
yoffset = y * yratio - nav_dialog->disp_shell->offset_y;
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
gimp_display_shell_scroll (nav_dialog->disp_shell, xoffset, yoffset);
|
2001-06-18 21:10:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_zoom (GimpNavigationPreview *nav_preview,
|
|
|
|
GimpZoomType direction,
|
|
|
|
NavigationDialog *nav_dialog)
|
1999-08-28 03:07:21 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
gimp_display_shell_scale (nav_dialog->disp_shell, direction);
|
1999-08-13 06:21:04 +08:00
|
|
|
}
|
|
|
|
|
1999-08-28 03:07:21 +08:00
|
|
|
static void
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_scroll (GimpNavigationPreview *nav_preview,
|
|
|
|
GdkScrollDirection direction,
|
|
|
|
NavigationDialog *nav_dialog)
|
1999-08-28 03:07:21 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
GtkAdjustment *adj = NULL;
|
|
|
|
gdouble value;
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
switch (direction)
|
1999-08-28 03:07:21 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
case GDK_SCROLL_LEFT:
|
|
|
|
case GDK_SCROLL_RIGHT:
|
|
|
|
adj = nav_dialog->disp_shell->hsbdata;
|
|
|
|
break;
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
case GDK_SCROLL_UP:
|
|
|
|
case GDK_SCROLL_DOWN:
|
|
|
|
adj = nav_dialog->disp_shell->vsbdata;
|
|
|
|
break;
|
1999-08-28 03:07:21 +08:00
|
|
|
}
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
g_assert (adj != NULL);
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
value = adj->value;
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
switch (direction)
|
1999-08-24 06:47:36 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
case GDK_SCROLL_LEFT:
|
|
|
|
case GDK_SCROLL_UP:
|
|
|
|
value -= adj->page_increment / 2;
|
|
|
|
break;
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
case GDK_SCROLL_RIGHT:
|
|
|
|
case GDK_SCROLL_DOWN:
|
|
|
|
value += adj->page_increment / 2;
|
|
|
|
break;
|
2001-06-18 21:10:03 +08:00
|
|
|
}
|
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
value = CLAMP (value, adj->lower, adj->upper - adj->page_size);
|
1999-09-02 06:39:44 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
gtk_adjustment_set_value (adj, value);
|
2001-06-18 21:10:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_button_release (GtkWidget *widget,
|
|
|
|
GdkEventButton *bevent,
|
|
|
|
NavigationDialog *nav_dialog)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
if (bevent->button == 1)
|
1999-08-13 06:21:04 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
gtk_widget_hide (nav_dialog->shell);
|
2001-06-18 21:10:03 +08:00
|
|
|
}
|
1999-08-13 06:21:04 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
1999-11-20 08:46:58 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
static void
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_zoom_in (GtkWidget *widget,
|
|
|
|
NavigationDialog *nav_dialog)
|
1999-08-28 03:07:21 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
gimp_display_shell_scale (nav_dialog->disp_shell, GIMP_ZOOM_IN);
|
1999-11-20 08:46:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_zoom_out (GtkWidget *widget,
|
|
|
|
NavigationDialog *nav_dialog)
|
1999-11-20 08:46:58 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
gimp_display_shell_scale (nav_dialog->disp_shell, GIMP_ZOOM_OUT);
|
1999-11-20 08:46:58 +08:00
|
|
|
}
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
static void
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_zoom_adj_changed (GtkAdjustment *adj,
|
|
|
|
NavigationDialog *nav_dialog)
|
1999-11-20 08:46:58 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
gint scalesrc;
|
|
|
|
gint scaledest;
|
1999-11-20 08:46:58 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
if (adj->value < 0.0)
|
1999-11-20 08:46:58 +08:00
|
|
|
{
|
2001-06-18 21:10:03 +08:00
|
|
|
scalesrc = abs ((gint) adj->value - 1);
|
|
|
|
scaledest = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
scaledest = abs ((gint) adj->value + 1);
|
|
|
|
scalesrc = 1;
|
1999-11-20 08:46:58 +08:00
|
|
|
}
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
nav_dialog->block_adj_sig = TRUE;
|
2002-05-06 03:17:41 +08:00
|
|
|
gimp_display_shell_scale (nav_dialog->disp_shell,
|
2001-11-01 05:18:57 +08:00
|
|
|
(scaledest * 100) + scalesrc);
|
2001-06-18 21:10:03 +08:00
|
|
|
nav_dialog->block_adj_sig = FALSE;
|
1999-08-13 06:21:04 +08:00
|
|
|
}
|
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
static void
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_display_changed (GimpContext *context,
|
|
|
|
GimpDisplay *gdisp,
|
|
|
|
NavigationDialog *nav_dialog)
|
1999-09-02 06:39:44 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
GimpDisplay *old_gdisp = NULL;
|
|
|
|
GimpImage *gimage;
|
|
|
|
gchar *title;
|
1999-09-02 06:39:44 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
if (nav_dialog->disp_shell)
|
|
|
|
old_gdisp = nav_dialog->disp_shell->gdisp;
|
1999-09-02 06:39:44 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
if (gdisp == old_gdisp || ! gdisp)
|
2001-06-18 21:10:03 +08:00
|
|
|
return;
|
1999-09-02 06:39:44 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
gtk_widget_set_sensitive (nav_window_auto->shell, TRUE);
|
1999-09-02 06:39:44 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
nav_dialog->frozen = FALSE;
|
1999-09-02 06:39:44 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
title = nav_dialog_title (GIMP_DISPLAY_SHELL (gdisp->shell));
|
1999-09-02 06:39:44 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
gtk_window_set_title (GTK_WINDOW (nav_dialog->shell), title);
|
2000-12-14 21:52:16 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
g_free (title);
|
2000-12-14 21:52:16 +08:00
|
|
|
|
2001-06-18 21:10:03 +08:00
|
|
|
gimage = gdisp->gimage;
|
2000-02-19 21:19:08 +08:00
|
|
|
|
2001-07-05 03:31:35 +08:00
|
|
|
if (gimage && gimp_container_have (context->gimp->images,
|
|
|
|
GIMP_OBJECT (gimage)))
|
2001-06-18 21:10:03 +08:00
|
|
|
{
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog->disp_shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
1999-09-05 06:27:20 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
gimp_preview_set_viewable (GIMP_PREVIEW (nav_dialog->preview),
|
|
|
|
GIMP_VIEWABLE (gdisp->gimage));
|
1999-09-05 06:27:20 +08:00
|
|
|
|
2002-05-06 03:17:41 +08:00
|
|
|
nav_dialog_update (nav_dialog);
|
2001-06-18 21:10:03 +08:00
|
|
|
}
|
1999-09-05 06:27:20 +08:00
|
|
|
}
|