removed gimp_config_values_equal().
2002-11-23 Michael Natterer <mitch@gimp.org> * app/config/gimpconfig-utils.[ch]: removed gimp_config_values_equal(). * app/config/gimpconfig-serialize.c * app/config/gimpconfig.c: use g_param_values_cmp() instead so our registered compare methods are used. * app/config/gimpdisplayconfig.[ch]: added "canvas_padding_mode" and "canvas_padding_color" properties. * app/display/display-enums.[ch]: added enum GimpDisplayPaddingMode which can be one of { theme, light check, dark check, custom }. * app/display/gimpdisplay.h * app/display/gimpdisplay-handlers.c: removed cached monitor resolution values... * app/display/gimpdisplayshell.[ch]: ...and added them here. Added padding state as in GimpDisplayConfig. Added utility function gimp_display_shell_set_padding() which hides all the details. Added the new padding modes to the padding color button's context menu. * app/display/gimpdisplayshell-callbacks.[ch]: don't fiddle with colors manually but use gimp_display_shell_set_padding() in realize() and in the color button callbacks. * app/display/gimpdisplayshell-handlers.c: connect to notify::monitor-[xy]resolution and notify::canvas-padding-[mode|color] and update accordingly. * app/widgets/gimppropwidgets.[ch]: added gimp_prop_color_button_new(). * app/widgets/gimpdialogfactory.[ch]: added gimp_dialog_factories_session_clear() (unimplemented). * app/gui/preferences-dialog.c: added widgets for padding mode and color. Removed some callbacks by connecting the functions they called directly. Cleanup.
This commit is contained in:

committed by
Michael Natterer

parent
c618840144
commit
4ce4adf87d
43
ChangeLog
43
ChangeLog
@ -1,3 +1,46 @@
|
||||
2002-11-23 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/config/gimpconfig-utils.[ch]: removed
|
||||
gimp_config_values_equal().
|
||||
|
||||
* app/config/gimpconfig-serialize.c
|
||||
* app/config/gimpconfig.c: use g_param_values_cmp() instead so
|
||||
our registered compare methods are used.
|
||||
|
||||
* app/config/gimpdisplayconfig.[ch]: added "canvas_padding_mode"
|
||||
and "canvas_padding_color" properties.
|
||||
|
||||
* app/display/display-enums.[ch]: added enum GimpDisplayPaddingMode
|
||||
which can be one of { theme, light check, dark check, custom }.
|
||||
|
||||
* app/display/gimpdisplay.h
|
||||
* app/display/gimpdisplay-handlers.c: removed cached monitor
|
||||
resolution values...
|
||||
|
||||
* app/display/gimpdisplayshell.[ch]: ...and added them here. Added
|
||||
padding state as in GimpDisplayConfig. Added utility function
|
||||
gimp_display_shell_set_padding() which hides all the details.
|
||||
Added the new padding modes to the padding color button's context
|
||||
menu.
|
||||
|
||||
* app/display/gimpdisplayshell-callbacks.[ch]: don't fiddle
|
||||
with colors manually but use gimp_display_shell_set_padding()
|
||||
in realize() and in the color button callbacks.
|
||||
|
||||
* app/display/gimpdisplayshell-handlers.c: connect to
|
||||
notify::monitor-[xy]resolution and
|
||||
notify::canvas-padding-[mode|color] and update accordingly.
|
||||
|
||||
* app/widgets/gimppropwidgets.[ch]: added
|
||||
gimp_prop_color_button_new().
|
||||
|
||||
* app/widgets/gimpdialogfactory.[ch]: added
|
||||
gimp_dialog_factories_session_clear() (unimplemented).
|
||||
|
||||
* app/gui/preferences-dialog.c: added widgets for padding mode and
|
||||
color. Removed some callbacks by connecting the functions they
|
||||
called directly. Cleanup.
|
||||
|
||||
2002-11-23 Jakub Steiner <jimmac@ximian.com>
|
||||
|
||||
* themes/Default/images/preferences/folders-environ.png:
|
||||
|
@ -177,7 +177,7 @@ gimp_config_serialize_changed_properties (GObject *new,
|
||||
g_object_get_property (new, prop_spec->name, &new_value);
|
||||
g_object_get_property (old, prop_spec->name, &old_value);
|
||||
|
||||
if (!gimp_config_values_equal (&new_value, &old_value))
|
||||
if (g_param_values_cmp (prop_spec, &new_value, &old_value) != 0)
|
||||
{
|
||||
if (property_written)
|
||||
g_string_assign (str, "\n");
|
||||
|
@ -30,40 +30,6 @@
|
||||
#include "gimpconfig-utils.h"
|
||||
|
||||
|
||||
gboolean
|
||||
gimp_config_values_equal (const GValue *a,
|
||||
const GValue *b)
|
||||
{
|
||||
g_return_val_if_fail (G_VALUE_TYPE (a) == G_VALUE_TYPE (b), FALSE);
|
||||
|
||||
if (g_value_fits_pointer (a))
|
||||
{
|
||||
if (a->data[0].v_pointer == b->data[0].v_pointer)
|
||||
return TRUE;
|
||||
|
||||
if (G_VALUE_HOLDS_STRING (a))
|
||||
{
|
||||
const gchar *a_str = g_value_get_string (a);
|
||||
const gchar *b_str = g_value_get_string (b);
|
||||
|
||||
if (a_str && b_str)
|
||||
return (strcmp (a_str, b_str) == 0);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("%s: Can not compare values of type %s.",
|
||||
G_STRLOC, G_VALUE_TYPE_NAME (a));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return (a->data[0].v_uint64 == b->data[0].v_uint64);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_config_copy_properties (GObject *src,
|
||||
GObject *dest)
|
||||
|
@ -23,8 +23,6 @@
|
||||
#define __GIMP_CONFIG_UTILS_H__
|
||||
|
||||
|
||||
gboolean gimp_config_values_equal (const GValue *a,
|
||||
const GValue *b);
|
||||
void gimp_config_copy_properties (GObject *src,
|
||||
GObject *dest);
|
||||
|
||||
|
@ -163,7 +163,7 @@ gimp_config_iface_equal (GObject *a,
|
||||
g_object_get_property (a, prop_spec->name, &a_value);
|
||||
g_object_get_property (b, prop_spec->name, &b_value);
|
||||
|
||||
equal = gimp_config_values_equal (&a_value, &b_value);
|
||||
equal = (g_param_values_cmp (prop_spec, &a_value, &b_value) == 0);
|
||||
|
||||
g_value_unset (&a_value);
|
||||
g_value_unset (&b_value);
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
||||
#include "config-types.h"
|
||||
@ -68,7 +69,9 @@ enum
|
||||
PROP_MONITOR_XRESOLUTION,
|
||||
PROP_MONITOR_YRESOLUTION,
|
||||
PROP_MONITOR_RES_FROM_GDK,
|
||||
PROP_NAV_PREVIEW_SIZE
|
||||
PROP_NAV_PREVIEW_SIZE,
|
||||
PROP_CANVAS_PADDING_MODE,
|
||||
PROP_CANVAS_PADDING_COLOR
|
||||
};
|
||||
|
||||
static GObjectClass *parent_class = NULL;
|
||||
@ -106,6 +109,7 @@ static void
|
||||
gimp_display_config_class_init (GimpDisplayConfigClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpRGB white;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
@ -115,6 +119,8 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
|
||||
object_class->set_property = gimp_display_config_set_property;
|
||||
object_class->get_property = gimp_display_config_get_property;
|
||||
|
||||
gimp_rgba_set (&white, 1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_MARCHING_ANTS_SPEED,
|
||||
"marching-ants-speed",
|
||||
50, G_MAXINT, 300,
|
||||
@ -182,7 +188,17 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
|
||||
0);
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_NAV_PREVIEW_SIZE,
|
||||
"navigation-preview-size",
|
||||
GIMP_TYPE_PREVIEW_SIZE, GIMP_PREVIEW_SIZE_MEDIUM,
|
||||
GIMP_TYPE_PREVIEW_SIZE,
|
||||
GIMP_PREVIEW_SIZE_MEDIUM,
|
||||
0);
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_CANVAS_PADDING_MODE,
|
||||
"canvas-padding-mode",
|
||||
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",
|
||||
&white,
|
||||
0);
|
||||
}
|
||||
|
||||
@ -264,6 +280,12 @@ 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_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;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
@ -334,6 +356,12 @@ 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_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;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
|
@ -57,6 +57,8 @@ struct _GimpDisplayConfig
|
||||
gdouble monitor_yres;
|
||||
gboolean monitor_res_from_gdk;
|
||||
GimpPreviewSize nav_preview_size;
|
||||
GimpDisplayPaddingMode canvas_padding_mode;
|
||||
GimpRGB canvas_padding_color;
|
||||
};
|
||||
|
||||
struct _GimpDisplayConfigClass
|
||||
|
@ -58,9 +58,6 @@ struct _GimpDisplay
|
||||
gint instance; /* the instance # of this gdisplay as */
|
||||
/* taken from the gimage at creation */
|
||||
|
||||
gdouble monitor_xres;
|
||||
gdouble monitor_yres;
|
||||
|
||||
GtkWidget *shell; /* shell widget for this gdisplay */
|
||||
|
||||
gboolean draw_guides; /* should the guides be drawn? */
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
#include "widgets/gimpdeviceinfo.h"
|
||||
#include "widgets/gimpdevices.h"
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
#include "widgets/gimppropwidgets.h"
|
||||
|
||||
#include "gui.h"
|
||||
@ -66,19 +67,15 @@ static void prefs_cancel_callback (GtkWidget *widget,
|
||||
static void prefs_ok_callback (GtkWidget *widget,
|
||||
GtkWidget *dialog);
|
||||
|
||||
static void prefs_clear_session_info_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void prefs_default_resolution_callback (GtkWidget *widget,
|
||||
GtkWidget *size_sizeentry);
|
||||
static void prefs_res_source_callback (GtkWidget *widget,
|
||||
GObject *config);
|
||||
static void prefs_resolution_calibrate_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
GtkWidget *sizeentry);
|
||||
static void prefs_input_dialog_able_callback (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
gpointer data);
|
||||
static void prefs_input_dialog_save_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void prefs_restart_notification (void);
|
||||
|
||||
|
||||
@ -422,19 +419,6 @@ prefs_ok_callback (GtkWidget *widget,
|
||||
g_object_unref (config_copy);
|
||||
}
|
||||
|
||||
static void
|
||||
prefs_clear_session_info_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: g_list_free (session_info_updates);
|
||||
#endif
|
||||
#if 0
|
||||
g_list_free (session_info_updates);
|
||||
session_info_updates = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
prefs_default_resolution_callback (GtkWidget *widget,
|
||||
GtkWidget *size_sizeentry)
|
||||
@ -489,19 +473,18 @@ prefs_res_source_callback (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
prefs_resolution_calibrate_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
GtkWidget *sizeentry)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *image;
|
||||
|
||||
dialog = gtk_widget_get_toplevel (GTK_WIDGET (data));
|
||||
dialog = gtk_widget_get_toplevel (sizeentry);
|
||||
|
||||
notebook = g_object_get_data (G_OBJECT (dialog), "notebook");
|
||||
|
||||
image = g_object_get_data (G_OBJECT (notebook), "image");
|
||||
|
||||
resolution_calibrate_dialog (GTK_WIDGET (data),
|
||||
resolution_calibrate_dialog (sizeentry,
|
||||
gtk_image_get_pixbuf (GTK_IMAGE (image)),
|
||||
NULL, NULL, NULL);
|
||||
}
|
||||
@ -514,13 +497,6 @@ prefs_input_dialog_able_callback (GtkWidget *widget,
|
||||
gimp_device_info_changed_by_device (device);
|
||||
}
|
||||
|
||||
static void
|
||||
prefs_input_dialog_save_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_devices_save (GIMP (data));
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
prefs_notebook_append_page (Gimp *gimp,
|
||||
GtkNotebook *notebook,
|
||||
@ -654,7 +630,7 @@ prefs_frame_new (gchar *label,
|
||||
gboolean expand)
|
||||
{
|
||||
GtkWidget *frame;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *vbox;
|
||||
|
||||
frame = gtk_frame_new (label);
|
||||
|
||||
@ -665,12 +641,12 @@ prefs_frame_new (gchar *label,
|
||||
|
||||
gtk_widget_show (frame);
|
||||
|
||||
vbox2 = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
||||
gtk_widget_show (vbox2);
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
return vbox2;
|
||||
return vbox;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
@ -733,6 +709,27 @@ prefs_check_button_add (GObject *config,
|
||||
return button;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
prefs_color_button_add (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *label,
|
||||
const gchar *title,
|
||||
GtkTable *table,
|
||||
gint table_row)
|
||||
{
|
||||
GtkWidget *button;
|
||||
|
||||
button = gimp_prop_color_button_new (config, property_name, title,
|
||||
20, 20, GIMP_COLOR_AREA_SMALL_CHECKS);
|
||||
|
||||
if (button)
|
||||
gimp_table_attach_aligned (table, 0, table_row,
|
||||
label, 1.0, 0.5,
|
||||
button, 1, TRUE);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
prefs_enum_option_menu_add (GObject *config,
|
||||
const gchar *property_name,
|
||||
@ -1231,7 +1228,7 @@ prefs_dialog_new (Gimp *gimp,
|
||||
gtk_widget_show (button);
|
||||
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (prefs_clear_session_info_callback),
|
||||
G_CALLBACK (gimp_dialog_factories_session_clear),
|
||||
NULL);
|
||||
|
||||
|
||||
@ -1369,8 +1366,8 @@ prefs_dialog_new (Gimp *gimp,
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (prefs_input_dialog_save_callback),
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gimp_devices_save),
|
||||
gimp);
|
||||
|
||||
|
||||
@ -1406,11 +1403,18 @@ prefs_dialog_new (Gimp *gimp,
|
||||
_("Show S_tatusbar"),
|
||||
GTK_BOX (vbox2));
|
||||
|
||||
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
|
||||
table = prefs_table_new (3, GTK_CONTAINER (vbox2), FALSE);
|
||||
|
||||
prefs_spin_button_add (config, "marching-ants-speed", 10.0, 100.0, 0,
|
||||
_("Marching _Ants Speed:"),
|
||||
GTK_TABLE (table), 0);
|
||||
prefs_enum_option_menu_add (config, "canvas-padding-mode", 0, 0,
|
||||
_("Canvas Padding Mode:"),
|
||||
GTK_TABLE (table), 1);
|
||||
prefs_color_button_add (config, "canvas-padding-color",
|
||||
_("Custom Canvas _Padding Color:"),
|
||||
_("Select Custom Canvas Padding Color"),
|
||||
GTK_TABLE (table), 2);
|
||||
|
||||
vbox2 = prefs_frame_new (_("Pointer Movement Feedback"),
|
||||
GTK_CONTAINER (vbox), FALSE);
|
||||
@ -1464,29 +1468,29 @@ prefs_dialog_new (Gimp *gimp,
|
||||
N_("Show memory usage")
|
||||
};
|
||||
|
||||
gchar *formats[] =
|
||||
struct
|
||||
{
|
||||
gchar *current_setting;
|
||||
const gchar *title;
|
||||
const gchar *property_name;
|
||||
}
|
||||
formats[] =
|
||||
{
|
||||
{
|
||||
display_config->image_title_format,
|
||||
display_config->image_status_format
|
||||
};
|
||||
|
||||
const gchar *format_titles[] =
|
||||
{
|
||||
N_("Image Title Format"),
|
||||
N_("Image Statusbar Format")
|
||||
};
|
||||
|
||||
const gchar *format_properties[] =
|
||||
"image-title-format"
|
||||
},
|
||||
{
|
||||
"image-title-format",
|
||||
display_config->image_status_format,
|
||||
N_("Image Statusbar Format"),
|
||||
"image-status-format"
|
||||
}
|
||||
};
|
||||
|
||||
gint format;
|
||||
|
||||
g_assert (G_N_ELEMENTS (format_strings) == G_N_ELEMENTS (format_names));
|
||||
g_assert (G_N_ELEMENTS (formats) == G_N_ELEMENTS (format_titles));
|
||||
g_assert (G_N_ELEMENTS (formats) == G_N_ELEMENTS (format_properties));
|
||||
|
||||
for (format = 0; format < G_N_ELEMENTS (formats); format++)
|
||||
{
|
||||
@ -1500,12 +1504,12 @@ prefs_dialog_new (Gimp *gimp,
|
||||
GtkTreeSelection *sel;
|
||||
gint i;
|
||||
|
||||
format_strings[0] = formats[format];
|
||||
format_strings[0] = formats[format].current_setting;
|
||||
|
||||
vbox2 = prefs_frame_new (gettext (format_titles[format]),
|
||||
vbox2 = prefs_frame_new (gettext (formats[format].title),
|
||||
GTK_CONTAINER (vbox), TRUE);
|
||||
|
||||
entry = gimp_prop_entry_new (config, format_properties[format], 0);
|
||||
entry = gimp_prop_entry_new (config, formats[format].property_name, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), entry, FALSE, FALSE, 0);
|
||||
gtk_widget_show (entry);
|
||||
|
||||
@ -1813,7 +1817,10 @@ prefs_dialog_new (Gimp *gimp,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*********************/
|
||||
/* Folders / <paths> */
|
||||
/*********************/
|
||||
{
|
||||
static const struct
|
||||
{
|
||||
|
@ -28,5 +28,26 @@ gimp_cursor_mode_get_type (void)
|
||||
}
|
||||
|
||||
|
||||
static const GEnumValue gimp_display_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" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
GType
|
||||
gimp_display_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);
|
||||
|
||||
return enum_type;
|
||||
}
|
||||
|
||||
|
||||
/* Generated data ends here */
|
||||
|
||||
|
@ -32,4 +32,17 @@ typedef enum
|
||||
} GimpCursorMode;
|
||||
|
||||
|
||||
#define GIMP_TYPE_DISPLAY_PADDING_MODE (gimp_display_padding_mode_get_type ())
|
||||
|
||||
GType gimp_display_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;
|
||||
|
||||
|
||||
#endif /* __DISPLAY_ENUMS_H__ */
|
||||
|
@ -60,9 +60,6 @@ gimp_display_connect (GimpDisplay *gdisp,
|
||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||
g_return_if_fail (gdisp->gimage == NULL);
|
||||
|
||||
gdisp->monitor_xres = GIMP_DISPLAY_CONFIG (gimage->gimp->config)->monitor_xres;
|
||||
gdisp->monitor_yres = GIMP_DISPLAY_CONFIG (gimage->gimp->config)->monitor_yres;
|
||||
|
||||
gdisp->gimage = gimage;
|
||||
gdisp->instance = gimage->instance_count;
|
||||
|
||||
|
@ -58,9 +58,6 @@ struct _GimpDisplay
|
||||
gint instance; /* the instance # of this gdisplay as */
|
||||
/* taken from the gimage at creation */
|
||||
|
||||
gdouble monitor_xres;
|
||||
gdouble monitor_yres;
|
||||
|
||||
GtkWidget *shell; /* shell widget for this gdisplay */
|
||||
|
||||
gboolean draw_guides; /* should the guides be drawn? */
|
||||
|
@ -55,14 +55,13 @@
|
||||
#include "gimpdisplayshell.h"
|
||||
#include "gimpdisplayshell-callbacks.h"
|
||||
#include "gimpdisplayshell-layer-select.h"
|
||||
#include "gimpdisplayshell-render.h"
|
||||
#include "gimpdisplayshell-scale.h"
|
||||
#include "gimpdisplayshell-scroll.h"
|
||||
#include "gimpdisplayshell-selection.h"
|
||||
#include "gimpnavigationview.h"
|
||||
#include "gimpstatusbar.h"
|
||||
|
||||
#include "app_procs.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
@ -238,46 +237,19 @@ void
|
||||
gimp_display_shell_canvas_realize (GtkWidget *canvas,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
/* FIXME!! */
|
||||
GimpDisplayConfig *config = GIMP_DISPLAY_CONFIG (the_gimp->config);
|
||||
|
||||
GimpDisplayConfig *config;
|
||||
GimpDisplay *gdisp;
|
||||
GdkColor color;
|
||||
guchar r, g, b;
|
||||
|
||||
gdisp = shell->gdisp;
|
||||
config = GIMP_DISPLAY_CONFIG (gdisp->gimage->gimp->config);
|
||||
|
||||
gtk_widget_grab_focus (shell->canvas);
|
||||
|
||||
if (TRUE /* gimprc.use_style_padding_color */)
|
||||
{
|
||||
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 (&shell->padding_color, r, g, b);
|
||||
|
||||
g_signal_handlers_block_by_func (G_OBJECT (shell->padding_button),
|
||||
gimp_display_shell_color_button_changed,
|
||||
shell);
|
||||
|
||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (shell->padding_button),
|
||||
&shell->padding_color);
|
||||
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (shell->padding_button),
|
||||
gimp_display_shell_color_button_changed,
|
||||
shell);
|
||||
}
|
||||
|
||||
gimp_rgb_get_uchar (&shell->padding_color, &r, &g, &b);
|
||||
|
||||
shell->padding_gc = gdk_gc_new (canvas->window);
|
||||
|
||||
color.red = (r << 8) | r;
|
||||
color.green = (g << 8) | g;
|
||||
color.blue = (b << 8) | b;
|
||||
|
||||
gdk_gc_set_rgb_fg_color (shell->padding_gc, &color);
|
||||
gimp_display_shell_set_padding (shell,
|
||||
shell->padding_mode,
|
||||
&shell->padding_color);
|
||||
|
||||
gdk_window_set_back_pixmap (shell->canvas->window, NULL, FALSE);
|
||||
|
||||
@ -1292,9 +1264,24 @@ gimp_display_shell_color_button_press (GtkWidget *widget,
|
||||
b = shell->canvas->style->bg[GTK_STATE_NORMAL].blue >> 8;
|
||||
|
||||
gimp_rgba_set_uchar (&color, r, g, b, 255);
|
||||
|
||||
gimp_item_factory_set_color (color_button->item_factory,
|
||||
"/Default Color", &color, FALSE);
|
||||
"/Default from Theme", &color, FALSE);
|
||||
|
||||
gimp_rgba_set_uchar (&color,
|
||||
render_blend_light_check[0],
|
||||
render_blend_light_check[1],
|
||||
render_blend_light_check[2],
|
||||
255);
|
||||
gimp_item_factory_set_color (color_button->item_factory,
|
||||
"/Light Check Color", &color, FALSE);
|
||||
|
||||
gimp_rgba_set_uchar (&color,
|
||||
render_blend_dark_check[0],
|
||||
render_blend_dark_check[1],
|
||||
render_blend_dark_check[2],
|
||||
255);
|
||||
gimp_item_factory_set_color (color_button->item_factory,
|
||||
"/Dark Check Color", &color, FALSE);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@ -1304,43 +1291,58 @@ void
|
||||
gimp_display_shell_color_button_changed (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
GdkColor gdk_color;
|
||||
guchar r, g, b;
|
||||
GimpRGB color;
|
||||
|
||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (widget),
|
||||
&shell->padding_color);
|
||||
shell->padding_mode_set = TRUE;
|
||||
|
||||
gimp_rgb_get_uchar (&shell->padding_color, &r, &g, &b);
|
||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (widget), &color);
|
||||
|
||||
gdk_color.red = r + r * 256;
|
||||
gdk_color.green = g + g * 256;
|
||||
gdk_color.blue = b + b * 256;
|
||||
|
||||
gdk_gc_set_rgb_fg_color (shell->padding_gc, &gdk_color);
|
||||
gimp_display_shell_set_padding (shell,
|
||||
GIMP_DISPLAY_PADDING_MODE_CUSTOM,
|
||||
&color);
|
||||
|
||||
gimp_display_shell_expose_full (shell);
|
||||
gimp_display_shell_flush (shell);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_color_button_default (gpointer callback_data,
|
||||
gimp_display_shell_color_button_menu_callback (gpointer callback_data,
|
||||
guint callback_action,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
guchar r, g, b;
|
||||
GimpRGB color;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (callback_data);
|
||||
|
||||
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;
|
||||
if (callback_action == GIMP_DISPLAY_PADDING_MODE_CUSTOM)
|
||||
{
|
||||
gtk_button_clicked (GTK_BUTTON (shell->padding_button));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (callback_action == 0xffff)
|
||||
{
|
||||
GimpDisplayConfig *config;
|
||||
|
||||
gimp_rgb_set_uchar (&color, r, g, b);
|
||||
config = GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config);
|
||||
|
||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (shell->padding_button),
|
||||
&color);
|
||||
shell->padding_mode_set = FALSE;
|
||||
|
||||
gimp_display_shell_set_padding (shell,
|
||||
config->canvas_padding_mode,
|
||||
&config->canvas_padding_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->padding_mode_set = TRUE;
|
||||
|
||||
gimp_display_shell_set_padding (shell, callback_action,
|
||||
&shell->padding_color);
|
||||
}
|
||||
|
||||
gimp_display_shell_expose_full (shell);
|
||||
gimp_display_shell_flush (shell);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -65,7 +65,7 @@ gboolean gimp_display_shell_color_button_press (GtkWidget *widget,
|
||||
GimpDisplayShell *shell);
|
||||
void gimp_display_shell_color_button_changed (GtkWidget *widget,
|
||||
GimpDisplayShell *shell);
|
||||
void gimp_display_shell_color_button_default (gpointer data,
|
||||
void gimp_display_shell_color_button_menu_callback (gpointer data,
|
||||
guint action,
|
||||
GtkWidget *widget);
|
||||
|
||||
|
@ -74,7 +74,6 @@
|
||||
#include "gimpdisplayshell-selection.h"
|
||||
#include "gimpstatusbar.h"
|
||||
|
||||
#include "app_procs.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
@ -266,7 +265,9 @@ gimp_display_shell_init (GimpDisplayShell *shell)
|
||||
shell->cursor_y = 0;
|
||||
|
||||
shell->padding_button = NULL;
|
||||
gimp_rgb_set (&shell->padding_color, 1.0, 1.0, 1.0);
|
||||
shell->padding_mode = GIMP_DISPLAY_PADDING_MODE_DEFAULT;
|
||||
shell->padding_mode_set = FALSE;
|
||||
gimp_rgba_set (&shell->padding_color, 1.0, 1.0, 1.0, 1.0);
|
||||
shell->padding_gc = NULL;
|
||||
|
||||
shell->warning_dialog = NULL;
|
||||
@ -646,8 +647,21 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
||||
static GtkItemFactoryEntry menu_items[] =
|
||||
{
|
||||
{ "/---", NULL, NULL, 0, "<Separator>"},
|
||||
{ N_("/Default Color"), NULL,
|
||||
gimp_display_shell_color_button_default, 0, NULL }
|
||||
{ N_("/From Theme"), NULL,
|
||||
gimp_display_shell_color_button_menu_callback,
|
||||
GIMP_DISPLAY_PADDING_MODE_DEFAULT, NULL },
|
||||
{ N_("/Light Check Color"), NULL,
|
||||
gimp_display_shell_color_button_menu_callback,
|
||||
GIMP_DISPLAY_PADDING_MODE_LIGHT_CHECK, NULL },
|
||||
{ N_("/Dark Check Color"), NULL,
|
||||
gimp_display_shell_color_button_menu_callback,
|
||||
GIMP_DISPLAY_PADDING_MODE_DARK_CHECK, NULL },
|
||||
{ N_("/Select Custom Color..."), NULL,
|
||||
gimp_display_shell_color_button_menu_callback,
|
||||
GIMP_DISPLAY_PADDING_MODE_CUSTOM, NULL },
|
||||
{ N_("/As in Preferences"), NULL,
|
||||
gimp_display_shell_color_button_menu_callback,
|
||||
0xffff, NULL }
|
||||
};
|
||||
|
||||
gtk_item_factory_create_items (GIMP_COLOR_BUTTON (shell->padding_button)->item_factory,
|
||||
@ -757,12 +771,11 @@ void
|
||||
gimp_display_shell_close (GimpDisplayShell *shell,
|
||||
gboolean kill_it)
|
||||
{
|
||||
/* FIXME!! */
|
||||
GimpDisplayConfig *config = GIMP_DISPLAY_CONFIG (the_gimp->config);
|
||||
|
||||
GimpDisplayConfig *config;
|
||||
GimpImage *gimage;
|
||||
|
||||
gimage = shell->gdisp->gimage;
|
||||
config = GIMP_DISPLAY_CONFIG (gimage->gimp->config);
|
||||
|
||||
/* FIXME: gimp_busy HACK not really appropriate here because we only
|
||||
* want to prevent the busy image and display to be closed. --Mitch
|
||||
@ -1691,13 +1704,13 @@ gimp_display_shell_update_cursor (GimpDisplayShell *shell,
|
||||
void
|
||||
gimp_display_shell_update_title (GimpDisplayShell *shell)
|
||||
{
|
||||
/* FIXME!! */
|
||||
GimpDisplayConfig *config = GIMP_DISPLAY_CONFIG (the_gimp->config);
|
||||
|
||||
GimpDisplayConfig *config;
|
||||
gchar title[MAX_TITLE_BUF];
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
config = GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config);
|
||||
|
||||
/* format the title */
|
||||
gimp_display_shell_format_title (shell, title, sizeof (title),
|
||||
config->image_title_format);
|
||||
@ -1745,6 +1758,83 @@ gimp_display_shell_update_icon (GimpDisplayShell *shell)
|
||||
g_object_unref (G_OBJECT (pixbuf));
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_set_padding (GimpDisplayShell *shell,
|
||||
GimpDisplayPaddingMode padding_mode,
|
||||
GimpRGB *padding_color)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (padding_color != NULL);
|
||||
|
||||
shell->padding_mode = padding_mode;
|
||||
|
||||
switch (shell->padding_mode)
|
||||
{
|
||||
case GIMP_DISPLAY_PADDING_MODE_DEFAULT:
|
||||
if (shell->padding_gc)
|
||||
{
|
||||
guchar r, g, b;
|
||||
|
||||
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 (&shell->padding_color, r, g, b);
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->padding_color = *padding_color;
|
||||
}
|
||||
break;
|
||||
|
||||
case GIMP_DISPLAY_PADDING_MODE_LIGHT_CHECK:
|
||||
gimp_rgb_set_uchar (&shell->padding_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 (&shell->padding_color,
|
||||
render_blend_dark_check[0],
|
||||
render_blend_dark_check[1],
|
||||
render_blend_dark_check[2]);
|
||||
break;
|
||||
|
||||
case GIMP_DISPLAY_PADDING_MODE_CUSTOM:
|
||||
shell->padding_color = *padding_color;
|
||||
break;
|
||||
}
|
||||
|
||||
if (shell->padding_gc)
|
||||
{
|
||||
GdkColor gdk_color;
|
||||
guchar r, g, b;
|
||||
|
||||
gimp_rgb_get_uchar (&shell->padding_color, &r, &g, &b);
|
||||
|
||||
gdk_color.red = r + r * 256;
|
||||
gdk_color.green = g + g * 256;
|
||||
gdk_color.blue = b + b * 256;
|
||||
|
||||
gdk_gc_set_rgb_fg_color (shell->padding_gc, &gdk_color);
|
||||
}
|
||||
|
||||
if (shell->padding_button)
|
||||
{
|
||||
g_signal_handlers_block_by_func (G_OBJECT (shell->padding_button),
|
||||
gimp_display_shell_color_button_changed,
|
||||
shell);
|
||||
|
||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (shell->padding_button),
|
||||
&shell->padding_color);
|
||||
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (shell->padding_button),
|
||||
gimp_display_shell_color_button_changed,
|
||||
shell);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_draw_guide (GimpDisplayShell *shell,
|
||||
GimpGuide *guide,
|
||||
@ -2183,11 +2273,12 @@ gimp_display_shell_real_set_cursor (GimpDisplayShell *shell,
|
||||
GimpCursorModifier modifier,
|
||||
gboolean always_install)
|
||||
{
|
||||
/* FIXME!! */
|
||||
GimpDisplayConfig *config = GIMP_DISPLAY_CONFIG (the_gimp->config);
|
||||
GimpDisplayConfig *config;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
config = GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config);
|
||||
|
||||
if (cursor_type != GIMP_BAD_CURSOR)
|
||||
{
|
||||
switch (config->cursor_mode)
|
||||
|
@ -35,9 +35,9 @@
|
||||
|
||||
/* finding the effective screen resolution (double) */
|
||||
#define SCREEN_XRES(s) (s->dot_for_dot ? \
|
||||
s->gdisp->gimage->xresolution : s->gdisp->monitor_xres)
|
||||
s->gdisp->gimage->xresolution : s->monitor_xres)
|
||||
#define SCREEN_YRES(s) (s->dot_for_dot ? \
|
||||
s->gdisp->gimage->yresolution : s->gdisp->monitor_yres)
|
||||
s->gdisp->gimage->yresolution : s->monitor_yres)
|
||||
|
||||
/* calculate scale factors (double) */
|
||||
#define SCALEFACTOR_X(s) ((SCALEDEST(s) * SCREEN_XRES(s)) / \
|
||||
@ -75,6 +75,9 @@ struct _GimpDisplayShell
|
||||
|
||||
GimpItemFactory *item_factory;
|
||||
|
||||
gdouble monitor_xres;
|
||||
gdouble monitor_yres;
|
||||
|
||||
gint scale; /* scale factor from original raw image */
|
||||
gboolean dot_for_dot; /* is monitor resolution being ignored? */
|
||||
|
||||
@ -127,6 +130,8 @@ struct _GimpDisplayShell
|
||||
gint cursor_y; /* software cursor Y value */
|
||||
|
||||
GtkWidget *padding_button; /* GimpColorPanel in the NE corner */
|
||||
GimpDisplayPaddingMode padding_mode;
|
||||
gboolean padding_mode_set;
|
||||
GimpRGB padding_color; /* color of the empty around the image */
|
||||
GdkGC *padding_gc; /* GC with padding_color as BG */
|
||||
|
||||
@ -254,6 +259,10 @@ void gimp_display_shell_update_cursor (GimpDisplayShell *shell,
|
||||
void gimp_display_shell_update_title (GimpDisplayShell *shell);
|
||||
void gimp_display_shell_update_icon (GimpDisplayShell *shell);
|
||||
|
||||
void gimp_display_shell_set_padding (GimpDisplayShell *shell,
|
||||
GimpDisplayPaddingMode mode,
|
||||
GimpRGB *color);
|
||||
|
||||
void gimp_display_shell_draw_guide (GimpDisplayShell *shell,
|
||||
GimpGuide *guide,
|
||||
gboolean active);
|
||||
|
@ -72,6 +72,12 @@ static void gimp_display_shell_title_notify_handler (GObject *c
|
||||
static void gimp_display_shell_nav_size_notify_handler (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_display_shell_monitor_res_notify_handler (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_display_shell_padding_notify_handler (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
static gboolean gimp_display_shell_idle_update_icon (gpointer data);
|
||||
|
||||
@ -81,6 +87,7 @@ static gboolean gimp_display_shell_idle_update_icon (gpointer d
|
||||
void
|
||||
gimp_display_shell_connect (GimpDisplayShell *shell)
|
||||
{
|
||||
GimpDisplayConfig *display_config;
|
||||
GimpImage *gimage;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
@ -89,6 +96,13 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
|
||||
|
||||
gimage = shell->gdisp->gimage;
|
||||
|
||||
display_config = GIMP_DISPLAY_CONFIG (gimage->gimp->config);
|
||||
|
||||
shell->monitor_xres = display_config->monitor_xres;
|
||||
shell->monitor_yres = display_config->monitor_yres;
|
||||
shell->padding_mode = display_config->canvas_padding_mode;
|
||||
shell->padding_color = display_config->canvas_padding_color;
|
||||
|
||||
g_signal_connect (G_OBJECT (gimage), "clean",
|
||||
G_CALLBACK (gimp_display_shell_clean_dirty_handler),
|
||||
shell);
|
||||
@ -143,6 +157,22 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
|
||||
"notify::navigation-preview-size",
|
||||
G_CALLBACK (gimp_display_shell_nav_size_notify_handler),
|
||||
shell);
|
||||
g_signal_connect (G_OBJECT (gimage->gimp->config),
|
||||
"notify::monitor-xresolutuion",
|
||||
G_CALLBACK (gimp_display_shell_monitor_res_notify_handler),
|
||||
shell);
|
||||
g_signal_connect (G_OBJECT (gimage->gimp->config),
|
||||
"notify::monitor-yresolutuion",
|
||||
G_CALLBACK (gimp_display_shell_monitor_res_notify_handler),
|
||||
shell);
|
||||
g_signal_connect (G_OBJECT (gimage->gimp->config),
|
||||
"notify::canvas-padding-mode",
|
||||
G_CALLBACK (gimp_display_shell_padding_notify_handler),
|
||||
shell);
|
||||
g_signal_connect (G_OBJECT (gimage->gimp->config),
|
||||
"notify::canvas-padding-color",
|
||||
G_CALLBACK (gimp_display_shell_padding_notify_handler),
|
||||
shell);
|
||||
|
||||
gimp_display_shell_invalidate_preview_handler (gimage, shell);
|
||||
gimp_display_shell_qmask_changed_handler (gimage, shell);
|
||||
@ -165,6 +195,12 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell)
|
||||
shell->icon_idle_id = 0;
|
||||
}
|
||||
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (gimage->gimp->config),
|
||||
gimp_display_shell_padding_notify_handler,
|
||||
shell);
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (gimage->gimp->config),
|
||||
gimp_display_shell_monitor_res_notify_handler,
|
||||
shell);
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (gimage->gimp->config),
|
||||
gimp_display_shell_nav_size_notify_handler,
|
||||
shell);
|
||||
@ -320,6 +356,19 @@ gimp_display_shell_check_notify_handler (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
switch (shell->padding_mode)
|
||||
{
|
||||
case GIMP_DISPLAY_PADDING_MODE_LIGHT_CHECK:
|
||||
case GIMP_DISPLAY_PADDING_MODE_DARK_CHECK:
|
||||
gimp_display_shell_set_padding (shell,
|
||||
shell->padding_mode,
|
||||
&shell->padding_color);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gimp_display_shell_expose_full (shell);
|
||||
gimp_display_shell_flush (shell);
|
||||
}
|
||||
@ -351,6 +400,40 @@ gimp_display_shell_nav_size_notify_handler (GObject *config,
|
||||
gtk_widget_set_sensitive (shell->nav_ebox, sensitive);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_shell_monitor_res_notify_handler (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
shell->monitor_xres = GIMP_DISPLAY_CONFIG (config)->monitor_xres;
|
||||
shell->monitor_yres = GIMP_DISPLAY_CONFIG (config)->monitor_yres;
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: update displays on monitor resolution change
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_shell_padding_notify_handler (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
/* if the user did not set the padding mode for this display explicitely */
|
||||
if (! shell->padding_mode_set)
|
||||
{
|
||||
GimpDisplayConfig *display_config;
|
||||
|
||||
display_config = GIMP_DISPLAY_CONFIG (config);
|
||||
|
||||
gimp_display_shell_set_padding (shell,
|
||||
display_config->canvas_padding_mode,
|
||||
&display_config->canvas_padding_color);
|
||||
|
||||
gimp_display_shell_expose_full (shell);
|
||||
gimp_display_shell_flush (shell);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_display_shell_idle_update_icon (gpointer data)
|
||||
{
|
||||
|
@ -74,7 +74,6 @@
|
||||
#include "gimpdisplayshell-selection.h"
|
||||
#include "gimpstatusbar.h"
|
||||
|
||||
#include "app_procs.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
@ -266,7 +265,9 @@ gimp_display_shell_init (GimpDisplayShell *shell)
|
||||
shell->cursor_y = 0;
|
||||
|
||||
shell->padding_button = NULL;
|
||||
gimp_rgb_set (&shell->padding_color, 1.0, 1.0, 1.0);
|
||||
shell->padding_mode = GIMP_DISPLAY_PADDING_MODE_DEFAULT;
|
||||
shell->padding_mode_set = FALSE;
|
||||
gimp_rgba_set (&shell->padding_color, 1.0, 1.0, 1.0, 1.0);
|
||||
shell->padding_gc = NULL;
|
||||
|
||||
shell->warning_dialog = NULL;
|
||||
@ -646,8 +647,21 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
||||
static GtkItemFactoryEntry menu_items[] =
|
||||
{
|
||||
{ "/---", NULL, NULL, 0, "<Separator>"},
|
||||
{ N_("/Default Color"), NULL,
|
||||
gimp_display_shell_color_button_default, 0, NULL }
|
||||
{ N_("/From Theme"), NULL,
|
||||
gimp_display_shell_color_button_menu_callback,
|
||||
GIMP_DISPLAY_PADDING_MODE_DEFAULT, NULL },
|
||||
{ N_("/Light Check Color"), NULL,
|
||||
gimp_display_shell_color_button_menu_callback,
|
||||
GIMP_DISPLAY_PADDING_MODE_LIGHT_CHECK, NULL },
|
||||
{ N_("/Dark Check Color"), NULL,
|
||||
gimp_display_shell_color_button_menu_callback,
|
||||
GIMP_DISPLAY_PADDING_MODE_DARK_CHECK, NULL },
|
||||
{ N_("/Select Custom Color..."), NULL,
|
||||
gimp_display_shell_color_button_menu_callback,
|
||||
GIMP_DISPLAY_PADDING_MODE_CUSTOM, NULL },
|
||||
{ N_("/As in Preferences"), NULL,
|
||||
gimp_display_shell_color_button_menu_callback,
|
||||
0xffff, NULL }
|
||||
};
|
||||
|
||||
gtk_item_factory_create_items (GIMP_COLOR_BUTTON (shell->padding_button)->item_factory,
|
||||
@ -757,12 +771,11 @@ void
|
||||
gimp_display_shell_close (GimpDisplayShell *shell,
|
||||
gboolean kill_it)
|
||||
{
|
||||
/* FIXME!! */
|
||||
GimpDisplayConfig *config = GIMP_DISPLAY_CONFIG (the_gimp->config);
|
||||
|
||||
GimpDisplayConfig *config;
|
||||
GimpImage *gimage;
|
||||
|
||||
gimage = shell->gdisp->gimage;
|
||||
config = GIMP_DISPLAY_CONFIG (gimage->gimp->config);
|
||||
|
||||
/* FIXME: gimp_busy HACK not really appropriate here because we only
|
||||
* want to prevent the busy image and display to be closed. --Mitch
|
||||
@ -1691,13 +1704,13 @@ gimp_display_shell_update_cursor (GimpDisplayShell *shell,
|
||||
void
|
||||
gimp_display_shell_update_title (GimpDisplayShell *shell)
|
||||
{
|
||||
/* FIXME!! */
|
||||
GimpDisplayConfig *config = GIMP_DISPLAY_CONFIG (the_gimp->config);
|
||||
|
||||
GimpDisplayConfig *config;
|
||||
gchar title[MAX_TITLE_BUF];
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
config = GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config);
|
||||
|
||||
/* format the title */
|
||||
gimp_display_shell_format_title (shell, title, sizeof (title),
|
||||
config->image_title_format);
|
||||
@ -1745,6 +1758,83 @@ gimp_display_shell_update_icon (GimpDisplayShell *shell)
|
||||
g_object_unref (G_OBJECT (pixbuf));
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_set_padding (GimpDisplayShell *shell,
|
||||
GimpDisplayPaddingMode padding_mode,
|
||||
GimpRGB *padding_color)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (padding_color != NULL);
|
||||
|
||||
shell->padding_mode = padding_mode;
|
||||
|
||||
switch (shell->padding_mode)
|
||||
{
|
||||
case GIMP_DISPLAY_PADDING_MODE_DEFAULT:
|
||||
if (shell->padding_gc)
|
||||
{
|
||||
guchar r, g, b;
|
||||
|
||||
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 (&shell->padding_color, r, g, b);
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->padding_color = *padding_color;
|
||||
}
|
||||
break;
|
||||
|
||||
case GIMP_DISPLAY_PADDING_MODE_LIGHT_CHECK:
|
||||
gimp_rgb_set_uchar (&shell->padding_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 (&shell->padding_color,
|
||||
render_blend_dark_check[0],
|
||||
render_blend_dark_check[1],
|
||||
render_blend_dark_check[2]);
|
||||
break;
|
||||
|
||||
case GIMP_DISPLAY_PADDING_MODE_CUSTOM:
|
||||
shell->padding_color = *padding_color;
|
||||
break;
|
||||
}
|
||||
|
||||
if (shell->padding_gc)
|
||||
{
|
||||
GdkColor gdk_color;
|
||||
guchar r, g, b;
|
||||
|
||||
gimp_rgb_get_uchar (&shell->padding_color, &r, &g, &b);
|
||||
|
||||
gdk_color.red = r + r * 256;
|
||||
gdk_color.green = g + g * 256;
|
||||
gdk_color.blue = b + b * 256;
|
||||
|
||||
gdk_gc_set_rgb_fg_color (shell->padding_gc, &gdk_color);
|
||||
}
|
||||
|
||||
if (shell->padding_button)
|
||||
{
|
||||
g_signal_handlers_block_by_func (G_OBJECT (shell->padding_button),
|
||||
gimp_display_shell_color_button_changed,
|
||||
shell);
|
||||
|
||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (shell->padding_button),
|
||||
&shell->padding_color);
|
||||
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (shell->padding_button),
|
||||
gimp_display_shell_color_button_changed,
|
||||
shell);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_draw_guide (GimpDisplayShell *shell,
|
||||
GimpGuide *guide,
|
||||
@ -2183,11 +2273,12 @@ gimp_display_shell_real_set_cursor (GimpDisplayShell *shell,
|
||||
GimpCursorModifier modifier,
|
||||
gboolean always_install)
|
||||
{
|
||||
/* FIXME!! */
|
||||
GimpDisplayConfig *config = GIMP_DISPLAY_CONFIG (the_gimp->config);
|
||||
GimpDisplayConfig *config;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
config = GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config);
|
||||
|
||||
if (cursor_type != GIMP_BAD_CURSOR)
|
||||
{
|
||||
switch (config->cursor_mode)
|
||||
|
@ -35,9 +35,9 @@
|
||||
|
||||
/* finding the effective screen resolution (double) */
|
||||
#define SCREEN_XRES(s) (s->dot_for_dot ? \
|
||||
s->gdisp->gimage->xresolution : s->gdisp->monitor_xres)
|
||||
s->gdisp->gimage->xresolution : s->monitor_xres)
|
||||
#define SCREEN_YRES(s) (s->dot_for_dot ? \
|
||||
s->gdisp->gimage->yresolution : s->gdisp->monitor_yres)
|
||||
s->gdisp->gimage->yresolution : s->monitor_yres)
|
||||
|
||||
/* calculate scale factors (double) */
|
||||
#define SCALEFACTOR_X(s) ((SCALEDEST(s) * SCREEN_XRES(s)) / \
|
||||
@ -75,6 +75,9 @@ struct _GimpDisplayShell
|
||||
|
||||
GimpItemFactory *item_factory;
|
||||
|
||||
gdouble monitor_xres;
|
||||
gdouble monitor_yres;
|
||||
|
||||
gint scale; /* scale factor from original raw image */
|
||||
gboolean dot_for_dot; /* is monitor resolution being ignored? */
|
||||
|
||||
@ -127,6 +130,8 @@ struct _GimpDisplayShell
|
||||
gint cursor_y; /* software cursor Y value */
|
||||
|
||||
GtkWidget *padding_button; /* GimpColorPanel in the NE corner */
|
||||
GimpDisplayPaddingMode padding_mode;
|
||||
gboolean padding_mode_set;
|
||||
GimpRGB padding_color; /* color of the empty around the image */
|
||||
GdkGC *padding_gc; /* GC with padding_color as BG */
|
||||
|
||||
@ -254,6 +259,10 @@ void gimp_display_shell_update_cursor (GimpDisplayShell *shell,
|
||||
void gimp_display_shell_update_title (GimpDisplayShell *shell);
|
||||
void gimp_display_shell_update_icon (GimpDisplayShell *shell);
|
||||
|
||||
void gimp_display_shell_set_padding (GimpDisplayShell *shell,
|
||||
GimpDisplayPaddingMode mode,
|
||||
GimpRGB *color);
|
||||
|
||||
void gimp_display_shell_draw_guide (GimpDisplayShell *shell,
|
||||
GimpGuide *guide,
|
||||
gboolean active);
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
#include "widgets/gimpdeviceinfo.h"
|
||||
#include "widgets/gimpdevices.h"
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
#include "widgets/gimppropwidgets.h"
|
||||
|
||||
#include "gui.h"
|
||||
@ -66,19 +67,15 @@ static void prefs_cancel_callback (GtkWidget *widget,
|
||||
static void prefs_ok_callback (GtkWidget *widget,
|
||||
GtkWidget *dialog);
|
||||
|
||||
static void prefs_clear_session_info_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void prefs_default_resolution_callback (GtkWidget *widget,
|
||||
GtkWidget *size_sizeentry);
|
||||
static void prefs_res_source_callback (GtkWidget *widget,
|
||||
GObject *config);
|
||||
static void prefs_resolution_calibrate_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
GtkWidget *sizeentry);
|
||||
static void prefs_input_dialog_able_callback (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
gpointer data);
|
||||
static void prefs_input_dialog_save_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void prefs_restart_notification (void);
|
||||
|
||||
|
||||
@ -422,19 +419,6 @@ prefs_ok_callback (GtkWidget *widget,
|
||||
g_object_unref (config_copy);
|
||||
}
|
||||
|
||||
static void
|
||||
prefs_clear_session_info_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: g_list_free (session_info_updates);
|
||||
#endif
|
||||
#if 0
|
||||
g_list_free (session_info_updates);
|
||||
session_info_updates = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
prefs_default_resolution_callback (GtkWidget *widget,
|
||||
GtkWidget *size_sizeentry)
|
||||
@ -489,19 +473,18 @@ prefs_res_source_callback (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
prefs_resolution_calibrate_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
GtkWidget *sizeentry)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *image;
|
||||
|
||||
dialog = gtk_widget_get_toplevel (GTK_WIDGET (data));
|
||||
dialog = gtk_widget_get_toplevel (sizeentry);
|
||||
|
||||
notebook = g_object_get_data (G_OBJECT (dialog), "notebook");
|
||||
|
||||
image = g_object_get_data (G_OBJECT (notebook), "image");
|
||||
|
||||
resolution_calibrate_dialog (GTK_WIDGET (data),
|
||||
resolution_calibrate_dialog (sizeentry,
|
||||
gtk_image_get_pixbuf (GTK_IMAGE (image)),
|
||||
NULL, NULL, NULL);
|
||||
}
|
||||
@ -514,13 +497,6 @@ prefs_input_dialog_able_callback (GtkWidget *widget,
|
||||
gimp_device_info_changed_by_device (device);
|
||||
}
|
||||
|
||||
static void
|
||||
prefs_input_dialog_save_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_devices_save (GIMP (data));
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
prefs_notebook_append_page (Gimp *gimp,
|
||||
GtkNotebook *notebook,
|
||||
@ -654,7 +630,7 @@ prefs_frame_new (gchar *label,
|
||||
gboolean expand)
|
||||
{
|
||||
GtkWidget *frame;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *vbox;
|
||||
|
||||
frame = gtk_frame_new (label);
|
||||
|
||||
@ -665,12 +641,12 @@ prefs_frame_new (gchar *label,
|
||||
|
||||
gtk_widget_show (frame);
|
||||
|
||||
vbox2 = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
||||
gtk_widget_show (vbox2);
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
return vbox2;
|
||||
return vbox;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
@ -733,6 +709,27 @@ prefs_check_button_add (GObject *config,
|
||||
return button;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
prefs_color_button_add (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *label,
|
||||
const gchar *title,
|
||||
GtkTable *table,
|
||||
gint table_row)
|
||||
{
|
||||
GtkWidget *button;
|
||||
|
||||
button = gimp_prop_color_button_new (config, property_name, title,
|
||||
20, 20, GIMP_COLOR_AREA_SMALL_CHECKS);
|
||||
|
||||
if (button)
|
||||
gimp_table_attach_aligned (table, 0, table_row,
|
||||
label, 1.0, 0.5,
|
||||
button, 1, TRUE);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
prefs_enum_option_menu_add (GObject *config,
|
||||
const gchar *property_name,
|
||||
@ -1231,7 +1228,7 @@ prefs_dialog_new (Gimp *gimp,
|
||||
gtk_widget_show (button);
|
||||
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (prefs_clear_session_info_callback),
|
||||
G_CALLBACK (gimp_dialog_factories_session_clear),
|
||||
NULL);
|
||||
|
||||
|
||||
@ -1369,8 +1366,8 @@ prefs_dialog_new (Gimp *gimp,
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (prefs_input_dialog_save_callback),
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (gimp_devices_save),
|
||||
gimp);
|
||||
|
||||
|
||||
@ -1406,11 +1403,18 @@ prefs_dialog_new (Gimp *gimp,
|
||||
_("Show S_tatusbar"),
|
||||
GTK_BOX (vbox2));
|
||||
|
||||
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
|
||||
table = prefs_table_new (3, GTK_CONTAINER (vbox2), FALSE);
|
||||
|
||||
prefs_spin_button_add (config, "marching-ants-speed", 10.0, 100.0, 0,
|
||||
_("Marching _Ants Speed:"),
|
||||
GTK_TABLE (table), 0);
|
||||
prefs_enum_option_menu_add (config, "canvas-padding-mode", 0, 0,
|
||||
_("Canvas Padding Mode:"),
|
||||
GTK_TABLE (table), 1);
|
||||
prefs_color_button_add (config, "canvas-padding-color",
|
||||
_("Custom Canvas _Padding Color:"),
|
||||
_("Select Custom Canvas Padding Color"),
|
||||
GTK_TABLE (table), 2);
|
||||
|
||||
vbox2 = prefs_frame_new (_("Pointer Movement Feedback"),
|
||||
GTK_CONTAINER (vbox), FALSE);
|
||||
@ -1464,29 +1468,29 @@ prefs_dialog_new (Gimp *gimp,
|
||||
N_("Show memory usage")
|
||||
};
|
||||
|
||||
gchar *formats[] =
|
||||
struct
|
||||
{
|
||||
gchar *current_setting;
|
||||
const gchar *title;
|
||||
const gchar *property_name;
|
||||
}
|
||||
formats[] =
|
||||
{
|
||||
{
|
||||
display_config->image_title_format,
|
||||
display_config->image_status_format
|
||||
};
|
||||
|
||||
const gchar *format_titles[] =
|
||||
{
|
||||
N_("Image Title Format"),
|
||||
N_("Image Statusbar Format")
|
||||
};
|
||||
|
||||
const gchar *format_properties[] =
|
||||
"image-title-format"
|
||||
},
|
||||
{
|
||||
"image-title-format",
|
||||
display_config->image_status_format,
|
||||
N_("Image Statusbar Format"),
|
||||
"image-status-format"
|
||||
}
|
||||
};
|
||||
|
||||
gint format;
|
||||
|
||||
g_assert (G_N_ELEMENTS (format_strings) == G_N_ELEMENTS (format_names));
|
||||
g_assert (G_N_ELEMENTS (formats) == G_N_ELEMENTS (format_titles));
|
||||
g_assert (G_N_ELEMENTS (formats) == G_N_ELEMENTS (format_properties));
|
||||
|
||||
for (format = 0; format < G_N_ELEMENTS (formats); format++)
|
||||
{
|
||||
@ -1500,12 +1504,12 @@ prefs_dialog_new (Gimp *gimp,
|
||||
GtkTreeSelection *sel;
|
||||
gint i;
|
||||
|
||||
format_strings[0] = formats[format];
|
||||
format_strings[0] = formats[format].current_setting;
|
||||
|
||||
vbox2 = prefs_frame_new (gettext (format_titles[format]),
|
||||
vbox2 = prefs_frame_new (gettext (formats[format].title),
|
||||
GTK_CONTAINER (vbox), TRUE);
|
||||
|
||||
entry = gimp_prop_entry_new (config, format_properties[format], 0);
|
||||
entry = gimp_prop_entry_new (config, formats[format].property_name, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), entry, FALSE, FALSE, 0);
|
||||
gtk_widget_show (entry);
|
||||
|
||||
@ -1813,7 +1817,10 @@ prefs_dialog_new (Gimp *gimp,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*********************/
|
||||
/* Folders / <paths> */
|
||||
/*********************/
|
||||
{
|
||||
static const struct
|
||||
{
|
||||
|
@ -79,6 +79,9 @@ static void gimp_dialog_factories_save_foreach (gchar *name,
|
||||
static void gimp_dialog_factories_restore_foreach (gchar *name,
|
||||
GimpDialogFactory *factory,
|
||||
gpointer data);
|
||||
static void gimp_dialog_factories_clear_foreach (gchar *name,
|
||||
GimpDialogFactory *factory,
|
||||
gpointer data);
|
||||
static void gimp_dialog_factory_get_window_info (GtkWidget *window,
|
||||
GimpSessionInfo *info);
|
||||
static void gimp_dialog_factory_set_window_geometry (GtkWidget *window,
|
||||
@ -904,6 +907,18 @@ gimp_dialog_factories_session_restore (void)
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_dialog_factories_session_clear (void)
|
||||
{
|
||||
GimpDialogFactoryClass *factory_class;
|
||||
|
||||
factory_class = g_type_class_peek (GIMP_TYPE_DIALOG_FACTORY);
|
||||
|
||||
g_hash_table_foreach (factory_class->factories,
|
||||
(GHFunc) gimp_dialog_factories_clear_foreach,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_dialog_factories_toggle (GimpDialogFactory *toolbox_factory)
|
||||
{
|
||||
@ -1222,6 +1237,28 @@ gimp_dialog_factories_restore_foreach (gchar *name,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dialog_factories_clear_foreach (gchar *name,
|
||||
GimpDialogFactory *factory,
|
||||
gpointer data)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
for (list = factory->session_infos; list; list = g_list_next (list))
|
||||
{
|
||||
GimpSessionInfo *info;
|
||||
|
||||
info = (GimpSessionInfo *) list->data;
|
||||
|
||||
if (info->widget)
|
||||
continue;
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: implement session info deletion
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dialog_factory_get_window_info (GtkWidget *window,
|
||||
GimpSessionInfo *info)
|
||||
|
@ -147,6 +147,7 @@ void gimp_dialog_factory_remove_dialog (GimpDialogFactory *factory,
|
||||
|
||||
void gimp_dialog_factories_session_save (FILE *file);
|
||||
void gimp_dialog_factories_session_restore (void);
|
||||
void gimp_dialog_factories_session_clear (void);
|
||||
|
||||
void gimp_dialog_factories_toggle (GimpDialogFactory *toolbox_factory);
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include "config/gimpconfig-params.h"
|
||||
|
||||
#include "gimpcolorpanel.h"
|
||||
#include "gimpenummenu.h"
|
||||
#include "gimppropwidgets.h"
|
||||
|
||||
@ -1400,6 +1401,105 @@ gimp_prop_coordinates_notify_unit (GObject *config,
|
||||
}
|
||||
|
||||
|
||||
/******************/
|
||||
/* color button */
|
||||
/******************/
|
||||
|
||||
static void gimp_prop_color_button_callback (GtkWidget *widget,
|
||||
GObject *config);
|
||||
static void gimp_prop_color_button_notify (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GtkWidget *button);
|
||||
|
||||
GtkWidget *
|
||||
gimp_prop_color_button_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *title,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpColorAreaType type)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
GtkWidget *button;
|
||||
GimpRGB *value;
|
||||
|
||||
param_spec = check_param_spec (config, property_name,
|
||||
GIMP_TYPE_PARAM_COLOR, G_STRLOC);
|
||||
if (! param_spec)
|
||||
return NULL;
|
||||
|
||||
g_object_get (config,
|
||||
property_name, &value,
|
||||
NULL);
|
||||
|
||||
button = gimp_color_panel_new (title, value, type, width, height);
|
||||
|
||||
g_free (value);
|
||||
|
||||
set_param_spec (G_OBJECT (button), param_spec);
|
||||
|
||||
g_signal_connect (G_OBJECT (button), "color_changed",
|
||||
G_CALLBACK (gimp_prop_color_button_callback),
|
||||
config);
|
||||
|
||||
connect_notify (config, property_name,
|
||||
G_CALLBACK (gimp_prop_color_button_notify),
|
||||
button);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_color_button_callback (GtkWidget *button,
|
||||
GObject *config)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
GimpRGB value;
|
||||
|
||||
param_spec = get_param_spec (G_OBJECT (button));
|
||||
if (! param_spec)
|
||||
return;
|
||||
|
||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (button), &value);
|
||||
|
||||
g_signal_handlers_block_by_func (config,
|
||||
gimp_prop_color_button_notify,
|
||||
button);
|
||||
|
||||
g_object_set (config,
|
||||
param_spec->name, &value,
|
||||
NULL);
|
||||
|
||||
g_signal_handlers_unblock_by_func (config,
|
||||
gimp_prop_color_button_notify,
|
||||
button);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_color_button_notify (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GtkWidget *button)
|
||||
{
|
||||
GimpRGB *value;
|
||||
|
||||
g_object_get (config,
|
||||
param_spec->name, &value,
|
||||
NULL);
|
||||
|
||||
g_signal_handlers_block_by_func (G_OBJECT (button),
|
||||
gimp_prop_color_button_callback,
|
||||
config);
|
||||
|
||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (button), value);
|
||||
|
||||
g_free (value);
|
||||
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (button),
|
||||
gimp_prop_color_button_callback,
|
||||
config);
|
||||
}
|
||||
|
||||
|
||||
/*******************************/
|
||||
/* private utility functions */
|
||||
/*******************************/
|
||||
|
@ -101,4 +101,14 @@ GtkWidget * gimp_prop_coordinates_new (GObject *config,
|
||||
gboolean has_chainbutton);
|
||||
|
||||
|
||||
/* GimpParamColor */
|
||||
|
||||
GtkWidget * gimp_prop_color_button_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *title,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpColorAreaType type);
|
||||
|
||||
|
||||
#endif /* __GIMP_PROP_WIDGETS_H__ */
|
||||
|
@ -163,7 +163,7 @@ gimp_config_iface_equal (GObject *a,
|
||||
g_object_get_property (a, prop_spec->name, &a_value);
|
||||
g_object_get_property (b, prop_spec->name, &b_value);
|
||||
|
||||
equal = gimp_config_values_equal (&a_value, &b_value);
|
||||
equal = (g_param_values_cmp (prop_spec, &a_value, &b_value) == 0);
|
||||
|
||||
g_value_unset (&a_value);
|
||||
g_value_unset (&b_value);
|
||||
|
@ -177,7 +177,7 @@ gimp_config_serialize_changed_properties (GObject *new,
|
||||
g_object_get_property (new, prop_spec->name, &new_value);
|
||||
g_object_get_property (old, prop_spec->name, &old_value);
|
||||
|
||||
if (!gimp_config_values_equal (&new_value, &old_value))
|
||||
if (g_param_values_cmp (prop_spec, &new_value, &old_value) != 0)
|
||||
{
|
||||
if (property_written)
|
||||
g_string_assign (str, "\n");
|
||||
|
@ -30,40 +30,6 @@
|
||||
#include "gimpconfig-utils.h"
|
||||
|
||||
|
||||
gboolean
|
||||
gimp_config_values_equal (const GValue *a,
|
||||
const GValue *b)
|
||||
{
|
||||
g_return_val_if_fail (G_VALUE_TYPE (a) == G_VALUE_TYPE (b), FALSE);
|
||||
|
||||
if (g_value_fits_pointer (a))
|
||||
{
|
||||
if (a->data[0].v_pointer == b->data[0].v_pointer)
|
||||
return TRUE;
|
||||
|
||||
if (G_VALUE_HOLDS_STRING (a))
|
||||
{
|
||||
const gchar *a_str = g_value_get_string (a);
|
||||
const gchar *b_str = g_value_get_string (b);
|
||||
|
||||
if (a_str && b_str)
|
||||
return (strcmp (a_str, b_str) == 0);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("%s: Can not compare values of type %s.",
|
||||
G_STRLOC, G_VALUE_TYPE_NAME (a));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return (a->data[0].v_uint64 == b->data[0].v_uint64);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_config_copy_properties (GObject *src,
|
||||
GObject *dest)
|
||||
|
@ -23,8 +23,6 @@
|
||||
#define __GIMP_CONFIG_UTILS_H__
|
||||
|
||||
|
||||
gboolean gimp_config_values_equal (const GValue *a,
|
||||
const GValue *b);
|
||||
void gimp_config_copy_properties (GObject *src,
|
||||
GObject *dest);
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include "config/gimpconfig-params.h"
|
||||
|
||||
#include "gimpcolorpanel.h"
|
||||
#include "gimpenummenu.h"
|
||||
#include "gimppropwidgets.h"
|
||||
|
||||
@ -1400,6 +1401,105 @@ gimp_prop_coordinates_notify_unit (GObject *config,
|
||||
}
|
||||
|
||||
|
||||
/******************/
|
||||
/* color button */
|
||||
/******************/
|
||||
|
||||
static void gimp_prop_color_button_callback (GtkWidget *widget,
|
||||
GObject *config);
|
||||
static void gimp_prop_color_button_notify (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GtkWidget *button);
|
||||
|
||||
GtkWidget *
|
||||
gimp_prop_color_button_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *title,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpColorAreaType type)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
GtkWidget *button;
|
||||
GimpRGB *value;
|
||||
|
||||
param_spec = check_param_spec (config, property_name,
|
||||
GIMP_TYPE_PARAM_COLOR, G_STRLOC);
|
||||
if (! param_spec)
|
||||
return NULL;
|
||||
|
||||
g_object_get (config,
|
||||
property_name, &value,
|
||||
NULL);
|
||||
|
||||
button = gimp_color_panel_new (title, value, type, width, height);
|
||||
|
||||
g_free (value);
|
||||
|
||||
set_param_spec (G_OBJECT (button), param_spec);
|
||||
|
||||
g_signal_connect (G_OBJECT (button), "color_changed",
|
||||
G_CALLBACK (gimp_prop_color_button_callback),
|
||||
config);
|
||||
|
||||
connect_notify (config, property_name,
|
||||
G_CALLBACK (gimp_prop_color_button_notify),
|
||||
button);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_color_button_callback (GtkWidget *button,
|
||||
GObject *config)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
GimpRGB value;
|
||||
|
||||
param_spec = get_param_spec (G_OBJECT (button));
|
||||
if (! param_spec)
|
||||
return;
|
||||
|
||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (button), &value);
|
||||
|
||||
g_signal_handlers_block_by_func (config,
|
||||
gimp_prop_color_button_notify,
|
||||
button);
|
||||
|
||||
g_object_set (config,
|
||||
param_spec->name, &value,
|
||||
NULL);
|
||||
|
||||
g_signal_handlers_unblock_by_func (config,
|
||||
gimp_prop_color_button_notify,
|
||||
button);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_color_button_notify (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GtkWidget *button)
|
||||
{
|
||||
GimpRGB *value;
|
||||
|
||||
g_object_get (config,
|
||||
param_spec->name, &value,
|
||||
NULL);
|
||||
|
||||
g_signal_handlers_block_by_func (G_OBJECT (button),
|
||||
gimp_prop_color_button_callback,
|
||||
config);
|
||||
|
||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (button), value);
|
||||
|
||||
g_free (value);
|
||||
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (button),
|
||||
gimp_prop_color_button_callback,
|
||||
config);
|
||||
}
|
||||
|
||||
|
||||
/*******************************/
|
||||
/* private utility functions */
|
||||
/*******************************/
|
||||
|
@ -101,4 +101,14 @@ GtkWidget * gimp_prop_coordinates_new (GObject *config,
|
||||
gboolean has_chainbutton);
|
||||
|
||||
|
||||
/* GimpParamColor */
|
||||
|
||||
GtkWidget * gimp_prop_color_button_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *title,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpColorAreaType type);
|
||||
|
||||
|
||||
#endif /* __GIMP_PROP_WIDGETS_H__ */
|
||||
|
Reference in New Issue
Block a user