2001-06-26 20:09:43 +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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2004-04-20 21:25:55 +08:00
|
|
|
#include "actions-types.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2002-11-19 04:50:31 +08:00
|
|
|
#include "config/gimpguiconfig.h"
|
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
#include "core/gimp.h"
|
|
|
|
#include "core/gimpcontext.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
#include "core/gimpimage.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:20:09 +08:00
|
|
|
#include "display/gimpdisplayshell.h"
|
2003-03-12 00:49:36 +08:00
|
|
|
#include "display/gimpdisplayshell-appearance.h"
|
2003-11-22 06:52:36 +08:00
|
|
|
#include "display/gimpdisplayshell-filter-dialog.h"
|
2001-11-02 17:31:21 +08:00
|
|
|
#include "display/gimpdisplayshell-scale.h"
|
2001-09-26 07:23:09 +08:00
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
#include "widgets/gimpactiongroup.h"
|
2004-02-01 04:23:53 +08:00
|
|
|
#include "widgets/gimpdock.h"
|
2002-03-20 23:32:35 +08:00
|
|
|
#include "widgets/gimpdialogfactory.h"
|
2004-04-29 20:52:29 +08:00
|
|
|
#include "widgets/gimpuimanager.h"
|
2002-03-20 23:32:35 +08:00
|
|
|
|
2004-04-20 21:25:55 +08:00
|
|
|
#include "gui/dialogs.h"
|
|
|
|
#include "gui/info-dialog.h"
|
|
|
|
#include "gui/info-window.h"
|
|
|
|
|
2004-05-03 22:03:51 +08:00
|
|
|
#include "actions.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
#include "view-commands.h"
|
|
|
|
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
#define SET_ACTIVE(manager,group_name,action_name,active) \
|
|
|
|
{ GimpActionGroup *group = \
|
|
|
|
gimp_ui_manager_get_action_group (manager, group_name); \
|
|
|
|
gimp_action_group_set_action_active (group, action_name, active); }
|
|
|
|
|
2003-11-11 21:09:50 +08:00
|
|
|
#define IS_ACTIVE_DISPLAY(gdisp) \
|
|
|
|
((gdisp) == \
|
|
|
|
gimp_context_get_display (gimp_get_user_context ((gdisp)->gimage->gimp)))
|
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2004-05-03 22:46:29 +08:00
|
|
|
/* public functions */
|
|
|
|
|
2004-05-05 19:40:20 +08:00
|
|
|
void
|
|
|
|
view_new_view_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2004-06-02 06:04:20 +08:00
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
2004-05-05 19:40:20 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
|
|
|
|
2004-06-02 06:04:20 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
|
|
|
gimp_create_display (gdisp->gimage->gimp,
|
|
|
|
gdisp->gimage,
|
|
|
|
shell->unit, shell->scale);
|
2004-05-05 19:40:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
view_close_view_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDisplay *gdisp;
|
|
|
|
return_if_no_display (gdisp, data);
|
|
|
|
|
|
|
|
gimp_display_shell_close (GIMP_DISPLAY_SHELL (gdisp->shell), FALSE);
|
|
|
|
}
|
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_zoom_out_cmd_callback (GtkAction *action,
|
2003-05-29 00:07:53 +08:00
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2001-10-17 19:33:43 +08:00
|
|
|
GimpDisplay *gdisp;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2004-01-30 06:22:29 +08:00
|
|
|
gimp_display_shell_scale (GIMP_DISPLAY_SHELL (gdisp->shell),
|
|
|
|
GIMP_ZOOM_OUT, 0.0);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_zoom_in_cmd_callback (GtkAction *action,
|
2003-05-29 00:07:53 +08:00
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2001-10-17 19:33:43 +08:00
|
|
|
GimpDisplay *gdisp;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2004-01-30 06:22:29 +08:00
|
|
|
gimp_display_shell_scale (GIMP_DISPLAY_SHELL (gdisp->shell),
|
|
|
|
GIMP_ZOOM_IN, 0.0);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
2001-11-02 17:31:21 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_zoom_fit_cmd_callback (GtkAction *action,
|
2001-11-02 17:31:21 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDisplay *gdisp;
|
|
|
|
return_if_no_display (gdisp, data);
|
|
|
|
|
|
|
|
gimp_display_shell_scale_fit (GIMP_DISPLAY_SHELL (gdisp->shell));
|
|
|
|
}
|
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_zoom_cmd_callback (GtkAction *action,
|
|
|
|
GtkAction *current,
|
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2003-03-13 01:18:25 +08:00
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
2004-04-29 20:52:29 +08:00
|
|
|
gint value;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2003-03-13 01:18:25 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
|
2003-04-04 16:32:51 +08:00
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
if (value == 0 /* Other... */)
|
|
|
|
{
|
|
|
|
/* check if we are activated by the user
|
|
|
|
* or from view_actions_set_zoom()
|
|
|
|
*/
|
|
|
|
if (shell->scale != shell->other_scale)
|
|
|
|
gimp_display_shell_scale_dialog (shell);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (fabs (value - shell->scale) > 0.0001)
|
|
|
|
gimp_display_shell_scale (shell, GIMP_ZOOM_TO, (gdouble) value / 10000);
|
|
|
|
}
|
2003-04-04 16:32:51 +08:00
|
|
|
}
|
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_dot_for_dot_cmd_callback (GtkAction *action,
|
2001-06-26 20:09:43 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
2003-01-11 01:55:53 +08:00
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
2004-04-29 20:52:29 +08:00
|
|
|
gboolean active;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
|
|
|
|
|
|
|
if (active != shell->dot_for_dot)
|
2003-01-11 01:55:53 +08:00
|
|
|
{
|
2004-04-29 20:52:29 +08:00
|
|
|
gimp_display_shell_scale_set_dot_for_dot (shell, active);
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
SET_ACTIVE (shell->menubar_manager, "view", "view-dot-for-dot",
|
|
|
|
shell->dot_for_dot);
|
2003-11-11 21:09:50 +08:00
|
|
|
|
|
|
|
if (IS_ACTIVE_DISPLAY (gdisp))
|
2004-04-29 20:52:29 +08:00
|
|
|
SET_ACTIVE (shell->popup_manager, "view", "view-dot-for-dot",
|
|
|
|
shell->dot_for_dot);
|
2003-01-11 01:55:53 +08:00
|
|
|
}
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_info_window_cmd_callback (GtkAction *action,
|
2001-06-26 20:09:43 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2002-11-19 04:50:31 +08:00
|
|
|
if (GIMP_GUI_CONFIG (gdisp->gimage->gimp->config)->info_window_per_display)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
if (! shell->info_dialog)
|
|
|
|
shell->info_dialog = info_window_create (gdisp);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2004-01-25 21:53:23 +08:00
|
|
|
/* To update the fields of the info window for the first time. *
|
|
|
|
* It's no use updating it in info_window_create() because the *
|
|
|
|
* pointer of the info window is not present in the shell yet. */
|
|
|
|
info_window_update (gdisp);
|
|
|
|
|
2004-01-21 19:16:57 +08:00
|
|
|
info_dialog_present (shell->info_dialog);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-10-29 19:47:11 +08:00
|
|
|
info_window_follow_auto (gdisp->gimage->gimp);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_navigation_window_cmd_callback (GtkAction *action,
|
2002-03-20 23:32:35 +08:00
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2002-05-08 00:23:14 +08:00
|
|
|
gimp_dialog_factory_dialog_raise (global_dock_factory,
|
2004-04-29 20:52:29 +08:00
|
|
|
gtk_widget_get_screen (gdisp->shell),
|
2002-05-08 00:23:14 +08:00
|
|
|
"gimp-navigation-view", -1);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
2002-03-20 23:32:35 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_display_filters_cmd_callback (GtkAction *action,
|
2002-03-20 23:32:35 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
|
|
|
return_if_no_display (gdisp, data);
|
|
|
|
|
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2003-11-22 06:52:36 +08:00
|
|
|
if (! shell->filters_dialog)
|
|
|
|
{
|
|
|
|
shell->filters_dialog = gimp_display_shell_filter_dialog_new (shell);
|
|
|
|
|
|
|
|
g_signal_connect (shell->filters_dialog, "destroy",
|
|
|
|
G_CALLBACK (gtk_widget_destroyed),
|
|
|
|
&shell->filters_dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_window_present (GTK_WINDOW (shell->filters_dialog));
|
2002-03-20 23:32:35 +08:00
|
|
|
}
|
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_toggle_selection_cmd_callback (GtkAction *action,
|
2001-06-26 20:09:43 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
2001-11-11 07:03:22 +08:00
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
2004-04-29 20:52:29 +08:00
|
|
|
gboolean active;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-11-11 07:03:22 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
|
|
|
|
|
|
|
gimp_display_shell_set_show_selection (shell, active);
|
2001-11-16 23:08:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_toggle_layer_boundary_cmd_callback (GtkAction *action,
|
2001-11-16 23:08:59 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
2004-04-29 20:52:29 +08:00
|
|
|
gboolean active;
|
2001-11-16 23:08:59 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
|
|
|
|
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
|
|
|
|
|
|
|
gimp_display_shell_set_show_layer (shell, active);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
2002-12-14 22:13:54 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_toggle_menubar_cmd_callback (GtkAction *action,
|
2002-12-14 22:13:54 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
2004-04-29 20:52:29 +08:00
|
|
|
gboolean active;
|
2002-12-14 22:13:54 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
|
|
|
|
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
|
|
|
|
|
|
|
gimp_display_shell_set_show_menubar (shell, active);
|
2002-12-14 22:13:54 +08:00
|
|
|
}
|
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_toggle_rulers_cmd_callback (GtkAction *action,
|
2001-06-26 20:09:43 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
2003-03-12 00:49:36 +08:00
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
2004-04-29 20:52:29 +08:00
|
|
|
gboolean active;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
|
|
|
|
|
|
|
gimp_display_shell_set_show_rulers (shell, active);
|
2003-03-12 00:49:36 +08:00
|
|
|
}
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2003-03-12 00:49:36 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_toggle_scrollbars_cmd_callback (GtkAction *action,
|
2003-03-12 00:49:36 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
2004-04-29 20:52:29 +08:00
|
|
|
gboolean active;
|
2003-03-12 00:49:36 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
2002-12-14 22:13:54 +08:00
|
|
|
|
2003-03-12 00:49:36 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
|
|
|
|
|
|
|
gimp_display_shell_set_show_scrollbars (shell, active);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_toggle_statusbar_cmd_callback (GtkAction *action,
|
2001-06-26 20:09:43 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
2004-04-29 20:52:29 +08:00
|
|
|
gboolean active;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
|
|
|
|
|
|
|
gimp_display_shell_set_show_statusbar (shell, active);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_toggle_guides_cmd_callback (GtkAction *action,
|
2001-06-26 20:09:43 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
2003-03-20 19:31:33 +08:00
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
2004-04-29 20:52:29 +08:00
|
|
|
gboolean active;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2003-03-20 19:31:33 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
|
|
|
|
|
|
|
gimp_display_shell_set_show_guides (shell, active);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_snap_to_guides_cmd_callback (GtkAction *action,
|
2001-06-26 20:09:43 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
2003-01-11 01:55:53 +08:00
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
2004-04-29 20:52:29 +08:00
|
|
|
gboolean active;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
2002-12-14 22:13:54 +08:00
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
2003-01-11 01:55:53 +08:00
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
gimp_display_shell_set_snap_to_guides (shell, active);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
2003-06-24 03:34:48 +08:00
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_toggle_grid_cmd_callback (GtkAction *action,
|
2003-06-24 03:34:48 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
2004-04-29 20:52:29 +08:00
|
|
|
gboolean active;
|
2003-06-24 03:34:48 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
|
|
|
|
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
2003-06-24 03:34:48 +08:00
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
gimp_display_shell_set_show_grid (shell, active);
|
2003-06-24 03:34:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_snap_to_grid_cmd_callback (GtkAction *action,
|
2003-06-24 03:34:48 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
2004-04-29 20:52:29 +08:00
|
|
|
gboolean active;
|
2003-06-24 03:34:48 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
|
|
|
|
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
2003-11-11 21:09:50 +08:00
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
gimp_display_shell_set_snap_to_grid (shell, active);
|
2003-06-24 03:34:48 +08:00
|
|
|
}
|
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_shrink_wrap_cmd_callback (GtkAction *action,
|
2001-06-26 20:09:43 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
2001-10-17 19:33:43 +08:00
|
|
|
GimpDisplay *gdisp;
|
2001-10-29 19:47:11 +08:00
|
|
|
return_if_no_display (gdisp, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_shell_scale_shrink_wrap (GIMP_DISPLAY_SHELL (gdisp->shell));
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
2003-11-10 08:24:33 +08:00
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_fullscreen_cmd_callback (GtkAction *action,
|
2003-11-10 08:24:33 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplayShell *shell;
|
2004-04-29 20:52:29 +08:00
|
|
|
gboolean active;
|
2003-11-10 08:24:33 +08:00
|
|
|
gboolean fullscreen;
|
|
|
|
return_if_no_display (gdisp, data);
|
|
|
|
|
|
|
|
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
|
|
|
|
|
|
|
gimp_display_shell_set_fullscreen (shell, active);
|
2003-11-10 08:24:33 +08:00
|
|
|
|
|
|
|
fullscreen = (shell->window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
if (active != fullscreen)
|
2003-11-10 08:24:33 +08:00
|
|
|
{
|
2004-04-29 20:52:29 +08:00
|
|
|
SET_ACTIVE (shell->menubar_manager, "view", "view-fullscreen",
|
|
|
|
fullscreen);
|
2003-11-11 21:09:50 +08:00
|
|
|
|
|
|
|
if (IS_ACTIVE_DISPLAY (gdisp))
|
2004-04-29 20:52:29 +08:00
|
|
|
SET_ACTIVE (shell->popup_manager, "view", "view-fullscreen",
|
|
|
|
fullscreen);
|
2003-11-10 08:24:33 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
view_change_screen_confirm_callback (GtkWidget *query_box,
|
|
|
|
gint value,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GdkScreen *screen;
|
|
|
|
|
|
|
|
screen = gdk_display_get_screen (gtk_widget_get_display (GTK_WIDGET (data)),
|
|
|
|
value);
|
|
|
|
|
|
|
|
if (screen)
|
|
|
|
gtk_window_set_screen (GTK_WINDOW (data), screen);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
view_change_screen_destroy_callback (GtkWidget *query_box,
|
|
|
|
GtkWidget *shell)
|
|
|
|
{
|
|
|
|
g_object_set_data (G_OBJECT (shell), "gimp-change-screen-dialog", NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
view_change_screen_cmd_callback (GtkAction *action,
|
2003-11-10 08:24:33 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GdkScreen *screen;
|
|
|
|
GdkDisplay *display;
|
|
|
|
gint cur_screen;
|
|
|
|
gint num_screens;
|
|
|
|
GtkWidget *qbox;
|
|
|
|
return_if_no_display (gdisp, data);
|
|
|
|
|
|
|
|
qbox = g_object_get_data (G_OBJECT (gdisp->shell),
|
|
|
|
"gimp-change-screen-dialog");
|
|
|
|
|
|
|
|
if (qbox)
|
|
|
|
{
|
|
|
|
gtk_window_present (GTK_WINDOW (qbox));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
screen = gtk_widget_get_screen (gdisp->shell);
|
|
|
|
display = gtk_widget_get_display (gdisp->shell);
|
|
|
|
|
|
|
|
cur_screen = gdk_screen_get_number (screen);
|
|
|
|
num_screens = gdk_display_get_n_screens (display);
|
|
|
|
|
|
|
|
qbox = gimp_query_int_box ("Move Display to Screen",
|
|
|
|
gdisp->shell,
|
|
|
|
NULL, 0,
|
2003-11-14 23:33:40 +08:00
|
|
|
"Enter destination screen",
|
2003-11-10 08:24:33 +08:00
|
|
|
cur_screen, 0, num_screens - 1,
|
|
|
|
G_OBJECT (gdisp->shell), "destroy",
|
|
|
|
view_change_screen_confirm_callback,
|
|
|
|
gdisp->shell);
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (gdisp->shell), "gimp-change-screen-dialog", qbox);
|
|
|
|
|
|
|
|
g_signal_connect (qbox, "destroy",
|
|
|
|
G_CALLBACK (view_change_screen_destroy_callback),
|
|
|
|
gdisp->shell);
|
|
|
|
|
|
|
|
gtk_widget_show (qbox);
|
|
|
|
}
|