Commit e3480536 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

app/display/Makefile.am new files that implement a GimpConfig object with

2003-10-22  Sven Neumann  <sven@gimp.org>

	* 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.
parent 49fd45e2
2003-10-22 Sven Neumann <sven@gimp.org>
* 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 <sven@gimp.org>
 
* app/widgets/gimpwidgets-utils.[ch]: added new function
......@@ -23,21 +23,22 @@
#define __CONFIG_TYPES_H__
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 _GimpConfigWriter GimpConfigWriter;
typedef struct _GimpXmlParser GimpXmlParser;
typedef struct _GimpGrid GimpGrid;
typedef struct _GimpTemplate GimpTemplate;
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 _GimpConfigWriter GimpConfigWriter;
typedef struct _GimpXmlParser GimpXmlParser;
typedef struct _GimpDisplayOptions GimpDisplayOptions;
typedef struct _GimpGrid GimpGrid;
typedef struct _GimpTemplate GimpTemplate;
#endif /* __CONFIG_TYPES_H__ */
......@@ -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_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);
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);
}
static void
gimp_display_config_finalize (GObject *object)
gimp_display_config_init (GimpDisplayConfig *config)
{
GimpDisplayConfig *display_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);
}
display_config = GIMP_DISPLAY_CONFIG (object);
static void
gimp_display_config_finalize (GObject *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);
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);
case PROP_DEFAULT_VIEW:
g_value_set_object (value, display_config->default_view);
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");
}
......@@ -38,39 +38,27 @@ typedef struct _GimpDisplayConfigClass GimpDisplayConfigClass;
struct _GimpDisplayConfig
{
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;
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;
GimpDisplayOptions *default_view;
GimpDisplayOptions *default_fullscreen_view;
};
struct _GimpDisplayConfigClass
......
......@@ -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."
......
......@@ -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_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));
prefs_display_options_frame_add (gimp,
G_OBJECT (display_config->default_view),
_("Default Appearance in Normal Mode"),
GTK_CONTAINER (vbox));
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));
/****************************************************************/
......
......@@ -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 \
......
......@@ -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[] =
{