diff --git a/ChangeLog b/ChangeLog index 043cfde5a2..0cc2d72686 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +2003-10-22 Sven Neumann + + * app/display/Makefile.am + * app/display/gimpdisplayoptions.[ch]: new files that implement + a GimpConfig object with GimpDisplayShell and GimpCanvas options. + Actually two classes, one for the normal view, a derived one with + different default values for fullscreen mode. + + * app/display/display-enums.[ch]: renamed GimpDisplayPadding enum + to GimpCanvasPadding. + + * app/config/config-types.h: added the GimpDisplayOptions typedef. + + * app/config/gimprc-blurbs.h + * app/config/gimpdisplayconfig.[ch]: replaced a bunch of properties + with two instances of GimpDisplayOptions. + + * app/display/gimpdisplayshell.[ch]: replaced the + GimpDisplayShellAppearance struct with GimpDisplayOptions. + + * app/display/gimpdisplayshell-appearance.[ch] + * app/display/gimpdisplayshell-callbacks.c + * app/display/gimpdisplayshell-handlers.[ch] + * app/gui/image-menu.c: changed accordingly. + + * app/gui/preferences-dialog.c: added a convenience function that + creates a view on a GimpDisplayOptions object. Not all values are + configurable here yet. + + * docs/gimprc-1.3.5.in + * etc/gimprc: regenerated to document the gimprc format changes. + 2003-10-22 Sven Neumann * app/widgets/gimpwidgets-utils.[ch]: added new function diff --git a/app/config/config-types.h b/app/config/config-types.h index b941d8502e..e719bd0dd1 100644 --- a/app/config/config-types.h +++ b/app/config/config-types.h @@ -23,21 +23,22 @@ #define __CONFIG_TYPES_H__ -typedef struct _GimpConfig GimpConfig; /* dummy typedef */ -typedef struct _GimpConfigInterface GimpConfigInterface; +typedef struct _GimpConfig GimpConfig; /* dummy typedef */ +typedef struct _GimpConfigInterface GimpConfigInterface; -typedef struct _GimpBaseConfig GimpBaseConfig; -typedef struct _GimpCoreConfig GimpCoreConfig; -typedef struct _GimpDisplayConfig GimpDisplayConfig; -typedef struct _GimpGuiConfig GimpGuiConfig; -typedef struct _GimpPluginConfig GimpPluginConfig; -typedef struct _GimpRc GimpRc; +typedef struct _GimpBaseConfig GimpBaseConfig; +typedef struct _GimpCoreConfig GimpCoreConfig; +typedef struct _GimpDisplayConfig GimpDisplayConfig; +typedef struct _GimpGuiConfig GimpGuiConfig; +typedef struct _GimpPluginConfig GimpPluginConfig; +typedef struct _GimpRc GimpRc; -typedef struct _GimpConfigWriter GimpConfigWriter; -typedef struct _GimpXmlParser GimpXmlParser; +typedef struct _GimpConfigWriter GimpConfigWriter; +typedef struct _GimpXmlParser GimpXmlParser; -typedef struct _GimpGrid GimpGrid; -typedef struct _GimpTemplate GimpTemplate; +typedef struct _GimpDisplayOptions GimpDisplayOptions; +typedef struct _GimpGrid GimpGrid; +typedef struct _GimpTemplate GimpTemplate; #endif /* __CONFIG_TYPES_H__ */ diff --git a/app/config/gimpdisplayconfig.c b/app/config/gimpdisplayconfig.c index e3ac3a7424..ef108e3859 100644 --- a/app/config/gimpdisplayconfig.c +++ b/app/config/gimpdisplayconfig.c @@ -28,6 +28,10 @@ #include "config-types.h" +#include "display/display-enums.h" +#include "display/gimpdisplayoptions.h" + +#include "gimpconfig.h" #include "gimpconfig-params.h" #include "gimpconfig-types.h" #include "gimpconfig-utils.h" @@ -39,6 +43,7 @@ static void gimp_display_config_class_init (GimpDisplayConfigClass *klass); +static void gimp_display_config_init (GimpDisplayConfig *config); static void gimp_display_config_finalize (GObject *object); static void gimp_display_config_set_property (GObject *object, guint property_id, @@ -49,10 +54,18 @@ static void gimp_display_config_get_property (GObject *object, GValue *value, GParamSpec *pspec); +static void gimp_display_config_view_notify (GObject *object, + GParamSpec *pspec, + gpointer data); +static void gimp_display_config_fullscreen_notify (GObject *object, + GParamSpec *pspec, + gpointer data); + #define DEFAULT_IMAGE_TITLE_FORMAT "%f-%p.%i (%t, %L) %z%%" #define DEFAULT_IMAGE_STATUS_FORMAT "%n (%m)" + enum { PROP_0, @@ -73,18 +86,8 @@ enum PROP_MONITOR_YRESOLUTION, PROP_MONITOR_RES_FROM_GDK, PROP_NAV_PREVIEW_SIZE, - PROP_SHOW_MENUBAR, - PROP_SHOW_RULERS, - PROP_SHOW_SCROLLBARS, - PROP_SHOW_STATUSBAR, - PROP_CANVAS_PADDING_MODE, - PROP_CANVAS_PADDING_COLOR, - PROP_FS_SHOW_MENUBAR, - PROP_FS_SHOW_RULERS, - PROP_FS_SHOW_SCROLLBARS, - PROP_FS_SHOW_STATUSBAR, - PROP_FS_CANVAS_PADDING_MODE, - PROP_FS_CANVAS_PADDING_COLOR + PROP_DEFAULT_VIEW, + PROP_DEFAULT_FULLSCREEN_VIEW }; static GObjectClass *parent_class = NULL; @@ -107,7 +110,7 @@ gimp_display_config_get_type (void) NULL, /* class_data */ sizeof (GimpDisplayConfig), 0, /* n_preallocs */ - NULL /* instance_init */ + (GInstanceInitFunc) gimp_display_config_init }; config_type = g_type_register_static (GIMP_TYPE_CORE_CONFIG, @@ -218,77 +221,50 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass) GIMP_PREVIEW_SIZE_MEDIUM, 0); - GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_MENUBAR, - "show-menubar", SHOW_MENUBAR_BLURB, - TRUE, - 0); - GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_RULERS, - "show-rulers", SHOW_RULERS_BLURB, - TRUE, - 0); - GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_SCROLLBARS, - "show-scrollbars", SHOW_SCROLLBARS_BLURB, - TRUE, - 0); - GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_STATUSBAR, - "show-statusbar", SHOW_STATUSBAR_BLURB, - TRUE, - 0); - GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_CANVAS_PADDING_MODE, - "canvas-padding-mode", - CANVAS_PADDING_MODE_BLURB, - GIMP_TYPE_DISPLAY_PADDING_MODE, - GIMP_DISPLAY_PADDING_MODE_DEFAULT, - 0); - GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, PROP_CANVAS_PADDING_COLOR, - "canvas-padding-color", - CANVAS_PADDING_COLOR_BLURB, - &white, - 0); + GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_DEFAULT_VIEW, + "default-view", + DEFAULT_VIEW_BLURB, + GIMP_TYPE_DISPLAY_OPTIONS, + GIMP_PARAM_AGGREGATE); + GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_DEFAULT_FULLSCREEN_VIEW, + "default-fullscreen-view", + DEFAULT_FULLSCREEN_VIEW_BLURB, + GIMP_TYPE_DISPLAY_OPTIONS, + GIMP_PARAM_AGGREGATE); +} - GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FS_SHOW_MENUBAR, - "fullscreen-show-menubar", - FS_SHOW_MENUBAR_BLURB, - FALSE, - 0); - GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FS_SHOW_RULERS, - "fullscreen-show-rulers", - FS_SHOW_RULERS_BLURB, - FALSE, - 0); - GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FS_SHOW_SCROLLBARS, - "fullscreen-show-scrollbars", - FS_SHOW_SCROLLBARS_BLURB, - FALSE, - 0); - GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FS_SHOW_STATUSBAR, - "fullscreen-show-statusbar", - FS_SHOW_STATUSBAR_BLURB, - FALSE, - 0); - GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_FS_CANVAS_PADDING_MODE, - "fullscreen-canvas-padding-mode", - FS_CANVAS_PADDING_MODE_BLURB, - GIMP_TYPE_DISPLAY_PADDING_MODE, - GIMP_DISPLAY_PADDING_MODE_CUSTOM, - 0); - GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, PROP_FS_CANVAS_PADDING_COLOR, - "fullscreen-canvas-padding-color", - FS_CANVAS_PADDING_COLOR_BLURB, - &black, - 0); +static void +gimp_display_config_init (GimpDisplayConfig *config) +{ + config->default_view = + g_object_new (GIMP_TYPE_DISPLAY_OPTIONS, NULL); + + g_signal_connect (config->default_view, "notify", + G_CALLBACK (gimp_display_config_view_notify), + config); + + config->default_fullscreen_view = + g_object_new (GIMP_TYPE_DISPLAY_OPTIONS_FULLSCREEN, NULL); + + g_signal_connect (config->default_fullscreen_view, "notify", + G_CALLBACK (gimp_display_config_fullscreen_notify), + config); } static void gimp_display_config_finalize (GObject *object) { - GimpDisplayConfig *display_config; - - display_config = GIMP_DISPLAY_CONFIG (object); + GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (object); g_free (display_config->image_title_format); g_free (display_config->image_status_format); + if (display_config->default_view) + g_object_unref (display_config->default_view); + + if (display_config->default_fullscreen_view) + g_object_unref (display_config->default_fullscreen_view); + G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -298,9 +274,7 @@ gimp_display_config_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - GimpDisplayConfig *display_config; - - display_config = GIMP_DISPLAY_CONFIG (object); + GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (object); switch (property_id) { @@ -357,43 +331,15 @@ gimp_display_config_set_property (GObject *object, case PROP_NAV_PREVIEW_SIZE: display_config->nav_preview_size = g_value_get_enum (value); break; - - case PROP_SHOW_MENUBAR: - display_config->show_menubar = g_value_get_boolean (value); + case PROP_DEFAULT_VIEW: + if (g_value_get_object (value)) + gimp_config_sync (GIMP_CONFIG (g_value_get_object (value)), + GIMP_CONFIG (display_config->default_view), 0); break; - case PROP_SHOW_RULERS: - display_config->show_rulers = g_value_get_boolean (value); - break; - case PROP_SHOW_SCROLLBARS: - display_config->show_scrollbars = g_value_get_boolean (value); - break; - case PROP_SHOW_STATUSBAR: - display_config->show_statusbar = g_value_get_boolean (value); - break; - case PROP_CANVAS_PADDING_MODE: - display_config->canvas_padding_mode = g_value_get_enum (value); - break; - case PROP_CANVAS_PADDING_COLOR: - display_config->canvas_padding_color = *(GimpRGB *) g_value_get_boxed (value); - break; - - case PROP_FS_SHOW_MENUBAR: - display_config->fs_show_menubar = g_value_get_boolean (value); - break; - case PROP_FS_SHOW_RULERS: - display_config->fs_show_rulers = g_value_get_boolean (value); - break; - case PROP_FS_SHOW_SCROLLBARS: - display_config->fs_show_scrollbars = g_value_get_boolean (value); - break; - case PROP_FS_SHOW_STATUSBAR: - display_config->fs_show_statusbar = g_value_get_boolean (value); - break; - case PROP_FS_CANVAS_PADDING_MODE: - display_config->fs_canvas_padding_mode = g_value_get_enum (value); - break; - case PROP_FS_CANVAS_PADDING_COLOR: - display_config->fs_canvas_padding_color = *(GimpRGB *) g_value_get_boxed (value); + case PROP_DEFAULT_FULLSCREEN_VIEW: + if (g_value_get_object (value)) + gimp_config_sync (GIMP_CONFIG (g_value_get_object (value)), + GIMP_CONFIG (display_config->default_fullscreen_view), 0); break; default: @@ -408,9 +354,7 @@ gimp_display_config_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - GimpDisplayConfig *display_config; - - display_config = GIMP_DISPLAY_CONFIG (object); + GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (object); switch (property_id) { @@ -465,43 +409,11 @@ gimp_display_config_get_property (GObject *object, case PROP_NAV_PREVIEW_SIZE: g_value_set_enum (value, display_config->nav_preview_size); break; - - case PROP_SHOW_MENUBAR: - g_value_set_boolean (value, display_config->show_menubar); + case PROP_DEFAULT_VIEW: + g_value_set_object (value, display_config->default_view); break; - case PROP_SHOW_RULERS: - g_value_set_boolean (value, display_config->show_rulers); - break; - case PROP_SHOW_SCROLLBARS: - g_value_set_boolean (value, display_config->show_scrollbars); - break; - case PROP_SHOW_STATUSBAR: - g_value_set_boolean (value, display_config->show_statusbar); - break; - case PROP_CANVAS_PADDING_MODE: - g_value_set_enum (value, display_config->canvas_padding_mode); - break; - case PROP_CANVAS_PADDING_COLOR: - g_value_set_boxed (value, &display_config->canvas_padding_color); - break; - - case PROP_FS_SHOW_MENUBAR: - g_value_set_boolean (value, display_config->fs_show_menubar); - break; - case PROP_FS_SHOW_RULERS: - g_value_set_boolean (value, display_config->fs_show_rulers); - break; - case PROP_FS_SHOW_SCROLLBARS: - g_value_set_boolean (value, display_config->fs_show_scrollbars); - break; - case PROP_FS_SHOW_STATUSBAR: - g_value_set_boolean (value, display_config->fs_show_statusbar); - break; - case PROP_FS_CANVAS_PADDING_MODE: - g_value_set_enum (value, display_config->fs_canvas_padding_mode); - break; - case PROP_FS_CANVAS_PADDING_COLOR: - g_value_set_boxed (value, &display_config->fs_canvas_padding_color); + case PROP_DEFAULT_FULLSCREEN_VIEW: + g_value_set_object (value, display_config->default_fullscreen_view); break; default: @@ -509,3 +421,19 @@ gimp_display_config_get_property (GObject *object, break; } } + +static void +gimp_display_config_view_notify (GObject *object, + GParamSpec *pspec, + gpointer data) +{ + g_object_notify (G_OBJECT (data), "default-view"); +} + +static void +gimp_display_config_fullscreen_notify (GObject *object, + GParamSpec *pspec, + gpointer data) +{ + g_object_notify (G_OBJECT (data), "default-fullscreen-view"); +} diff --git a/app/config/gimpdisplayconfig.h b/app/config/gimpdisplayconfig.h index af56f6fd26..9ae7c40f8c 100644 --- a/app/config/gimpdisplayconfig.h +++ b/app/config/gimpdisplayconfig.h @@ -38,39 +38,27 @@ typedef struct _GimpDisplayConfigClass GimpDisplayConfigClass; struct _GimpDisplayConfig { - GimpCoreConfig parent_instance; + GimpCoreConfig parent_instance; - gint marching_ants_speed; - gboolean colormap_cycling; - gboolean resize_windows_on_zoom; - gboolean resize_windows_on_resize; - gboolean default_dot_for_dot; - gboolean initial_zoom_to_fit; - gboolean perfect_mouse; - GimpCursorMode cursor_mode; - gboolean cursor_updating; - gboolean show_brush_outline; - gchar *image_title_format; - gchar *image_status_format; - gboolean confirm_on_close; - gdouble monitor_xres; - gdouble monitor_yres; - gboolean monitor_res_from_gdk; - GimpPreviewSize nav_preview_size; - - gboolean show_menubar; - gboolean show_rulers; - gboolean show_scrollbars; - gboolean show_statusbar; - GimpDisplayPaddingMode canvas_padding_mode; - GimpRGB canvas_padding_color; - - gboolean fs_show_menubar; - gboolean fs_show_rulers; - gboolean fs_show_scrollbars; - gboolean fs_show_statusbar; - GimpDisplayPaddingMode fs_canvas_padding_mode; - GimpRGB fs_canvas_padding_color; + gint marching_ants_speed; + gboolean colormap_cycling; + gboolean resize_windows_on_zoom; + gboolean resize_windows_on_resize; + gboolean default_dot_for_dot; + gboolean initial_zoom_to_fit; + gboolean perfect_mouse; + GimpCursorMode cursor_mode; + gboolean cursor_updating; + gboolean show_brush_outline; + gchar *image_title_format; + gchar *image_status_format; + gboolean confirm_on_close; + gdouble monitor_xres; + gdouble monitor_yres; + gboolean monitor_res_from_gdk; + GimpPreviewSize nav_preview_size; + GimpDisplayOptions *default_view; + GimpDisplayOptions *default_fullscreen_view; }; struct _GimpDisplayConfigClass diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h index 2089d806a7..0df7f40b26 100644 --- a/app/config/gimprc-blurbs.h +++ b/app/config/gimprc-blurbs.h @@ -79,6 +79,12 @@ N_("Tools such as fuzzy-select and bucket fill find regions based on a " \ "intensity from the original is greater than a specified threshold. " \ "This value represents the default threshold.") +#define DEFAULT_VIEW_BLURB \ +"Sets the default settings for the image view." + +#define DEFAULT_FULLSCREEN_VIEW_BLURB \ +"Sets the default settings used when an image is viewed in fullscreen mode." + #define ENVIRON_PATH_BLURB \ "Sets the environ search path." diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c index 683fd38e52..46e8834737 100644 --- a/app/dialogs/preferences-dialog.c +++ b/app/dialogs/preferences-dialog.c @@ -573,7 +573,7 @@ prefs_format_string_select_callback (GtkTreeSelection *sel, } static GtkWidget * -prefs_frame_new (gchar *label, +prefs_frame_new (const gchar *label, GtkContainer *parent, gboolean expand) { @@ -812,6 +812,41 @@ prefs_memsize_entry_add (GObject *config, return entry; } +static void +prefs_display_options_frame_add (Gimp *gimp, + GObject *object, + const gchar *label, + GtkContainer *parent) +{ + GtkBox *box; + GtkWidget *table; + GtkWidget *button; + + box = GTK_BOX (prefs_frame_new (label, parent, FALSE)); + + prefs_check_button_add (object, + "show-menubar", _("Show Menubar"), box); + prefs_check_button_add (object, + "show-rulers", _("Show _Rulers"), box); + prefs_check_button_add (object, + "show-scrollbars", _("Show Scrollbars"), box); + prefs_check_button_add (object, + "show-statusbar", _("Show S_tatusbar"), box); + + table = prefs_table_new (2, GTK_CONTAINER (box), FALSE); + + prefs_enum_option_menu_add (object, "padding-mode", 0, 0, + _("Canvas Padding Mode:"), GTK_TABLE (table), 0); + + button = prefs_color_button_add (object, "padding-color", + _("Custom Padding Color:"), + _("Select Custom Canvas Padding Color"), + GTK_TABLE (table), 1); + gimp_color_panel_set_context (GIMP_COLOR_PANEL (button), + gimp_get_user_context (gimp)); + +} + static void prefs_help_func (const gchar *help_id, gpointer help_data) @@ -1380,63 +1415,15 @@ prefs_dialog_new (Gimp *gimp, &grandchild_iter, page_index++); - /* Normal Mode */ - vbox2 = prefs_frame_new (_("Default Appearance in Normal Mode"), - GTK_CONTAINER (vbox), FALSE); + prefs_display_options_frame_add (gimp, + G_OBJECT (display_config->default_view), + _("Default Appearance in Normal Mode"), + GTK_CONTAINER (vbox)); - prefs_check_button_add (object, "show-menubar", - _("Show Menubar"), - GTK_BOX (vbox2)); - prefs_check_button_add (object, "show-rulers", - _("Show _Rulers"), - GTK_BOX (vbox2)); - prefs_check_button_add (object, "show-scrollbars", - _("Show Scrollbars"), - GTK_BOX (vbox2)); - prefs_check_button_add (object, "show-statusbar", - _("Show S_tatusbar"), - GTK_BOX (vbox2)); - - table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE); - - prefs_enum_option_menu_add (object, "canvas-padding-mode", 0, 0, - _("Canvas Padding Mode:"), - GTK_TABLE (table), 0); - button = prefs_color_button_add (object, "canvas-padding-color", - _("Custom Padding Color:"), - _("Select Custom Canvas Padding Color"), - GTK_TABLE (table), 1); - gimp_color_panel_set_context (GIMP_COLOR_PANEL (button), - gimp_get_user_context (gimp)); - - /* Fullscreen Mode */ - vbox2 = prefs_frame_new (_("Default Appearance in Fullscreen Mode"), - GTK_CONTAINER (vbox), FALSE); - - prefs_check_button_add (object, "fullscreen-show-menubar", - _("Show Menubar"), - GTK_BOX (vbox2)); - prefs_check_button_add (object, "fullscreen-show-rulers", - _("Show _Rulers"), - GTK_BOX (vbox2)); - prefs_check_button_add (object, "fullscreen-show-scrollbars", - _("Show Scrollbars"), - GTK_BOX (vbox2)); - prefs_check_button_add (object, "fullscreen-show-statusbar", - _("Show S_tatusbar"), - GTK_BOX (vbox2)); - - table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE); - - prefs_enum_option_menu_add (object, "fullscreen-canvas-padding-mode", 0, 0, - _("Canvas Padding Mode:"), - GTK_TABLE (table), 0); - button = prefs_color_button_add (object, "fullscreen-canvas-padding-color", - _("Custom Padding Color:"), - _("Select Custom Canvas Padding Color"), - GTK_TABLE (table), 1); - gimp_color_panel_set_context (GIMP_COLOR_PANEL (button), - gimp_get_user_context (gimp)); + prefs_display_options_frame_add (gimp, + G_OBJECT (display_config->default_fullscreen_view), + _("Default Appearance in Fullscreen Mode"), + GTK_CONTAINER (vbox)); /****************************************************************/ diff --git a/app/display/Makefile.am b/app/display/Makefile.am index 11d99a5ad9..14a83d3f46 100644 --- a/app/display/Makefile.am +++ b/app/display/Makefile.am @@ -18,6 +18,8 @@ libappdisplay_a_sources = \ display-types.h \ gimpdisplay.c \ gimpdisplay.h \ + gimpdisplayoptions.c \ + gimpdisplayoptions.h \ gimpdisplay-area.c \ gimpdisplay-area.h \ gimpdisplay-foreach.c \ diff --git a/app/display/display-enums.c b/app/display/display-enums.c index 70f8cba9e9..cd35fd5cd4 100644 --- a/app/display/display-enums.c +++ b/app/display/display-enums.c @@ -28,22 +28,22 @@ gimp_cursor_mode_get_type (void) } -static const GEnumValue gimp_display_padding_mode_enum_values[] = +static const GEnumValue gimp_canvas_padding_mode_enum_values[] = { - { GIMP_DISPLAY_PADDING_MODE_DEFAULT, N_("From Theme"), "default" }, - { GIMP_DISPLAY_PADDING_MODE_LIGHT_CHECK, N_("Light Check Color"), "light-check" }, - { GIMP_DISPLAY_PADDING_MODE_DARK_CHECK, N_("Dark Check Color"), "dark-check" }, - { GIMP_DISPLAY_PADDING_MODE_CUSTOM, N_("Custom Color"), "custom" }, + { GIMP_CANVAS_PADDING_MODE_DEFAULT, N_("From Theme"), "default" }, + { GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK, N_("Light Check Color"), "light-check" }, + { GIMP_CANVAS_PADDING_MODE_DARK_CHECK, N_("Dark Check Color"), "dark-check" }, + { GIMP_CANVAS_PADDING_MODE_CUSTOM, N_("Custom Color"), "custom" }, { 0, NULL, NULL } }; GType -gimp_display_padding_mode_get_type (void) +gimp_canvas_padding_mode_get_type (void) { static GType enum_type = 0; if (!enum_type) - enum_type = g_enum_register_static ("GimpDisplayPaddingMode", gimp_display_padding_mode_enum_values); + enum_type = g_enum_register_static ("GimpCanvasPaddingMode", gimp_canvas_padding_mode_enum_values); return enum_type; } diff --git a/app/display/display-enums.h b/app/display/display-enums.h index ed39eec286..f329c1f6df 100644 --- a/app/display/display-enums.h +++ b/app/display/display-enums.h @@ -27,22 +27,22 @@ GType gimp_cursor_mode_get_type (void) G_GNUC_CONST; typedef enum { GIMP_CURSOR_MODE_TOOL_ICON, /*< desc="Tool Icon" >*/ - GIMP_CURSOR_MODE_TOOL_CROSSHAIR, /*< desc="Tool Icon with Crosshair" >*/ + GIMP_CURSOR_MODE_TOOL_CROSSHAIR, /*< desc="Tool Icon with Crosshair" >*/ GIMP_CURSOR_MODE_CROSSHAIR /*< desc="Crosshair only" >*/ } GimpCursorMode; -#define GIMP_TYPE_DISPLAY_PADDING_MODE (gimp_display_padding_mode_get_type ()) +#define GIMP_TYPE_CANVAS_PADDING_MODE (gimp_canvas_padding_mode_get_type ()) -GType gimp_display_padding_mode_get_type (void) G_GNUC_CONST; +GType gimp_canvas_padding_mode_get_type (void) G_GNUC_CONST; typedef enum { - GIMP_DISPLAY_PADDING_MODE_DEFAULT, /*< desc="From Theme" >*/ - GIMP_DISPLAY_PADDING_MODE_LIGHT_CHECK, /*< desc="Light Check Color" >*/ - GIMP_DISPLAY_PADDING_MODE_DARK_CHECK, /*< desc="Dark Check Color" >*/ - GIMP_DISPLAY_PADDING_MODE_CUSTOM /*< desc="Custom Color" >*/ -} GimpDisplayPaddingMode; + GIMP_CANVAS_PADDING_MODE_DEFAULT, /*< desc="From Theme" >*/ + GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK, /*< desc="Light Check Color" >*/ + GIMP_CANVAS_PADDING_MODE_DARK_CHECK, /*< desc="Dark Check Color" >*/ + GIMP_CANVAS_PADDING_MODE_CUSTOM /*< desc="Custom Color" >*/ +} GimpCanvasPaddingMode; #endif /* __DISPLAY_ENUMS_H__ */ diff --git a/app/display/gimpdisplayoptions.c b/app/display/gimpdisplayoptions.c new file mode 100644 index 0000000000..fdf8c9c276 --- /dev/null +++ b/app/display/gimpdisplayoptions.c @@ -0,0 +1,353 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * GimpDisplayOptions + * Copyright (C) 2003 Sven Neumann + * + * 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 + +#include "libgimpbase/gimpbase.h" +#include "libgimpmath/gimpmath.h" +#include "libgimpcolor/gimpcolor.h" + +#include "core/core-types.h" +#include "display-enums.h" + +#include "config/gimpconfig.h" +#include "config/gimpconfig.h" +#include "config/gimpconfig-params.h" +#include "config/gimprc-blurbs.h" + +#include "gimpdisplayoptions.h" + +#include "gimp-intl.h" + + +enum +{ + PROP_0, + PROP_SHOW_MENUBAR, + PROP_SHOW_RULERS, + PROP_SHOW_SCROLLBARS, + PROP_SHOW_STATUSBAR, + PROP_SHOW_SELECTION, + PROP_SHOW_ACTIVE_LAYER, + PROP_SHOW_GUIDES, + PROP_SHOW_GRID, + PROP_PADDING_MODE, + PROP_PADDING_COLOR +}; + + +static void gimp_display_options_class_init (GimpDisplayOptionsClass *klass); +static void gimp_display_options_fs_class_init (GimpDisplayOptionsClass *klass); +static void gimp_display_options_init (GimpDisplayOptions *options); + +static void gimp_display_options_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_display_options_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); + + +GType +gimp_display_options_get_type (void) +{ + static GType options_type = 0; + + if (! options_type) + { + static const GTypeInfo options_info = + { + sizeof (GimpDisplayOptionsClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_display_options_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GimpDisplayOptions), + 0, /* n_preallocs */ + (GInstanceInitFunc) gimp_display_options_init + }; + static const GInterfaceInfo config_iface_info = + { + NULL, /* iface_init */ + NULL, /* iface_finalize */ + NULL /* iface_data */ + }; + + options_type = g_type_register_static (G_TYPE_OBJECT, + "GimpDisplayOptions", + &options_info, 0); + + g_type_add_interface_static (options_type, GIMP_TYPE_CONFIG, + &config_iface_info); + } + + return options_type; +} + +GType +gimp_display_options_fullscreen_get_type (void) +{ + static GType options_type = 0; + + if (! options_type) + { + static const GTypeInfo options_info = + { + sizeof (GimpDisplayOptionsClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_display_options_fs_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GimpDisplayOptions), + 0, /* n_preallocs */ + NULL /* instance_init */ + }; + static const GInterfaceInfo config_iface_info = + { + NULL, /* iface_init */ + NULL, /* iface_finalize */ + NULL /* iface_data */ + }; + + options_type = g_type_register_static (GIMP_TYPE_DISPLAY_OPTIONS, + "GimpDisplayOptionsFullscreen", + &options_info, 0); + + g_type_add_interface_static (options_type, GIMP_TYPE_CONFIG, + &config_iface_info); + } + + return options_type; +} + +static void +gimp_display_options_class_init (GimpDisplayOptionsClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpRGB white; + + gimp_rgba_set (&white, 1.0, 1.0, 1.0, GIMP_OPACITY_OPAQUE); + + object_class->set_property = gimp_display_options_set_property; + object_class->get_property = gimp_display_options_get_property; + + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_MENUBAR, + "show-menubar", SHOW_MENUBAR_BLURB, + TRUE, + 0); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_RULERS, + "show-rulers", SHOW_RULERS_BLURB, + TRUE, + 0); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_SCROLLBARS, + "show-scrollbars", SHOW_SCROLLBARS_BLURB, + TRUE, + 0); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_STATUSBAR, + "show-statusbar", SHOW_STATUSBAR_BLURB, + TRUE, + 0); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_SELECTION, + "show-selection", NULL, + TRUE, + 0); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_ACTIVE_LAYER, + "show-active-layer", NULL, + TRUE, + 0); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_GUIDES, + "show-guides", NULL, + TRUE, + 0); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_GRID, + "show-grid", NULL, + FALSE, + 0); + GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_PADDING_MODE, + "padding-mode", CANVAS_PADDING_MODE_BLURB, + GIMP_TYPE_CANVAS_PADDING_MODE, + GIMP_CANVAS_PADDING_MODE_DEFAULT, + 0); + GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, PROP_PADDING_COLOR, + "padding-color", CANVAS_PADDING_COLOR_BLURB, + &white, + 0); +} + +static void +gimp_display_options_fs_class_init (GimpDisplayOptionsClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpRGB black; + + gimp_rgba_set (&black, 0.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE); + + object_class->set_property = gimp_display_options_set_property; + object_class->get_property = gimp_display_options_get_property; + + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_MENUBAR, + "show-menubar", FS_SHOW_MENUBAR_BLURB, + FALSE, + 0); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_RULERS, + "show-rulers", FS_SHOW_RULERS_BLURB, + FALSE, + 0); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_SCROLLBARS, + "show-scrollbars", FS_SHOW_SCROLLBARS_BLURB, + FALSE, + 0); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_STATUSBAR, + "show-statusbar", FS_SHOW_STATUSBAR_BLURB, + FALSE, + 0); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_SELECTION, + "show-selection", NULL, + FALSE, + 0); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_ACTIVE_LAYER, + "show-active-layer", NULL, + FALSE, + 0); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_GUIDES, + "show-guides", NULL, + FALSE, + 0); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_GRID, + "show-grid", NULL, + FALSE, + 0); + GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_PADDING_MODE, + "padding-mode", FS_CANVAS_PADDING_MODE_BLURB, + GIMP_TYPE_CANVAS_PADDING_MODE, + GIMP_CANVAS_PADDING_MODE_CUSTOM, + 0); + GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, PROP_PADDING_COLOR, + "padding-color", FS_CANVAS_PADDING_COLOR_BLURB, + &black, + 0); +} + +static void +gimp_display_options_init (GimpDisplayOptions *options) +{ + options->padding_mode_set = FALSE; +} + +static void +gimp_display_options_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + GimpDisplayOptions *options = GIMP_DISPLAY_OPTIONS (object); + + switch (property_id) + { + case PROP_SHOW_MENUBAR: + options->show_menubar = g_value_get_boolean (value); + break; + case PROP_SHOW_RULERS: + options->show_rulers = g_value_get_boolean (value); + break; + case PROP_SHOW_SCROLLBARS: + options->show_scrollbars = g_value_get_boolean (value); + break; + case PROP_SHOW_STATUSBAR: + options->show_statusbar = g_value_get_boolean (value); + break; + case PROP_SHOW_SELECTION: + options->show_selection = g_value_get_boolean (value); + break; + case PROP_SHOW_ACTIVE_LAYER: + options->show_active_layer = g_value_get_boolean (value); + break; + case PROP_SHOW_GUIDES: + options->show_guides = g_value_get_boolean (value); + break; + case PROP_SHOW_GRID: + options->show_grid = g_value_get_boolean (value); + break; + case PROP_PADDING_MODE: + options->padding_mode = g_value_get_enum (value); + break; + case PROP_PADDING_COLOR: + options->padding_color = *(GimpRGB *) g_value_get_boxed (value); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +gimp_display_options_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + GimpDisplayOptions *options = GIMP_DISPLAY_OPTIONS (object); + + switch (property_id) + { + case PROP_SHOW_MENUBAR: + g_value_set_boolean (value, options->show_menubar); + break; + case PROP_SHOW_RULERS: + g_value_set_boolean (value, options->show_rulers); + break; + case PROP_SHOW_SCROLLBARS: + g_value_set_boolean (value, options->show_scrollbars); + break; + case PROP_SHOW_STATUSBAR: + g_value_set_boolean (value, options->show_statusbar); + break; + case PROP_SHOW_SELECTION: + g_value_set_boolean (value, options->show_selection); + break; + case PROP_SHOW_ACTIVE_LAYER: + g_value_set_boolean (value, options->show_active_layer); + break; + case PROP_SHOW_GUIDES: + g_value_set_boolean (value, options->show_guides); + break; + case PROP_SHOW_GRID: + g_value_set_boolean (value, options->show_grid); + break; + case PROP_PADDING_MODE: + g_value_set_enum (value, options->padding_mode); + break; + case PROP_PADDING_COLOR: + g_value_set_boxed (value, &options->padding_color); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} diff --git a/app/display/gimpdisplayoptions.h b/app/display/gimpdisplayoptions.h new file mode 100644 index 0000000000..052769935a --- /dev/null +++ b/app/display/gimpdisplayoptions.h @@ -0,0 +1,68 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * GimpDisplayOptions + * Copyright (C) 2003 Sven Neumann + * + * 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. + */ + +#ifndef __GIMP_DISPLAY_OPTIONS_H__ +#define __GIMP_DISPLAY_OPTIONS_H__ + + +#define GIMP_TYPE_DISPLAY_OPTIONS (gimp_display_options_get_type ()) +#define GIMP_TYPE_DISPLAY_OPTIONS_FULLSCREEN (gimp_display_options_fullscreen_get_type ()) + +#define GIMP_DISPLAY_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DISPLAY_OPTIONS, GimpDisplayOptions)) +#define GIMP_DISPLAY_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DISPLAY_OPTIONS, GimpDisplayOptionsClass)) +#define GIMP_IS_DISPLAY_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DISPLAY_OPTIONS)) +#define GIMP_IS_DISPLAY_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DISPLAY_OPTIONS)) +#define GIMP_DISPLAY_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DISPLAY_OPTIONS, GimpDisplayOptionsClass)) + + +typedef struct _GimpDisplayOptionsClass GimpDisplayOptionsClass; + +struct _GimpDisplayOptions +{ + GObject parent_instance; + + /* GimpDisplayShell options */ + gboolean show_menubar; + gboolean show_rulers; + gboolean show_scrollbars; + gboolean show_statusbar; + + /* GimpCanvas options */ + gboolean show_selection; + gboolean show_active_layer; + gboolean show_guides; + gboolean show_grid; + GimpCanvasPaddingMode padding_mode; + GimpRGB padding_color; + gboolean padding_mode_set; +}; + +struct _GimpDisplayOptionsClass +{ + GObjectClass parent_class; +}; + + +GType gimp_display_options_get_type (void) G_GNUC_CONST; +GType gimp_display_options_fullscreen_get_type (void) G_GNUC_CONST; + + +#endif /* __GIMP_DISPLAY_OPTIONS_H__ */ diff --git a/app/display/gimpdisplayshell-appearance.c b/app/display/gimpdisplayshell-appearance.c index 3130c758de..855c1989cc 100644 --- a/app/display/gimpdisplayshell-appearance.c +++ b/app/display/gimpdisplayshell-appearance.c @@ -31,6 +31,7 @@ #include "widgets/gimpwidgets-utils.h" #include "gimpdisplay.h" +#include "gimpdisplayoptions.h" #include "gimpdisplayshell.h" #include "gimpdisplayshell-appearance.h" #include "gimpdisplayshell-callbacks.h" @@ -38,9 +39,8 @@ #include "gimpdisplayshell-render.h" -#define GET_APPEARANCE(shell) \ - (gimp_display_shell_get_fullscreen (shell) ? \ - &shell->fullscreen_appearance : &shell->appearance) +#define GET_OPTIONS(shell) (gimp_display_shell_get_fullscreen (shell) ? \ + shell->fullscreen_options : shell->options) void @@ -67,27 +67,206 @@ gimp_display_shell_get_fullscreen (GimpDisplayShell *shell) } void -gimp_display_shell_set_show_selection (GimpDisplayShell *shell, - gboolean show) +gimp_display_shell_set_show_menubar (GimpDisplayShell *shell, + gboolean show) { - GimpDisplayShellAppearance *appearance; + GimpDisplayOptions *options; + GtkWidget *menubar; + GtkContainer *vbox; g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - appearance = GET_APPEARANCE (shell); + options = GET_OPTIONS (shell); - if (show != appearance->selection) + g_object_set (options, "show-menubar", show, NULL); + + menubar = GTK_ITEM_FACTORY (shell->menubar_factory)->widget; + vbox = GTK_CONTAINER (shell->qmask->parent->parent); + + if (show) + gtk_widget_show (menubar); + else + gtk_widget_hide (menubar); + + if (options->show_menubar || options->show_statusbar) + gtk_container_set_border_width (vbox, 2); + else + gtk_container_set_border_width (vbox, 0); + + gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), + "/View/Show Menubar", show); + gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), + "/View/Show Menubar", show); +} + +gboolean +gimp_display_shell_get_show_menubar (GimpDisplayShell *shell) +{ + g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE); + + return GET_OPTIONS (shell)->show_menubar; +} + +void +gimp_display_shell_set_show_rulers (GimpDisplayShell *shell, + gboolean show) +{ + GimpDisplayOptions *options; + GtkTable *table; + + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); + + options = GET_OPTIONS (shell); + + g_object_set (options, "show-rulers", show, NULL); + + table = GTK_TABLE (shell->canvas->parent); + + if (show) { - appearance->selection = show ? TRUE : FALSE; + gtk_widget_show (shell->origin); + gtk_widget_show (shell->hrule); + gtk_widget_show (shell->vrule); - if (shell->select) - gimp_display_shell_selection_set_hidden (shell->select, ! show); - - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Show Selection", show); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Show Selection", show); + gtk_table_set_col_spacing (table, 0, 1); + gtk_table_set_row_spacing (table, 0, 1); } + else + { + gtk_widget_hide (shell->origin); + gtk_widget_hide (shell->hrule); + gtk_widget_hide (shell->vrule); + + gtk_table_set_col_spacing (table, 0, 0); + gtk_table_set_row_spacing (table, 0, 0); + } + + gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), + "/View/Show Rulers", show); + gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), + "/View/Show Rulers", show); +} + +gboolean +gimp_display_shell_get_show_rulers (GimpDisplayShell *shell) +{ + g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE); + + return GET_OPTIONS (shell)->show_rulers; +} + +void +gimp_display_shell_set_show_scrollbars (GimpDisplayShell *shell, + gboolean show) +{ + GimpDisplayOptions *options; + GtkBox *hbox; + GtkBox *vbox; + + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); + + options = GET_OPTIONS (shell); + + g_object_set (options, "show-scrollbars", show, NULL); + + hbox = GTK_BOX (shell->vsb->parent->parent); + vbox = GTK_BOX (shell->hsb->parent->parent); + + if (show) + { + gtk_widget_show (shell->nav_ebox); + gtk_widget_show (shell->hsb); + gtk_widget_show (shell->vsb); + gtk_widget_show (shell->qmask); + gtk_widget_show (shell->padding_button); + + gtk_box_set_spacing (hbox, 1); + gtk_box_set_spacing (vbox, 1); + } + else + { + gtk_widget_hide (shell->nav_ebox); + gtk_widget_hide (shell->hsb); + gtk_widget_hide (shell->vsb); + gtk_widget_hide (shell->qmask); + gtk_widget_hide (shell->padding_button); + + gtk_box_set_spacing (hbox, 0); + gtk_box_set_spacing (vbox, 0); + } + + gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), + "/View/Show Scrollbars", show); + gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), + "/View/Show Scrollbars", show); +} + +gboolean +gimp_display_shell_get_show_scrollbars (GimpDisplayShell *shell) +{ + g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE); + + return GET_OPTIONS (shell)->show_scrollbars; +} + +void +gimp_display_shell_set_show_statusbar (GimpDisplayShell *shell, + gboolean show) +{ + GimpDisplayOptions *options; + GtkContainer *vbox; + + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); + + options = GET_OPTIONS (shell); + + g_object_set (options, "show-statusbar", show, NULL); + + vbox = GTK_CONTAINER (shell->qmask->parent->parent); + + if (show) + gtk_widget_show (shell->statusbar); + else + gtk_widget_hide (shell->statusbar); + + if (options->show_menubar || options->show_statusbar) + gtk_container_set_border_width (vbox, 2); + else + gtk_container_set_border_width (vbox, 0); + + gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), + "/View/Show Statusbar", show); + gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), + "/View/Show Statusbar", show); +} + +gboolean +gimp_display_shell_get_show_statusbar (GimpDisplayShell *shell) +{ + g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE); + + return GET_OPTIONS (shell)->show_statusbar; +} + +void +gimp_display_shell_set_show_selection (GimpDisplayShell *shell, + gboolean show) +{ + GimpDisplayOptions *options; + + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); + + options = GET_OPTIONS (shell); + + g_object_set (options, "show-selection", show, NULL); + + if (shell->select) + gimp_display_shell_selection_set_hidden (shell->select, ! show); + + gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), + "/View/Show Selection", show); + gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), + "/View/Show Selection", show); } gboolean @@ -95,31 +274,28 @@ gimp_display_shell_get_show_selection (GimpDisplayShell *shell) { g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE); - return GET_APPEARANCE (shell)->selection; + return GET_OPTIONS (shell)->show_selection; } void gimp_display_shell_set_show_layer (GimpDisplayShell *shell, gboolean show) { - GimpDisplayShellAppearance *appearance; + GimpDisplayOptions *options; g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - appearance = GET_APPEARANCE (shell); + options = GET_OPTIONS (shell); - if (show != appearance->active_layer) - { - appearance->active_layer = show ? TRUE : FALSE; + g_object_set (options, "show-active-layer", show, NULL); - if (shell->select) - gimp_display_shell_selection_layer_set_hidden (shell->select, ! show); + if (shell->select) + gimp_display_shell_selection_layer_set_hidden (shell->select, ! show); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Show Layer Boundary", show); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Show Layer Boundary", show); - } + gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), + "/View/Show Layer Boundary", show); + gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), + "/View/Show Layer Boundary", show); } gboolean @@ -127,31 +303,28 @@ gimp_display_shell_get_show_layer (GimpDisplayShell *shell) { g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE); - return GET_APPEARANCE (shell)->active_layer; + return GET_OPTIONS (shell)->show_active_layer; } void gimp_display_shell_set_show_grid (GimpDisplayShell *shell, gboolean show) { - GimpDisplayShellAppearance *appearance; + GimpDisplayOptions *options; g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - appearance = GET_APPEARANCE (shell); + options = GET_OPTIONS (shell); - if (show != appearance->grid) - { - appearance->grid = show ? TRUE : FALSE; + g_object_set (options, "show-grid", show, NULL); - if (shell->gdisp->gimage->grid) - gimp_display_shell_expose_full (shell); + if (shell->gdisp->gimage->grid) + gimp_display_shell_expose_full (shell); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Show Grid", show); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Show Grid", show); - } + gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), + "/View/Show Grid", show); + gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), + "/View/Show Grid", show); } gboolean @@ -159,7 +332,7 @@ gimp_display_shell_get_show_grid (GimpDisplayShell *shell) { g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE); - return GET_APPEARANCE (shell)->grid; + return GET_OPTIONS (shell)->show_grid; } void @@ -191,24 +364,21 @@ void gimp_display_shell_set_show_guides (GimpDisplayShell *shell, gboolean show) { - GimpDisplayShellAppearance *appearance; + GimpDisplayOptions *options; g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - appearance = GET_APPEARANCE (shell); + options = GET_OPTIONS (shell); - if (show != appearance->guides) - { - appearance->guides = show ? TRUE : FALSE; + g_object_set (options, "show-guides", show, NULL); - if (shell->gdisp->gimage->guides) - gimp_display_shell_expose_full (shell); + if (shell->gdisp->gimage->guides) + gimp_display_shell_expose_full (shell); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Show Guides", show); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Show Guides", show); - } + gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), + "/View/Show Guides", show); + gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), + "/View/Show Guides", show); } gboolean @@ -216,268 +386,68 @@ gimp_display_shell_get_show_guides (GimpDisplayShell *shell) { g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE); - return GET_APPEARANCE (shell)->guides; + return GET_OPTIONS (shell)->show_guides; } void -gimp_display_shell_set_show_menubar (GimpDisplayShell *shell, - gboolean show) +gimp_display_shell_set_padding (GimpDisplayShell *shell, + GimpCanvasPaddingMode padding_mode, + const GimpRGB *padding_color) { - GimpDisplayShellAppearance *appearance; - - g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - - appearance = GET_APPEARANCE (shell); - - if (show != appearance->menubar) - { - GtkWidget *menubar; - GtkContainer *vbox; - - menubar = GTK_ITEM_FACTORY (shell->menubar_factory)->widget; - vbox = GTK_CONTAINER (shell->qmask->parent->parent); - - if (show) - gtk_widget_show (menubar); - else - gtk_widget_hide (menubar); - - appearance->menubar = show ? TRUE : FALSE; - - if (appearance->menubar || appearance->statusbar) - gtk_container_set_border_width (vbox, 2); - else - gtk_container_set_border_width (vbox, 0); - - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Show Menubar", show); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Show Menubar", show); - } -} - -gboolean -gimp_display_shell_get_show_menubar (GimpDisplayShell *shell) -{ - g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE); - - return GET_APPEARANCE (shell)->menubar; -} - -void -gimp_display_shell_set_show_rulers (GimpDisplayShell *shell, - gboolean show) -{ - GimpDisplayShellAppearance *appearance; - - g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - - appearance = GET_APPEARANCE (shell); - - if (show != appearance->rulers) - { - GtkTable *table; - - table = GTK_TABLE (shell->canvas->parent); - - if (show) - { - gtk_widget_show (shell->origin); - gtk_widget_show (shell->hrule); - gtk_widget_show (shell->vrule); - - gtk_table_set_col_spacing (table, 0, 1); - gtk_table_set_row_spacing (table, 0, 1); - } - else - { - gtk_widget_hide (shell->origin); - gtk_widget_hide (shell->hrule); - gtk_widget_hide (shell->vrule); - - gtk_table_set_col_spacing (table, 0, 0); - gtk_table_set_row_spacing (table, 0, 0); - } - - appearance->rulers = show ? TRUE : FALSE; - - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Show Rulers", show); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Show Rulers", show); - } -} - -gboolean -gimp_display_shell_get_show_rulers (GimpDisplayShell *shell) -{ - g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE); - - return GET_APPEARANCE (shell)->rulers; -} - -void -gimp_display_shell_set_show_scrollbars (GimpDisplayShell *shell, - gboolean show) -{ - GimpDisplayShellAppearance *appearance; - - g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - - appearance = GET_APPEARANCE (shell); - - if (show != appearance->scrollbars) - { - GtkBox *hbox; - GtkBox *vbox; - - hbox = GTK_BOX (shell->vsb->parent->parent); - vbox = GTK_BOX (shell->hsb->parent->parent); - - if (show) - { - gtk_widget_show (shell->nav_ebox); - gtk_widget_show (shell->hsb); - gtk_widget_show (shell->vsb); - gtk_widget_show (shell->qmask); - gtk_widget_show (shell->padding_button); - - gtk_box_set_spacing (hbox, 1); - gtk_box_set_spacing (vbox, 1); - } - else - { - gtk_widget_hide (shell->nav_ebox); - gtk_widget_hide (shell->hsb); - gtk_widget_hide (shell->vsb); - gtk_widget_hide (shell->qmask); - gtk_widget_hide (shell->padding_button); - - gtk_box_set_spacing (hbox, 0); - gtk_box_set_spacing (vbox, 0); - } - - appearance->scrollbars = show ? TRUE : FALSE; - - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Show Scrollbars", show); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Show Scrollbars", show); - } -} - -gboolean -gimp_display_shell_get_show_scrollbars (GimpDisplayShell *shell) -{ - g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE); - - return GET_APPEARANCE (shell)->scrollbars; -} - -void -gimp_display_shell_set_show_statusbar (GimpDisplayShell *shell, - gboolean show) -{ - GimpDisplayShellAppearance *appearance; - - g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - - appearance = GET_APPEARANCE (shell); - - if (show != appearance->statusbar) - { - GtkContainer *vbox; - - vbox = GTK_CONTAINER (shell->qmask->parent->parent); - - if (show) - gtk_widget_show (shell->statusbar); - else - gtk_widget_hide (shell->statusbar); - - appearance->statusbar = show ? TRUE : FALSE; - - if (appearance->menubar || appearance->statusbar) - gtk_container_set_border_width (vbox, 2); - else - gtk_container_set_border_width (vbox, 0); - - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), - "/View/Show Statusbar", show); - gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->popup_factory), - "/View/Show Statusbar", show); - } -} - -gboolean -gimp_display_shell_get_show_statusbar (GimpDisplayShell *shell) -{ - g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE); - - return GET_APPEARANCE (shell)->statusbar; -} - -void -gimp_display_shell_set_padding (GimpDisplayShell *shell, - GimpDisplayPaddingMode padding_mode, - const GimpRGB *padding_color) -{ - GimpDisplayShellAppearance *appearance; - guchar r, g, b; + GimpDisplayOptions *options; + GimpRGB color = *padding_color; g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); g_return_if_fail (padding_color != NULL); - appearance = GET_APPEARANCE (shell); + options = GET_OPTIONS (shell); - appearance->padding_mode = padding_mode; - - switch (appearance->padding_mode) + switch (padding_mode) { - case GIMP_DISPLAY_PADDING_MODE_DEFAULT: + case GIMP_CANVAS_PADDING_MODE_DEFAULT: if (shell->canvas) { gtk_widget_ensure_style (shell->canvas); - - r = shell->canvas->style->bg[GTK_STATE_NORMAL].red >> 8; - g = shell->canvas->style->bg[GTK_STATE_NORMAL].green >> 8; - b = shell->canvas->style->bg[GTK_STATE_NORMAL].blue >> 8; - - gimp_rgb_set_uchar (&appearance->padding_color, r, g, b); + gimp_rgb_set_gdk_color (&color, + shell->canvas->style->bg + GTK_STATE_NORMAL); } break; - case GIMP_DISPLAY_PADDING_MODE_LIGHT_CHECK: - gimp_rgb_set_uchar (&appearance->padding_color, + case GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK: + gimp_rgb_set_uchar (&color, render_blend_light_check[0], render_blend_light_check[1], render_blend_light_check[2]); break; - case GIMP_DISPLAY_PADDING_MODE_DARK_CHECK: - gimp_rgb_set_uchar (&appearance->padding_color, + case GIMP_CANVAS_PADDING_MODE_DARK_CHECK: + gimp_rgb_set_uchar (&color, render_blend_dark_check[0], render_blend_dark_check[1], render_blend_dark_check[2]); break; - case GIMP_DISPLAY_PADDING_MODE_CUSTOM: - appearance->padding_color = *padding_color; + case GIMP_CANVAS_PADDING_MODE_CUSTOM: break; } + g_object_set (options, + "padding-mode", padding_mode, + "padding-color", &color, + NULL); + if (GTK_WIDGET_REALIZED (shell->canvas)) { GdkColormap *colormap; - GdkColor color; + GdkColor gdk_color; - gimp_rgb_get_gdk_color (&appearance->padding_color, &color); + gimp_rgb_get_gdk_color (&color, &gdk_color); colormap = gdk_drawable_get_colormap (shell->canvas->window); g_return_if_fail (colormap != NULL); - gdk_colormap_alloc_color (colormap, &color, FALSE, TRUE); + gdk_colormap_alloc_color (colormap, &gdk_color, FALSE, TRUE); - gdk_window_set_background (shell->canvas->window, &color); + gdk_window_set_background (shell->canvas->window, &gdk_color); } if (shell->padding_button) @@ -487,7 +457,7 @@ gimp_display_shell_set_padding (GimpDisplayShell *shell, shell); gimp_color_button_set_color (GIMP_COLOR_BUTTON (shell->padding_button), - &appearance->padding_color); + &color); g_signal_handlers_unblock_by_func (shell->padding_button, gimp_display_shell_color_button_changed, @@ -498,19 +468,19 @@ gimp_display_shell_set_padding (GimpDisplayShell *shell, } void -gimp_display_shell_get_padding (GimpDisplayShell *shell, - GimpDisplayPaddingMode *padding_mode, - GimpRGB *padding_color) +gimp_display_shell_get_padding (GimpDisplayShell *shell, + GimpCanvasPaddingMode *padding_mode, + GimpRGB *padding_color) { - GimpDisplayShellAppearance *appearance; + GimpDisplayOptions *options; g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - appearance = GET_APPEARANCE (shell); + options = GET_OPTIONS (shell); if (padding_mode) - *padding_mode = appearance->padding_mode; + *padding_mode = options->padding_mode; if (padding_color) - *padding_color = appearance->padding_color; + *padding_color = options->padding_color; } diff --git a/app/display/gimpdisplayshell-appearance.h b/app/display/gimpdisplayshell-appearance.h index 6e1e989724..18eed7890b 100644 --- a/app/display/gimpdisplayshell-appearance.h +++ b/app/display/gimpdisplayshell-appearance.h @@ -24,6 +24,22 @@ void gimp_display_shell_set_fullscreen (GimpDisplayShell *shell, gboolean fullscreen); gboolean gimp_display_shell_get_fullscreen (GimpDisplayShell *shell); +void gimp_display_shell_set_show_menubar (GimpDisplayShell *shell, + gboolean show); +gboolean gimp_display_shell_get_show_menubar (GimpDisplayShell *shell); + +void gimp_display_shell_set_show_rulers (GimpDisplayShell *shell, + gboolean show); +gboolean gimp_display_shell_get_show_rulers (GimpDisplayShell *shell); + +void gimp_display_shell_set_show_scrollbars (GimpDisplayShell *shell, + gboolean show); +gboolean gimp_display_shell_get_show_scrollbars (GimpDisplayShell *shell); + +void gimp_display_shell_set_show_statusbar (GimpDisplayShell *shell, + gboolean show); +gboolean gimp_display_shell_get_show_statusbar (GimpDisplayShell *shell); + void gimp_display_shell_set_show_selection (GimpDisplayShell *shell, gboolean show); gboolean gimp_display_shell_get_show_selection (GimpDisplayShell *shell); @@ -44,27 +60,11 @@ void gimp_display_shell_set_show_guides (GimpDisplayShell *shell, gboolean show); gboolean gimp_display_shell_get_show_guides (GimpDisplayShell *shell); -void gimp_display_shell_set_show_menubar (GimpDisplayShell *shell, - gboolean show); -gboolean gimp_display_shell_get_show_menubar (GimpDisplayShell *shell); - -void gimp_display_shell_set_show_rulers (GimpDisplayShell *shell, - gboolean show); -gboolean gimp_display_shell_get_show_rulers (GimpDisplayShell *shell); - -void gimp_display_shell_set_show_scrollbars (GimpDisplayShell *shell, - gboolean show); -gboolean gimp_display_shell_get_show_scrollbars (GimpDisplayShell *shell); - -void gimp_display_shell_set_show_statusbar (GimpDisplayShell *shell, - gboolean show); -gboolean gimp_display_shell_get_show_statusbar (GimpDisplayShell *shell); - void gimp_display_shell_set_padding (GimpDisplayShell *shell, - GimpDisplayPaddingMode mode, + GimpCanvasPaddingMode mode, const GimpRGB *color); void gimp_display_shell_get_padding (GimpDisplayShell *shell, - GimpDisplayPaddingMode *mode, + GimpCanvasPaddingMode *mode, GimpRGB *color); diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c index 3a9c63a7d0..5fde9c8e8d 100644 --- a/app/display/gimpdisplayshell-callbacks.c +++ b/app/display/gimpdisplayshell-callbacks.c @@ -51,6 +51,7 @@ #include "widgets/gimpwidgets-utils.h" #include "gimpdisplay.h" +#include "gimpdisplayoptions.h" #include "gimpdisplayshell.h" #include "gimpdisplayshell-appearance.h" #include "gimpdisplayshell-callbacks.h" @@ -185,10 +186,9 @@ gimp_display_shell_events (GtkWidget *widget, case GDK_WINDOW_STATE: { - GdkEventWindowState *sevent; - GimpDisplayShellAppearance appearance; - gboolean fullscreen; - gboolean padding_mode_set; + GdkEventWindowState *sevent; + GimpDisplayOptions *options; + gboolean fullscreen; sevent = (GdkEventWindowState *) event; @@ -199,35 +199,27 @@ gimp_display_shell_events (GtkWidget *widget, fullscreen = gimp_display_shell_get_fullscreen (shell); - if (fullscreen) - { - padding_mode_set = shell->fullscreen_appearance.padding_mode_set; + options = fullscreen ? shell->fullscreen_options : shell->options; - appearance = shell->fullscreen_appearance; - shell->fullscreen_appearance = shell->appearance; - - shell->fullscreen_appearance.padding_mode_set = padding_mode_set; - } - else - { - padding_mode_set = shell->appearance.padding_mode_set; - - appearance = shell->appearance; - shell->appearance = shell->fullscreen_appearance; - - shell->appearance.padding_mode_set = padding_mode_set; - } - - gimp_display_shell_set_show_selection (shell, appearance.selection); - gimp_display_shell_set_show_layer (shell, appearance.active_layer); - gimp_display_shell_set_show_guides (shell, appearance.guides); - gimp_display_shell_set_show_grid (shell, appearance.grid); - gimp_display_shell_set_show_menubar (shell, appearance.menubar); - gimp_display_shell_set_show_rulers (shell, appearance.rulers); - gimp_display_shell_set_show_scrollbars (shell, appearance.scrollbars); - gimp_display_shell_set_show_statusbar (shell, appearance.statusbar); - gimp_display_shell_set_padding (shell, appearance.padding_mode, - &appearance.padding_color); + 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_active_layer); + gimp_display_shell_set_show_guides (shell, + options->show_guides); + gimp_display_shell_set_show_grid (shell, + options->show_grid); + gimp_display_shell_set_padding (shell, + options->padding_mode, + &options->padding_color); gimp_item_factory_set_active (GTK_ITEM_FACTORY (shell->menubar_factory), "/View/Fullscreen", fullscreen); @@ -255,10 +247,10 @@ void gimp_display_shell_canvas_realize (GtkWidget *canvas, GimpDisplayShell *shell) { - GimpDisplayConfig *config; - GimpDisplay *gdisp; - GimpDisplayPaddingMode padding_mode; - GimpRGB padding_color; + GimpDisplayConfig *config; + GimpDisplay *gdisp; + GimpCanvasPaddingMode padding_mode; + GimpRGB padding_color; gdisp = shell->gdisp; config = GIMP_DISPLAY_CONFIG (gdisp->gimage->gimp->config); @@ -1347,15 +1339,14 @@ gimp_display_shell_color_button_changed (GtkWidget *widget, GimpRGB color; if (gimp_display_shell_get_fullscreen (shell)) - shell->fullscreen_appearance.padding_mode_set = TRUE; + shell->fullscreen_options->padding_mode_set = TRUE; else - shell->appearance.padding_mode_set = TRUE; + shell->options->padding_mode_set = TRUE; gimp_color_button_get_color (GIMP_COLOR_BUTTON (widget), &color); gimp_display_shell_set_padding (shell, - GIMP_DISPLAY_PADDING_MODE_CUSTOM, - &color); + GIMP_CANVAS_PADDING_MODE_CUSTOM, &color); } void @@ -1363,46 +1354,47 @@ gimp_display_shell_color_button_menu_callback (gpointer callback_data, guint callback_action, GtkWidget *widget) { - GimpDisplayShellAppearance *appearance; - GimpDisplayShell *shell; - gboolean fullscreen; + GimpDisplayOptions *options; + GimpDisplayShell *shell; + gboolean fullscreen; shell = GIMP_DISPLAY_SHELL (callback_data); fullscreen = gimp_display_shell_get_fullscreen (shell); if (fullscreen) - appearance = &shell->fullscreen_appearance; + options = shell->fullscreen_options; else - appearance = &shell->appearance; + options = shell->options; - if (callback_action == GIMP_DISPLAY_PADDING_MODE_CUSTOM) + if (callback_action == GIMP_CANVAS_PADDING_MODE_CUSTOM) { gtk_button_clicked (GTK_BUTTON (shell->padding_button)); } else if (callback_action == 0xffff) { - GimpDisplayConfig *config; + GimpDisplayConfig *config; + GimpDisplayOptions *default_options; config = GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config); - appearance->padding_mode_set = FALSE; + options->padding_mode_set = FALSE; if (fullscreen) - gimp_display_shell_set_padding (shell, - config->fs_canvas_padding_mode, - &config->fs_canvas_padding_color); + default_options = config->default_fullscreen_view; else - gimp_display_shell_set_padding (shell, - config->canvas_padding_mode, - &config->canvas_padding_color); + default_options = config->default_view; + + gimp_display_shell_set_padding (shell, + default_options->padding_mode, + &default_options->padding_color); } else { - appearance->padding_mode_set = TRUE; + options->padding_mode_set = TRUE; gimp_display_shell_set_padding (shell, callback_action, - &appearance->padding_color); + &options->padding_color); } } diff --git a/app/display/gimpdisplayshell-draw.c b/app/display/gimpdisplayshell-draw.c index d853d110b0..e91917f9c5 100644 --- a/app/display/gimpdisplayshell-draw.c +++ b/app/display/gimpdisplayshell-draw.c @@ -31,6 +31,8 @@ #endif #include "gui/gui-types.h" +#include "config/gimpconfig.h" +#include "config/gimpconfig-utils.h" #include "config/gimpdisplayconfig.h" #include "core/gimp.h" @@ -63,6 +65,7 @@ #include "tools/tool_manager.h" #include "gimpdisplay.h" +#include "gimpdisplayoptions.h" #include "gimpdisplayshell.h" #include "gimpdisplayshell-appearance.h" #include "gimpdisplayshell-callbacks.h" @@ -94,6 +97,7 @@ enum static void gimp_display_shell_class_init (GimpDisplayShellClass *klass); static void gimp_display_shell_init (GimpDisplayShell *shell); +static void gimp_display_shell_finalize (GObject *object); static void gimp_display_shell_destroy (GtkObject *object); static void gimp_display_shell_screen_changed (GtkWidget *widget, GdkScreen *previous); @@ -145,11 +149,13 @@ gimp_display_shell_get_type (void) static void gimp_display_shell_class_init (GimpDisplayShellClass *klass) { + GObjectClass *gobject_class; GtkObjectClass *object_class; GtkWidgetClass *widget_class; - object_class = GTK_OBJECT_CLASS (klass); - widget_class = GTK_WIDGET_CLASS (klass); + gobject_class = G_OBJECT_CLASS (klass); + object_class = GTK_OBJECT_CLASS (klass); + widget_class = GTK_WIDGET_CLASS (klass); parent_class = g_type_class_peek_parent (klass); @@ -180,6 +186,8 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass) gimp_marshal_VOID__VOID, G_TYPE_NONE, 0); + gobject_class->finalize = gimp_display_shell_finalize; + object_class->destroy = gimp_display_shell_destroy; widget_class->screen_changed = gimp_display_shell_screen_changed; @@ -267,37 +275,16 @@ gimp_display_shell_init (GimpDisplayShell *shell) shell->paused_count = 0; - shell->appearance.selection = TRUE; - shell->appearance.active_layer = TRUE; - shell->appearance.guides = TRUE; - shell->appearance.grid = FALSE; - shell->appearance.menubar = TRUE; - shell->appearance.rulers = TRUE; - shell->appearance.scrollbars = TRUE; - shell->appearance.statusbar = TRUE; - shell->appearance.padding_mode = GIMP_DISPLAY_PADDING_MODE_DEFAULT; - gimp_rgba_set (&shell->appearance.padding_color, - 1.0, 1.0, 1.0, GIMP_OPACITY_OPAQUE); - shell->appearance.padding_mode_set = FALSE; + shell->options = + g_object_new (GIMP_TYPE_DISPLAY_OPTIONS, NULL); + shell->fullscreen_options = + g_object_new (GIMP_TYPE_DISPLAY_OPTIONS_FULLSCREEN, NULL); - shell->fullscreen_appearance.selection = TRUE; - shell->fullscreen_appearance.active_layer = TRUE; - shell->fullscreen_appearance.guides = TRUE; - shell->fullscreen_appearance.grid = FALSE; - shell->fullscreen_appearance.menubar = FALSE; - shell->fullscreen_appearance.rulers = FALSE; - shell->fullscreen_appearance.scrollbars = FALSE; - shell->fullscreen_appearance.statusbar = FALSE; - shell->fullscreen_appearance.padding_mode = GIMP_DISPLAY_PADDING_MODE_CUSTOM; - gimp_rgba_set (&shell->fullscreen_appearance.padding_color, - 0.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE); - shell->fullscreen_appearance.padding_mode_set = FALSE; - - shell->space_pressed = FALSE; - shell->space_release_pending = FALSE; - shell->scrolling = FALSE; - shell->scroll_start_x = 0; - shell->scroll_start_y = 0; + shell->space_pressed = FALSE; + shell->space_release_pending = FALSE; + shell->scrolling = FALSE; + shell->scroll_start_x = 0; + shell->scroll_start_y = 0; shell->button_press_before_focus = FALSE; gtk_window_set_wmclass (GTK_WINDOW (shell), "image_window", "Gimp"); @@ -348,15 +335,26 @@ gimp_display_shell_init (GimpDisplayShell *shell) gimp_help_connect (GTK_WIDGET (shell), gimp_standard_help_func, GIMP_HELP_IMAGE_WINDOW, NULL); +} +static void +gimp_display_shell_finalize (GObject *object) +{ + GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (object); + + if (shell->options) + g_object_unref (shell->options); + + if (shell->fullscreen_options) + g_object_unref (shell->fullscreen_options); + + G_OBJECT_CLASS (parent_class)->finalize (object); } static void gimp_display_shell_destroy (GtkObject *object) { - GimpDisplayShell *shell; - - shell = GIMP_DISPLAY_SHELL (object); + GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (object); if (shell->gdisp) { @@ -519,19 +517,10 @@ gimp_display_shell_new (GimpDisplay *gdisp, shell->dot_for_dot = config->default_dot_for_dot; - shell->appearance.menubar = config->show_menubar; - shell->appearance.rulers = config->show_rulers; - shell->appearance.scrollbars = config->show_scrollbars; - shell->appearance.statusbar = config->show_statusbar; - shell->appearance.padding_mode = config->canvas_padding_mode; - shell->appearance.padding_color = config->canvas_padding_color; - - shell->fullscreen_appearance.menubar = config->fs_show_menubar; - shell->fullscreen_appearance.rulers = config->fs_show_rulers; - shell->fullscreen_appearance.scrollbars = config->fs_show_scrollbars; - shell->fullscreen_appearance.statusbar = config->fs_show_statusbar; - shell->fullscreen_appearance.padding_mode = config->fs_canvas_padding_mode; - shell->fullscreen_appearance.padding_color = config->fs_canvas_padding_color; + gimp_config_sync (GIMP_CONFIG (config->default_view), + GIMP_CONFIG (shell->options), 0); + gimp_config_sync (GIMP_CONFIG (config->default_fullscreen_view), + GIMP_CONFIG (shell->fullscreen_options), 0); /* adjust the initial scale -- so that window fits on screen the 75% * value is the same as in gimp_display_shell_shrink_wrap. It @@ -662,7 +651,7 @@ gimp_display_shell_new (GimpDisplay *gdisp, gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, FALSE, 0); - if (shell->appearance.menubar) + if (shell->options->show_menubar) gtk_widget_show (menubar); /* active display callback */ @@ -793,7 +782,7 @@ gimp_display_shell_new (GimpDisplay *gdisp, /* create the contents of the right_vbox *********************************/ shell->padding_button = gimp_color_panel_new (_("Set Canvas Padding Color"), - &shell->appearance.padding_color, + &shell->options->padding_color, GIMP_COLOR_AREA_FLAT, 15, 15); GTK_WIDGET_UNSET_FLAGS (shell->padding_button, GTK_CAN_FOCUS); @@ -815,19 +804,19 @@ gimp_display_shell_new (GimpDisplay *gdisp, { { N_("/From Theme"), NULL, gimp_display_shell_color_button_menu_callback, - GIMP_DISPLAY_PADDING_MODE_DEFAULT, NULL }, + GIMP_CANVAS_PADDING_MODE_DEFAULT, NULL }, { N_("/Light Check Color"), NULL, gimp_display_shell_color_button_menu_callback, - GIMP_DISPLAY_PADDING_MODE_LIGHT_CHECK, NULL }, + GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK, NULL }, { N_("/Dark Check Color"), NULL, gimp_display_shell_color_button_menu_callback, - GIMP_DISPLAY_PADDING_MODE_DARK_CHECK, NULL }, + GIMP_CANVAS_PADDING_MODE_DARK_CHECK, NULL }, { "/---", NULL, NULL, 0, ""}, { N_("/Select Custom Color..."), NULL, gimp_display_shell_color_button_menu_callback, - GIMP_DISPLAY_PADDING_MODE_CUSTOM, "", + GIMP_CANVAS_PADDING_MODE_CUSTOM, "", GTK_STOCK_SELECT_COLOR }, { N_("/As in Preferences"), NULL, gimp_display_shell_color_button_menu_callback, @@ -910,7 +899,7 @@ gimp_display_shell_new (GimpDisplay *gdisp, /* show everything *******************************************************/ - if (shell->appearance.rulers) + if (shell->options->show_rulers) { gtk_widget_show (shell->origin); gtk_widget_show (shell->hrule); @@ -919,7 +908,7 @@ gimp_display_shell_new (GimpDisplay *gdisp, gtk_widget_show (shell->canvas); - if (shell->appearance.scrollbars) + if (shell->options->show_scrollbars) { gtk_widget_show (shell->vsb); gtk_widget_show (shell->hsb); @@ -928,7 +917,7 @@ gimp_display_shell_new (GimpDisplay *gdisp, gtk_widget_show (shell->nav_ebox); } - if (shell->appearance.statusbar) + if (shell->options->show_statusbar) gtk_widget_show (shell->statusbar); gtk_widget_show (main_vbox); diff --git a/app/display/gimpdisplayshell-draw.h b/app/display/gimpdisplayshell-draw.h index c57329edc9..1c59461721 100644 --- a/app/display/gimpdisplayshell-draw.h +++ b/app/display/gimpdisplayshell-draw.h @@ -27,26 +27,6 @@ #include "gui/gui-types.h" -typedef struct _GimpDisplayShellAppearance GimpDisplayShellAppearance; - -struct _GimpDisplayShellAppearance -{ - gboolean selection; - gboolean active_layer; - gboolean guides; - gboolean grid; - - gboolean menubar; - gboolean rulers; - gboolean scrollbars; - gboolean statusbar; - - GimpDisplayPaddingMode padding_mode; - GimpRGB padding_color; - gboolean padding_mode_set; -}; - - /* finding the effective screen resolution (double) */ #define SCREEN_XRES(s) (s->dot_for_dot ? \ s->gdisp->gimage->xresolution : s->monitor_xres) @@ -170,8 +150,8 @@ struct _GimpDisplayShell GQuark vectors_thaw_handler; GQuark vectors_visible_handler; - GimpDisplayShellAppearance appearance; - GimpDisplayShellAppearance fullscreen_appearance; + GimpDisplayOptions *options; + GimpDisplayOptions *fullscreen_options; /* the state of gimp_display_shell_tool_events() */ gboolean space_pressed; diff --git a/app/display/gimpdisplayshell-handlers.c b/app/display/gimpdisplayshell-handlers.c index c837daa04c..e9caf9f76a 100644 --- a/app/display/gimpdisplayshell-handlers.c +++ b/app/display/gimpdisplayshell-handlers.c @@ -34,6 +34,7 @@ #include "widgets/gimpwidgets-utils.h" #include "gimpdisplay.h" +#include "gimpdisplayoptions.h" #include "gimpdisplayshell.h" #include "gimpdisplayshell-appearance.h" #include "gimpdisplayshell-callbacks.h" @@ -116,8 +117,8 @@ static gboolean gimp_display_shell_idle_update_icon (gpointer d void gimp_display_shell_connect (GimpDisplayShell *shell) { - GimpDisplayConfig *display_config; GimpImage *gimage; + GimpDisplayConfig *display_config; g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); g_return_if_fail (GIMP_IS_DISPLAY (shell->gdisp)); @@ -192,6 +193,7 @@ gimp_display_shell_connect (GimpDisplayShell *shell) "notify::transparency-type", G_CALLBACK (gimp_display_shell_check_notify_handler), shell); + g_signal_connect (gimage->gimp->config, "notify::image-title-format", G_CALLBACK (gimp_display_shell_title_notify_handler), @@ -216,22 +218,24 @@ gimp_display_shell_connect (GimpDisplayShell *shell) "notify::monitor-yresolution", G_CALLBACK (gimp_display_shell_monitor_res_notify_handler), shell); - g_signal_connect (gimage->gimp->config, - "notify::canvas-padding-mode", + + g_signal_connect (display_config->default_view, + "notify::padding-mode", G_CALLBACK (gimp_display_shell_padding_notify_handler), shell); - g_signal_connect (gimage->gimp->config, - "notify::canvas-padding-color", + g_signal_connect (display_config->default_view, + "notify::padding-color", G_CALLBACK (gimp_display_shell_padding_notify_handler), shell); - g_signal_connect (gimage->gimp->config, - "notify::fullscreen-canvas-padding-mode", + g_signal_connect (display_config->default_fullscreen_view, + "notify::padding-mode", G_CALLBACK (gimp_display_shell_padding_notify_handler), shell); - g_signal_connect (gimage->gimp->config, - "notify::fullscreen-canvas-padding-color", + g_signal_connect (display_config->default_fullscreen_view, + "notify::padding-color", G_CALLBACK (gimp_display_shell_padding_notify_handler), shell); + g_signal_connect (gimage->gimp->config, "notify::marching-ants-speed", G_CALLBACK (gimp_display_shell_ants_speed_notify_handler), @@ -244,7 +248,8 @@ gimp_display_shell_connect (GimpDisplayShell *shell) void gimp_display_shell_disconnect (GimpDisplayShell *shell) { - GimpImage *gimage; + GimpImage *gimage; + GimpDisplayConfig *display_config; g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); g_return_if_fail (GIMP_IS_DISPLAY (shell->gdisp)); @@ -252,6 +257,8 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell) gimage = shell->gdisp->gimage; + display_config = GIMP_DISPLAY_CONFIG (gimage->gimp->config); + if (shell->icon_idle_id) { g_source_remove (shell->icon_idle_id); @@ -261,10 +268,10 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell) g_signal_handlers_disconnect_by_func (gimage->gimp->config, gimp_display_shell_ants_speed_notify_handler, shell); - g_signal_handlers_disconnect_by_func (gimage->gimp->config, + g_signal_handlers_disconnect_by_func (display_config->default_view, gimp_display_shell_padding_notify_handler, shell); - g_signal_handlers_disconnect_by_func (gimage->gimp->config, + g_signal_handlers_disconnect_by_func (display_config->default_fullscreen_view, gimp_display_shell_monitor_res_notify_handler, shell); g_signal_handlers_disconnect_by_func (gimage->gimp->config, @@ -502,15 +509,15 @@ gimp_display_shell_check_notify_handler (GObject *config, GParamSpec *param_spec, GimpDisplayShell *shell) { - GimpDisplayPaddingMode padding_mode; - GimpRGB padding_color; + GimpCanvasPaddingMode padding_mode; + GimpRGB padding_color; gimp_display_shell_get_padding (shell, &padding_mode, &padding_color); switch (padding_mode) { - case GIMP_DISPLAY_PADDING_MODE_LIGHT_CHECK: - case GIMP_DISPLAY_PADDING_MODE_DARK_CHECK: + case GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK: + case GIMP_CANVAS_PADDING_MODE_DARK_CHECK: gimp_display_shell_set_padding (shell, padding_mode, &padding_color); break; @@ -574,20 +581,20 @@ gimp_display_shell_padding_notify_handler (GObject *config, GParamSpec *param_spec, GimpDisplayShell *shell) { - GimpDisplayConfig *display_config; - gboolean fullscreen; - GimpDisplayPaddingMode padding_mode; - GimpRGB padding_color; + GimpDisplayConfig *display_config; + gboolean fullscreen; + GimpCanvasPaddingMode padding_mode; + GimpRGB padding_color; - display_config = GIMP_DISPLAY_CONFIG (config); + display_config = GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config); fullscreen = gimp_display_shell_get_fullscreen (shell); /* if the user did not set the padding mode for this display explicitely */ - if (! shell->fullscreen_appearance.padding_mode_set) + if (! shell->fullscreen_options->padding_mode_set) { - padding_mode = display_config->fs_canvas_padding_mode; - padding_color = display_config->fs_canvas_padding_color; + padding_mode = display_config->default_fullscreen_view->padding_mode; + padding_color = display_config->default_fullscreen_view->padding_color; if (fullscreen) { @@ -595,21 +602,21 @@ gimp_display_shell_padding_notify_handler (GObject *config, } else { - shell->fullscreen_appearance.padding_mode = padding_mode; - shell->fullscreen_appearance.padding_color = padding_color; + shell->fullscreen_options->padding_mode = padding_mode; + shell->fullscreen_options->padding_color = padding_color; } } /* if the user did not set the padding mode for this display explicitely */ - if (! shell->appearance.padding_mode_set) + if (! shell->options->padding_mode_set) { - padding_mode = display_config->canvas_padding_mode; - padding_color = display_config->canvas_padding_color; + padding_mode = display_config->default_view->padding_mode; + padding_color = display_config->default_view->padding_color; if (fullscreen) { - shell->appearance.padding_mode = padding_mode; - shell->appearance.padding_color = padding_color; + shell->options->padding_mode = padding_mode; + shell->options->padding_color = padding_color; } else { diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c index d853d110b0..e91917f9c5 100644 --- a/app/display/gimpdisplayshell.c +++ b/app/display/gimpdisplayshell.c @@ -31,6 +31,8 @@ #endif #include "gui/gui-types.h" +#include "config/gimpconfig.h" +#include "config/gimpconfig-utils.h" #include "config/gimpdisplayconfig.h" #include "core/gimp.h" @@ -63,6 +65,7 @@ #include "tools/tool_manager.h" #include "gimpdisplay.h" +#include "gimpdisplayoptions.h" #include "gimpdisplayshell.h" #include "gimpdisplayshell-appearance.h" #include "gimpdisplayshell-callbacks.h" @@ -94,6 +97,7 @@ enum static void gimp_display_shell_class_init (GimpDisplayShellClass *klass); static void gimp_display_shell_init (GimpDisplayShell *shell); +static void gimp_display_shell_finalize (GObject *object); static void gimp_display_shell_destroy (GtkObject *object); static void gimp_display_shell_screen_changed (GtkWidget *widget, GdkScreen *previous); @@ -145,11 +149,13 @@ gimp_display_shell_get_type (void) static void gimp_display_shell_class_init (GimpDisplayShellClass *klass) { + GObjectClass *gobject_class; GtkObjectClass *object_class; GtkWidgetClass *widget_class; - object_class = GTK_OBJECT_CLASS (klass); - widget_class = GTK_WIDGET_CLASS (klass); + gobject_class = G_OBJECT_CLASS (klass); + object_class = GTK_OBJECT_CLASS (klass); + widget_class = GTK_WIDGET_CLASS (klass); parent_class = g_type_class_peek_parent (klass); @@ -180,6 +186,8 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass) gimp_marshal_VOID__VOID, G_TYPE_NONE, 0); + gobject_class->finalize = gimp_display_shell_finalize; + object_class->destroy = gimp_display_shell_destroy; widget_class->screen_changed = gimp_display_shell_screen_changed; @@ -267,37 +275,16 @@ gimp_display_shell_init (GimpDisplayShell *shell) shell->paused_count = 0; - shell->appearance.selection = TRUE; - shell->appearance.active_layer = TRUE; - shell->appearance.guides = TRUE; - shell->appearance.grid = FALSE; - shell->appearance.menubar = TRUE; - shell->appearance.rulers = TRUE; - shell->appearance.scrollbars = TRUE; - shell->appearance.statusbar = TRUE; - shell->appearance.padding_mode = GIMP_DISPLAY_PADDING_MODE_DEFAULT; - gimp_rgba_set (&shell->appearance.padding_color, - 1.0, 1.0, 1.0, GIMP_OPACITY_OPAQUE); - shell->appearance.padding_mode_set = FALSE; + shell->options = + g_object_new (GIMP_TYPE_DISPLAY_OPTIONS, NULL); + shell->fullscreen_options = + g_object_new (GIMP_TYPE_DISPLAY_OPTIONS_FULLSCREEN, NULL); - shell->fullscreen_appearance.selection = TRUE; - shell->fullscreen_appearance.active_layer = TRUE; - shell->fullscreen_appearance.guides = TRUE; - shell->fullscreen_appearance.grid = FALSE; - shell->fullscreen_appearance.menubar = FALSE; - shell->fullscreen_appearance.rulers = FALSE; - shell->fullscreen_appearance.scrollbars = FALSE; - shell->fullscreen_appearance.statusbar = FALSE; - shell->fullscreen_appearance.padding_mode = GIMP_DISPLAY_PADDING_MODE_CUSTOM; - gimp_rgba_set (&shell->fullscreen_appearance.padding_color, - 0.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE); - shell->fullscreen_appearance.padding_mode_set = FALSE; - - shell->space_pressed = FALSE; - shell->space_release_pending = FALSE; - shell->scrolling = FALSE; - shell->scroll_start_x = 0; - shell->scroll_start_y = 0; + shell->space_pressed = FALSE; + shell->space_release_pending = FALSE; + shell->scrolling = FALSE; + shell->scroll_start_x = 0; + shell->scroll_start_y = 0; shell->button_press_before_focus = FALSE; gtk_window_set_wmclass (GTK_WINDOW (shell), "image_window", "Gimp"); @@ -348,15 +335,26 @@ gimp_display_shell_init (GimpDisplayShell *shell) gimp_help_connect (GTK_WIDGET (shell), gimp_standard_help_func, GIMP_HELP_IMAGE_WINDOW, NULL); +} +static void +gimp_display_shell_finalize (GObject *object) +{ + GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (object); + + if (shell->options) + g_object_unref (shell->options); + + if (shell->fullscreen_options) + g_object_unref (shell->fullscreen_options); + + G_OBJECT_CLASS (parent_class)->finalize (object); } static void gimp_display_shell_destroy (GtkObject *object) { - GimpDisplayShell *shell; - - shell = GIMP_DISPLAY_SHELL (object); + GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (object); if (shell->gdisp) { @@ -519,19 +517,10 @@ gimp_display_shell_new (GimpDisplay *gdisp, shell->dot_for_dot = config->default_dot_for_dot; - shell->appearance.menubar = config->show_menubar; - shell->appearance.rulers = config->show_rulers; - shell->appearance.scrollbars = config->show_scrollbars; - shell->appearance.statusbar = config->show_statusbar; - shell->appearance.padding_mode = config->canvas_padding_mode; - shell->appearance.padding_color = config->canvas_padding_color; - - shell->fullscreen_appearance.menubar = config->fs_show_menubar; - shell->fullscreen_appearance.rulers = config->fs_show_rulers; - shell->fullscreen_appearance.scrollbars = config->fs_show_scrollbars; - shell->fullscreen_appearance.statusbar = config->fs_show_statusbar; - shell->fullscreen_appearance.padding_mode = config->fs_canvas_padding_mode; - shell->fullscreen_appearance.padding_color = config->fs_canvas_padding_color; + gimp_config_sync (GIMP_CONFIG (config->default_view), + GIMP_CONFIG (shell->options), 0); + gimp_config_sync (GIMP_CONFIG (config->default_fullscreen_view), + GIMP_CONFIG (shell->fullscreen_options), 0); /* adjust the initial scale -- so that window fits on screen the 75% * value is the same as in gimp_display_shell_shrink_wrap. It @@ -662,7 +651,7 @@ gimp_display_shell_new (GimpDisplay *gdisp, gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, FALSE, 0); - if (shell->appearance.menubar) + if (shell->options->show_menubar) gtk_widget_show (menubar); /* active display callback */ @@ -793,7 +782,7 @@ gimp_display_shell_new (GimpDisplay *gdisp, /* create the contents of the right_vbox *********************************/ shell->padding_button = gimp_color_panel_new (_("Set Canvas Padding Color"), - &shell->appearance.padding_color, + &shell->options->padding_color, GIMP_COLOR_AREA_FLAT, 15, 15); GTK_WIDGET_UNSET_FLAGS (shell->padding_button, GTK_CAN_FOCUS); @@ -815,19 +804,19 @@ gimp_display_shell_new (GimpDisplay *gdisp, { { N_("/From Theme"), NULL, gimp_display_shell_color_button_menu_callback, - GIMP_DISPLAY_PADDING_MODE_DEFAULT, NULL }, + GIMP_CANVAS_PADDING_MODE_DEFAULT, NULL }, { N_("/Light Check Color"), NULL, gimp_display_shell_color_button_menu_callback, - GIMP_DISPLAY_PADDING_MODE_LIGHT_CHECK, NULL }, + GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK, NULL }, { N_("/Dark Check Color"), NULL, gimp_display_shell_color_button_menu_callback, - GIMP_DISPLAY_PADDING_MODE_DARK_CHECK, NULL }, + GIMP_CANVAS_PADDING_MODE_DARK_CHECK, NULL }, { "/---", NULL, NULL, 0, ""}, { N_("/Select Custom Color..."), NULL, gimp_display_shell_color_button_menu_callback, - GIMP_DISPLAY_PADDING_MODE_CUSTOM, "", + GIMP_CANVAS_PADDING_MODE_CUSTOM, "", GTK_STOCK_SELECT_COLOR }, { N_("/As in Preferences"), NULL, gimp_display_shell_color_button_menu_callback, @@ -910,7 +899,7 @@ gimp_display_shell_new (GimpDisplay *gdisp, /* show everything *******************************************************/ - if (shell->appearance.rulers) + if (shell->options->show_rulers) { gtk_widget_show (shell->origin); gtk_widget_show (shell->hrule); @@ -919,7 +908,7 @@ gimp_display_shell_new (GimpDisplay *gdisp, gtk_widget_show (shell->canvas); - if (shell->appearance.scrollbars) + if (shell->options->show_scrollbars) { gtk_widget_show (shell->vsb); gtk_widget_show (shell->hsb); @@ -928,7 +917,7 @@ gimp_display_shell_new (GimpDisplay *gdisp, gtk_widget_show (shell->nav_ebox); } - if (shell->appearance.statusbar) + if (shell->options->show_statusbar) gtk_widget_show (shell->statusbar); gtk_widget_show (main_vbox); diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h index c57329edc9..1c59461721 100644 --- a/app/display/gimpdisplayshell.h +++ b/app/display/gimpdisplayshell.h @@ -27,26 +27,6 @@ #include "gui/gui-types.h" -typedef struct _GimpDisplayShellAppearance GimpDisplayShellAppearance; - -struct _GimpDisplayShellAppearance -{ - gboolean selection; - gboolean active_layer; - gboolean guides; - gboolean grid; - - gboolean menubar; - gboolean rulers; - gboolean scrollbars; - gboolean statusbar; - - GimpDisplayPaddingMode padding_mode; - GimpRGB padding_color; - gboolean padding_mode_set; -}; - - /* finding the effective screen resolution (double) */ #define SCREEN_XRES(s) (s->dot_for_dot ? \ s->gdisp->gimage->xresolution : s->monitor_xres) @@ -170,8 +150,8 @@ struct _GimpDisplayShell GQuark vectors_thaw_handler; GQuark vectors_visible_handler; - GimpDisplayShellAppearance appearance; - GimpDisplayShellAppearance fullscreen_appearance; + GimpDisplayOptions *options; + GimpDisplayOptions *fullscreen_options; /* the state of gimp_display_shell_tool_events() */ gboolean space_pressed; diff --git a/app/gui/image-menu.c b/app/gui/image-menu.c index 2db9ec224a..65393653aa 100644 --- a/app/gui/image-menu.c +++ b/app/gui/image-menu.c @@ -41,6 +41,7 @@ #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" +#include "display/gimpdisplayoptions.h" #include "display/gimpdisplayshell.h" #include "display/gimpdisplayshell-appearance.h" #include "display/gimpdisplayshell-selection.h" @@ -1295,29 +1296,29 @@ void image_menu_update (GtkItemFactory *item_factory, gpointer data) { - Gimp *gimp = NULL; - GimpDisplayShell *shell = NULL; - GimpDisplay *gdisp = NULL; - GimpImage *gimage = NULL; - GimpDrawable *drawable = NULL; - GimpLayer *layer = NULL; - GimpVectors *vectors = NULL; - GimpImageType drawable_type = -1; - GimpRGB fg; - GimpRGB bg; - gboolean is_rgb = FALSE; - gboolean is_gray = FALSE; - gboolean is_indexed = FALSE; - gboolean fs = FALSE; - gboolean aux = FALSE; - gboolean lm = FALSE; - gboolean lp = FALSE; - gboolean sel = FALSE; - gboolean alpha = FALSE; - gint lind = -1; - gint lnum = -1; - gboolean fullscreen = FALSE; - GimpDisplayShellAppearance *appearance = NULL; + Gimp *gimp = NULL; + GimpDisplay *gdisp = NULL; + GimpDisplayShell *shell = NULL; + GimpDisplayOptions *options = NULL; + GimpImage *gimage = NULL; + GimpDrawable *drawable = NULL; + GimpLayer *layer = NULL; + GimpVectors *vectors = NULL; + GimpImageType drawable_type = -1; + GimpRGB fg; + GimpRGB bg; + gboolean is_rgb = FALSE; + gboolean is_gray = FALSE; + gboolean is_indexed = FALSE; + gboolean fs = FALSE; + gboolean aux = FALSE; + gboolean lm = FALSE; + gboolean lp = FALSE; + gboolean sel = FALSE; + gboolean alpha = FALSE; + gint lind = -1; + gint lnum = -1; + gboolean fullscreen = FALSE; gimp = GIMP_ITEM_FACTORY (item_factory)->gimp; @@ -1366,10 +1367,7 @@ image_menu_update (GtkItemFactory *item_factory, fullscreen = gimp_display_shell_get_fullscreen (shell); - if (fullscreen) - appearance = &shell->fullscreen_appearance; - else - appearance = &shell->appearance; + options = fullscreen ? shell->fullscreen_options : shell->options; } gimp_context_get_foreground (gimp_get_user_context (gimp), &fg); @@ -1491,22 +1489,22 @@ image_menu_update (GtkItemFactory *item_factory, SET_SENSITIVE ("/View/Display Filters...", gdisp); SET_SENSITIVE ("/View/Show Selection", gdisp); - SET_ACTIVE ("/View/Show Selection", gdisp && appearance->selection); + SET_ACTIVE ("/View/Show Selection", gdisp && options->show_selection); SET_SENSITIVE ("/View/Show Layer Boundary", gdisp); - SET_ACTIVE ("/View/Show Layer Boundary", gdisp && appearance->active_layer); - SET_ACTIVE ("/View/Show Guides", gdisp && appearance->guides); + SET_ACTIVE ("/View/Show Layer Boundary", gdisp && options->show_active_layer); + SET_ACTIVE ("/View/Show Guides", gdisp && options->show_guides); SET_ACTIVE ("/View/Snap to Guides", gdisp && shell->snap_to_guides); - SET_ACTIVE ("/View/Show Grid", gdisp && appearance->grid); + SET_ACTIVE ("/View/Show Grid", gdisp && options->show_grid); SET_ACTIVE ("/View/Snap to Grid", gdisp && shell->snap_to_grid); SET_SENSITIVE ("/View/Show Menubar", gdisp); - SET_ACTIVE ("/View/Show Menubar", gdisp && appearance->menubar); + SET_ACTIVE ("/View/Show Menubar", gdisp && options->show_menubar); SET_SENSITIVE ("/View/Show Rulers", gdisp); - SET_ACTIVE ("/View/Show Rulers", gdisp && appearance->rulers); + SET_ACTIVE ("/View/Show Rulers", gdisp && options->show_rulers); SET_SENSITIVE ("/View/Show Scrollbars", gdisp); - SET_ACTIVE ("/View/Show Scrollbars", gdisp && appearance->scrollbars); + SET_ACTIVE ("/View/Show Scrollbars", gdisp && options->show_scrollbars); SET_SENSITIVE ("/View/Show Statusbar", gdisp); - SET_ACTIVE ("/View/Show Statusbar", gdisp && appearance->statusbar); + SET_ACTIVE ("/View/Show Statusbar", gdisp && options->show_statusbar); SET_SENSITIVE ("/View/Shrink Wrap", gdisp); diff --git a/app/gui/preferences-dialog.c b/app/gui/preferences-dialog.c index 683fd38e52..46e8834737 100644 --- a/app/gui/preferences-dialog.c +++ b/app/gui/preferences-dialog.c @@ -573,7 +573,7 @@ prefs_format_string_select_callback (GtkTreeSelection *sel, } static GtkWidget * -prefs_frame_new (gchar *label, +prefs_frame_new (const gchar *label, GtkContainer *parent, gboolean expand) { @@ -812,6 +812,41 @@ prefs_memsize_entry_add (GObject *config, return entry; } +static void +prefs_display_options_frame_add (Gimp *gimp, + GObject *object, + const gchar *label, + GtkContainer *parent) +{ + GtkBox *box; + GtkWidget *table; + GtkWidget *button; + + box = GTK_BOX (prefs_frame_new (label, parent, FALSE)); + + prefs_check_button_add (object, + "show-menubar", _("Show Menubar"), box); + prefs_check_button_add (object, + "show-rulers", _("Show _Rulers"), box); + prefs_check_button_add (object, + "show-scrollbars", _("Show Scrollbars"), box); + prefs_check_button_add (object, + "show-statusbar", _("Show S_tatusbar"), box); + + table = prefs_table_new (2, GTK_CONTAINER (box), FALSE); + + prefs_enum_option_menu_add (object, "padding-mode", 0, 0, + _("Canvas Padding Mode:"), GTK_TABLE (table), 0); + + button = prefs_color_button_add (object, "padding-color", + _("Custom Padding Color:"), + _("Select Custom Canvas Padding Color"), + GTK_TABLE (table), 1); + gimp_color_panel_set_context (GIMP_COLOR_PANEL (button), + gimp_get_user_context (gimp)); + +} + static void prefs_help_func (const gchar *help_id, gpointer help_data) @@ -1380,63 +1415,15 @@ prefs_dialog_new (Gimp *gimp, &grandchild_iter, page_index++); - /* Normal Mode */ - vbox2 = prefs_frame_new (_("Default Appearance in Normal Mode"), - GTK_CONTAINER (vbox), FALSE); + prefs_display_options_frame_add (gimp, + G_OBJECT (display_config->default_view), + _("Default Appearance in Normal Mode"), + GTK_CONTAINER (vbox)); - prefs_check_button_add (object, "show-menubar", - _("Show Menubar"), - GTK_BOX (vbox2)); - prefs_check_button_add (object, "show-rulers", - _("Show _Rulers"), - GTK_BOX (vbox2)); - prefs_check_button_add (object, "show-scrollbars", - _("Show Scrollbars"), - GTK_BOX (vbox2)); - prefs_check_button_add (object, "show-statusbar", - _("Show S_tatusbar"), - GTK_BOX (vbox2)); - - table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE); - - prefs_enum_option_menu_add (object, "canvas-padding-mode", 0, 0, - _("Canvas Padding Mode:"), - GTK_TABLE (table), 0); - button = prefs_color_button_add (object, "canvas-padding-color", - _("Custom Padding Color:"), - _("Select Custom Canvas Padding Color"), - GTK_TABLE (table), 1); - gimp_color_panel_set_context (GIMP_COLOR_PANEL (button), - gimp_get_user_context (gimp)); - - /* Fullscreen Mode */ - vbox2 = prefs_frame_new (_("Default Appearance in Fullscreen Mode"), - GTK_CONTAINER (vbox), FALSE); - - prefs_check_button_add (object, "fullscreen-show-menubar", - _("Show Menubar"), - GTK_BOX (vbox2)); - prefs_check_button_add (object, "fullscreen-show-rulers", - _("Show _Rulers"), - GTK_BOX (vbox2)); - prefs_check_button_add (object, "fullscreen-show-scrollbars", - _("Show Scrollbars"), - GTK_BOX (vbox2)); - prefs_check_button_add (object, "fullscreen-show-statusbar", - _("Show S_tatusbar"), - GTK_BOX (vbox2)); - - table = prefs_table_new (2, GTK_CONTAINER (vbox2), FALSE); - - prefs_enum_option_menu_add (object, "fullscreen-canvas-padding-mode", 0, 0, - _("Canvas Padding Mode:"), - GTK_TABLE (table), 0); - button = prefs_color_button_add (object, "fullscreen-canvas-padding-color", - _("Custom Padding Color:"), - _("Select Custom Canvas Padding Color"), - GTK_TABLE (table), 1); - gimp_color_panel_set_context (GIMP_COLOR_PANEL (button), - gimp_get_user_context (gimp)); + prefs_display_options_frame_add (gimp, + G_OBJECT (display_config->default_fullscreen_view), + _("Default Appearance in Fullscreen Mode"), + GTK_CONTAINER (vbox)); /****************************************************************/ diff --git a/app/menus/image-menu.c b/app/menus/image-menu.c index 2db9ec224a..65393653aa 100644 --- a/app/menus/image-menu.c +++ b/app/menus/image-menu.c @@ -41,6 +41,7 @@ #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" +#include "display/gimpdisplayoptions.h" #include "display/gimpdisplayshell.h" #include "display/gimpdisplayshell-appearance.h" #include "display/gimpdisplayshell-selection.h" @@ -1295,29 +1296,29 @@ void image_menu_update (GtkItemFactory *item_factory, gpointer data) { - Gimp *gimp = NULL; - GimpDisplayShell *shell = NULL; - GimpDisplay *gdisp = NULL; - GimpImage *gimage = NULL; - GimpDrawable *drawable = NULL; - GimpLayer *layer = NULL; - GimpVectors *vectors = NULL; - GimpImageType drawable_type = -1; - GimpRGB fg; - GimpRGB bg; - gboolean is_rgb = FALSE; - gboolean is_gray = FALSE; - gboolean is_indexed = FALSE; - gboolean fs = FALSE; - gboolean aux = FALSE; - gboolean lm = FALSE; - gboolean lp = FALSE; - gboolean sel = FALSE; - gboolean alpha = FALSE; - gint lind = -1; - gint lnum = -1; - gboolean fullscreen = FALSE; - GimpDisplayShellAppearance *appearance = NULL; + Gimp *gimp = NULL; + GimpDisplay *gdisp = NULL; + GimpDisplayShell *shell = NULL; + GimpDisplayOptions *options = NULL; + GimpImage *gimage = NULL; + GimpDrawable *drawable = NULL; + GimpLayer *layer = NULL; + GimpVectors *vectors = NULL; + GimpImageType drawable_type = -1; + GimpRGB fg; + GimpRGB bg; + gboolean is_rgb = FALSE; + gboolean is_gray = FALSE; + gboolean is_indexed = FALSE; + gboolean fs = FALSE; + gboolean aux = FALSE; + gboolean lm = FALSE; + gboolean lp = FALSE; + gboolean sel = FALSE; + gboolean alpha = FALSE; + gint lind = -1; + gint lnum = -1; + gboolean fullscreen = FALSE; gimp = GIMP_ITEM_FACTORY (item_factory)->gimp; @@ -1366,10 +1367,7 @@ image_menu_update (GtkItemFactory *item_factory, fullscreen = gimp_display_shell_get_fullscreen (shell); - if (fullscreen) - appearance = &shell->fullscreen_appearance; - else - appearance = &shell->appearance; + options = fullscreen ? shell->fullscreen_options : shell->options; } gimp_context_get_foreground (gimp_get_user_context (gimp), &fg); @@ -1491,22 +1489,22 @@ image_menu_update (GtkItemFactory *item_factory, SET_SENSITIVE ("/View/Display Filters...", gdisp); SET_SENSITIVE ("/View/Show Selection", gdisp); - SET_ACTIVE ("/View/Show Selection", gdisp && appearance->selection); + SET_ACTIVE ("/View/Show Selection", gdisp && options->show_selection); SET_SENSITIVE ("/View/Show Layer Boundary", gdisp); - SET_ACTIVE ("/View/Show Layer Boundary", gdisp && appearance->active_layer); - SET_ACTIVE ("/View/Show Guides", gdisp && appearance->guides); + SET_ACTIVE ("/View/Show Layer Boundary", gdisp && options->show_active_layer); + SET_ACTIVE ("/View/Show Guides", gdisp && options->show_guides); SET_ACTIVE ("/View/Snap to Guides", gdisp && shell->snap_to_guides); - SET_ACTIVE ("/View/Show Grid", gdisp && appearance->grid); + SET_ACTIVE ("/View/Show Grid", gdisp && options->show_grid); SET_ACTIVE ("/View/Snap to Grid", gdisp && shell->snap_to_grid); SET_SENSITIVE ("/View/Show Menubar", gdisp); - SET_ACTIVE ("/View/Show Menubar", gdisp && appearance->menubar); + SET_ACTIVE ("/View/Show Menubar", gdisp && options->show_menubar); SET_SENSITIVE ("/View/Show Rulers", gdisp); - SET_ACTIVE ("/View/Show Rulers", gdisp && appearance->rulers); + SET_ACTIVE ("/View/Show Rulers", gdisp && options->show_rulers); SET_SENSITIVE ("/View/Show Scrollbars", gdisp); - SET_ACTIVE ("/View/Show Scrollbars", gdisp && appearance->scrollbars); + SET_ACTIVE ("/View/Show Scrollbars", gdisp && options->show_scrollbars); SET_SENSITIVE ("/View/Show Statusbar", gdisp); - SET_ACTIVE ("/View/Show Statusbar", gdisp && appearance->statusbar); + SET_ACTIVE ("/View/Show Statusbar", gdisp && options->show_statusbar); SET_SENSITIVE ("/View/Shrink Wrap", gdisp); diff --git a/docs/gimprc-1.3.5.in b/docs/gimprc-1.3.5.in index cf7db5d263..3ef071b95f 100644 --- a/docs/gimprc-1.3.5.in +++ b/docs/gimprc-1.3.5.in @@ -156,20 +156,6 @@ palette path. This is a string value. Specify a default gradient. The gradient is searched for in the specified gradient path. This is a string value. -.TP -(default-grid - (xspacing 10.000000) - (yspacing 10.000000) - (spacing-unit inches) - (xoffset 0.000000) - (yoffset 0.000000) - (offset-unit inches) - (fgcolor (color-rgba 0.000000 0.000000 0.000000 1.000000)) - (bgcolor (color-rgba 1.000000 1.000000 1.000000 1.000000)) - (style intersections)) - -Specify a default image grid. This is a parameter list. - .TP (default-font "Sans") @@ -177,54 +163,32 @@ Specify a default font. The font is searched for in the fontconfig font path. This is a string value. .TP -(default-comment "Created with The GIMP") +(default-image + (width 256) + (height 256) + (unit inches) + (xresolution 72.000000) + (yresolution 72.000000) + (resolution-unit inches) + (image-type rgb) + (fill-type background-fill) + (comment "Created with The GIMP")) -Sets the default comment. This is a string value. +Sets the default image in the "File/New" dialog. This is a parameter list. .TP -(default-image-type rgb) +(default-grid + (style intersections) + (fgcolor (color-rgba 0.000000 0.000000 0.000000 1.000000)) + (bgcolor (color-rgba 1.000000 1.000000 1.000000 1.000000)) + (xspacing 10.000000) + (yspacing 10.000000) + (spacing-unit inches) + (xoffset 0.000000) + (yoffset 0.000000) + (offset-unit inches)) -Sets the default image type in the "File/New" dialog. Possible values are -rgb, gray and indexed. - -.TP -(default-image-width 256) - -Sets the default image width in the "File/New" dialog. This is an integer -value. - -.TP -(default-image-height 256) - -Sets the default image height in the "File/New" dialog. This is an integer -value. - -.TP -(default-unit inches) - -Sets the default unit for new images and for the "File/New" dialog. This units -will be used for coordinate display when not in dot-for-dot mode. The unit -can be one inches, millimeters, points or picas plus those in your user units -database. - -.TP -(default-xresolution 72.000000) - -Sets the default horizontal resolution for new images and for the "File/New" -dialog. This value is always in dpi (dots per inch). This is a float value. - -.TP -(default-yresolution 72.000000) - -Sets the default vertical resolution for new images and for the "File/New" -dialog. This value is always in dpi (dots per inch). This is a float value. - -.TP -(default-resolution-unit inches) - -Sets the units for the display of the default resolution in the "File/New" -dialog. The unit can be one inches, millimeters, points or picas plus those -in your user units database. +Specify a default image grid. This is a parameter list. .TP (undo-levels 5) @@ -234,13 +198,14 @@ kept available until the undo-size limit is reached. This is an integer value. .TP -(undo-size 1024k) +(undo-size 4M) Sets an upper limit to the memory that is used per image to keep operations on -the undo stack. The integer size can contain a suffix of 'B', 'K', 'M' or 'G' -which makes GIMP interpret the size as being specified in bytes, kilobytes, -megabytes or gigabytes. If no suffix is specified the size defaults to being -specified in kilobytes. +the undo stack. Regardless of this setting, at least as many undo-levels as +configured can be undone. The integer size can contain a suffix of 'B', 'K', +'M' or 'G' which makes GIMP interpret the size as being specified in bytes, +kilobytes, megabytes or gigabytes. If no suffix is specified the size defaults +to being specified in kilobytes. .TP (pluginrc-path "${gimp_dir}/pluginrc") @@ -324,7 +289,7 @@ opened, otherwise it will be displayed with a scale of 1:1. Possible values are yes and no. .TP -(perfect-mouse no) +(perfect-mouse yes) When enabled, the X server is queried for the mouse's current position on each motion event, rather than relying on the position hint. This means painting @@ -352,7 +317,7 @@ When enabled, all paint tools will show a preview of the current brush's outline. Possible values are yes and no. .TP -(image-title-format "%f-%p.%i (%t)") +(image-title-format "%f-%p.%i (%t, %L) %z%%") Sets the text to appear in image window titles. This is a format string; certain % character sequences are recognised and expanded as follows: @@ -381,11 +346,13 @@ certain % character sequences are recognised and expanded as follows: .br %Cx expands to x if the image is clean, the empty string otherwise .br -%m memory used by the image -.br %l the number of layers .br -%L the name of the active layer/channel +%L the number of layers (long form) +.br +%m memory used by the image +.br +%n the name of the active layer/channel .br %w image width in pixels .br @@ -403,7 +370,7 @@ certain % character sequences are recognised and expanded as follows: .br .TP -(image-status-format "%f-%p.%i (%t)") +(image-status-format "%n (%m)") Sets the text to appear in image window status bars. This is a format string; certain % character sequences are recognised and expanded as follows: @@ -432,11 +399,13 @@ certain % character sequences are recognised and expanded as follows: .br %Cx expands to x if the image is clean, the empty string otherwise .br -%m memory used by the image -.br %l the number of layers .br -%L the name of the active layer/channel +%L the number of layers (long form) +.br +%m memory used by the image +.br +%n the name of the active layer/channel .br %w image width in pixels .br @@ -487,82 +456,35 @@ the image window. Possible values are tiny, extra-small, small, medium, large, extra-large, huge, enormous and gigantic. .TP -(show-menubar yes) +(default-view + (show-menubar yes) + (show-rulers yes) + (show-scrollbars yes) + (show-statusbar yes) + (show-selection yes) + (show-active-layer yes) + (show-guides yes) + (show-grid no) + (padding-mode default) + (padding-color (color-rgba 1.000000 1.000000 1.000000 1.000000))) -When enabled, the menubar is visible by default. This can also be toggled with -the "View->Show Menubar" command. Possible values are yes and no. +Sets the default settings for the image view. This is a parameter list. .TP -(show-rulers yes) +(default-fullscreen-view + (show-menubar no) + (show-rulers no) + (show-scrollbars no) + (show-statusbar no) + (show-selection no) + (show-active-layer no) + (show-guides no) + (show-grid no) + (padding-mode custom) + (padding-color (color-rgba 0.000000 0.000000 0.000000 1.000000))) -When enabled, the rulers are visible by default. This can also be toggled with -the "View->Show Rulers" command. Possible values are yes and no. - -.TP -(show-scrollbars yes) - -When enabled, the scrollbars are visible by default. This can also be toggled -with the "View->Show Scrollbars" command. Possible values are yes and no. - -.TP -(show-statusbar yes) - -When enabled, the statusbar is visible by default. This can also be toggled -with the "View->Show Statusbar" command. Possible values are yes and no. - -.TP -(canvas-padding-mode default) - -Specifies how the area around the image should be drawn. Possible values are -default, light-check, dark-check and custom. - -.TP -(canvas-padding-color (color-rgba 1.000000 1.000000 1.000000 1.000000)) - -Sets the canvas padding color used if the padding mode is set to custom color. - The color is specified in the form (color-rgba red green blue alpha) with -channel values as floats between 0.0 and 1.0. - -.TP -(fullscreen-show-menubar no) - -When enabled, the menubar is visible by default in fullscreen mode. This can -also be toggled with the "View->Show Menubar" command. Possible values are -yes and no. - -.TP -(fullscreen-show-rulers no) - -When enabled, the rulers are visible by default in fullscreen mode. This can -also be toggled with the "View->Show Rulers" command. Possible values are yes -and no. - -.TP -(fullscreen-show-scrollbars no) - -When enabled, the scrollbars are visible by default in fullscreen mode. This -can also be toggled with the "View->Show Scrollbars" command. Possible values -are yes and no. - -.TP -(fullscreen-show-statusbar no) - -When enabled, the statusbar is visible by default in fullscreen mode. This can -also be toggled with the "View->Show Statusbar" command. Possible values are -yes and no. - -.TP -(fullscreen-canvas-padding-mode custom) - -Specifies how the area around the image should be drawn when in fullscreen -mode. Possible values are default, light-check, dark-check and custom. - -.TP -(fullscreen-canvas-padding-color (color-rgba 0.000000 0.000000 0.000000 1.000000)) - -Sets the canvas padding color used when in fullscreen mode and the padding -mode is set to custom color. The color is specified in the form (color-rgba -red green blue alpha) with channel values as floats between 0.0 and 1.0. +Sets the default settings used when an image is viewed in fullscreen mode. +This is a parameter list. .TP (transparency-size medium-checks) diff --git a/docs/gimprc.5.in b/docs/gimprc.5.in index cf7db5d263..3ef071b95f 100644 --- a/docs/gimprc.5.in +++ b/docs/gimprc.5.in @@ -156,20 +156,6 @@ palette path. This is a string value. Specify a default gradient. The gradient is searched for in the specified gradient path. This is a string value. -.TP -(default-grid - (xspacing 10.000000) - (yspacing 10.000000) - (spacing-unit inches) - (xoffset 0.000000) - (yoffset 0.000000) - (offset-unit inches) - (fgcolor (color-rgba 0.000000 0.000000 0.000000 1.000000)) - (bgcolor (color-rgba 1.000000 1.000000 1.000000 1.000000)) - (style intersections)) - -Specify a default image grid. This is a parameter list. - .TP (default-font "Sans") @@ -177,54 +163,32 @@ Specify a default font. The font is searched for in the fontconfig font path. This is a string value. .TP -(default-comment "Created with The GIMP") +(default-image + (width 256) + (height 256) + (unit inches) + (xresolution 72.000000) + (yresolution 72.000000) + (resolution-unit inches) + (image-type rgb) + (fill-type background-fill) + (comment "Created with The GIMP")) -Sets the default comment. This is a string value. +Sets the default image in the "File/New" dialog. This is a parameter list. .TP -(default-image-type rgb) +(default-grid + (style intersections) + (fgcolor (color-rgba 0.000000 0.000000 0.000000 1.000000)) + (bgcolor (color-rgba 1.000000 1.000000 1.000000 1.000000)) + (xspacing 10.000000) + (yspacing 10.000000) + (spacing-unit inches) + (xoffset 0.000000) + (yoffset 0.000000) + (offset-unit inches)) -Sets the default image type in the "File/New" dialog. Possible values are -rgb, gray and indexed. - -.TP -(default-image-width 256) - -Sets the default image width in the "File/New" dialog. This is an integer -value. - -.TP -(default-image-height 256) - -Sets the default image height in the "File/New" dialog. This is an integer -value. - -.TP -(default-unit inches) - -Sets the default unit for new images and for the "File/New" dialog. This units -will be used for coordinate display when not in dot-for-dot mode. The unit -can be one inches, millimeters, points or picas plus those in your user units -database. - -.TP -(default-xresolution 72.000000) - -Sets the default horizontal resolution for new images and for the "File/New" -dialog. This value is always in dpi (dots per inch). This is a float value. - -.TP -(default-yresolution 72.000000) - -Sets the default vertical resolution for new images and for the "File/New" -dialog. This value is always in dpi (dots per inch). This is a float value. - -.TP -(default-resolution-unit inches) - -Sets the units for the display of the default resolution in the "File/New" -dialog. The unit can be one inches, millimeters, points or picas plus those -in your user units database. +Specify a default image grid. This is a parameter list. .TP (undo-levels 5) @@ -234,13 +198,14 @@ kept available until the undo-size limit is reached. This is an integer value. .TP -(undo-size 1024k) +(undo-size 4M) Sets an upper limit to the memory that is used per image to keep operations on -the undo stack. The integer size can contain a suffix of 'B', 'K', 'M' or 'G' -which makes GIMP interpret the size as being specified in bytes, kilobytes, -megabytes or gigabytes. If no suffix is specified the size defaults to being -specified in kilobytes. +the undo stack. Regardless of this setting, at least as many undo-levels as +configured can be undone. The integer size can contain a suffix of 'B', 'K', +'M' or 'G' which makes GIMP interpret the size as being specified in bytes, +kilobytes, megabytes or gigabytes. If no suffix is specified the size defaults +to being specified in kilobytes. .TP (pluginrc-path "${gimp_dir}/pluginrc") @@ -324,7 +289,7 @@ opened, otherwise it will be displayed with a scale of 1:1. Possible values are yes and no. .TP -(perfect-mouse no) +(perfect-mouse yes) When enabled, the X server is queried for the mouse's current position on each motion event, rather than relying on the position hint. This means painting @@ -352,7 +317,7 @@ When enabled, all paint tools will show a preview of the current brush's outline. Possible values are yes and no. .TP -(image-title-format "%f-%p.%i (%t)") +(image-title-format "%f-%p.%i (%t, %L) %z%%") Sets the text to appear in image window titles. This is a format string; certain % character sequences are recognised and expanded as follows: @@ -381,11 +346,13 @@ certain % character sequences are recognised and expanded as follows: .br %Cx expands to x if the image is clean, the empty string otherwise .br -%m memory used by the image -.br %l the number of layers .br -%L the name of the active layer/channel +%L the number of layers (long form) +.br +%m memory used by the image +.br +%n the name of the active layer/channel .br %w image width in pixels .br @@ -403,7 +370,7 @@ certain % character sequences are recognised and expanded as follows: .br .TP -(image-status-format "%f-%p.%i (%t)") +(image-status-format "%n (%m)") Sets the text to appear in image window status bars. This is a format string; certain % character sequences are recognised and expanded as follows: @@ -432,11 +399,13 @@ certain % character sequences are recognised and expanded as follows: .br %Cx expands to x if the image is clean, the empty string otherwise .br -%m memory used by the image -.br %l the number of layers .br -%L the name of the active layer/channel +%L the number of layers (long form) +.br +%m memory used by the image +.br +%n the name of the active layer/channel .br %w image width in pixels .br @@ -487,82 +456,35 @@ the image window. Possible values are tiny, extra-small, small, medium, large, extra-large, huge, enormous and gigantic. .TP -(show-menubar yes) +(default-view + (show-menubar yes) + (show-rulers yes) + (show-scrollbars yes) + (show-statusbar yes) + (show-selection yes) + (show-active-layer yes) + (show-guides yes) + (show-grid no) + (padding-mode default) + (padding-color (color-rgba 1.000000 1.000000 1.000000 1.000000))) -When enabled, the menubar is visible by default. This can also be toggled with -the "View->Show Menubar" command. Possible values are yes and no. +Sets the default settings for the image view. This is a parameter list. .TP -(show-rulers yes) +(default-fullscreen-view + (show-menubar no) + (show-rulers no) + (show-scrollbars no) + (show-statusbar no) + (show-selection no) + (show-active-layer no) + (show-guides no) + (show-grid no) + (padding-mode custom) + (padding-color (color-rgba 0.000000 0.000000 0.000000 1.000000))) -When enabled, the rulers are visible by default. This can also be toggled with -the "View->Show Rulers" command. Possible values are yes and no. - -.TP -(show-scrollbars yes) - -When enabled, the scrollbars are visible by default. This can also be toggled -with the "View->Show Scrollbars" command. Possible values are yes and no. - -.TP -(show-statusbar yes) - -When enabled, the statusbar is visible by default. This can also be toggled -with the "View->Show Statusbar" command. Possible values are yes and no. - -.TP -(canvas-padding-mode default) - -Specifies how the area around the image should be drawn. Possible values are -default, light-check, dark-check and custom. - -.TP -(canvas-padding-color (color-rgba 1.000000 1.000000 1.000000 1.000000)) - -Sets the canvas padding color used if the padding mode is set to custom color. - The color is specified in the form (color-rgba red green blue alpha) with -channel values as floats between 0.0 and 1.0. - -.TP -(fullscreen-show-menubar no) - -When enabled, the menubar is visible by default in fullscreen mode. This can -also be toggled with the "View->Show Menubar" command. Possible values are -yes and no. - -.TP -(fullscreen-show-rulers no) - -When enabled, the rulers are visible by default in fullscreen mode. This can -also be toggled with the "View->Show Rulers" command. Possible values are yes -and no. - -.TP -(fullscreen-show-scrollbars no) - -When enabled, the scrollbars are visible by default in fullscreen mode. This -can also be toggled with the "View->Show Scrollbars" command. Possible values -are yes and no. - -.TP -(fullscreen-show-statusbar no) - -When enabled, the statusbar is visible by default in fullscreen mode. This can -also be toggled with the "View->Show Statusbar" command. Possible values are -yes and no. - -.TP -(fullscreen-canvas-padding-mode custom) - -Specifies how the area around the image should be drawn when in fullscreen -mode. Possible values are default, light-check, dark-check and custom. - -.TP -(fullscreen-canvas-padding-color (color-rgba 0.000000 0.000000 0.000000 1.000000)) - -Sets the canvas padding color used when in fullscreen mode and the padding -mode is set to custom color. The color is specified in the form (color-rgba -red green blue alpha) with channel values as floats between 0.0 and 1.0. +Sets the default settings used when an image is viewed in fullscreen mode. +This is a parameter list. .TP (transparency-size medium-checks) diff --git a/etc/gimprc b/etc/gimprc index 7f5a7bebb3..e88e8cf979 100644 --- a/etc/gimprc +++ b/etc/gimprc @@ -117,67 +117,36 @@ # # (default-gradient "FG to BG (RGB)") -# Specify a default image grid. This is a parameter list. -# -# (default-grid -# (xspacing 10.000000) -# (yspacing 10.000000) -# (spacing-unit inches) -# (xoffset 0.000000) -# (yoffset 0.000000) -# (offset-unit inches) -# (fgcolor (color-rgba 0.000000 0.000000 0.000000 1.000000)) -# (bgcolor (color-rgba 1.000000 1.000000 1.000000 1.000000)) -# (style intersections)) - # Specify a default font. The font is searched for in the fontconfig font # path. This is a string value. # # (default-font "Sans") -# Sets the default comment. This is a string value. +# Sets the default image in the "File/New" dialog. This is a parameter list. # -# (default-comment "Created with The GIMP") +# (default-image +# (width 256) +# (height 256) +# (unit inches) +# (xresolution 72.000000) +# (yresolution 72.000000) +# (resolution-unit inches) +# (image-type rgb) +# (fill-type background-fill) +# (comment "Created with The GIMP")) -# Sets the default image type in the "File/New" dialog. Possible values are -# rgb, gray and indexed. +# Specify a default image grid. This is a parameter list. # -# (default-image-type rgb) - -# Sets the default image width in the "File/New" dialog. This is an integer -# value. -# -# (default-image-width 256) - -# Sets the default image height in the "File/New" dialog. This is an integer -# value. -# -# (default-image-height 256) - -# Sets the default unit for new images and for the "File/New" dialog. This -# units will be used for coordinate display when not in dot-for-dot mode. -# The unit can be one inches, millimeters, points or picas plus those in your -# user units database. -# -# (default-unit inches) - -# Sets the default horizontal resolution for new images and for the -# "File/New" dialog. This value is always in dpi (dots per inch). This is a -# float value. -# -# (default-xresolution 72.000000) - -# Sets the default vertical resolution for new images and for the "File/New" -# dialog. This value is always in dpi (dots per inch). This is a float -# value. -# -# (default-yresolution 72.000000) - -# Sets the units for the display of the default resolution in the "File/New" -# dialog. The unit can be one inches, millimeters, points or picas plus -# those in your user units database. -# -# (default-resolution-unit inches) +# (default-grid +# (style intersections) +# (fgcolor (color-rgba 0.000000 0.000000 0.000000 1.000000)) +# (bgcolor (color-rgba 1.000000 1.000000 1.000000 1.000000)) +# (xspacing 10.000000) +# (yspacing 10.000000) +# (spacing-unit inches) +# (xoffset 0.000000) +# (yoffset 0.000000) +# (offset-unit inches)) # Sets the minimal number of operations that can be undone. More undo levels # are kept available until the undo-size limit is reached. This is an @@ -186,12 +155,13 @@ # (undo-levels 5) # Sets an upper limit to the memory that is used per image to keep operations -# on the undo stack. The integer size can contain a suffix of 'B', 'K', 'M' -# or 'G' which makes GIMP interpret the size as being specified in bytes, -# kilobytes, megabytes or gigabytes. If no suffix is specified the size -# defaults to being specified in kilobytes. +# on the undo stack. Regardless of this setting, at least as many undo-levels +# as configured can be undone. The integer size can contain a suffix of 'B', +# 'K', 'M' or 'G' which makes GIMP interpret the size as being specified in +# bytes, kilobytes, megabytes or gigabytes. If no suffix is specified the +# size defaults to being specified in kilobytes. # -# (undo-size 1024k) +# (undo-size 4M) # Sets the pluginrc search path. This is a single filename. # @@ -268,7 +238,7 @@ # Perversely, on some X servers enabling this option results in faster # painting. Possible values are yes and no. # -# (perfect-mouse no) +# (perfect-mouse yes) # Sets the mode of cursor the GIMP will use. Possible values are tool-icon, # tool-crosshair and crosshair. @@ -300,9 +270,10 @@ # %d destination scale factor # %Dx expands to x if the image is dirty, the empty string otherwise # %Cx expands to x if the image is clean, the empty string otherwise -# %m memory used by the image # %l the number of layers -# %L the name of the active layer/channel +# %L the number of layers (long form) +# %m memory used by the image +# %n the name of the active layer/channel # %w image width in pixels # %W image width in real-world units # %h image height in pixels @@ -311,7 +282,7 @@ # %U unit abbreviation # # -# (image-title-format "%f-%p.%i (%t)") +# (image-title-format "%f-%p.%i (%t, %L) %z%%") # Sets the text to appear in image window status bars. This is a format # string; certain % character sequences are recognised and expanded as @@ -328,9 +299,10 @@ # %d destination scale factor # %Dx expands to x if the image is dirty, the empty string otherwise # %Cx expands to x if the image is clean, the empty string otherwise -# %m memory used by the image # %l the number of layers -# %L the name of the active layer/channel +# %L the number of layers (long form) +# %m memory used by the image +# %n the name of the active layer/channel # %w image width in pixels # %W image width in real-world units # %h image height in pixels @@ -339,7 +311,7 @@ # %U unit abbreviation # # -# (image-status-format "%f-%p.%i (%t)") +# (image-status-format "%n (%m)") # Ask for confirmation before closing an image without saving. Possible # values are yes and no. @@ -369,73 +341,34 @@ # # (navigation-preview-size medium) -# When enabled, the menubar is visible by default. This can also be toggled -# with the "View->Show Menubar" command. Possible values are yes and no. +# Sets the default settings for the image view. This is a parameter list. # -# (show-menubar yes) +# (default-view +# (show-menubar yes) +# (show-rulers yes) +# (show-scrollbars yes) +# (show-statusbar yes) +# (show-selection yes) +# (show-active-layer yes) +# (show-guides yes) +# (show-grid no) +# (padding-mode default) +# (padding-color (color-rgba 1.000000 1.000000 1.000000 1.000000))) -# When enabled, the rulers are visible by default. This can also be toggled -# with the "View->Show Rulers" command. Possible values are yes and no. +# Sets the default settings used when an image is viewed in fullscreen mode. +# This is a parameter list. # -# (show-rulers yes) - -# When enabled, the scrollbars are visible by default. This can also be -# toggled with the "View->Show Scrollbars" command. Possible values are yes -# and no. -# -# (show-scrollbars yes) - -# When enabled, the statusbar is visible by default. This can also be toggled -# with the "View->Show Statusbar" command. Possible values are yes and no. -# -# (show-statusbar yes) - -# Specifies how the area around the image should be drawn. Possible values -# are default, light-check, dark-check and custom. -# -# (canvas-padding-mode default) - -# Sets the canvas padding color used if the padding mode is set to custom -# color. The color is specified in the form (color-rgba red green blue -# alpha) with channel values as floats between 0.0 and 1.0. -# -# (canvas-padding-color (color-rgba 1.000000 1.000000 1.000000 1.000000)) - -# When enabled, the menubar is visible by default in fullscreen mode. This -# can also be toggled with the "View->Show Menubar" command. Possible values -# are yes and no. -# -# (fullscreen-show-menubar no) - -# When enabled, the rulers are visible by default in fullscreen mode. This -# can also be toggled with the "View->Show Rulers" command. Possible values -# are yes and no. -# -# (fullscreen-show-rulers no) - -# When enabled, the scrollbars are visible by default in fullscreen mode. -# This can also be toggled with the "View->Show Scrollbars" command. -# Possible values are yes and no. -# -# (fullscreen-show-scrollbars no) - -# When enabled, the statusbar is visible by default in fullscreen mode. This -# can also be toggled with the "View->Show Statusbar" command. Possible -# values are yes and no. -# -# (fullscreen-show-statusbar no) - -# Specifies how the area around the image should be drawn when in fullscreen -# mode. Possible values are default, light-check, dark-check and custom. -# -# (fullscreen-canvas-padding-mode custom) - -# Sets the canvas padding color used when in fullscreen mode and the padding -# mode is set to custom color. The color is specified in the form -# (color-rgba red green blue alpha) with channel values as floats between 0.0 -# and 1.0. -# -# (fullscreen-canvas-padding-color (color-rgba 0.000000 0.000000 0.000000 1.000000)) +# (default-fullscreen-view +# (show-menubar no) +# (show-rulers no) +# (show-scrollbars no) +# (show-statusbar no) +# (show-selection no) +# (show-active-layer no) +# (show-guides no) +# (show-grid no) +# (padding-mode custom) +# (padding-color (color-rgba 0.000000 0.000000 0.000000 1.000000))) # Sets the size of the checkerboard used to display transparency. Possible # values are small-checks, medium-checks and large-checks. diff --git a/po/ChangeLog b/po/ChangeLog index 0fc72ea12c..57b81814c4 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,3 +1,7 @@ +2003-10-22 Sven Neumann + + * POTFILES.in: added app/display/gimpdisplayoptions.c. + 2003-10-21 Miloslav Trmac * cs.po: Updated Czech translation. @@ -8,7 +12,7 @@ 2003-10-20 Marco Ciampa - * it.po: Updated italian translation. + * it.po: Updated italian translation. 2003-10-19 Jan Morén @@ -37,7 +41,7 @@ 2003-10-15 Marco Ciampa - * it.po: Updated italian translation. + * it.po: Updated italian translation. 2003-10-15 Sven Neumann diff --git a/po/POTFILES.in b/po/POTFILES.in index f7f31e07cc..7508a36fc0 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -66,6 +66,7 @@ app/core/gimpunit.c app/display/display-enums.c app/display/gimpdisplay.c +app/display/gimpdisplayoptions.c app/display/gimpdisplayshell.c app/display/gimpdisplayshell-callbacks.c app/display/gimpdisplayshell-dnd.c