[gthumb] adjust colors: added a preview check button to compare the image with the original
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] adjust colors: added a preview check button to compare the image with the original
- Date: Tue, 5 Jul 2011 17:11:03 +0000 (UTC)
commit 9467134be62888555ba62deda64ce7c6ef31948c
Author: Paolo Bacchilega <paobac src gnome org>
Date: Tue Jul 5 19:09:59 2011 +0200
adjust colors: added a preview check button to compare the image with the original
[bug #566040]
.../file_tools/data/ui/adjust-colors-options.ui | 113 +++++++++++++++----
.../file_tools/gth-file-tool-adjust-colors.c | 32 +++++-
2 files changed, 116 insertions(+), 29 deletions(-)
---
diff --git a/extensions/file_tools/data/ui/adjust-colors-options.ui b/extensions/file_tools/data/ui/adjust-colors-options.ui
index 4c275a5..9493178 100644
--- a/extensions/file_tools/data/ui/adjust-colors-options.ui
+++ b/extensions/file_tools/data/ui/adjust-colors-options.ui
@@ -1,33 +1,85 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy project-wide -->
+ <object class="GtkAdjustment" id="crop_height_adjustment">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ </object>
+ <object class="GtkAdjustment" id="crop_width_adjustment">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ </object>
+ <object class="GtkAdjustment" id="crop_x_adjustment">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ </object>
+ <object class="GtkAdjustment" id="crop_y_adjustment">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ </object>
<object class="GtkAlignment" id="options">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="top_padding">6</property>
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="spacing">12</property>
<child>
- <object class="GtkHBox" id="histogram_hbox">
- <property name="height_request">160</property>
+ <object class="GtkVBox" id="box1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
<child>
- <placeholder/>
+ <object class="GtkHBox" id="histogram_hbox">
+ <property name="height_request">160</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="preview_checkbutton">
+ <property name="label" translatable="yes">_Preview</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTable" id="table1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="n_rows">8</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
@@ -35,6 +87,7 @@
<child>
<object class="GtkLabel" id="brightness_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">B_rightness:</property>
<property name="use_underline">True</property>
@@ -51,6 +104,7 @@
<child>
<object class="GtkLabel" id="contrast_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Con_trast:</property>
<property name="use_underline">True</property>
@@ -67,6 +121,7 @@
<child>
<object class="GtkLabel" id="saturation_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Saturation:</property>
<property name="use_underline">True</property>
@@ -83,6 +138,7 @@
<child>
<object class="GtkHBox" id="brightness_hbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<placeholder/>
</child>
@@ -97,6 +153,7 @@
<child>
<object class="GtkHBox" id="contrast_hbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<placeholder/>
</child>
@@ -111,6 +168,7 @@
<child>
<object class="GtkHBox" id="saturation_hbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<placeholder/>
</child>
@@ -125,6 +183,7 @@
<child>
<object class="GtkHBox" id="gamma_hbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<placeholder/>
</child>
@@ -137,6 +196,7 @@
<child>
<object class="GtkLabel" id="gamma_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">G_amma:</property>
<property name="use_underline">True</property>
@@ -151,6 +211,7 @@
<child>
<object class="GtkLabel" id="cyan_red_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Cyan-_Red:</property>
<property name="use_underline">True</property>
@@ -167,6 +228,7 @@
<child>
<object class="GtkLabel" id="magenta_green_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Magenta-Green:</property>
<property name="use_underline">True</property>
@@ -183,6 +245,7 @@
<child>
<object class="GtkLabel" id="yellow_blue_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Yellow-Blue:</property>
<property name="use_underline">True</property>
@@ -199,11 +262,13 @@
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="top_padding">12</property>
<property name="bottom_padding">6</property>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Color Levels</property>
<property name="use_underline">True</property>
@@ -222,6 +287,7 @@
<child>
<object class="GtkHBox" id="cyan_red_hbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<placeholder/>
</child>
@@ -236,6 +302,7 @@
<child>
<object class="GtkHBox" id="magenta_green_hbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<placeholder/>
</child>
@@ -250,6 +317,7 @@
<child>
<object class="GtkHBox" id="yellow_blue_hbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<placeholder/>
</child>
@@ -263,42 +331,52 @@
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkButton" id="reset_button">
<property name="label" translatable="yes">_Reset</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHSeparator" id="hseparator1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="padding">6</property>
<property name="position">1</property>
</packing>
@@ -306,6 +384,7 @@
<child>
<object class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">12</property>
<property name="layout_style">center</property>
<child>
@@ -314,6 +393,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
@@ -329,6 +409,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -348,28 +429,12 @@
</object>
</child>
</object>
- <object class="GtkAdjustment" id="ratio_w_adjustment">
- <property name="upper">9999</property>
- <property name="step_increment">1</property>
- </object>
- <object class="GtkAdjustment" id="crop_x_adjustment">
- <property name="upper">100</property>
- <property name="step_increment">1</property>
- </object>
- <object class="GtkAdjustment" id="crop_y_adjustment">
- <property name="upper">100</property>
- <property name="step_increment">1</property>
- </object>
- <object class="GtkAdjustment" id="crop_width_adjustment">
- <property name="upper">100</property>
- <property name="step_increment">1</property>
- </object>
- <object class="GtkAdjustment" id="crop_height_adjustment">
+ <object class="GtkAdjustment" id="ratio_h_adjustment">
<property name="upper">100</property>
<property name="step_increment">1</property>
</object>
- <object class="GtkAdjustment" id="ratio_h_adjustment">
- <property name="upper">100</property>
+ <object class="GtkAdjustment" id="ratio_w_adjustment">
+ <property name="upper">9999</property>
<property name="step_increment">1</property>
</object>
</interface>
diff --git a/extensions/file_tools/gth-file-tool-adjust-colors.c b/extensions/file_tools/gth-file-tool-adjust-colors.c
index f3620c8..742cfed 100644
--- a/extensions/file_tools/gth-file-tool-adjust-colors.c
+++ b/extensions/file_tools/gth-file-tool-adjust-colors.c
@@ -222,7 +222,8 @@ adjust_colors_after (GthAsyncTask *task,
cairo_surface_destroy (self->priv->destination);
self->priv->destination = cairo_surface_reference (adjust_data->destination);
- gth_image_viewer_page_set_image (GTH_IMAGE_VIEWER_PAGE (adjust_data->viewer_page), self->priv->destination, FALSE);
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("preview_checkbutton"))))
+ gth_image_viewer_page_set_image (GTH_IMAGE_VIEWER_PAGE (adjust_data->viewer_page), self->priv->destination, FALSE);
gth_histogram_calculate_for_image (self->priv->histogram, self->priv->destination);
}
@@ -343,10 +344,10 @@ apply_cb (gpointer user_data)
adjust_data->color_level[2] = gtk_adjustment_get_value (self->priv->yellow_blue_adj);
self->priv->image_task = gth_async_task_new (adjust_colors_before,
- adjust_colors_exec,
- adjust_colors_after,
- adjust_data,
- adjust_data_free);
+ adjust_colors_exec,
+ adjust_colors_after,
+ adjust_data,
+ adjust_data_free);
gth_browser_exec_task (GTH_BROWSER (window), self->priv->image_task, FALSE);
return FALSE;
@@ -365,6 +366,23 @@ value_changed_cb (GtkAdjustment *adj,
}
+static void
+preview_checkbutton_toggled_cb (GtkToggleButton *togglebutton,
+ gpointer user_data)
+{
+ GthFileToolAdjustColors *self = user_data;
+ GtkWidget *window;
+ GtkWidget *viewer_page;
+
+ window = gth_file_tool_get_window (GTH_FILE_TOOL (self));
+ viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
+ if (gtk_toggle_button_get_active (togglebutton))
+ gth_image_viewer_page_set_image (GTH_IMAGE_VIEWER_PAGE (viewer_page), self->priv->destination, FALSE);
+ else
+ gth_image_viewer_page_set_image (GTH_IMAGE_VIEWER_PAGE (viewer_page), self->priv->source, FALSE);
+}
+
+
static GtkWidget *
gth_file_tool_adjust_colors_get_options (GthFileTool *base)
{
@@ -461,6 +479,10 @@ gth_file_tool_adjust_colors_get_options (GthFileTool *base)
"value-changed",
G_CALLBACK (value_changed_cb),
self);
+ g_signal_connect (GET_WIDGET ("preview_checkbutton"),
+ "toggled",
+ G_CALLBACK (preview_checkbutton_toggled_cb),
+ self);
gth_histogram_calculate_for_image (self->priv->histogram, self->priv->source);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]