2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2003-03-12 00:49:36 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2003-03-12 00:49:36 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2003-03-12 00:49:36 +08:00
|
|
|
* (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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2003-03-12 00:49:36 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2003-03-12 00:49:36 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "libgimpcolor/gimpcolor.h"
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
|
|
|
#include "display-types.h"
|
|
|
|
|
2003-11-11 21:09:50 +08:00
|
|
|
#include "core/gimp.h"
|
|
|
|
#include "core/gimpcontext.h"
|
2003-03-20 19:31:33 +08:00
|
|
|
#include "core/gimpimage.h"
|
2008-03-19 06:21:47 +08:00
|
|
|
#include "core/gimpimage-grid.h"
|
2007-12-26 01:09:04 +08:00
|
|
|
#include "core/gimpimage-guides.h"
|
|
|
|
#include "core/gimpimage-sample-points.h"
|
2003-03-20 19:31:33 +08:00
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
#include "widgets/gimpactiongroup.h"
|
2005-07-20 04:42:14 +08:00
|
|
|
#include "widgets/gimprender.h"
|
2004-04-29 20:52:29 +08:00
|
|
|
#include "widgets/gimpuimanager.h"
|
2003-06-11 00:44:44 +08:00
|
|
|
#include "widgets/gimpwidgets-utils.h"
|
2003-03-12 00:49:36 +08:00
|
|
|
|
2003-11-11 03:35:56 +08:00
|
|
|
#include "gimpcanvas.h"
|
2003-03-20 19:31:33 +08:00
|
|
|
#include "gimpdisplay.h"
|
2003-10-22 22:46:05 +08:00
|
|
|
#include "gimpdisplayoptions.h"
|
2003-03-12 00:49:36 +08:00
|
|
|
#include "gimpdisplayshell.h"
|
|
|
|
#include "gimpdisplayshell-appearance.h"
|
2003-03-20 19:31:33 +08:00
|
|
|
#include "gimpdisplayshell-selection.h"
|
2009-09-23 20:52:33 +08:00
|
|
|
#include "gimpimagewindow.h"
|
2007-05-29 01:42:55 +08:00
|
|
|
#include "gimpstatusbar.h"
|
2003-03-12 00:49:36 +08:00
|
|
|
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
/* local function prototypes */
|
2003-11-11 21:09:50 +08:00
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
static GimpDisplayOptions *
|
|
|
|
appearance_get_options (const GimpDisplayShell *shell);
|
|
|
|
static void appearance_set_action_active (GimpDisplayShell *shell,
|
|
|
|
const gchar *action,
|
|
|
|
gboolean active);
|
|
|
|
static void appearance_set_action_color (GimpDisplayShell *shell,
|
|
|
|
const gchar *action,
|
|
|
|
const GimpRGB *color);
|
2004-04-29 20:52:29 +08:00
|
|
|
|
2003-03-12 00:49:36 +08:00
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
/* public functions */
|
2003-03-12 00:49:36 +08:00
|
|
|
|
2008-03-19 06:21:47 +08:00
|
|
|
void
|
|
|
|
gimp_display_shell_appearance_update (GimpDisplayShell *shell)
|
|
|
|
{
|
|
|
|
GimpDisplayOptions *options;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
options = appearance_get_options (shell);
|
2008-03-19 06:21:47 +08:00
|
|
|
|
|
|
|
gimp_display_shell_set_show_menubar (shell,
|
|
|
|
options->show_menubar);
|
|
|
|
gimp_display_shell_set_show_rulers (shell,
|
|
|
|
options->show_rulers);
|
|
|
|
gimp_display_shell_set_show_scrollbars (shell,
|
|
|
|
options->show_scrollbars);
|
|
|
|
gimp_display_shell_set_show_statusbar (shell,
|
|
|
|
options->show_statusbar);
|
|
|
|
gimp_display_shell_set_show_selection (shell,
|
|
|
|
options->show_selection);
|
|
|
|
gimp_display_shell_set_show_layer (shell,
|
|
|
|
options->show_layer_boundary);
|
|
|
|
gimp_display_shell_set_show_guides (shell,
|
|
|
|
options->show_guides);
|
|
|
|
gimp_display_shell_set_show_grid (shell,
|
|
|
|
options->show_grid);
|
|
|
|
gimp_display_shell_set_show_sample_points (shell,
|
|
|
|
options->show_sample_points);
|
|
|
|
gimp_display_shell_set_padding (shell,
|
|
|
|
options->padding_mode,
|
|
|
|
&options->padding_color);
|
|
|
|
}
|
|
|
|
|
2003-03-20 19:31:33 +08:00
|
|
|
void
|
2003-10-22 22:46:05 +08:00
|
|
|
gimp_display_shell_set_show_menubar (GimpDisplayShell *shell,
|
|
|
|
gboolean show)
|
2003-03-20 19:31:33 +08:00
|
|
|
{
|
2003-10-22 22:46:05 +08:00
|
|
|
GimpDisplayOptions *options;
|
2009-09-25 07:12:55 +08:00
|
|
|
GtkWidget *toplevel;
|
|
|
|
GimpImageWindow *window;
|
2003-03-20 19:31:33 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
options = appearance_get_options (shell);
|
|
|
|
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));
|
|
|
|
window = GIMP_IMAGE_WINDOW (toplevel);
|
2003-03-20 19:31:33 +08:00
|
|
|
|
2003-10-22 22:46:05 +08:00
|
|
|
g_object_set (options, "show-menubar", show, NULL);
|
2003-03-20 19:31:33 +08:00
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
if (gimp_image_window_get_active_display (window) == shell->display &&
|
|
|
|
window->menubar)
|
2004-12-01 08:13:48 +08:00
|
|
|
{
|
|
|
|
if (show)
|
2009-09-25 07:12:55 +08:00
|
|
|
gtk_widget_show (window->menubar);
|
2004-12-01 08:13:48 +08:00
|
|
|
else
|
2009-09-25 07:12:55 +08:00
|
|
|
gtk_widget_hide (window->menubar);
|
2004-12-01 08:13:48 +08:00
|
|
|
}
|
2003-10-22 22:46:05 +08:00
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
appearance_set_action_active (shell, "view-show-menubar", show);
|
2003-03-20 19:31:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2008-08-10 18:09:03 +08:00
|
|
|
gimp_display_shell_get_show_menubar (const GimpDisplayShell *shell)
|
2003-03-20 19:31:33 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
return appearance_get_options (shell)->show_menubar;
|
2003-03-20 19:31:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-10-22 22:46:05 +08:00
|
|
|
gimp_display_shell_set_show_rulers (GimpDisplayShell *shell,
|
|
|
|
gboolean show)
|
2003-03-20 19:31:33 +08:00
|
|
|
{
|
2003-10-22 22:46:05 +08:00
|
|
|
GimpDisplayOptions *options;
|
|
|
|
GtkTable *table;
|
2003-03-20 19:31:33 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
options = appearance_get_options (shell);
|
2003-10-22 22:46:05 +08:00
|
|
|
|
|
|
|
g_object_set (options, "show-rulers", show, NULL);
|
2003-03-20 19:31:33 +08:00
|
|
|
|
2008-06-28 23:12:13 +08:00
|
|
|
table = GTK_TABLE (gtk_widget_get_parent (GTK_WIDGET (shell->canvas)));
|
2003-10-22 22:46:05 +08:00
|
|
|
|
|
|
|
if (show)
|
2003-03-20 19:31:33 +08:00
|
|
|
{
|
2006-12-12 19:20:59 +08:00
|
|
|
gtk_widget_show (shell->origin);
|
2003-10-22 22:46:05 +08:00
|
|
|
gtk_widget_show (shell->hrule);
|
|
|
|
gtk_widget_show (shell->vrule);
|
2003-03-20 19:31:33 +08:00
|
|
|
|
2003-10-22 22:46:05 +08:00
|
|
|
gtk_table_set_col_spacing (table, 0, 1);
|
|
|
|
gtk_table_set_row_spacing (table, 0, 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-12-12 19:20:59 +08:00
|
|
|
gtk_widget_hide (shell->origin);
|
2003-10-22 22:46:05 +08:00
|
|
|
gtk_widget_hide (shell->hrule);
|
|
|
|
gtk_widget_hide (shell->vrule);
|
2003-03-20 19:31:33 +08:00
|
|
|
|
2003-10-22 22:46:05 +08:00
|
|
|
gtk_table_set_col_spacing (table, 0, 0);
|
|
|
|
gtk_table_set_row_spacing (table, 0, 0);
|
2003-03-20 19:31:33 +08:00
|
|
|
}
|
2003-10-22 22:46:05 +08:00
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
appearance_set_action_active (shell, "view-show-rulers", show);
|
2003-03-20 19:31:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2008-08-10 18:09:03 +08:00
|
|
|
gimp_display_shell_get_show_rulers (const GimpDisplayShell *shell)
|
2003-03-20 19:31:33 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
return appearance_get_options (shell)->show_rulers;
|
2003-03-20 19:31:33 +08:00
|
|
|
}
|
|
|
|
|
2003-06-24 03:34:48 +08:00
|
|
|
void
|
2003-10-22 22:46:05 +08:00
|
|
|
gimp_display_shell_set_show_scrollbars (GimpDisplayShell *shell,
|
|
|
|
gboolean show)
|
2003-06-24 03:34:48 +08:00
|
|
|
{
|
2003-10-22 22:46:05 +08:00
|
|
|
GimpDisplayOptions *options;
|
2008-06-28 23:12:13 +08:00
|
|
|
GtkWidget *parent;
|
2003-10-22 22:46:05 +08:00
|
|
|
GtkBox *hbox;
|
|
|
|
GtkBox *vbox;
|
2003-06-24 03:34:48 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
options = appearance_get_options (shell);
|
2003-06-24 03:34:48 +08:00
|
|
|
|
2003-10-22 22:46:05 +08:00
|
|
|
g_object_set (options, "show-scrollbars", show, NULL);
|
2003-06-24 03:34:48 +08:00
|
|
|
|
2008-06-28 23:12:13 +08:00
|
|
|
parent = gtk_widget_get_parent (shell->vsb);
|
|
|
|
hbox = GTK_BOX (gtk_widget_get_parent (parent));
|
|
|
|
|
|
|
|
parent = gtk_widget_get_parent (shell->hsb);
|
|
|
|
vbox = GTK_BOX (gtk_widget_get_parent (parent));
|
2003-06-24 03:34:48 +08:00
|
|
|
|
2003-10-22 22:46:05 +08:00
|
|
|
if (show)
|
|
|
|
{
|
|
|
|
gtk_widget_show (shell->nav_ebox);
|
|
|
|
gtk_widget_show (shell->hsb);
|
|
|
|
gtk_widget_show (shell->vsb);
|
2005-09-19 20:44:06 +08:00
|
|
|
gtk_widget_show (shell->quick_mask_button);
|
2004-06-23 00:31:27 +08:00
|
|
|
gtk_widget_show (shell->zoom_button);
|
2003-10-22 22:46:05 +08:00
|
|
|
|
|
|
|
gtk_box_set_spacing (hbox, 1);
|
|
|
|
gtk_box_set_spacing (vbox, 1);
|
2003-06-24 03:34:48 +08:00
|
|
|
}
|
2003-10-22 22:46:05 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_widget_hide (shell->nav_ebox);
|
|
|
|
gtk_widget_hide (shell->hsb);
|
|
|
|
gtk_widget_hide (shell->vsb);
|
2005-09-19 20:44:06 +08:00
|
|
|
gtk_widget_hide (shell->quick_mask_button);
|
2004-06-23 00:31:27 +08:00
|
|
|
gtk_widget_hide (shell->zoom_button);
|
2003-10-22 22:46:05 +08:00
|
|
|
|
|
|
|
gtk_box_set_spacing (hbox, 0);
|
|
|
|
gtk_box_set_spacing (vbox, 0);
|
|
|
|
}
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
appearance_set_action_active (shell, "view-show-scrollbars", show);
|
2003-06-24 03:34:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2008-08-10 18:09:03 +08:00
|
|
|
gimp_display_shell_get_show_scrollbars (const GimpDisplayShell *shell)
|
2003-06-24 03:34:48 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
return appearance_get_options (shell)->show_scrollbars;
|
2003-06-24 03:34:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-10-22 22:46:05 +08:00
|
|
|
gimp_display_shell_set_show_statusbar (GimpDisplayShell *shell,
|
|
|
|
gboolean show)
|
2003-06-24 03:34:48 +08:00
|
|
|
{
|
2003-10-22 22:46:05 +08:00
|
|
|
GimpDisplayOptions *options;
|
2009-09-25 07:12:55 +08:00
|
|
|
GtkWidget *toplevel;
|
|
|
|
GimpImageWindow *window;
|
2003-10-22 22:46:05 +08:00
|
|
|
|
2003-06-24 03:34:48 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
options = appearance_get_options (shell);
|
|
|
|
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));
|
|
|
|
window = GIMP_IMAGE_WINDOW (toplevel);
|
2003-06-24 03:34:48 +08:00
|
|
|
|
2003-10-22 22:46:05 +08:00
|
|
|
g_object_set (options, "show-statusbar", show, NULL);
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
if (gimp_image_window_get_active_display (window) == shell->display)
|
|
|
|
{
|
|
|
|
gimp_statusbar_set_visible (GIMP_STATUSBAR (window->statusbar), show);
|
|
|
|
}
|
2003-11-11 21:09:50 +08:00
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
appearance_set_action_active (shell, "view-show-statusbar", show);
|
2003-06-24 03:34:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2008-08-10 18:09:03 +08:00
|
|
|
gimp_display_shell_get_show_statusbar (const GimpDisplayShell *shell)
|
2003-06-24 03:34:48 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
return appearance_get_options (shell)->show_statusbar;
|
2003-06-24 03:34:48 +08:00
|
|
|
}
|
|
|
|
|
2003-03-20 19:31:33 +08:00
|
|
|
void
|
2003-10-22 22:46:05 +08:00
|
|
|
gimp_display_shell_set_show_selection (GimpDisplayShell *shell,
|
|
|
|
gboolean show)
|
2003-03-20 19:31:33 +08:00
|
|
|
{
|
2003-10-22 22:46:05 +08:00
|
|
|
GimpDisplayOptions *options;
|
2003-03-20 19:31:33 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
options = appearance_get_options (shell);
|
2003-03-20 19:31:33 +08:00
|
|
|
|
2003-10-22 22:46:05 +08:00
|
|
|
g_object_set (options, "show-selection", show, NULL);
|
2003-03-20 19:31:33 +08:00
|
|
|
|
2006-09-05 01:18:38 +08:00
|
|
|
gimp_display_shell_selection_set_hidden (shell, ! show);
|
2003-03-20 19:31:33 +08:00
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
appearance_set_action_active (shell, "view-show-selection", show);
|
2003-03-20 19:31:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2008-08-10 18:09:03 +08:00
|
|
|
gimp_display_shell_get_show_selection (const GimpDisplayShell *shell)
|
2003-03-20 19:31:33 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
return appearance_get_options (shell)->show_selection;
|
2003-03-20 19:31:33 +08:00
|
|
|
}
|
|
|
|
|
2003-03-12 00:49:36 +08:00
|
|
|
void
|
2003-10-22 22:46:05 +08:00
|
|
|
gimp_display_shell_set_show_layer (GimpDisplayShell *shell,
|
|
|
|
gboolean show)
|
2003-03-12 00:49:36 +08:00
|
|
|
{
|
2003-10-22 22:46:05 +08:00
|
|
|
GimpDisplayOptions *options;
|
2003-03-12 00:49:36 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
options = appearance_get_options (shell);
|
2003-03-12 00:49:36 +08:00
|
|
|
|
2003-10-23 15:33:16 +08:00
|
|
|
g_object_set (options, "show-layer-boundary", show, NULL);
|
2003-03-12 00:49:36 +08:00
|
|
|
|
2006-09-05 01:18:38 +08:00
|
|
|
gimp_display_shell_selection_layer_set_hidden (shell, ! show);
|
2003-03-12 00:49:36 +08:00
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
appearance_set_action_active (shell, "view-show-layer-boundary", show);
|
2003-03-12 00:49:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2008-08-10 18:09:03 +08:00
|
|
|
gimp_display_shell_get_show_layer (const GimpDisplayShell *shell)
|
2003-03-12 00:49:36 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
return appearance_get_options (shell)->show_layer_boundary;
|
2003-03-12 00:49:36 +08:00
|
|
|
}
|
|
|
|
|
2004-06-13 09:37:29 +08:00
|
|
|
void
|
|
|
|
gimp_display_shell_set_show_transform (GimpDisplayShell *shell,
|
|
|
|
gboolean show)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
|
|
|
shell->show_transform_preview = show;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2008-08-10 18:09:03 +08:00
|
|
|
gimp_display_shell_get_show_transform (const GimpDisplayShell *shell)
|
2004-06-13 09:37:29 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
|
|
|
return shell->show_transform_preview;
|
|
|
|
}
|
|
|
|
|
2003-03-12 00:49:36 +08:00
|
|
|
void
|
2005-03-05 08:10:40 +08:00
|
|
|
gimp_display_shell_set_show_guides (GimpDisplayShell *shell,
|
|
|
|
gboolean show)
|
2003-03-12 00:49:36 +08:00
|
|
|
{
|
2003-10-22 22:46:05 +08:00
|
|
|
GimpDisplayOptions *options;
|
2003-03-12 00:49:36 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
options = appearance_get_options (shell);
|
2003-03-12 00:49:36 +08:00
|
|
|
|
2005-03-05 08:10:40 +08:00
|
|
|
g_object_set (options, "show-guides", show, NULL);
|
2003-03-12 00:49:36 +08:00
|
|
|
|
2008-03-19 06:21:47 +08:00
|
|
|
if (shell->display->image &&
|
|
|
|
gimp_image_get_guides (shell->display->image))
|
|
|
|
{
|
|
|
|
gimp_display_shell_expose_full (shell);
|
|
|
|
}
|
2003-03-12 00:49:36 +08:00
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
appearance_set_action_active (shell, "view-show-guides", show);
|
2003-03-12 00:49:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2008-08-10 18:09:03 +08:00
|
|
|
gimp_display_shell_get_show_guides (const GimpDisplayShell *shell)
|
2003-03-12 00:49:36 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
return appearance_get_options (shell)->show_guides;
|
2003-03-12 00:49:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-03-05 08:10:40 +08:00
|
|
|
gimp_display_shell_set_show_grid (GimpDisplayShell *shell,
|
|
|
|
gboolean show)
|
2003-03-12 00:49:36 +08:00
|
|
|
{
|
2003-10-22 22:46:05 +08:00
|
|
|
GimpDisplayOptions *options;
|
2003-03-12 00:49:36 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
options = appearance_get_options (shell);
|
2003-03-12 00:49:36 +08:00
|
|
|
|
2005-03-05 08:10:40 +08:00
|
|
|
g_object_set (options, "show-grid", show, NULL);
|
2003-03-12 00:49:36 +08:00
|
|
|
|
2008-03-19 06:21:47 +08:00
|
|
|
if (shell->display->image &&
|
|
|
|
gimp_image_get_grid (shell->display->image))
|
|
|
|
{
|
|
|
|
gimp_display_shell_expose_full (shell);
|
|
|
|
}
|
2003-03-12 00:49:36 +08:00
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
appearance_set_action_active (shell, "view-show-grid", show);
|
2003-03-12 00:49:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2008-08-10 18:09:03 +08:00
|
|
|
gimp_display_shell_get_show_grid (const GimpDisplayShell *shell)
|
2003-03-12 00:49:36 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
return appearance_get_options (shell)->show_grid;
|
2003-07-18 06:30:13 +08:00
|
|
|
}
|
|
|
|
|
2005-03-05 00:34:59 +08:00
|
|
|
void
|
|
|
|
gimp_display_shell_set_show_sample_points (GimpDisplayShell *shell,
|
|
|
|
gboolean show)
|
|
|
|
{
|
|
|
|
GimpDisplayOptions *options;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
options = appearance_get_options (shell);
|
2005-03-05 00:34:59 +08:00
|
|
|
|
|
|
|
g_object_set (options, "show-sample-points", show, NULL);
|
|
|
|
|
2008-03-19 06:21:47 +08:00
|
|
|
if (shell->display->image &&
|
|
|
|
gimp_image_get_sample_points (shell->display->image))
|
|
|
|
{
|
|
|
|
gimp_display_shell_expose_full (shell);
|
|
|
|
}
|
2005-03-05 00:34:59 +08:00
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
appearance_set_action_active (shell, "view-show-sample-points", show);
|
2005-03-05 00:34:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2008-08-10 18:09:03 +08:00
|
|
|
gimp_display_shell_get_show_sample_points (const GimpDisplayShell *shell)
|
2005-03-05 00:34:59 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
return appearance_get_options (shell)->show_sample_points;
|
2005-03-05 00:34:59 +08:00
|
|
|
}
|
|
|
|
|
2005-01-04 00:55:24 +08:00
|
|
|
void
|
|
|
|
gimp_display_shell_set_snap_to_grid (GimpDisplayShell *shell,
|
|
|
|
gboolean snap)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
|
|
|
if (snap != shell->snap_to_grid)
|
|
|
|
{
|
|
|
|
shell->snap_to_grid = snap ? TRUE : FALSE;
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
appearance_set_action_active (shell, "view-snap-to-grid", snap);
|
2005-01-04 00:55:24 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2008-08-10 18:09:03 +08:00
|
|
|
gimp_display_shell_get_snap_to_grid (const GimpDisplayShell *shell)
|
2005-01-04 00:55:24 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
|
|
|
return shell->snap_to_grid;
|
|
|
|
}
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
void
|
|
|
|
gimp_display_shell_set_snap_to_guides (GimpDisplayShell *shell,
|
|
|
|
gboolean snap)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
|
|
|
if (snap != shell->snap_to_guides)
|
|
|
|
{
|
|
|
|
shell->snap_to_guides = snap ? TRUE : FALSE;
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
appearance_set_action_active (shell, "view-snap-to-guides", snap);
|
2004-04-29 20:52:29 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2008-08-10 18:09:03 +08:00
|
|
|
gimp_display_shell_get_snap_to_guides (const GimpDisplayShell *shell)
|
2004-04-29 20:52:29 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
|
|
|
return shell->snap_to_guides;
|
|
|
|
}
|
|
|
|
|
2005-01-04 00:19:10 +08:00
|
|
|
void
|
|
|
|
gimp_display_shell_set_snap_to_canvas (GimpDisplayShell *shell,
|
|
|
|
gboolean snap)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
|
|
|
if (snap != shell->snap_to_canvas)
|
|
|
|
{
|
|
|
|
shell->snap_to_canvas = snap ? TRUE : FALSE;
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
appearance_set_action_active (shell, "view-snap-to-canvas", snap);
|
2005-01-04 00:19:10 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2008-08-10 18:09:03 +08:00
|
|
|
gimp_display_shell_get_snap_to_canvas (const GimpDisplayShell *shell)
|
2005-01-04 00:19:10 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
|
|
|
return shell->snap_to_canvas;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_display_shell_set_snap_to_vectors (GimpDisplayShell *shell,
|
|
|
|
gboolean snap)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
|
|
|
if (snap != shell->snap_to_vectors)
|
|
|
|
{
|
|
|
|
shell->snap_to_vectors = snap ? TRUE : FALSE;
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
appearance_set_action_active (shell, "view-snap-to-vectors", snap);
|
2005-01-04 00:19:10 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2008-08-10 18:09:03 +08:00
|
|
|
gimp_display_shell_get_snap_to_vectors (const GimpDisplayShell *shell)
|
2005-01-04 00:19:10 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
|
|
|
return shell->snap_to_vectors;
|
|
|
|
}
|
|
|
|
|
2003-07-18 06:30:13 +08:00
|
|
|
void
|
2003-10-22 22:46:05 +08:00
|
|
|
gimp_display_shell_set_padding (GimpDisplayShell *shell,
|
|
|
|
GimpCanvasPaddingMode padding_mode,
|
|
|
|
const GimpRGB *padding_color)
|
2003-07-18 06:30:13 +08:00
|
|
|
{
|
2003-10-22 22:46:05 +08:00
|
|
|
GimpDisplayOptions *options;
|
2003-10-23 20:08:16 +08:00
|
|
|
GimpRGB color;
|
2003-07-18 06:30:13 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
g_return_if_fail (padding_color != NULL);
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
options = appearance_get_options (shell);
|
2003-10-23 20:08:16 +08:00
|
|
|
color = *padding_color;
|
2003-07-18 06:30:13 +08:00
|
|
|
|
2003-10-22 22:46:05 +08:00
|
|
|
switch (padding_mode)
|
2003-07-18 06:30:13 +08:00
|
|
|
{
|
2003-10-22 22:46:05 +08:00
|
|
|
case GIMP_CANVAS_PADDING_MODE_DEFAULT:
|
2003-07-18 06:30:13 +08:00
|
|
|
if (shell->canvas)
|
|
|
|
{
|
2008-06-28 23:12:13 +08:00
|
|
|
GtkStyle *style;
|
|
|
|
|
2003-07-18 06:30:13 +08:00
|
|
|
gtk_widget_ensure_style (shell->canvas);
|
2008-06-28 23:12:13 +08:00
|
|
|
|
|
|
|
style = gtk_widget_get_style (shell->canvas);
|
|
|
|
|
|
|
|
gimp_rgb_set_gdk_color (&color, style->bg + GTK_STATE_NORMAL);
|
2003-07-18 06:30:13 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2003-10-22 22:46:05 +08:00
|
|
|
case GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK:
|
2007-12-29 03:14:36 +08:00
|
|
|
color = *gimp_render_light_check_color ();
|
2003-07-18 06:30:13 +08:00
|
|
|
break;
|
|
|
|
|
2003-10-22 22:46:05 +08:00
|
|
|
case GIMP_CANVAS_PADDING_MODE_DARK_CHECK:
|
2007-12-29 03:14:36 +08:00
|
|
|
color = *gimp_render_dark_check_color ();
|
2003-07-18 06:30:13 +08:00
|
|
|
break;
|
|
|
|
|
2003-10-22 22:46:05 +08:00
|
|
|
case GIMP_CANVAS_PADDING_MODE_CUSTOM:
|
2004-06-23 00:31:27 +08:00
|
|
|
case GIMP_CANVAS_PADDING_MODE_RESET:
|
2003-07-18 06:30:13 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-10-22 22:46:05 +08:00
|
|
|
g_object_set (options,
|
|
|
|
"padding-mode", padding_mode,
|
|
|
|
"padding-color", &color,
|
|
|
|
NULL);
|
|
|
|
|
2003-11-11 03:35:56 +08:00
|
|
|
gimp_canvas_set_bg_color (GIMP_CANVAS (shell->canvas), &color);
|
2003-07-18 06:30:13 +08:00
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
appearance_set_action_color (shell, "view-padding-color-menu",
|
|
|
|
&options->padding_color);
|
2003-07-18 06:30:13 +08:00
|
|
|
|
|
|
|
gimp_display_shell_expose_full (shell);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-08-10 18:09:03 +08:00
|
|
|
gimp_display_shell_get_padding (const GimpDisplayShell *shell,
|
|
|
|
GimpCanvasPaddingMode *padding_mode,
|
|
|
|
GimpRGB *padding_color)
|
2003-07-18 06:30:13 +08:00
|
|
|
{
|
2003-10-22 22:46:05 +08:00
|
|
|
GimpDisplayOptions *options;
|
2003-07-18 06:30:13 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2009-09-25 07:12:55 +08:00
|
|
|
options = appearance_get_options (shell);
|
2003-07-18 06:30:13 +08:00
|
|
|
|
|
|
|
if (padding_mode)
|
2003-10-22 22:46:05 +08:00
|
|
|
*padding_mode = options->padding_mode;
|
2003-07-18 06:30:13 +08:00
|
|
|
|
|
|
|
if (padding_color)
|
2003-10-22 22:46:05 +08:00
|
|
|
*padding_color = options->padding_color;
|
2003-03-12 00:49:36 +08:00
|
|
|
}
|
2009-09-25 07:12:55 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static GimpDisplayOptions *
|
|
|
|
appearance_get_options (const GimpDisplayShell *shell)
|
|
|
|
{
|
|
|
|
if (shell->display->image)
|
|
|
|
{
|
|
|
|
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));
|
|
|
|
GimpImageWindow *window = GIMP_IMAGE_WINDOW (toplevel);
|
|
|
|
|
|
|
|
if (gimp_image_window_get_fullscreen (window))
|
|
|
|
return shell->fullscreen_options;
|
|
|
|
else
|
|
|
|
return shell->options;
|
|
|
|
}
|
|
|
|
|
|
|
|
return shell->no_image_options;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
appearance_set_action_active (GimpDisplayShell *shell,
|
|
|
|
const gchar *action,
|
|
|
|
gboolean active)
|
|
|
|
{
|
|
|
|
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));
|
|
|
|
GimpImageWindow *window = GIMP_IMAGE_WINDOW (toplevel);
|
|
|
|
GimpContext *context;
|
|
|
|
|
|
|
|
if (gimp_image_window_get_active_display (window) == shell->display)
|
|
|
|
{
|
|
|
|
GimpActionGroup *action_group;
|
|
|
|
|
|
|
|
action_group = gimp_ui_manager_get_action_group (window->menubar_manager,
|
|
|
|
"view");
|
|
|
|
|
|
|
|
if (action_group)
|
|
|
|
gimp_action_group_set_action_active (action_group, action, active);
|
|
|
|
}
|
|
|
|
|
|
|
|
context = gimp_get_user_context (shell->display->gimp);
|
|
|
|
|
|
|
|
if (shell->display == gimp_context_get_display (context))
|
|
|
|
{
|
|
|
|
GimpActionGroup *action_group;
|
|
|
|
|
|
|
|
action_group = gimp_ui_manager_get_action_group (shell->popup_manager,
|
|
|
|
"view");
|
|
|
|
|
|
|
|
if (action_group)
|
|
|
|
gimp_action_group_set_action_active (action_group, action, active);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
appearance_set_action_color (GimpDisplayShell *shell,
|
|
|
|
const gchar *action,
|
|
|
|
const GimpRGB *color)
|
|
|
|
{
|
|
|
|
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));
|
|
|
|
GimpImageWindow *window = GIMP_IMAGE_WINDOW (toplevel);
|
|
|
|
GimpContext *context;
|
|
|
|
|
|
|
|
if (gimp_image_window_get_active_display (window) == shell->display)
|
|
|
|
{
|
|
|
|
GimpActionGroup *action_group;
|
|
|
|
|
|
|
|
action_group = gimp_ui_manager_get_action_group (window->menubar_manager,
|
|
|
|
"view");
|
|
|
|
|
|
|
|
if (action_group)
|
|
|
|
gimp_action_group_set_action_color (action_group, action, color, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
context = gimp_get_user_context (shell->display->gimp);
|
|
|
|
|
|
|
|
if (shell->display == gimp_context_get_display (context))
|
|
|
|
{
|
|
|
|
GimpActionGroup *action_group;
|
|
|
|
|
|
|
|
action_group = gimp_ui_manager_get_action_group (shell->popup_manager,
|
|
|
|
"view");
|
|
|
|
|
|
|
|
if (action_group)
|
|
|
|
gimp_action_group_set_action_color (action_group, action, color, FALSE);
|
|
|
|
}
|
|
|
|
}
|