mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
libgimpwidgets, app: have all previews track the monitor they are on
and update their color transforms with the new monitor's color profile. A widget is considered changing monitors when its toplevel window's center crosses, in order to let widgets within one window have consistent colors.
This commit is contained in:
parent
4a16a9f714
commit
3ed305f6f5
11 changed files with 443 additions and 410 deletions
|
@ -132,6 +132,8 @@ static void gimp_container_tree_view_expand_rows (GtkTreeModel
|
||||||
GtkTreeView *view,
|
GtkTreeView *view,
|
||||||
GtkTreeIter *parent);
|
GtkTreeIter *parent);
|
||||||
|
|
||||||
|
static void gimp_container_tree_view_monitor_changed (GimpContainerTreeView *view);
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GimpContainerTreeView, gimp_container_tree_view,
|
G_DEFINE_TYPE_WITH_CODE (GimpContainerTreeView, gimp_container_tree_view,
|
||||||
GIMP_TYPE_CONTAINER_BOX,
|
GIMP_TYPE_CONTAINER_BOX,
|
||||||
|
@ -224,6 +226,10 @@ gimp_container_tree_view_init (GimpContainerTreeView *tree_view)
|
||||||
GTK_SHADOW_IN);
|
GTK_SHADOW_IN);
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (box->scrolled_win),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (box->scrolled_win),
|
||||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||||
|
|
||||||
|
gimp_widget_track_monitor (GTK_WIDGET (tree_view),
|
||||||
|
G_CALLBACK (gimp_container_tree_view_monitor_changed),
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1476,3 +1482,32 @@ gimp_container_tree_view_expand_rows (GtkTreeModel *model,
|
||||||
}
|
}
|
||||||
while (gtk_tree_model_iter_next (model, &iter));
|
while (gtk_tree_model_iter_next (model, &iter));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gimp_container_tree_view_monitor_changed_foreach (GtkTreeModel *model,
|
||||||
|
GtkTreePath *path,
|
||||||
|
GtkTreeIter *iter,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpViewRenderer *renderer;
|
||||||
|
|
||||||
|
gtk_tree_model_get (model, iter,
|
||||||
|
GIMP_CONTAINER_TREE_STORE_COLUMN_RENDERER, &renderer,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
if (renderer)
|
||||||
|
{
|
||||||
|
gimp_view_renderer_free_color_transform (renderer);
|
||||||
|
g_object_unref (renderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_container_tree_view_monitor_changed (GimpContainerTreeView *view)
|
||||||
|
{
|
||||||
|
gtk_tree_model_foreach (view->model,
|
||||||
|
gimp_container_tree_view_monitor_changed_foreach,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
|
@ -64,42 +64,41 @@ typedef enum
|
||||||
} FgBgTarget;
|
} FgBgTarget;
|
||||||
|
|
||||||
|
|
||||||
static void gimp_fg_bg_editor_dispose (GObject *object);
|
static void gimp_fg_bg_editor_dispose (GObject *object);
|
||||||
static void gimp_fg_bg_editor_set_property (GObject *object,
|
static void gimp_fg_bg_editor_set_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
static void gimp_fg_bg_editor_get_property (GObject *object,
|
static void gimp_fg_bg_editor_get_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
|
|
||||||
static void gimp_fg_bg_editor_style_set (GtkWidget *widget,
|
static void gimp_fg_bg_editor_style_set (GtkWidget *widget,
|
||||||
GtkStyle *prev_style);
|
GtkStyle *prev_style);
|
||||||
static gboolean gimp_fg_bg_editor_expose (GtkWidget *widget,
|
static gboolean gimp_fg_bg_editor_expose (GtkWidget *widget,
|
||||||
GdkEventExpose *eevent);
|
GdkEventExpose *eevent);
|
||||||
static gboolean gimp_fg_bg_editor_button_press (GtkWidget *widget,
|
static gboolean gimp_fg_bg_editor_button_press (GtkWidget *widget,
|
||||||
GdkEventButton *bevent);
|
GdkEventButton *bevent);
|
||||||
static gboolean gimp_fg_bg_editor_button_release (GtkWidget *widget,
|
static gboolean gimp_fg_bg_editor_button_release (GtkWidget *widget,
|
||||||
GdkEventButton *bevent);
|
GdkEventButton *bevent);
|
||||||
static gboolean gimp_fg_bg_editor_drag_motion (GtkWidget *widget,
|
static gboolean gimp_fg_bg_editor_drag_motion (GtkWidget *widget,
|
||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
guint time);
|
guint time);
|
||||||
|
|
||||||
static void gimp_fg_bg_editor_drag_color (GtkWidget *widget,
|
static void gimp_fg_bg_editor_drag_color (GtkWidget *widget,
|
||||||
GimpRGB *color,
|
GimpRGB *color,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void gimp_fg_bg_editor_drop_color (GtkWidget *widget,
|
static void gimp_fg_bg_editor_drop_color (GtkWidget *widget,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
const GimpRGB *color,
|
const GimpRGB *color,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
static void gimp_fg_bg_editor_config_notify (GimpColorConfig *config,
|
static void gimp_fg_bg_editor_create_transform (GimpFgBgEditor *editor);
|
||||||
const GParamSpec *pspec,
|
static void gimp_fg_bg_editor_destroy_transform (GimpFgBgEditor *editor);
|
||||||
GimpFgBgEditor *editor);
|
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GimpFgBgEditor, gimp_fg_bg_editor, GTK_TYPE_DRAWING_AREA)
|
G_DEFINE_TYPE (GimpFgBgEditor, gimp_fg_bg_editor, GTK_TYPE_DRAWING_AREA)
|
||||||
|
@ -152,7 +151,6 @@ gimp_fg_bg_editor_class_init (GimpFgBgEditorClass *klass)
|
||||||
static void
|
static void
|
||||||
gimp_fg_bg_editor_init (GimpFgBgEditor *editor)
|
gimp_fg_bg_editor_init (GimpFgBgEditor *editor)
|
||||||
{
|
{
|
||||||
editor->context = NULL;
|
|
||||||
editor->active_color = GIMP_ACTIVE_COLOR_FOREGROUND;
|
editor->active_color = GIMP_ACTIVE_COLOR_FOREGROUND;
|
||||||
|
|
||||||
gtk_widget_add_events (GTK_WIDGET (editor),
|
gtk_widget_add_events (GTK_WIDGET (editor),
|
||||||
|
@ -163,6 +161,10 @@ gimp_fg_bg_editor_init (GimpFgBgEditor *editor)
|
||||||
gimp_fg_bg_editor_drag_color, NULL);
|
gimp_fg_bg_editor_drag_color, NULL);
|
||||||
gimp_dnd_color_dest_add (GTK_WIDGET (editor),
|
gimp_dnd_color_dest_add (GTK_WIDGET (editor),
|
||||||
gimp_fg_bg_editor_drop_color, NULL);
|
gimp_fg_bg_editor_drop_color, NULL);
|
||||||
|
|
||||||
|
gimp_widget_track_monitor (GTK_WIDGET (editor),
|
||||||
|
G_CALLBACK (gimp_fg_bg_editor_destroy_transform),
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -331,20 +333,7 @@ gimp_fg_bg_editor_expose (GtkWidget *widget,
|
||||||
|
|
||||||
|
|
||||||
if (! editor->transform)
|
if (! editor->transform)
|
||||||
{
|
gimp_fg_bg_editor_create_transform (editor);
|
||||||
static GimpColorProfile *profile = NULL;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (! profile))
|
|
||||||
profile = gimp_color_profile_new_rgb_srgb ();
|
|
||||||
|
|
||||||
editor->transform =
|
|
||||||
gimp_widget_get_color_transform (widget,
|
|
||||||
editor->color_config,
|
|
||||||
profile,
|
|
||||||
babl_format ("R'G'B'A double"),
|
|
||||||
babl_format ("R'G'B'A double"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* draw the background area */
|
/* draw the background area */
|
||||||
|
|
||||||
|
@ -569,46 +558,46 @@ gimp_fg_bg_editor_set_context (GimpFgBgEditor *editor,
|
||||||
g_return_if_fail (GIMP_IS_FG_BG_EDITOR (editor));
|
g_return_if_fail (GIMP_IS_FG_BG_EDITOR (editor));
|
||||||
g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context));
|
g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context));
|
||||||
|
|
||||||
if (context == editor->context)
|
if (context != editor->context)
|
||||||
return;
|
|
||||||
|
|
||||||
if (editor->context)
|
|
||||||
{
|
{
|
||||||
g_signal_handlers_disconnect_by_func (editor->context,
|
if (editor->context)
|
||||||
gtk_widget_queue_draw,
|
{
|
||||||
editor);
|
g_signal_handlers_disconnect_by_func (editor->context,
|
||||||
g_object_unref (editor->context);
|
gtk_widget_queue_draw,
|
||||||
|
editor);
|
||||||
|
g_object_unref (editor->context);
|
||||||
|
|
||||||
g_signal_handlers_disconnect_by_func (editor->color_config,
|
g_signal_handlers_disconnect_by_func (editor->color_config,
|
||||||
gimp_fg_bg_editor_config_notify,
|
gimp_fg_bg_editor_destroy_transform,
|
||||||
editor);
|
editor);
|
||||||
g_object_unref (editor->color_config);
|
g_object_unref (editor->color_config);
|
||||||
editor->color_config = NULL;
|
editor->color_config = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
editor->context = context;
|
||||||
|
|
||||||
|
if (context)
|
||||||
|
{
|
||||||
|
g_object_ref (context);
|
||||||
|
|
||||||
|
g_signal_connect_swapped (context, "foreground-changed",
|
||||||
|
G_CALLBACK (gtk_widget_queue_draw),
|
||||||
|
editor);
|
||||||
|
g_signal_connect_swapped (context, "background-changed",
|
||||||
|
G_CALLBACK (gtk_widget_queue_draw),
|
||||||
|
editor);
|
||||||
|
|
||||||
|
editor->color_config = g_object_ref (context->gimp->config->color_management);
|
||||||
|
|
||||||
|
g_signal_connect_swapped (editor->color_config, "notify",
|
||||||
|
G_CALLBACK (gimp_fg_bg_editor_destroy_transform),
|
||||||
|
editor);
|
||||||
|
}
|
||||||
|
|
||||||
|
gimp_fg_bg_editor_destroy_transform (editor);
|
||||||
|
|
||||||
|
g_object_notify (G_OBJECT (editor), "context");
|
||||||
}
|
}
|
||||||
|
|
||||||
editor->context = context;
|
|
||||||
|
|
||||||
if (context)
|
|
||||||
{
|
|
||||||
g_object_ref (context);
|
|
||||||
|
|
||||||
g_signal_connect_swapped (context, "foreground-changed",
|
|
||||||
G_CALLBACK (gtk_widget_queue_draw),
|
|
||||||
editor);
|
|
||||||
g_signal_connect_swapped (context, "background-changed",
|
|
||||||
G_CALLBACK (gtk_widget_queue_draw),
|
|
||||||
editor);
|
|
||||||
|
|
||||||
editor->color_config = g_object_ref (context->gimp->config->color_management);
|
|
||||||
|
|
||||||
g_signal_connect (editor->color_config, "notify",
|
|
||||||
G_CALLBACK (gimp_fg_bg_editor_config_notify),
|
|
||||||
editor);
|
|
||||||
}
|
|
||||||
|
|
||||||
gimp_fg_bg_editor_config_notify (NULL, NULL, editor);
|
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (editor), "context");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -675,9 +664,26 @@ gimp_fg_bg_editor_drop_color (GtkWidget *widget,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_fg_bg_editor_config_notify (GimpColorConfig *config,
|
gimp_fg_bg_editor_create_transform (GimpFgBgEditor *editor)
|
||||||
const GParamSpec *pspec,
|
{
|
||||||
GimpFgBgEditor *editor)
|
if (editor->color_config)
|
||||||
|
{
|
||||||
|
static GimpColorProfile *profile = NULL;
|
||||||
|
|
||||||
|
if (G_UNLIKELY (! profile))
|
||||||
|
profile = gimp_color_profile_new_rgb_srgb ();
|
||||||
|
|
||||||
|
editor->transform =
|
||||||
|
gimp_widget_get_color_transform (GTK_WIDGET (editor),
|
||||||
|
editor->color_config,
|
||||||
|
profile,
|
||||||
|
babl_format ("R'G'B'A double"),
|
||||||
|
babl_format ("R'G'B'A double"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_fg_bg_editor_destroy_transform (GimpFgBgEditor *editor)
|
||||||
{
|
{
|
||||||
if (editor->transform)
|
if (editor->transform)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,22 +47,22 @@ enum
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void gimp_fg_bg_view_dispose (GObject *object);
|
static void gimp_fg_bg_view_dispose (GObject *object);
|
||||||
static void gimp_fg_bg_view_set_property (GObject *object,
|
static void gimp_fg_bg_view_set_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
static void gimp_fg_bg_view_get_property (GObject *object,
|
static void gimp_fg_bg_view_get_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
|
|
||||||
static gboolean gimp_fg_bg_view_expose (GtkWidget *widget,
|
static gboolean gimp_fg_bg_view_expose (GtkWidget *widget,
|
||||||
GdkEventExpose *eevent);
|
GdkEventExpose *eevent);
|
||||||
|
|
||||||
|
static void gimp_fg_bg_view_create_transform (GimpFgBgView *view);
|
||||||
|
static void gimp_fg_bg_view_destroy_transform (GimpFgBgView *view);
|
||||||
|
|
||||||
static void gimp_fg_bg_view_config_notify (GimpColorConfig *config,
|
|
||||||
const GParamSpec *pspec,
|
|
||||||
GimpFgBgView *view);
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GimpFgBgView, gimp_fg_bg_view, GTK_TYPE_WIDGET)
|
G_DEFINE_TYPE (GimpFgBgView, gimp_fg_bg_view, GTK_TYPE_WIDGET)
|
||||||
|
|
||||||
|
@ -93,7 +93,9 @@ gimp_fg_bg_view_init (GimpFgBgView *view)
|
||||||
{
|
{
|
||||||
gtk_widget_set_has_window (GTK_WIDGET (view), FALSE);
|
gtk_widget_set_has_window (GTK_WIDGET (view), FALSE);
|
||||||
|
|
||||||
view->context = NULL;
|
gimp_widget_track_monitor (GTK_WIDGET (view),
|
||||||
|
G_CALLBACK (gimp_fg_bg_view_destroy_transform),
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -175,19 +177,7 @@ gimp_fg_bg_view_expose (GtkWidget *widget,
|
||||||
rect_h = allocation.height * 3 / 4;
|
rect_h = allocation.height * 3 / 4;
|
||||||
|
|
||||||
if (! view->transform)
|
if (! view->transform)
|
||||||
{
|
gimp_fg_bg_view_create_transform (view);
|
||||||
static GimpColorProfile *profile = NULL;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (! profile))
|
|
||||||
profile = gimp_color_profile_new_rgb_srgb ();
|
|
||||||
|
|
||||||
view->transform =
|
|
||||||
gimp_widget_get_color_transform (widget,
|
|
||||||
view->color_config,
|
|
||||||
profile,
|
|
||||||
babl_format ("R'G'B'A double"),
|
|
||||||
babl_format ("R'G'B'A double"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* draw the background area */
|
/* draw the background area */
|
||||||
|
|
||||||
|
@ -251,9 +241,26 @@ gimp_fg_bg_view_expose (GtkWidget *widget,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_fg_bg_view_config_notify (GimpColorConfig *config,
|
gimp_fg_bg_view_create_transform (GimpFgBgView *view)
|
||||||
const GParamSpec *pspec,
|
{
|
||||||
GimpFgBgView *view)
|
if (view->color_config)
|
||||||
|
{
|
||||||
|
static GimpColorProfile *profile = NULL;
|
||||||
|
|
||||||
|
if (G_UNLIKELY (! profile))
|
||||||
|
profile = gimp_color_profile_new_rgb_srgb ();
|
||||||
|
|
||||||
|
view->transform =
|
||||||
|
gimp_widget_get_color_transform (GTK_WIDGET (view),
|
||||||
|
view->color_config,
|
||||||
|
profile,
|
||||||
|
babl_format ("R'G'B'A double"),
|
||||||
|
babl_format ("R'G'B'A double"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_fg_bg_view_destroy_transform (GimpFgBgView *view)
|
||||||
{
|
{
|
||||||
if (view->transform)
|
if (view->transform)
|
||||||
{
|
{
|
||||||
|
@ -284,45 +291,45 @@ gimp_fg_bg_view_set_context (GimpFgBgView *view,
|
||||||
g_return_if_fail (GIMP_IS_FG_BG_VIEW (view));
|
g_return_if_fail (GIMP_IS_FG_BG_VIEW (view));
|
||||||
g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context));
|
g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context));
|
||||||
|
|
||||||
if (context == view->context)
|
if (context != view->context)
|
||||||
return;
|
|
||||||
|
|
||||||
if (view->context)
|
|
||||||
{
|
{
|
||||||
g_signal_handlers_disconnect_by_func (view->context,
|
if (view->context)
|
||||||
gtk_widget_queue_draw,
|
{
|
||||||
view);
|
g_signal_handlers_disconnect_by_func (view->context,
|
||||||
g_object_unref (view->context);
|
gtk_widget_queue_draw,
|
||||||
view->context = NULL;
|
view);
|
||||||
|
g_object_unref (view->context);
|
||||||
|
view->context = NULL;
|
||||||
|
|
||||||
g_signal_handlers_disconnect_by_func (view->color_config,
|
g_signal_handlers_disconnect_by_func (view->color_config,
|
||||||
gimp_fg_bg_view_config_notify,
|
gimp_fg_bg_view_destroy_transform,
|
||||||
view);
|
view);
|
||||||
g_object_unref (view->color_config);
|
g_object_unref (view->color_config);
|
||||||
view->color_config = NULL;
|
view->color_config = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
view->context = context;
|
||||||
|
|
||||||
|
if (context)
|
||||||
|
{
|
||||||
|
g_object_ref (context);
|
||||||
|
|
||||||
|
g_signal_connect_swapped (context, "foreground-changed",
|
||||||
|
G_CALLBACK (gtk_widget_queue_draw),
|
||||||
|
view);
|
||||||
|
g_signal_connect_swapped (context, "background-changed",
|
||||||
|
G_CALLBACK (gtk_widget_queue_draw),
|
||||||
|
view);
|
||||||
|
|
||||||
|
view->color_config = g_object_ref (context->gimp->config->color_management);
|
||||||
|
|
||||||
|
g_signal_connect_swapped (view->color_config, "notify",
|
||||||
|
G_CALLBACK (gimp_fg_bg_view_destroy_transform),
|
||||||
|
view);
|
||||||
|
}
|
||||||
|
|
||||||
|
gimp_fg_bg_view_destroy_transform (view);
|
||||||
|
|
||||||
|
g_object_notify (G_OBJECT (view), "context");
|
||||||
}
|
}
|
||||||
|
|
||||||
view->context = context;
|
|
||||||
|
|
||||||
if (context)
|
|
||||||
{
|
|
||||||
g_object_ref (context);
|
|
||||||
|
|
||||||
g_signal_connect_swapped (context, "foreground-changed",
|
|
||||||
G_CALLBACK (gtk_widget_queue_draw),
|
|
||||||
view);
|
|
||||||
g_signal_connect_swapped (context, "background-changed",
|
|
||||||
G_CALLBACK (gtk_widget_queue_draw),
|
|
||||||
view);
|
|
||||||
|
|
||||||
view->color_config = g_object_ref (context->gimp->config->color_management);
|
|
||||||
|
|
||||||
g_signal_connect (view->color_config, "notify",
|
|
||||||
G_CALLBACK (gimp_fg_bg_view_config_notify),
|
|
||||||
view);
|
|
||||||
}
|
|
||||||
|
|
||||||
gimp_fg_bg_view_config_notify (NULL, NULL, view);
|
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (view), "context");
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,8 @@ static void gimp_view_real_set_viewable (GimpView *view,
|
||||||
static void gimp_view_update_callback (GimpViewRenderer *renderer,
|
static void gimp_view_update_callback (GimpViewRenderer *renderer,
|
||||||
GimpView *view);
|
GimpView *view);
|
||||||
|
|
||||||
|
static void gimp_view_monitor_changed (GimpView *view);
|
||||||
|
|
||||||
static GimpViewable * gimp_view_drag_viewable (GtkWidget *widget,
|
static GimpViewable * gimp_view_drag_viewable (GtkWidget *widget,
|
||||||
GimpContext **context,
|
GimpContext **context,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
@ -173,10 +175,6 @@ gimp_view_init (GimpView *view)
|
||||||
GDK_ENTER_NOTIFY_MASK |
|
GDK_ENTER_NOTIFY_MASK |
|
||||||
GDK_LEAVE_NOTIFY_MASK);
|
GDK_LEAVE_NOTIFY_MASK);
|
||||||
|
|
||||||
view->event_window = NULL;
|
|
||||||
view->viewable = NULL;
|
|
||||||
view->renderer = NULL;
|
|
||||||
|
|
||||||
view->clickable = FALSE;
|
view->clickable = FALSE;
|
||||||
view->eat_button_events = TRUE;
|
view->eat_button_events = TRUE;
|
||||||
view->show_popup = FALSE;
|
view->show_popup = FALSE;
|
||||||
|
@ -185,6 +183,10 @@ gimp_view_init (GimpView *view)
|
||||||
view->in_button = FALSE;
|
view->in_button = FALSE;
|
||||||
view->has_grab = FALSE;
|
view->has_grab = FALSE;
|
||||||
view->press_state = 0;
|
view->press_state = 0;
|
||||||
|
|
||||||
|
gimp_widget_track_monitor (GTK_WIDGET (view),
|
||||||
|
G_CALLBACK (gimp_view_monitor_changed),
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -823,6 +825,13 @@ gimp_view_update_callback (GimpViewRenderer *renderer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_view_monitor_changed (GimpView *view)
|
||||||
|
{
|
||||||
|
if (view->renderer)
|
||||||
|
gimp_view_renderer_free_color_transform (view->renderer);
|
||||||
|
}
|
||||||
|
|
||||||
static GimpViewable *
|
static GimpViewable *
|
||||||
gimp_view_drag_viewable (GtkWidget *widget,
|
gimp_view_drag_viewable (GtkWidget *widget,
|
||||||
GimpContext **context,
|
GimpContext **context,
|
||||||
|
|
|
@ -113,8 +113,6 @@ static cairo_pattern_t *
|
||||||
gimp_view_renderer_create_background (GimpViewRenderer *renderer,
|
gimp_view_renderer_create_background (GimpViewRenderer *renderer,
|
||||||
GtkWidget *widget);
|
GtkWidget *widget);
|
||||||
|
|
||||||
static void gimp_view_renderer_transform_free (GimpViewRenderer *renderer);
|
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GimpViewRenderer, gimp_view_renderer, G_TYPE_OBJECT)
|
G_DEFINE_TYPE (GimpViewRenderer, gimp_view_renderer, G_TYPE_OBJECT)
|
||||||
|
|
||||||
|
@ -362,7 +360,7 @@ gimp_view_renderer_set_viewable (GimpViewRenderer *renderer,
|
||||||
renderer->priv->pixbuf = NULL;
|
renderer->priv->pixbuf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_view_renderer_transform_free (renderer);
|
gimp_view_renderer_free_color_transform (renderer);
|
||||||
|
|
||||||
if (renderer->viewable)
|
if (renderer->viewable)
|
||||||
{
|
{
|
||||||
|
@ -887,8 +885,7 @@ static void
|
||||||
gimp_view_renderer_profile_changed (GimpViewRenderer *renderer,
|
gimp_view_renderer_profile_changed (GimpViewRenderer *renderer,
|
||||||
GimpViewable *viewable)
|
GimpViewable *viewable)
|
||||||
{
|
{
|
||||||
gimp_view_renderer_transform_free (renderer);
|
gimp_view_renderer_free_color_transform (renderer);
|
||||||
gimp_view_renderer_invalidate (renderer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -896,8 +893,7 @@ gimp_view_renderer_config_notify (GObject *config,
|
||||||
const GParamSpec *pspec,
|
const GParamSpec *pspec,
|
||||||
GimpViewRenderer *renderer)
|
GimpViewRenderer *renderer)
|
||||||
{
|
{
|
||||||
gimp_view_renderer_transform_free (renderer);
|
gimp_view_renderer_free_color_transform (renderer);
|
||||||
gimp_view_renderer_invalidate (renderer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -983,9 +979,8 @@ gimp_view_renderer_render_pixbuf (GimpViewRenderer *renderer,
|
||||||
|
|
||||||
format = gimp_pixbuf_get_format (pixbuf);
|
format = gimp_pixbuf_get_format (pixbuf);
|
||||||
|
|
||||||
transform =
|
transform = gimp_view_renderer_get_color_transform (renderer, widget,
|
||||||
gimp_view_renderer_get_color_transform (renderer, widget,
|
format, format);
|
||||||
format, format);
|
|
||||||
|
|
||||||
if (transform)
|
if (transform)
|
||||||
{
|
{
|
||||||
|
@ -1133,6 +1128,19 @@ gimp_view_renderer_get_color_transform (GimpViewRenderer *renderer,
|
||||||
return renderer->priv->profile_transform;
|
return renderer->priv->profile_transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gimp_view_renderer_free_color_transform (GimpViewRenderer *renderer)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GIMP_IS_VIEW_RENDERER (renderer));
|
||||||
|
|
||||||
|
if (renderer->priv->profile_transform)
|
||||||
|
{
|
||||||
|
g_object_unref (renderer->priv->profile_transform);
|
||||||
|
renderer->priv->profile_transform = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
gimp_view_renderer_invalidate (renderer);
|
||||||
|
}
|
||||||
|
|
||||||
/* private functions */
|
/* private functions */
|
||||||
|
|
||||||
|
@ -1413,13 +1421,3 @@ gimp_view_renderer_create_background (GimpViewRenderer *renderer,
|
||||||
|
|
||||||
return pattern;
|
return pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gimp_view_renderer_transform_free (GimpViewRenderer *renderer)
|
|
||||||
{
|
|
||||||
if (renderer->priv->profile_transform)
|
|
||||||
{
|
|
||||||
g_object_unref (renderer->priv->profile_transform);
|
|
||||||
renderer->priv->profile_transform = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ GimpColorTransform *
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
const Babl *src_format,
|
const Babl *src_format,
|
||||||
const Babl *dest_format);
|
const Babl *dest_format);
|
||||||
|
void gimp_view_renderer_free_color_transform (GimpViewRenderer *renderer);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_VIEW_RENDERER_H__ */
|
#endif /* __GIMP_VIEW_RENDERER_H__ */
|
||||||
|
|
|
@ -123,11 +123,8 @@ static void gimp_color_area_drag_data_get (GtkWidget *widget,
|
||||||
guint info,
|
guint info,
|
||||||
guint time);
|
guint time);
|
||||||
|
|
||||||
static void gimp_color_area_config_notify (GimpColorConfig *config,
|
|
||||||
const GParamSpec *pspec,
|
|
||||||
GimpColorArea *area);
|
|
||||||
|
|
||||||
static void gimp_color_area_create_transform (GimpColorArea *area);
|
static void gimp_color_area_create_transform (GimpColorArea *area);
|
||||||
|
static void gimp_color_area_destroy_transform (GimpColorArea *area);
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GimpColorArea, gimp_color_area, GTK_TYPE_DRAWING_AREA)
|
G_DEFINE_TYPE (GimpColorArea, gimp_color_area, GTK_TYPE_DRAWING_AREA)
|
||||||
|
@ -242,6 +239,10 @@ gimp_color_area_init (GimpColorArea *area)
|
||||||
GTK_DEST_DEFAULT_DROP,
|
GTK_DEST_DEFAULT_DROP,
|
||||||
&target, 1,
|
&target, 1,
|
||||||
GDK_ACTION_COPY);
|
GDK_ACTION_COPY);
|
||||||
|
|
||||||
|
gimp_widget_track_monitor (GTK_WIDGET (area),
|
||||||
|
G_CALLBACK (gimp_color_area_destroy_transform),
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -619,15 +620,11 @@ gimp_color_area_set_color_config (GimpColorArea *area,
|
||||||
if (priv->config)
|
if (priv->config)
|
||||||
{
|
{
|
||||||
g_signal_handlers_disconnect_by_func (priv->config,
|
g_signal_handlers_disconnect_by_func (priv->config,
|
||||||
gimp_color_area_config_notify,
|
gimp_color_area_destroy_transform,
|
||||||
area);
|
area);
|
||||||
g_object_unref (priv->config);
|
g_object_unref (priv->config);
|
||||||
|
|
||||||
if (priv->transform)
|
gimp_color_area_destroy_transform (area);
|
||||||
{
|
|
||||||
g_object_unref (priv->transform);
|
|
||||||
priv->transform = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->config = config;
|
priv->config = config;
|
||||||
|
@ -636,9 +633,9 @@ gimp_color_area_set_color_config (GimpColorArea *area,
|
||||||
{
|
{
|
||||||
g_object_ref (priv->config);
|
g_object_ref (priv->config);
|
||||||
|
|
||||||
g_signal_connect (priv->config, "notify",
|
g_signal_connect_swapped (priv->config, "notify",
|
||||||
G_CALLBACK (gimp_color_area_config_notify),
|
G_CALLBACK (gimp_color_area_destroy_transform),
|
||||||
area);
|
area);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -915,22 +912,6 @@ gimp_color_area_drag_data_get (GtkWidget *widget,
|
||||||
16, (guchar *) vals, 8);
|
16, (guchar *) vals, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gimp_color_area_config_notify (GimpColorConfig *config,
|
|
||||||
const GParamSpec *pspec,
|
|
||||||
GimpColorArea *area)
|
|
||||||
{
|
|
||||||
GimpColorAreaPrivate *priv = GET_PRIVATE (area);
|
|
||||||
|
|
||||||
if (priv->transform)
|
|
||||||
{
|
|
||||||
g_object_unref (priv->transform);
|
|
||||||
priv->transform = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (area));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_color_area_create_transform (GimpColorArea *area)
|
gimp_color_area_create_transform (GimpColorArea *area)
|
||||||
{
|
{
|
||||||
|
@ -952,3 +933,17 @@ gimp_color_area_create_transform (GimpColorArea *area)
|
||||||
format);
|
format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_color_area_destroy_transform (GimpColorArea *area)
|
||||||
|
{
|
||||||
|
GimpColorAreaPrivate *priv = GET_PRIVATE (area);
|
||||||
|
|
||||||
|
if (priv->transform)
|
||||||
|
{
|
||||||
|
g_object_unref (priv->transform);
|
||||||
|
priv->transform = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_queue_draw (GTK_WIDGET (area));
|
||||||
|
}
|
||||||
|
|
|
@ -68,36 +68,34 @@ struct _GimpColorScalePrivate
|
||||||
GimpColorScalePrivate)
|
GimpColorScalePrivate)
|
||||||
|
|
||||||
|
|
||||||
static void gimp_color_scale_dispose (GObject *object);
|
static void gimp_color_scale_dispose (GObject *object);
|
||||||
static void gimp_color_scale_finalize (GObject *object);
|
static void gimp_color_scale_finalize (GObject *object);
|
||||||
static void gimp_color_scale_get_property (GObject *object,
|
static void gimp_color_scale_get_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
static void gimp_color_scale_set_property (GObject *object,
|
static void gimp_color_scale_set_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
|
|
||||||
static void gimp_color_scale_size_allocate (GtkWidget *widget,
|
static void gimp_color_scale_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
static void gimp_color_scale_state_changed (GtkWidget *widget,
|
static void gimp_color_scale_state_changed (GtkWidget *widget,
|
||||||
GtkStateType previous_state);
|
GtkStateType previous_state);
|
||||||
static gboolean gimp_color_scale_button_press (GtkWidget *widget,
|
static gboolean gimp_color_scale_button_press (GtkWidget *widget,
|
||||||
GdkEventButton *event);
|
GdkEventButton *event);
|
||||||
static gboolean gimp_color_scale_button_release (GtkWidget *widget,
|
static gboolean gimp_color_scale_button_release (GtkWidget *widget,
|
||||||
GdkEventButton *event);
|
GdkEventButton *event);
|
||||||
static gboolean gimp_color_scale_expose (GtkWidget *widget,
|
static gboolean gimp_color_scale_expose (GtkWidget *widget,
|
||||||
GdkEventExpose *event);
|
GdkEventExpose *event);
|
||||||
|
|
||||||
static void gimp_color_scale_render (GimpColorScale *scale);
|
static void gimp_color_scale_render (GimpColorScale *scale);
|
||||||
static void gimp_color_scale_render_alpha (GimpColorScale *scale);
|
static void gimp_color_scale_render_alpha (GimpColorScale *scale);
|
||||||
static void gimp_color_scale_render_stipple (GimpColorScale *scale);
|
static void gimp_color_scale_render_stipple (GimpColorScale *scale);
|
||||||
|
|
||||||
static void gimp_color_scale_config_notify (GimpColorConfig *config,
|
static void gimp_color_scale_create_transform (GimpColorScale *scale);
|
||||||
const GParamSpec *pspec,
|
static void gimp_color_scale_destroy_transform (GimpColorScale *scale);
|
||||||
GimpColorScale *scale);
|
|
||||||
static void gimp_color_scale_create_transform (GimpColorScale *scale);
|
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GimpColorScale, gimp_color_scale, GTK_TYPE_SCALE)
|
G_DEFINE_TYPE (GimpColorScale, gimp_color_scale, GTK_TYPE_SCALE)
|
||||||
|
@ -167,6 +165,10 @@ gimp_color_scale_init (GimpColorScale *scale)
|
||||||
|
|
||||||
gimp_rgba_set (&scale->rgb, 0.0, 0.0, 0.0, 1.0);
|
gimp_rgba_set (&scale->rgb, 0.0, 0.0, 0.0, 1.0);
|
||||||
gimp_rgb_to_hsv (&scale->rgb, &scale->hsv);
|
gimp_rgb_to_hsv (&scale->rgb, &scale->hsv);
|
||||||
|
|
||||||
|
gimp_widget_track_monitor (GTK_WIDGET (scale),
|
||||||
|
G_CALLBACK (gimp_color_scale_destroy_transform),
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -665,15 +667,11 @@ gimp_color_scale_set_color_config (GimpColorScale *scale,
|
||||||
if (priv->config)
|
if (priv->config)
|
||||||
{
|
{
|
||||||
g_signal_handlers_disconnect_by_func (priv->config,
|
g_signal_handlers_disconnect_by_func (priv->config,
|
||||||
gimp_color_scale_config_notify,
|
gimp_color_scale_destroy_transform,
|
||||||
scale);
|
scale);
|
||||||
g_object_unref (priv->config);
|
g_object_unref (priv->config);
|
||||||
|
|
||||||
if (priv->transform)
|
gimp_color_scale_destroy_transform (scale);
|
||||||
{
|
|
||||||
g_object_unref (priv->transform);
|
|
||||||
priv->transform = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->config = config;
|
priv->config = config;
|
||||||
|
@ -682,9 +680,9 @@ gimp_color_scale_set_color_config (GimpColorScale *scale,
|
||||||
{
|
{
|
||||||
g_object_ref (priv->config);
|
g_object_ref (priv->config);
|
||||||
|
|
||||||
g_signal_connect (priv->config, "notify",
|
g_signal_connect_swapped (priv->config, "notify",
|
||||||
G_CALLBACK (gimp_color_scale_config_notify),
|
G_CALLBACK (gimp_color_scale_destroy_transform),
|
||||||
scale);
|
scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -981,22 +979,6 @@ gimp_color_scale_render_stipple (GimpColorScale *scale)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gimp_color_scale_config_notify (GimpColorConfig *config,
|
|
||||||
const GParamSpec *pspec,
|
|
||||||
GimpColorScale *scale)
|
|
||||||
{
|
|
||||||
GimpColorScalePrivate *priv = GET_PRIVATE (scale);
|
|
||||||
|
|
||||||
if (priv->transform)
|
|
||||||
{
|
|
||||||
g_object_unref (priv->transform);
|
|
||||||
priv->transform = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (scale));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_color_scale_create_transform (GimpColorScale *scale)
|
gimp_color_scale_create_transform (GimpColorScale *scale)
|
||||||
{
|
{
|
||||||
|
@ -1018,3 +1000,17 @@ gimp_color_scale_create_transform (GimpColorScale *scale)
|
||||||
format);
|
format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_color_scale_destroy_transform (GimpColorScale *scale)
|
||||||
|
{
|
||||||
|
GimpColorScalePrivate *priv = GET_PRIVATE (scale);
|
||||||
|
|
||||||
|
if (priv->transform)
|
||||||
|
{
|
||||||
|
g_object_unref (priv->transform);
|
||||||
|
priv->transform = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_queue_draw (GTK_WIDGET (scale));
|
||||||
|
}
|
||||||
|
|
|
@ -75,34 +75,31 @@ struct _GimpPreviewAreaPrivate
|
||||||
GimpPreviewAreaPrivate)
|
GimpPreviewAreaPrivate)
|
||||||
|
|
||||||
|
|
||||||
static void gimp_preview_area_dispose (GObject *object);
|
static void gimp_preview_area_dispose (GObject *object);
|
||||||
static void gimp_preview_area_finalize (GObject *object);
|
static void gimp_preview_area_finalize (GObject *object);
|
||||||
static void gimp_preview_area_set_property (GObject *object,
|
static void gimp_preview_area_set_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
static void gimp_preview_area_get_property (GObject *object,
|
static void gimp_preview_area_get_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
|
|
||||||
static void gimp_preview_area_size_allocate (GtkWidget *widget,
|
static void gimp_preview_area_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
static gboolean gimp_preview_area_expose (GtkWidget *widget,
|
static gboolean gimp_preview_area_expose (GtkWidget *widget,
|
||||||
GdkEventExpose *event);
|
GdkEventExpose *event);
|
||||||
|
|
||||||
static void gimp_preview_area_queue_draw (GimpPreviewArea *area,
|
static void gimp_preview_area_queue_draw (GimpPreviewArea *area,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
gint width,
|
gint width,
|
||||||
gint height);
|
gint height);
|
||||||
static gint gimp_preview_area_image_type_bytes (GimpImageType type);
|
static gint gimp_preview_area_image_type_bytes (GimpImageType type);
|
||||||
|
|
||||||
static void gimp_preview_area_config_notify (GimpColorConfig *config,
|
static void gimp_preview_area_create_transform (GimpPreviewArea *area);
|
||||||
const GParamSpec *pspec,
|
static void gimp_preview_area_destroy_transform (GimpPreviewArea *area);
|
||||||
GimpPreviewArea *area);
|
|
||||||
|
|
||||||
static void gimp_preview_area_create_transform (GimpPreviewArea *area);
|
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GimpPreviewArea, gimp_preview_area, GTK_TYPE_DRAWING_AREA)
|
G_DEFINE_TYPE (GimpPreviewArea, gimp_preview_area, GTK_TYPE_DRAWING_AREA)
|
||||||
|
@ -155,6 +152,10 @@ gimp_preview_area_init (GimpPreviewArea *area)
|
||||||
area->rowstride = 0;
|
area->rowstride = 0;
|
||||||
area->max_width = -1;
|
area->max_width = -1;
|
||||||
area->max_height = -1;
|
area->max_height = -1;
|
||||||
|
|
||||||
|
gimp_widget_track_monitor (GTK_WIDGET (area),
|
||||||
|
G_CALLBACK (gimp_preview_area_destroy_transform),
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -386,22 +387,6 @@ gimp_preview_area_image_type_bytes (GimpImageType type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gimp_preview_area_config_notify (GimpColorConfig *config,
|
|
||||||
const GParamSpec *pspec,
|
|
||||||
GimpPreviewArea *area)
|
|
||||||
{
|
|
||||||
GimpPreviewAreaPrivate *priv = GET_PRIVATE (area);
|
|
||||||
|
|
||||||
if (priv->transform)
|
|
||||||
{
|
|
||||||
g_object_unref (priv->transform);
|
|
||||||
priv->transform = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (area));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_preview_area_create_transform (GimpPreviewArea *area)
|
gimp_preview_area_create_transform (GimpPreviewArea *area)
|
||||||
{
|
{
|
||||||
|
@ -424,6 +409,20 @@ gimp_preview_area_create_transform (GimpPreviewArea *area)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_preview_area_destroy_transform (GimpPreviewArea *area)
|
||||||
|
{
|
||||||
|
GimpPreviewAreaPrivate *priv = GET_PRIVATE (area);
|
||||||
|
|
||||||
|
if (priv->transform)
|
||||||
|
{
|
||||||
|
g_object_unref (priv->transform);
|
||||||
|
priv->transform = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_queue_draw (GTK_WIDGET (area));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_preview_area_new:
|
* gimp_preview_area_new:
|
||||||
|
@ -1804,15 +1803,11 @@ gimp_preview_area_set_color_config (GimpPreviewArea *area,
|
||||||
if (priv->config)
|
if (priv->config)
|
||||||
{
|
{
|
||||||
g_signal_handlers_disconnect_by_func (priv->config,
|
g_signal_handlers_disconnect_by_func (priv->config,
|
||||||
gimp_preview_area_config_notify,
|
gimp_preview_area_destroy_transform,
|
||||||
area);
|
area);
|
||||||
g_object_unref (priv->config);
|
g_object_unref (priv->config);
|
||||||
|
|
||||||
if (priv->transform)
|
gimp_preview_area_destroy_transform (area);
|
||||||
{
|
|
||||||
g_object_unref (priv->transform);
|
|
||||||
priv->transform = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->config = config;
|
priv->config = config;
|
||||||
|
@ -1821,9 +1816,9 @@ gimp_preview_area_set_color_config (GimpPreviewArea *area,
|
||||||
{
|
{
|
||||||
g_object_ref (priv->config);
|
g_object_ref (priv->config);
|
||||||
|
|
||||||
g_signal_connect (priv->config, "notify",
|
g_signal_connect_swapped (priv->config, "notify",
|
||||||
G_CALLBACK (gimp_preview_area_config_notify),
|
G_CALLBACK (gimp_preview_area_destroy_transform),
|
||||||
area);
|
area);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,32 +64,30 @@ struct _ColorselWaterClass
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static GType colorsel_water_get_type (void);
|
static GType colorsel_water_get_type (void);
|
||||||
|
|
||||||
static void colorsel_water_dispose (GObject *object);
|
static void colorsel_water_dispose (GObject *object);
|
||||||
|
|
||||||
static void colorsel_water_set_config (GimpColorSelector *selector,
|
static void colorsel_water_set_config (GimpColorSelector *selector,
|
||||||
GimpColorConfig *config);
|
GimpColorConfig *config);
|
||||||
|
|
||||||
static void colorsel_water_config_notify (GimpColorConfig *config,
|
static void colorsel_water_create_transform (ColorselWater *water);
|
||||||
const GParamSpec *pspec,
|
static void colorsel_water_destroy_transform (ColorselWater *water);
|
||||||
ColorselWater *water);
|
|
||||||
static void colorsel_water_create_transform (ColorselWater *water);
|
|
||||||
|
|
||||||
static gboolean select_area_expose (GtkWidget *widget,
|
static gboolean select_area_expose (GtkWidget *widget,
|
||||||
GdkEventExpose *event,
|
GdkEventExpose *event,
|
||||||
ColorselWater *water);
|
ColorselWater *water);
|
||||||
static gboolean button_press_event (GtkWidget *widget,
|
static gboolean button_press_event (GtkWidget *widget,
|
||||||
GdkEventButton *event,
|
GdkEventButton *event,
|
||||||
ColorselWater *water);
|
ColorselWater *water);
|
||||||
static gboolean motion_notify_event (GtkWidget *widget,
|
static gboolean motion_notify_event (GtkWidget *widget,
|
||||||
GdkEventMotion *event,
|
GdkEventMotion *event,
|
||||||
ColorselWater *water);
|
ColorselWater *water);
|
||||||
static gboolean proximity_out_event (GtkWidget *widget,
|
static gboolean proximity_out_event (GtkWidget *widget,
|
||||||
GdkEventProximity *event,
|
GdkEventProximity *event,
|
||||||
ColorselWater *water);
|
ColorselWater *water);
|
||||||
static void pressure_adjust_update (GtkAdjustment *adj,
|
static void pressure_adjust_update (GtkAdjustment *adj,
|
||||||
ColorselWater *water);
|
ColorselWater *water);
|
||||||
|
|
||||||
|
|
||||||
static const GimpModuleInfo colorsel_water_info =
|
static const GimpModuleInfo colorsel_water_info =
|
||||||
|
@ -203,6 +201,10 @@ colorsel_water_init (ColorselWater *water)
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), scale, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), scale, FALSE, FALSE, 0);
|
||||||
|
|
||||||
gtk_widget_show_all (hbox);
|
gtk_widget_show_all (hbox);
|
||||||
|
|
||||||
|
gimp_widget_track_monitor (GTK_WIDGET (water),
|
||||||
|
G_CALLBACK (colorsel_water_destroy_transform),
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gdouble
|
static gdouble
|
||||||
|
@ -235,15 +237,11 @@ colorsel_water_set_config (GimpColorSelector *selector,
|
||||||
if (water->config)
|
if (water->config)
|
||||||
{
|
{
|
||||||
g_signal_handlers_disconnect_by_func (water->config,
|
g_signal_handlers_disconnect_by_func (water->config,
|
||||||
colorsel_water_config_notify,
|
colorsel_water_destroy_transform,
|
||||||
water);
|
water);
|
||||||
g_object_unref (water->config);
|
g_object_unref (water->config);
|
||||||
|
|
||||||
if (water->transform)
|
colorsel_water_destroy_transform (water);
|
||||||
{
|
|
||||||
g_object_unref (water->transform);
|
|
||||||
water->transform = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
water->config = config;
|
water->config = config;
|
||||||
|
@ -252,27 +250,13 @@ colorsel_water_set_config (GimpColorSelector *selector,
|
||||||
{
|
{
|
||||||
g_object_ref (water->config);
|
g_object_ref (water->config);
|
||||||
|
|
||||||
g_signal_connect (water->config, "notify",
|
g_signal_connect_swapped (water->config, "notify",
|
||||||
G_CALLBACK (colorsel_water_config_notify),
|
G_CALLBACK (colorsel_water_destroy_transform),
|
||||||
water);
|
water);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
colorsel_water_config_notify (GimpColorConfig *config,
|
|
||||||
const GParamSpec *pspec,
|
|
||||||
ColorselWater *water)
|
|
||||||
{
|
|
||||||
if (water->transform)
|
|
||||||
{
|
|
||||||
g_object_unref (water->transform);
|
|
||||||
water->transform = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (water->area));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
colorsel_water_create_transform (ColorselWater *water)
|
colorsel_water_create_transform (ColorselWater *water)
|
||||||
{
|
{
|
||||||
|
@ -293,6 +277,18 @@ colorsel_water_create_transform (ColorselWater *water)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
colorsel_water_destroy_transform (ColorselWater *water)
|
||||||
|
{
|
||||||
|
if (water->transform)
|
||||||
|
{
|
||||||
|
g_object_unref (water->transform);
|
||||||
|
water->transform = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_queue_draw (GTK_WIDGET (water->area));
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
select_area_expose (GtkWidget *widget,
|
select_area_expose (GtkWidget *widget,
|
||||||
GdkEventExpose *event,
|
GdkEventExpose *event,
|
||||||
|
|
|
@ -95,35 +95,33 @@ enum
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gimp_color_wheel_dispose (GObject *object);
|
static void gimp_color_wheel_dispose (GObject *object);
|
||||||
|
|
||||||
static void gimp_color_wheel_map (GtkWidget *widget);
|
static void gimp_color_wheel_map (GtkWidget *widget);
|
||||||
static void gimp_color_wheel_unmap (GtkWidget *widget);
|
static void gimp_color_wheel_unmap (GtkWidget *widget);
|
||||||
static void gimp_color_wheel_realize (GtkWidget *widget);
|
static void gimp_color_wheel_realize (GtkWidget *widget);
|
||||||
static void gimp_color_wheel_unrealize (GtkWidget *widget);
|
static void gimp_color_wheel_unrealize (GtkWidget *widget);
|
||||||
static void gimp_color_wheel_size_request (GtkWidget *widget,
|
static void gimp_color_wheel_size_request (GtkWidget *widget,
|
||||||
GtkRequisition *requisition);
|
GtkRequisition *requisition);
|
||||||
static void gimp_color_wheel_size_allocate (GtkWidget *widget,
|
static void gimp_color_wheel_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
static gboolean gimp_color_wheel_button_press (GtkWidget *widget,
|
static gboolean gimp_color_wheel_button_press (GtkWidget *widget,
|
||||||
GdkEventButton *event);
|
GdkEventButton *event);
|
||||||
static gboolean gimp_color_wheel_button_release (GtkWidget *widget,
|
static gboolean gimp_color_wheel_button_release (GtkWidget *widget,
|
||||||
GdkEventButton *event);
|
GdkEventButton *event);
|
||||||
static gboolean gimp_color_wheel_motion (GtkWidget *widget,
|
static gboolean gimp_color_wheel_motion (GtkWidget *widget,
|
||||||
GdkEventMotion *event);
|
GdkEventMotion *event);
|
||||||
static gboolean gimp_color_wheel_expose (GtkWidget *widget,
|
static gboolean gimp_color_wheel_expose (GtkWidget *widget,
|
||||||
GdkEventExpose *event);
|
GdkEventExpose *event);
|
||||||
static gboolean gimp_color_wheel_grab_broken (GtkWidget *widget,
|
static gboolean gimp_color_wheel_grab_broken (GtkWidget *widget,
|
||||||
GdkEventGrabBroken *event);
|
GdkEventGrabBroken *event);
|
||||||
static gboolean gimp_color_wheel_focus (GtkWidget *widget,
|
static gboolean gimp_color_wheel_focus (GtkWidget *widget,
|
||||||
GtkDirectionType direction);
|
GtkDirectionType direction);
|
||||||
static void gimp_color_wheel_move (GimpColorWheel *wheel,
|
static void gimp_color_wheel_move (GimpColorWheel *wheel,
|
||||||
GtkDirectionType dir);
|
GtkDirectionType dir);
|
||||||
|
|
||||||
static void gimp_color_wheel_config_notify (GimpColorConfig *config,
|
static void gimp_color_wheel_create_transform (GimpColorWheel *wheel);
|
||||||
const GParamSpec *pspec,
|
static void gimp_color_wheel_destroy_transform (GimpColorWheel *wheel);
|
||||||
GimpColorWheel *wheel);
|
|
||||||
static void gimp_color_wheel_create_transform (GimpColorWheel *wheel);
|
|
||||||
|
|
||||||
|
|
||||||
static guint wheel_signals[LAST_SIGNAL];
|
static guint wheel_signals[LAST_SIGNAL];
|
||||||
|
@ -238,6 +236,10 @@ gimp_color_wheel_init (GimpColorWheel *wheel)
|
||||||
priv->ring_fraction = DEFAULT_FRACTION;
|
priv->ring_fraction = DEFAULT_FRACTION;
|
||||||
priv->size = DEFAULT_SIZE;
|
priv->size = DEFAULT_SIZE;
|
||||||
priv->ring_width = DEFAULT_RING_WIDTH;
|
priv->ring_width = DEFAULT_RING_WIDTH;
|
||||||
|
|
||||||
|
gimp_widget_track_monitor (GTK_WIDGET (wheel),
|
||||||
|
G_CALLBACK (gimp_color_wheel_destroy_transform),
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1467,15 +1469,11 @@ gimp_color_wheel_set_color_config (GimpColorWheel *wheel,
|
||||||
if (priv->config)
|
if (priv->config)
|
||||||
{
|
{
|
||||||
g_signal_handlers_disconnect_by_func (priv->config,
|
g_signal_handlers_disconnect_by_func (priv->config,
|
||||||
gimp_color_wheel_config_notify,
|
gimp_color_wheel_destroy_transform,
|
||||||
wheel);
|
wheel);
|
||||||
g_object_unref (priv->config);
|
g_object_unref (priv->config);
|
||||||
|
|
||||||
if (priv->transform)
|
gimp_color_wheel_destroy_transform (wheel);
|
||||||
{
|
|
||||||
g_object_unref (priv->transform);
|
|
||||||
priv->transform = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->config = config;
|
priv->config = config;
|
||||||
|
@ -1484,9 +1482,9 @@ gimp_color_wheel_set_color_config (GimpColorWheel *wheel,
|
||||||
{
|
{
|
||||||
g_object_ref (priv->config);
|
g_object_ref (priv->config);
|
||||||
|
|
||||||
g_signal_connect (priv->config, "notify",
|
g_signal_connect_swapped (priv->config, "notify",
|
||||||
G_CALLBACK (gimp_color_wheel_config_notify),
|
G_CALLBACK (gimp_color_wheel_destroy_transform),
|
||||||
wheel);
|
wheel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1594,22 +1592,6 @@ gimp_color_wheel_move (GimpColorWheel *wheel,
|
||||||
gimp_color_wheel_set_color (wheel, hue, sat, val);
|
gimp_color_wheel_set_color (wheel, hue, sat, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gimp_color_wheel_config_notify (GimpColorConfig *config,
|
|
||||||
const GParamSpec *pspec,
|
|
||||||
GimpColorWheel *wheel)
|
|
||||||
{
|
|
||||||
GimpColorWheelPrivate *priv = wheel->priv;
|
|
||||||
|
|
||||||
if (priv->transform)
|
|
||||||
{
|
|
||||||
g_object_unref (priv->transform);
|
|
||||||
priv->transform = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (wheel));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_color_wheel_create_transform (GimpColorWheel *wheel)
|
gimp_color_wheel_create_transform (GimpColorWheel *wheel)
|
||||||
{
|
{
|
||||||
|
@ -1631,3 +1613,17 @@ gimp_color_wheel_create_transform (GimpColorWheel *wheel)
|
||||||
format);
|
format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_color_wheel_destroy_transform (GimpColorWheel *wheel)
|
||||||
|
{
|
||||||
|
GimpColorWheelPrivate *priv = wheel->priv;
|
||||||
|
|
||||||
|
if (priv->transform)
|
||||||
|
{
|
||||||
|
g_object_unref (priv->transform);
|
||||||
|
priv->transform = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_queue_draw (GTK_WIDGET (wheel));
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue