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
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://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 "display-types.h"
|
|
|
|
|
2010-02-02 04:55:18 +08:00
|
|
|
#include "config/gimpdisplayoptions.h"
|
|
|
|
|
2003-03-20 19:31:33 +08:00
|
|
|
#include "core/gimpimage.h"
|
|
|
|
|
2010-11-28 20:19:06 +08:00
|
|
|
#include "widgets/gimpdockcolumns.h"
|
2005-07-20 04:42:14 +08:00
|
|
|
#include "widgets/gimprender.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"
|
2010-10-02 02:41:27 +08:00
|
|
|
#include "gimpcanvasitem.h"
|
2003-03-20 19:31:33 +08:00
|
|
|
#include "gimpdisplay.h"
|
2003-03-12 00:49:36 +08:00
|
|
|
#include "gimpdisplayshell.h"
|
2016-05-15 04:51:21 +08:00
|
|
|
#include "gimpdisplayshell-actions.h"
|
2003-03-12 00:49:36 +08:00
|
|
|
#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
|
|
|
|
2016-05-15 04:51:21 +08:00
|
|
|
static GimpDisplayOptions * appearance_get_options (GimpDisplayShell *shell);
|
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;
|
2009-09-25 20:06:14 +08:00
|
|
|
GimpImageWindow *window;
|
2008-03-19 06:21:47 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2009-09-30 02:32:26 +08:00
|
|
|
options = appearance_get_options (shell);
|
|
|
|
window = gimp_display_shell_get_window (shell);
|
2009-09-25 20:06:14 +08:00
|
|
|
|
2009-09-30 02:32:26 +08:00
|
|
|
if (window)
|
2009-10-04 21:31:38 +08:00
|
|
|
{
|
2010-10-20 02:01:16 +08:00
|
|
|
gboolean fullscreen = gimp_image_window_get_fullscreen (window);
|
2009-10-04 21:31:38 +08:00
|
|
|
|
2016-05-15 04:51:21 +08:00
|
|
|
gimp_display_shell_set_action_active (shell, "view-fullscreen",
|
|
|
|
fullscreen);
|
2009-10-04 21:31:38 +08:00
|
|
|
}
|
2008-03-19 06:21:47 +08:00
|
|
|
|
|
|
|
gimp_display_shell_set_show_menubar (shell,
|
|
|
|
options->show_menubar);
|
2009-09-25 07:18:22 +08:00
|
|
|
gimp_display_shell_set_show_statusbar (shell,
|
|
|
|
options->show_statusbar);
|
|
|
|
|
2008-03-19 06:21:47 +08:00
|
|
|
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_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
|
|
|
GimpImageWindow *window;
|
2003-03-20 19:31:33 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2009-09-30 02:32:26 +08:00
|
|
|
options = appearance_get_options (shell);
|
|
|
|
window = gimp_display_shell_get_window (shell);
|
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-30 03:44:43 +08:00
|
|
|
if (window && gimp_image_window_get_active_shell (window) == shell)
|
2004-12-01 08:13:48 +08:00
|
|
|
{
|
2010-02-28 22:22:17 +08:00
|
|
|
gimp_image_window_keep_canvas_pos (gimp_display_shell_get_window (shell));
|
2009-09-30 03:44:43 +08:00
|
|
|
gimp_image_window_set_show_menubar (window, show);
|
2004-12-01 08:13:48 +08:00
|
|
|
}
|
2003-10-22 22:46:05 +08:00
|
|
|
|
2016-05-15 04:51:21 +08:00
|
|
|
gimp_display_shell_set_action_active (shell, "view-show-menubar", show);
|
2003-03-20 19:31:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2009-10-25 03:02:19 +08:00
|
|
|
gimp_display_shell_get_show_menubar (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
|
|
|
}
|
|
|
|
|
2009-09-25 07:18:22 +08:00
|
|
|
void
|
|
|
|
gimp_display_shell_set_show_statusbar (GimpDisplayShell *shell,
|
|
|
|
gboolean show)
|
|
|
|
{
|
|
|
|
GimpDisplayOptions *options;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2009-09-30 02:32:26 +08:00
|
|
|
options = appearance_get_options (shell);
|
2009-09-25 07:18:22 +08:00
|
|
|
|
|
|
|
g_object_set (options, "show-statusbar", show, NULL);
|
|
|
|
|
2010-02-28 22:22:17 +08:00
|
|
|
gimp_image_window_keep_canvas_pos (gimp_display_shell_get_window (shell));
|
2009-10-04 21:31:38 +08:00
|
|
|
gimp_statusbar_set_visible (GIMP_STATUSBAR (shell->statusbar), show);
|
2009-09-25 07:18:22 +08:00
|
|
|
|
2016-05-15 04:51:21 +08:00
|
|
|
gimp_display_shell_set_action_active (shell, "view-show-statusbar", show);
|
2009-09-25 07:18:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2009-10-25 03:02:19 +08:00
|
|
|
gimp_display_shell_get_show_statusbar (GimpDisplayShell *shell)
|
2009-09-25 07:18:22 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
|
|
|
return appearance_get_options (shell)->show_statusbar;
|
|
|
|
}
|
|
|
|
|
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;
|
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
|
|
|
|
2010-02-28 22:22:17 +08:00
|
|
|
gimp_image_window_keep_canvas_pos (gimp_display_shell_get_window (shell));
|
2009-10-17 20:56:28 +08:00
|
|
|
gtk_widget_set_visible (shell->origin, show);
|
|
|
|
gtk_widget_set_visible (shell->hrule, show);
|
|
|
|
gtk_widget_set_visible (shell->vrule, show);
|
2003-03-20 19:31:33 +08:00
|
|
|
|
2016-05-15 04:51:21 +08:00
|
|
|
gimp_display_shell_set_action_active (shell, "view-show-rulers", show);
|
2003-03-20 19:31:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2009-10-25 03:02:19 +08:00
|
|
|
gimp_display_shell_get_show_rulers (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;
|
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
|
|
|
|
2010-02-28 22:22:17 +08:00
|
|
|
gimp_image_window_keep_canvas_pos (gimp_display_shell_get_window (shell));
|
2009-10-17 20:56:28 +08:00
|
|
|
gtk_widget_set_visible (shell->nav_ebox, show);
|
|
|
|
gtk_widget_set_visible (shell->hsb, show);
|
|
|
|
gtk_widget_set_visible (shell->vsb, show);
|
|
|
|
gtk_widget_set_visible (shell->quick_mask_button, show);
|
|
|
|
gtk_widget_set_visible (shell->zoom_button, show);
|
|
|
|
|
2016-05-15 04:51:21 +08:00
|
|
|
gimp_display_shell_set_action_active (shell, "view-show-scrollbars", show);
|
2003-06-24 03:34:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2009-10-25 03:02:19 +08:00
|
|
|
gimp_display_shell_get_show_scrollbars (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
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2010-10-09 18:55:11 +08:00
|
|
|
gimp_display_shell_selection_set_show (shell, show);
|
2003-03-20 19:31:33 +08:00
|
|
|
|
2016-05-15 04:51:21 +08:00
|
|
|
gimp_display_shell_set_action_active (shell, "view-show-selection", show);
|
2003-03-20 19:31:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2009-10-25 03:02:19 +08:00
|
|
|
gimp_display_shell_get_show_selection (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
|
|
|
|
2010-10-03 06:28:40 +08:00
|
|
|
gimp_canvas_item_set_visible (shell->layer_boundary, show);
|
2003-03-12 00:49:36 +08:00
|
|
|
|
2016-05-15 04:51:21 +08:00
|
|
|
gimp_display_shell_set_action_active (shell, "view-show-layer-boundary", show);
|
2003-03-12 00:49:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2009-10-25 03:02:19 +08:00
|
|
|
gimp_display_shell_get_show_layer (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
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
2010-10-02 02:41:27 +08:00
|
|
|
gimp_canvas_item_set_visible (shell->guides, show);
|
2003-03-12 00:49:36 +08:00
|
|
|
|
2016-05-15 04:51:21 +08:00
|
|
|
gimp_display_shell_set_action_active (shell, "view-show-guides", show);
|
2003-03-12 00:49:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2009-10-25 03:02:19 +08:00
|
|
|
gimp_display_shell_get_show_guides (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
|
|
|
|
2010-10-03 02:57:40 +08:00
|
|
|
gimp_canvas_item_set_visible (shell->grid, show);
|
2003-03-12 00:49:36 +08:00
|
|
|
|
2016-05-15 04:51:21 +08:00
|
|
|
gimp_display_shell_set_action_active (shell, "view-show-grid", show);
|
2003-03-12 00:49:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2009-10-25 03:02:19 +08:00
|
|
|
gimp_display_shell_get_show_grid (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);
|
|
|
|
|
2010-10-02 02:41:27 +08:00
|
|
|
gimp_canvas_item_set_visible (shell->sample_points, show);
|
2005-03-05 00:34:59 +08:00
|
|
|
|
2016-05-15 04:51:21 +08:00
|
|
|
gimp_display_shell_set_action_active (shell, "view-show-sample-points", show);
|
2005-03-05 00:34:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2009-10-25 03:02:19 +08:00
|
|
|
gimp_display_shell_get_show_sample_points (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)
|
|
|
|
{
|
2013-07-16 17:21:34 +08:00
|
|
|
GimpDisplayOptions *options;
|
|
|
|
|
2005-01-04 00:55:24 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2013-07-16 17:21:34 +08:00
|
|
|
options = appearance_get_options (shell);
|
2005-01-04 00:55:24 +08:00
|
|
|
|
2013-07-16 17:21:34 +08:00
|
|
|
g_object_set (options, "snap-to-grid", snap, NULL);
|
2005-01-04 00:55:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2009-10-25 03:02:19 +08:00
|
|
|
gimp_display_shell_get_snap_to_grid (GimpDisplayShell *shell)
|
2005-01-04 00:55:24 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
2013-07-16 17:21:34 +08:00
|
|
|
return appearance_get_options (shell)->snap_to_grid;
|
2005-01-04 00:55:24 +08:00
|
|
|
}
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
void
|
|
|
|
gimp_display_shell_set_snap_to_guides (GimpDisplayShell *shell,
|
|
|
|
gboolean snap)
|
|
|
|
{
|
2013-07-16 17:21:34 +08:00
|
|
|
GimpDisplayOptions *options;
|
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2013-07-16 17:21:34 +08:00
|
|
|
options = appearance_get_options (shell);
|
2004-04-29 20:52:29 +08:00
|
|
|
|
2013-07-16 17:21:34 +08:00
|
|
|
g_object_set (options, "snap-to-guides", snap, NULL);
|
2004-04-29 20:52:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2009-10-25 03:02:19 +08:00
|
|
|
gimp_display_shell_get_snap_to_guides (GimpDisplayShell *shell)
|
2004-04-29 20:52:29 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
2013-07-16 17:21:34 +08:00
|
|
|
return appearance_get_options (shell)->snap_to_guides;
|
2004-04-29 20:52:29 +08:00
|
|
|
}
|
|
|
|
|
2005-01-04 00:19:10 +08:00
|
|
|
void
|
|
|
|
gimp_display_shell_set_snap_to_canvas (GimpDisplayShell *shell,
|
|
|
|
gboolean snap)
|
|
|
|
{
|
2013-07-16 17:21:34 +08:00
|
|
|
GimpDisplayOptions *options;
|
|
|
|
|
2005-01-04 00:19:10 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2013-07-16 17:21:34 +08:00
|
|
|
options = appearance_get_options (shell);
|
2005-01-04 00:19:10 +08:00
|
|
|
|
2013-07-16 17:21:34 +08:00
|
|
|
g_object_set (options, "snap-to-canvas", snap, NULL);
|
2005-01-04 00:19:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2009-10-25 03:02:19 +08:00
|
|
|
gimp_display_shell_get_snap_to_canvas (GimpDisplayShell *shell)
|
2005-01-04 00:19:10 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
2013-07-16 17:21:34 +08:00
|
|
|
return appearance_get_options (shell)->snap_to_canvas;
|
2005-01-04 00:19:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_display_shell_set_snap_to_vectors (GimpDisplayShell *shell,
|
|
|
|
gboolean snap)
|
|
|
|
{
|
2013-07-16 17:21:34 +08:00
|
|
|
GimpDisplayOptions *options;
|
|
|
|
|
2005-01-04 00:19:10 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
|
|
|
2013-07-16 17:21:34 +08:00
|
|
|
options = appearance_get_options (shell);
|
2005-01-04 00:19:10 +08:00
|
|
|
|
2013-07-16 17:21:34 +08:00
|
|
|
g_object_set (options, "snap-to-path", snap, NULL);
|
2005-01-04 00:19:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2009-10-25 03:02:19 +08:00
|
|
|
gimp_display_shell_get_snap_to_vectors (GimpDisplayShell *shell)
|
2005-01-04 00:19:10 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
|
|
|
2013-07-16 17:21:34 +08:00
|
|
|
return appearance_get_options (shell)->snap_to_path;
|
2005-01-04 00:19:10 +08:00
|
|
|
}
|
|
|
|
|
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
|
|
|
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);
|
|
|
|
|
2018-05-24 04:46:54 +08:00
|
|
|
gimp_canvas_set_padding (GIMP_CANVAS (shell->canvas),
|
|
|
|
padding_mode, &color);
|
2003-07-18 06:30:13 +08:00
|
|
|
|
2018-05-24 04:46:54 +08:00
|
|
|
if (padding_mode != GIMP_CANVAS_PADDING_MODE_DEFAULT)
|
|
|
|
gimp_display_shell_set_action_color (shell, "view-padding-color-menu",
|
|
|
|
&options->padding_color);
|
|
|
|
else
|
|
|
|
gimp_display_shell_set_action_color (shell, "view-padding-color-menu",
|
|
|
|
NULL);
|
2003-07-18 06:30:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-05-24 04:46:54 +08:00
|
|
|
gimp_display_shell_get_padding (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 *
|
2009-10-25 03:02:19 +08:00
|
|
|
appearance_get_options (GimpDisplayShell *shell)
|
2009-09-25 07:12:55 +08:00
|
|
|
{
|
2009-10-07 01:20:44 +08:00
|
|
|
if (gimp_display_get_image (shell->display))
|
2009-09-25 07:12:55 +08:00
|
|
|
{
|
2009-09-30 02:32:26 +08:00
|
|
|
GimpImageWindow *window = gimp_display_shell_get_window (shell);
|
2009-09-25 07:12:55 +08:00
|
|
|
|
2009-09-30 02:32:26 +08:00
|
|
|
if (window && gimp_image_window_get_fullscreen (window))
|
2009-09-25 07:12:55 +08:00
|
|
|
return shell->fullscreen_options;
|
|
|
|
else
|
|
|
|
return shell->options;
|
|
|
|
}
|
|
|
|
|
|
|
|
return shell->no_image_options;
|
|
|
|
}
|