[gthumb] added ability to select the aspect ratio in the resize tool
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] added ability to select the aspect ratio in the resize tool
- Date: Thu, 24 Jun 2010 12:14:32 +0000 (UTC)
commit eca51b546340d58c6314a2e1dd44e569d78bd951
Author: Paolo Bacchilega <paobac src gnome org>
Date: Thu Jun 24 13:40:04 2010 +0200
added ability to select the aspect ratio in the resize tool
.../data/gthumb_resize_options.schemas.in | 40 +++-
extensions/file_tools/data/ui/resize-options.ui | 233 +++++++++++++-
extensions/file_tools/gth-file-tool-crop.c | 63 ++--
extensions/file_tools/gth-file-tool-crop.h | 16 -
extensions/file_tools/gth-file-tool-resize.c | 328 ++++++++++++++++----
extensions/file_tools/preferences.h | 21 +-
extensions/image_viewer/gth-image-viewer-page.c | 2 +-
extensions/red_eye_removal/gth-file-tool-red-eye.c | 1 -
gthumb/typedefs.h | 17 +
9 files changed, 584 insertions(+), 137 deletions(-)
---
diff --git a/extensions/file_tools/data/gthumb_resize_options.schemas.in b/extensions/file_tools/data/gthumb_resize_options.schemas.in
index 0c87745..d17968a 100644
--- a/extensions/file_tools/data/gthumb_resize_options.schemas.in
+++ b/extensions/file_tools/data/gthumb_resize_options.schemas.in
@@ -14,8 +14,44 @@
</schema>
<schema>
- <key>/schemas/apps/gthumb/ext/resize/keep_aspect_ratio</key>
- <applyto>/apps/gthumb/ext/resize/keep_aspect_ratio</applyto>
+ <key>/schemas/apps/gthumb/ext/resize/aspect_ratio_width</key>
+ <applyto>/apps/gthumb/ext/resize/aspect_ratio_width</applyto>
+ <owner>gthumb</owner>
+ <type>int</type>
+ <default>1</default>
+ <locale name="C">
+ <short></short>
+ <long></long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gthumb/ext/resize/aspect_ratio_height</key>
+ <applyto>/apps/gthumb/ext/resize/aspect_ratio_height</applyto>
+ <owner>gthumb</owner>
+ <type>int</type>
+ <default>1</default>
+ <locale name="C">
+ <short></short>
+ <long></long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gthumb/ext/resize/aspect_ratio</key>
+ <applyto>/apps/gthumb/ext/resize/aspect_ratio</applyto>
+ <owner>gthumb</owner>
+ <type>string</type>
+ <default>image</default>
+ <locale name="C">
+ <short></short>
+ <long></long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gthumb/ext/resize/aspect_ratio_invert</key>
+ <applyto>/apps/gthumb/ext/resize/aspect_ratio_invert</applyto>
<owner>gthumb</owner>
<type>bool</type>
<default>true</default>
diff --git a/extensions/file_tools/data/ui/resize-options.ui b/extensions/file_tools/data/ui/resize-options.ui
index 9655614..c9da317 100644
--- a/extensions/file_tools/data/ui/resize-options.ui
+++ b/extensions/file_tools/data/ui/resize-options.ui
@@ -15,6 +15,113 @@
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
+ <object class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Original dimensions:</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Scale factor:</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="original_dimensions_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label">label</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="scale_factor_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label">label</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">New dimensions:</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="new_dimensions_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label">label</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Information</property>
+ <property name="use_markup">True</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkFrame" id="frame4">
<property name="visible">True</property>
<property name="label_xalign">0</property>
@@ -165,38 +272,136 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <object class="GtkFrame" id="frame1">
+ <object class="GtkFrame" id="frame5">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
- <object class="GtkAlignment" id="alignment1">
+ <object class="GtkAlignment" id="alignment6">
<property name="visible">True</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkVBox" id="vbox3">
+ <object class="GtkVBox" id="vbox8">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="GtkCheckButton" id="keep_ratio_checkbutton">
- <property name="label" translatable="yes">_Preserve original aspect ratio</property>
+ <object class="GtkHBox" id="ratio_combobox_box">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="custom_ratio_box">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkSpinButton" id="ratio_w_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="adjustment">ratio_w_adjustment</property>
+ <property name="climb_rate">1</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label17">
+ <property name="visible">True</property>
+ <property name="label">:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="ratio_h_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="adjustment">ratio_h_adjustment</property>
+ <property name="climb_rate">1</property>
+ <property name="update_policy">if-valid</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="invert_ratio_checkbutton">
+ <property name="label" translatable="yes">I_nvert aspect ratio</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
- <property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
- <property name="position">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
</packing>
</child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label16">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Aspect ratio</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="high_quality_checkbutton">
<property name="label" translatable="yes">High _quality</property>
@@ -210,7 +415,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
@@ -230,7 +435,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
@@ -322,4 +527,12 @@
</row>
</data>
</object>
+ <object class="GtkAdjustment" id="ratio_w_adjustment">
+ <property name="upper">999999</property>
+ <property name="step_increment">1</property>
+ </object>
+ <object class="GtkAdjustment" id="ratio_h_adjustment">
+ <property name="upper">999999</property>
+ <property name="step_increment">1</property>
+ </object>
</interface>
diff --git a/extensions/file_tools/gth-file-tool-crop.c b/extensions/file_tools/gth-file-tool-crop.c
index 6ad80dd..6bb82b3 100644
--- a/extensions/file_tools/gth-file-tool-crop.c
+++ b/extensions/file_tools/gth-file-tool-crop.c
@@ -207,60 +207,60 @@ ratio_combobox_changed_cb (GtkComboBox *combobox,
idx = gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->ratio_combobox));
switch (idx) {
- case GTH_CROP_RATIO_NONE:
+ case GTH_ASPECT_RATIO_NONE:
use_ratio = FALSE;
break;
- case GTH_CROP_RATIO_SQUARE:
+ case GTH_ASPECT_RATIO_SQUARE:
w = h = 1;
break;
- case GTH_CROP_RATIO_IMAGE:
+ case GTH_ASPECT_RATIO_IMAGE:
w = self->priv->pixbuf_width;
h = self->priv->pixbuf_height;
break;
- case GTH_CROP_RATIO_DISPLAY:
+ case GTH_ASPECT_RATIO_DISPLAY:
w = self->priv->screen_width;
h = self->priv->screen_height;
break;
- case GTH_CROP_RATIO_5x4:
+ case GTH_ASPECT_RATIO_5x4:
w = 5;
h = 4;
break;
- case GTH_CROP_RATIO_4x3:
+ case GTH_ASPECT_RATIO_4x3:
w = 4;
h = 3;
break;
- case GTH_CROP_RATIO_7x5:
+ case GTH_ASPECT_RATIO_7x5:
w = 7;
h = 5;
break;
- case GTH_CROP_RATIO_3x2:
+ case GTH_ASPECT_RATIO_3x2:
w = 3;
h = 2;
break;
- case GTH_CROP_RATIO_16x10:
+ case GTH_ASPECT_RATIO_16x10:
w = 16;
h = 10;
break;
- case GTH_CROP_RATIO_16x9:
+ case GTH_ASPECT_RATIO_16x9:
w = 16;
h = 9;
break;
- case GTH_CROP_RATIO_185x100:
+ case GTH_ASPECT_RATIO_185x100:
w = 185;
h = 100;
break;
- case GTH_CROP_RATIO_239x100:
+ case GTH_ASPECT_RATIO_239x100:
w = 239;
h = 100;
break;
- case GTH_CROP_RATIO_CUSTOM:
+ case GTH_ASPECT_RATIO_CUSTOM:
default:
w = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ratio_w_spinbutton));
h = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ratio_h_spinbutton));
break;
}
- gtk_widget_set_sensitive (GET_WIDGET ("custom_ratio_box"), idx == GTH_CROP_RATIO_CUSTOM);
+ gtk_widget_set_sensitive (GET_WIDGET ("custom_ratio_box"), idx == GTH_ASPECT_RATIO_CUSTOM);
gtk_widget_set_sensitive (GET_WIDGET ("invert_ratio_checkbutton"), use_ratio);
set_spin_value (self, ratio_w_spinbutton, w);
set_spin_value (self, ratio_h_spinbutton, h);
@@ -280,7 +280,7 @@ update_ratio (GtkSpinButton *spin,
int w, h;
double ratio;
- use_ratio = gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->ratio_combobox)) != GTH_CROP_RATIO_NONE;
+ use_ratio = gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->ratio_combobox)) != GTH_ASPECT_RATIO_NONE;
w = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_w_spinbutton")));
h = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_h_spinbutton")));
@@ -379,7 +379,7 @@ gth_file_tool_crop_get_options (GthFileTool *base)
gtk_widget_show (self->priv->ratio_combobox);
gtk_box_pack_start (GTK_BOX (GET_WIDGET ("ratio_combobox_box")), self->priv->ratio_combobox, FALSE, FALSE, 0);
- gtk_combo_box_set_active (GTK_COMBO_BOX (self->priv->ratio_combobox), eel_gconf_get_enum (PREF_CROP_ASPECT_RATIO, GTH_TYPE_CROP_RATIO, GTH_CROP_RATIO_NONE));
+ gtk_combo_box_set_active (GTK_COMBO_BOX (self->priv->ratio_combobox), eel_gconf_get_enum (PREF_CROP_ASPECT_RATIO, GTH_TYPE_ASPECT_RATIO, GTH_ASPECT_RATIO_NONE));
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_w_spinbutton")), MAX (eel_gconf_get_integer (PREF_CROP_ASPECT_RATIO_WIDTH, 1), 1));
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_h_spinbutton")), MAX (eel_gconf_get_integer (PREF_CROP_ASPECT_RATIO_HEIGHT, 1), 1));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("invert_ratio_checkbutton")), eel_gconf_get_boolean (PREF_CROP_ASPECT_RATIO_INVERT, FALSE));
@@ -462,28 +462,29 @@ gth_file_tool_crop_destroy_options (GthFileTool *base)
self = (GthFileToolCrop *) base;
- /* save the dialog options */
+ if (self->priv->builder != NULL) {
+ /* save the dialog options */
- eel_gconf_set_enum (PREF_CROP_GRID_TYPE, GTH_TYPE_GRID_TYPE, gth_image_selector_get_grid_type (self->priv->selector));
- eel_gconf_set_integer (PREF_CROP_ASPECT_RATIO_WIDTH, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_w_spinbutton"))));
- eel_gconf_set_integer (PREF_CROP_ASPECT_RATIO_HEIGHT, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_h_spinbutton"))));
- eel_gconf_set_enum (PREF_CROP_ASPECT_RATIO, GTH_TYPE_CROP_RATIO, gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->ratio_combobox)));
- eel_gconf_set_boolean (PREF_CROP_ASPECT_RATIO_INVERT, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("invert_ratio_checkbutton"))));
+ eel_gconf_set_enum (PREF_CROP_GRID_TYPE, GTH_TYPE_GRID_TYPE, gth_image_selector_get_grid_type (self->priv->selector));
+ eel_gconf_set_integer (PREF_CROP_ASPECT_RATIO_WIDTH, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_w_spinbutton"))));
+ eel_gconf_set_integer (PREF_CROP_ASPECT_RATIO_HEIGHT, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_h_spinbutton"))));
+ eel_gconf_set_enum (PREF_CROP_ASPECT_RATIO, GTH_TYPE_ASPECT_RATIO, gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->ratio_combobox)));
+ eel_gconf_set_boolean (PREF_CROP_ASPECT_RATIO_INVERT, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("invert_ratio_checkbutton"))));
- /**/
+ /* destroy the option data */
+
+ _g_object_unref (self->priv->src_pixbuf);
+ _g_object_unref (self->priv->builder);
+ _g_object_unref (self->priv->selector);
+ self->priv->src_pixbuf = NULL;
+ self->priv->builder = NULL;
+ self->priv->selector = NULL;
+ }
window = gth_file_tool_get_window (GTH_FILE_TOOL (self));
viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
gth_image_viewer_set_tool (GTH_IMAGE_VIEWER (viewer), NULL);
-
- _g_object_unref (self->priv->src_pixbuf);
- _g_object_unref (self->priv->builder);
- _g_object_unref (self->priv->selector);
-
- self->priv->src_pixbuf = NULL;
- self->priv->builder = NULL;
- self->priv->selector = NULL;
}
diff --git a/extensions/file_tools/gth-file-tool-crop.h b/extensions/file_tools/gth-file-tool-crop.h
index f8f89f3..d003ff7 100644
--- a/extensions/file_tools/gth-file-tool-crop.h
+++ b/extensions/file_tools/gth-file-tool-crop.h
@@ -27,22 +27,6 @@
G_BEGIN_DECLS
-typedef enum {
- GTH_CROP_RATIO_NONE = 0,
- GTH_CROP_RATIO_SQUARE,
- GTH_CROP_RATIO_IMAGE,
- GTH_CROP_RATIO_DISPLAY,
- GTH_CROP_RATIO_5x4,
- GTH_CROP_RATIO_4x3,
- GTH_CROP_RATIO_7x5,
- GTH_CROP_RATIO_3x2,
- GTH_CROP_RATIO_16x10,
- GTH_CROP_RATIO_16x9,
- GTH_CROP_RATIO_185x100,
- GTH_CROP_RATIO_239x100,
- GTH_CROP_RATIO_CUSTOM
-} GthCropRatio;
-
#define GTH_TYPE_FILE_TOOL_CROP (gth_file_tool_crop_get_type ())
#define GTH_FILE_TOOL_CROP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_FILE_TOOL_CROP, GthFileToolCrop))
#define GTH_FILE_TOOL_CROP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_FILE_TOOL_CROP, GthFileToolCropClass))
diff --git a/extensions/file_tools/gth-file-tool-resize.c b/extensions/file_tools/gth-file-tool-resize.c
index 95e83ff..e9762f1 100644
--- a/extensions/file_tools/gth-file-tool-resize.c
+++ b/extensions/file_tools/gth-file-tool-resize.c
@@ -32,19 +32,6 @@
#define HIGH_QUALITY_INTERPOLATION GDK_INTERP_HYPER
-typedef enum {
- GTH_RESIZE_RATIO_NONE = 0,
- GTH_RESIZE_RATIO_SQUARE,
- GTH_RESIZE_RATIO_IMAGE,
- GTH_RESIZE_RATIO_DISPLAY,
- GTH_RESIZE_RATIO_4_3,
- GTH_RESIZE_RATIO_4_6,
- GTH_RESIZE_RATIO_5_7,
- GTH_RESIZE_RATIO_8_10,
- GTH_RESIZE_RATIO_CUSTOM
-} GthResizeRatio;
-
-
static gpointer parent_class = NULL;
@@ -52,12 +39,15 @@ struct _GthFileToolResizePrivate {
GdkPixbuf *src_pixbuf;
GdkPixbuf *new_pixbuf;
GtkBuilder *builder;
- int original_width;
- int original_height;
- double original_ratio;
+ GtkWidget *ratio_combobox;
+ int pixbuf_width;
+ int pixbuf_height;
+ int screen_width;
+ int screen_height;
+ gboolean fixed_aspect_ratio;
+ double aspect_ratio;
int new_width;
int new_height;
- gboolean keep_ratio;
GdkInterpType interpolation;
GthUnit unit;
};
@@ -82,6 +72,12 @@ static void
cancel_button_clicked_cb (GtkButton *button,
GthFileToolResize *self)
{
+ 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));
+ gth_image_viewer_page_reset (GTH_IMAGE_VIEWER_PAGE (viewer_page));
gth_file_tool_hide_options (GTH_FILE_TOOL (self));
}
@@ -104,6 +100,25 @@ resize_button_clicked_cb (GtkButton *button,
static void
+update_dimensione_info_label (GthFileToolResize *self,
+ const char *id,
+ double x,
+ double y,
+ gboolean as_int)
+{
+ char *s;
+
+ if (as_int)
+ s = g_strdup_printf ("%dÃ?%d", (int) x, (int) y);
+ else
+ s = g_strdup_printf ("%.2fÃ?%.2f", x, y);
+ gtk_label_set_text (GTK_LABEL (GET_WIDGET (id)), s);
+
+ g_free (s);
+}
+
+
+static void
update_pixbuf_size (GthFileToolResize *self)
{
GtkWidget *window;
@@ -117,6 +132,17 @@ update_pixbuf_size (GthFileToolResize *self)
window = gth_file_tool_get_window (GTH_FILE_TOOL (self));
viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
gth_image_viewer_page_set_pixbuf (GTH_IMAGE_VIEWER_PAGE (viewer_page), self->priv->new_pixbuf, FALSE);
+
+ update_dimensione_info_label (self,
+ "new_dimensions_label",
+ self->priv->new_width,
+ self->priv->new_height,
+ TRUE);
+ update_dimensione_info_label (self,
+ "scale_factor_label",
+ (double) self->priv->new_width / self->priv->pixbuf_width,
+ (double) self->priv->new_height / self->priv->pixbuf_height,
+ FALSE);
}
@@ -127,15 +153,15 @@ selection_width_value_changed_cb (GtkSpinButton *spin,
if (self->priv->unit == GTH_UNIT_PIXELS)
self->priv->new_width = MAX (gtk_spin_button_get_value_as_int (spin), 1);
else if (self->priv->unit == GTH_UNIT_PERCENTAGE)
- self->priv->new_width = MAX ((int) round ((gtk_spin_button_get_value (spin) / 100.0) * self->priv->original_width), 1);
+ self->priv->new_width = MAX ((int) round ((gtk_spin_button_get_value (spin) / 100.0) * self->priv->pixbuf_width), 1);
- if (self->priv->keep_ratio) {
+ if (self->priv->fixed_aspect_ratio) {
g_signal_handlers_block_by_data (GET_WIDGET ("resize_height_spinbutton"), self);
- self->priv->new_height = MAX ((int) round ((double) self->priv->new_width / self->priv->original_ratio), 1);
+ self->priv->new_height = MAX ((int) round ((double) self->priv->new_width / self->priv->aspect_ratio), 1);
if (self->priv->unit == GTH_UNIT_PIXELS)
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton")), self->priv->new_height);
else if (self->priv->unit == GTH_UNIT_PERCENTAGE)
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton")), ((double) self->priv->new_height) / self->priv->original_height * 100.0);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton")), ((double) self->priv->new_height) / self->priv->pixbuf_height * 100.0);
g_signal_handlers_unblock_by_data (GET_WIDGET ("resize_height_spinbutton"), self);
}
@@ -150,15 +176,15 @@ selection_height_value_changed_cb (GtkSpinButton *spin,
if (self->priv->unit == GTH_UNIT_PIXELS)
self->priv->new_height = MAX (gtk_spin_button_get_value_as_int (spin), 1);
else if (self->priv->unit == GTH_UNIT_PERCENTAGE)
- self->priv->new_height = MAX ((int) round ((gtk_spin_button_get_value (spin) / 100.0) * self->priv->original_height), 1);
+ self->priv->new_height = MAX ((int) round ((gtk_spin_button_get_value (spin) / 100.0) * self->priv->pixbuf_height), 1);
- if (self->priv->keep_ratio) {
+ if (self->priv->fixed_aspect_ratio) {
g_signal_handlers_block_by_data (GET_WIDGET ("resize_width_spinbutton"), self);
- self->priv->new_width = MAX ((int) round ((double) self->priv->new_height * self->priv->original_ratio), 1);
+ self->priv->new_width = MAX ((int) round ((double) self->priv->new_height * self->priv->aspect_ratio), 1);
if (self->priv->unit == GTH_UNIT_PIXELS)
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), self->priv->new_width);
else if (self->priv->unit == GTH_UNIT_PERCENTAGE)
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), ((double) self->priv->new_width) / self->priv->original_width * 100.0);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), ((double) self->priv->new_width) / self->priv->pixbuf_width * 100.0);
g_signal_handlers_unblock_by_data (GET_WIDGET ("resize_width_spinbutton"), self);
}
@@ -167,14 +193,6 @@ selection_height_value_changed_cb (GtkSpinButton *spin,
static void
-keep_ratio_checkbutton_toggled_cb (GtkToggleButton *button,
- GthFileToolResize *self)
-{
- self->priv->keep_ratio = gtk_toggle_button_get_active (button);
-}
-
-
-static void
high_quality_checkbutton_toggled_cb (GtkToggleButton *button,
GthFileToolResize *self)
{
@@ -197,9 +215,9 @@ unit_combobox_changed_cb (GtkComboBox *combobox,
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), 2);
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton")), 2);
- p = ((double) self->priv->new_width) / self->priv->original_width * 100.0;
+ p = ((double) self->priv->new_width) / self->priv->pixbuf_width * 100.0;
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), p);
- p = ((double) self->priv->new_height) / self->priv->original_height * 100.0;
+ p = ((double) self->priv->new_height) / self->priv->pixbuf_height * 100.0;
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton")), p);
}
else if (self->priv->unit == GTH_UNIT_PIXELS) {
@@ -212,7 +230,134 @@ unit_combobox_changed_cb (GtkComboBox *combobox,
g_signal_handlers_unblock_by_data (GET_WIDGET ("resize_width_spinbutton"), self);
g_signal_handlers_unblock_by_data (GET_WIDGET ("resize_height_spinbutton"), self);
- update_pixbuf_size (self);
+ selection_width_value_changed_cb (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), self);
+}
+
+
+static void
+set_spin_value (GthFileToolResize *self,
+ GtkWidget *spin,
+ int x)
+{
+ g_signal_handlers_block_by_data (G_OBJECT (spin), self);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), x);
+ g_signal_handlers_unblock_by_data (G_OBJECT (spin), self);
+}
+
+
+static void
+ratio_combobox_changed_cb (GtkComboBox *combobox,
+ GthFileToolResize *self)
+{
+ GtkWidget *ratio_w_spinbutton;
+ GtkWidget *ratio_h_spinbutton;
+ int idx;
+ int w, h;
+ gboolean use_ratio;
+
+ ratio_w_spinbutton = GET_WIDGET ("ratio_w_spinbutton");
+ ratio_h_spinbutton = GET_WIDGET ("ratio_h_spinbutton");
+ w = h = 1;
+ use_ratio = TRUE;
+ idx = gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->ratio_combobox));
+
+ switch (idx) {
+ case GTH_ASPECT_RATIO_NONE:
+ use_ratio = FALSE;
+ break;
+ case GTH_ASPECT_RATIO_SQUARE:
+ w = h = 1;
+ break;
+ case GTH_ASPECT_RATIO_IMAGE:
+ w = self->priv->pixbuf_width;
+ h = self->priv->pixbuf_height;
+ break;
+ case GTH_ASPECT_RATIO_DISPLAY:
+ w = self->priv->screen_width;
+ h = self->priv->screen_height;
+ break;
+ case GTH_ASPECT_RATIO_5x4:
+ w = 5;
+ h = 4;
+ break;
+ case GTH_ASPECT_RATIO_4x3:
+ w = 4;
+ h = 3;
+ break;
+ case GTH_ASPECT_RATIO_7x5:
+ w = 7;
+ h = 5;
+ break;
+ case GTH_ASPECT_RATIO_3x2:
+ w = 3;
+ h = 2;
+ break;
+ case GTH_ASPECT_RATIO_16x10:
+ w = 16;
+ h = 10;
+ break;
+ case GTH_ASPECT_RATIO_16x9:
+ w = 16;
+ h = 9;
+ break;
+ case GTH_ASPECT_RATIO_185x100:
+ w = 185;
+ h = 100;
+ break;
+ case GTH_ASPECT_RATIO_239x100:
+ w = 239;
+ h = 100;
+ break;
+ case GTH_ASPECT_RATIO_CUSTOM:
+ default:
+ w = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ratio_w_spinbutton));
+ h = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ratio_h_spinbutton));
+ break;
+ }
+
+ gtk_widget_set_sensitive (GET_WIDGET ("custom_ratio_box"), idx == GTH_ASPECT_RATIO_CUSTOM);
+ gtk_widget_set_sensitive (GET_WIDGET ("invert_ratio_checkbutton"), use_ratio);
+ set_spin_value (self, ratio_w_spinbutton, w);
+ set_spin_value (self, ratio_h_spinbutton, h);
+
+ self->priv->fixed_aspect_ratio = use_ratio;
+ self->priv->aspect_ratio = (double) w / h;
+ selection_width_value_changed_cb (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), self);
+}
+
+
+static void
+update_ratio (GtkSpinButton *spin,
+ GthFileToolResize *self,
+ gboolean swap_x_and_y_to_start)
+{
+ int w, h;
+
+ self->priv->fixed_aspect_ratio = gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->ratio_combobox)) != GTH_ASPECT_RATIO_NONE;
+ w = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_w_spinbutton")));
+ h = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_h_spinbutton")));
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("invert_ratio_checkbutton"))))
+ self->priv->aspect_ratio = (double) h / w;
+ else
+ self->priv->aspect_ratio = (double) w / h;
+ selection_width_value_changed_cb (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), self);
+}
+
+
+static void
+ratio_value_changed_cb (GtkSpinButton *spin,
+ GthFileToolResize *self)
+{
+ update_ratio (spin, self, FALSE);
+}
+
+
+static void
+invert_ratio_changed_cb (GtkSpinButton *spin,
+ GthFileToolResize *self)
+{
+ update_ratio (spin, self, TRUE);
}
@@ -220,10 +365,11 @@ static GtkWidget *
gth_file_tool_resize_get_options (GthFileTool *base)
{
GthFileToolResize *self;
- GtkWidget *window;
- GtkWidget *viewer_page;
- GtkWidget *viewer;
- GtkWidget *options;
+ GtkWidget *window;
+ GtkWidget *viewer_page;
+ GtkWidget *viewer;
+ GtkWidget *options;
+ char *text;
self = (GthFileToolResize *) base;
@@ -241,25 +387,30 @@ gth_file_tool_resize_get_options (GthFileTool *base)
g_object_ref (self->priv->src_pixbuf);
- self->priv->original_width = gdk_pixbuf_get_width (self->priv->src_pixbuf);
- self->priv->original_height = gdk_pixbuf_get_height (self->priv->src_pixbuf);
- self->priv->original_ratio = (double) self->priv->original_width / self->priv->original_height;
+ self->priv->pixbuf_width = gdk_pixbuf_get_width (self->priv->src_pixbuf);
+ self->priv->pixbuf_height = gdk_pixbuf_get_height (self->priv->src_pixbuf);
+ _gtk_widget_get_screen_size (window, &self->priv->screen_width, &self->priv->screen_height);
self->priv->new_pixbuf = NULL;
- self->priv->new_width = self->priv->original_width;
- self->priv->new_height = self->priv->original_height;
- self->priv->keep_ratio = eel_gconf_get_boolean (PREF_RESIZE_KEEP_ASPECT_RATIO, TRUE);
+ self->priv->new_width = self->priv->pixbuf_width;
+ self->priv->new_height = self->priv->pixbuf_height;
self->priv->interpolation = eel_gconf_get_boolean (PREF_RESIZE_HIGH_QUALITY, TRUE) ? HIGH_QUALITY_INTERPOLATION : GDK_INTERP_NEAREST;
self->priv->unit = eel_gconf_get_enum (PREF_RESIZE_UNIT, GTH_TYPE_UNIT, GTH_UNIT_PERCENTAGE);
self->priv->builder = _gtk_builder_new_from_file ("resize-options.ui", "file_tools");
+ update_dimensione_info_label (self,
+ "original_dimensions_label",
+ self->priv->pixbuf_width,
+ self->priv->pixbuf_height,
+ TRUE);
+
options = _gtk_builder_get_widget (self->priv->builder, "options");
gtk_widget_show (options);
if (self->priv->unit == GTH_UNIT_PIXELS) {
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), 0);
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton")), 0);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), self->priv->original_width);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton")), self->priv->original_height);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), self->priv->pixbuf_width);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton")), self->priv->pixbuf_height);
}
else if (self->priv->unit == GTH_UNIT_PERCENTAGE) {
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), 2);
@@ -267,10 +418,35 @@ gth_file_tool_resize_get_options (GthFileTool *base)
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_width_spinbutton")), 100.0);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("resize_height_spinbutton")), 100.0);
}
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("keep_ratio_checkbutton")), self->priv->keep_ratio);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("high_quality_checkbutton")), self->priv->interpolation != GDK_INTERP_NEAREST);
gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("unit_combobox")), self->priv->unit);
+ self->priv->ratio_combobox = _gtk_combo_box_new_with_texts (_("None"), _("Square"), NULL);
+ text = g_strdup_printf (_("%d x %d (Image)"), self->priv->pixbuf_width, self->priv->pixbuf_height);
+ gtk_combo_box_append_text (GTK_COMBO_BOX (self->priv->ratio_combobox), text);
+ g_free (text);
+ text = g_strdup_printf (_("%d x %d (Screen)"), self->priv->screen_width, self->priv->screen_height);
+ gtk_combo_box_append_text (GTK_COMBO_BOX (self->priv->ratio_combobox), text);
+ g_free (text);
+ _gtk_combo_box_append_texts (GTK_COMBO_BOX (self->priv->ratio_combobox),
+ _("5:4"),
+ _("4:3 (DVD, Book)"),
+ _("7:5"),
+ _("3:2 (Postcard)"),
+ _("16:10"),
+ _("16:9 (DVD)"),
+ _("1.85:1"),
+ _("2.39:1"),
+ _("Custom"),
+ NULL);
+ gtk_widget_show (self->priv->ratio_combobox);
+ gtk_box_pack_start (GTK_BOX (GET_WIDGET ("ratio_combobox_box")), self->priv->ratio_combobox, FALSE, FALSE, 0);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("high_quality_checkbutton")), self->priv->interpolation != GDK_INTERP_NEAREST);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("invert_ratio_checkbutton")), eel_gconf_get_boolean (PREF_RESIZE_ASPECT_RATIO_INVERT, FALSE));
+
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_w_spinbutton")), MAX (eel_gconf_get_integer (PREF_RESIZE_ASPECT_RATIO_WIDTH, 1), 1));
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_h_spinbutton")), MAX (eel_gconf_get_integer (PREF_RESIZE_ASPECT_RATIO_HEIGHT, 1), 1));
+
g_signal_connect (GET_WIDGET ("resize_button"),
"clicked",
G_CALLBACK (resize_button_clicked_cb),
@@ -287,10 +463,6 @@ gth_file_tool_resize_get_options (GthFileTool *base)
"value-changed",
G_CALLBACK (selection_height_value_changed_cb),
self);
- g_signal_connect (GET_WIDGET ("keep_ratio_checkbutton"),
- "toggled",
- G_CALLBACK (keep_ratio_checkbutton_toggled_cb),
- self);
g_signal_connect (GET_WIDGET ("high_quality_checkbutton"),
"toggled",
G_CALLBACK (high_quality_checkbutton_toggled_cb),
@@ -299,6 +471,24 @@ gth_file_tool_resize_get_options (GthFileTool *base)
"changed",
G_CALLBACK (unit_combobox_changed_cb),
self);
+ g_signal_connect (self->priv->ratio_combobox,
+ "changed",
+ G_CALLBACK (ratio_combobox_changed_cb),
+ self);
+ g_signal_connect (GET_WIDGET ("ratio_w_spinbutton"),
+ "value_changed",
+ G_CALLBACK (ratio_value_changed_cb),
+ self);
+ g_signal_connect (GET_WIDGET ("ratio_h_spinbutton"),
+ "value_changed",
+ G_CALLBACK (ratio_value_changed_cb),
+ self);
+ g_signal_connect (GET_WIDGET ("invert_ratio_checkbutton"),
+ "toggled",
+ G_CALLBACK (invert_ratio_changed_cb),
+ self);
+
+ gtk_combo_box_set_active (GTK_COMBO_BOX (self->priv->ratio_combobox), eel_gconf_get_enum (PREF_RESIZE_ASPECT_RATIO, GTH_TYPE_ASPECT_RATIO, GTH_ASPECT_RATIO_IMAGE));
return options;
}
@@ -314,26 +504,30 @@ gth_file_tool_resize_destroy_options (GthFileTool *base)
self = (GthFileToolResize *) base;
- /* save the dialog options */
+ if (self->priv->builder != NULL) {
+ /* save the dialog options */
- eel_gconf_set_enum (PREF_RESIZE_UNIT, GTH_TYPE_UNIT, gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("unit_combobox"))));
- eel_gconf_set_boolean (PREF_RESIZE_KEEP_ASPECT_RATIO, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("keep_ratio_checkbutton"))));
- eel_gconf_set_boolean (PREF_RESIZE_HIGH_QUALITY, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("high_quality_checkbutton"))));
+ eel_gconf_set_enum (PREF_RESIZE_UNIT, GTH_TYPE_UNIT, gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("unit_combobox"))));
+ eel_gconf_set_integer (PREF_RESIZE_ASPECT_RATIO_WIDTH, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_w_spinbutton"))));
+ eel_gconf_set_integer (PREF_RESIZE_ASPECT_RATIO_HEIGHT, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_h_spinbutton"))));
+ eel_gconf_set_enum (PREF_RESIZE_ASPECT_RATIO, GTH_TYPE_ASPECT_RATIO, gtk_combo_box_get_active (GTK_COMBO_BOX (self->priv->ratio_combobox)));
+ eel_gconf_set_boolean (PREF_RESIZE_ASPECT_RATIO_INVERT, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("invert_ratio_checkbutton"))));
+ eel_gconf_set_boolean (PREF_RESIZE_HIGH_QUALITY, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("high_quality_checkbutton"))));
- /**/
+ /* destroy the options data */
+
+ _g_object_unref (self->priv->new_pixbuf);
+ _g_object_unref (self->priv->src_pixbuf);
+ _g_object_unref (self->priv->builder);
+ self->priv->new_pixbuf = NULL;
+ self->priv->src_pixbuf = NULL;
+ self->priv->builder = NULL;
+ }
window = gth_file_tool_get_window (GTH_FILE_TOOL (self));
viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
gth_image_viewer_set_tool (GTH_IMAGE_VIEWER (viewer), NULL);
-
- _g_object_unref (self->priv->new_pixbuf);
- _g_object_unref (self->priv->src_pixbuf);
- _g_object_unref (self->priv->builder);
-
- self->priv->new_pixbuf = NULL;
- self->priv->src_pixbuf = NULL;
- self->priv->builder = NULL;
}
diff --git a/extensions/file_tools/preferences.h b/extensions/file_tools/preferences.h
index 3b8fb48..93c3e43 100644
--- a/extensions/file_tools/preferences.h
+++ b/extensions/file_tools/preferences.h
@@ -27,15 +27,18 @@
G_BEGIN_DECLS
-#define PREF_CROP_GRID_TYPE "/apps/gthumb/ext/crop/grid_type"
-#define PREF_CROP_ASPECT_RATIO "/apps/gthumb/ext/crop/aspect_ratio"
-#define PREF_CROP_ASPECT_RATIO_INVERT "/apps/gthumb/ext/crop/aspect_ratio_invert"
-#define PREF_CROP_ASPECT_RATIO_WIDTH "/apps/gthumb/ext/crop/aspect_ratio_width"
-#define PREF_CROP_ASPECT_RATIO_HEIGHT "/apps/gthumb/ext/crop/aspect_ratio_height"
-
-#define PREF_RESIZE_UNIT "/apps/gthumb/ext/resize/unit"
-#define PREF_RESIZE_KEEP_ASPECT_RATIO "/apps/gthumb/ext/resize/keep_aspect_ratio"
-#define PREF_RESIZE_HIGH_QUALITY "/apps/gthumb/ext/resize/high_quality"
+#define PREF_CROP_GRID_TYPE "/apps/gthumb/ext/crop/grid_type"
+#define PREF_CROP_ASPECT_RATIO "/apps/gthumb/ext/crop/aspect_ratio"
+#define PREF_CROP_ASPECT_RATIO_INVERT "/apps/gthumb/ext/crop/aspect_ratio_invert"
+#define PREF_CROP_ASPECT_RATIO_WIDTH "/apps/gthumb/ext/crop/aspect_ratio_width"
+#define PREF_CROP_ASPECT_RATIO_HEIGHT "/apps/gthumb/ext/crop/aspect_ratio_height"
+
+#define PREF_RESIZE_UNIT "/apps/gthumb/ext/resize/unit"
+#define PREF_RESIZE_ASPECT_RATIO_WIDTH "/apps/gthumb/ext/resize/aspect_ratio_width"
+#define PREF_RESIZE_ASPECT_RATIO_HEIGHT "/apps/gthumb/ext/resize/aspect_ratio_height"
+#define PREF_RESIZE_ASPECT_RATIO "/apps/gthumb/ext/resize/aspect_ratio"
+#define PREF_RESIZE_ASPECT_RATIO_INVERT "/apps/gthumb/ext/resize/aspect_ratio_invert"
+#define PREF_RESIZE_HIGH_QUALITY "/apps/gthumb/ext/resize/high_quality"
G_END_DECLS
diff --git a/extensions/image_viewer/gth-image-viewer-page.c b/extensions/image_viewer/gth-image-viewer-page.c
index 2315100..6d7398d 100644
--- a/extensions/image_viewer/gth-image-viewer-page.c
+++ b/extensions/image_viewer/gth-image-viewer-page.c
@@ -922,7 +922,7 @@ _gth_image_viewer_page_set_pixbuf (GthImageViewerPage *self,
g_file_info_set_attribute_int32 (file_data->info, "image::width", width);
g_file_info_set_attribute_int32 (file_data->info, "image::height", height);
- size = g_strdup_printf ("%d x %d", width, height);
+ size = g_strdup_printf ("%d Ã? %d", width, height);
g_file_info_set_attribute_string (file_data->info, "general::dimensions", size);
gth_monitor_metadata_changed (gth_main_get_default_monitor (), file_data);
diff --git a/extensions/red_eye_removal/gth-file-tool-red-eye.c b/extensions/red_eye_removal/gth-file-tool-red-eye.c
index 4609746..9d0859d 100644
--- a/extensions/red_eye_removal/gth-file-tool-red-eye.c
+++ b/extensions/red_eye_removal/gth-file-tool-red-eye.c
@@ -417,7 +417,6 @@ gth_file_tool_red_eye_destroy_options (GthFileTool *base)
_g_object_unref (self->priv->builder);
_g_object_unref (self->priv->selector);
g_free (self->priv->is_red);
-
self->priv->builder = NULL;
self->priv->selector = NULL;
self->priv->is_red = NULL;
diff --git a/gthumb/typedefs.h b/gthumb/typedefs.h
index 4849c5d..2f64e59 100644
--- a/gthumb/typedefs.h
+++ b/gthumb/typedefs.h
@@ -101,6 +101,23 @@ typedef enum {
typedef enum {
+ GTH_ASPECT_RATIO_NONE = 0,
+ GTH_ASPECT_RATIO_SQUARE,
+ GTH_ASPECT_RATIO_IMAGE,
+ GTH_ASPECT_RATIO_DISPLAY,
+ GTH_ASPECT_RATIO_5x4,
+ GTH_ASPECT_RATIO_4x3,
+ GTH_ASPECT_RATIO_7x5,
+ GTH_ASPECT_RATIO_3x2,
+ GTH_ASPECT_RATIO_16x10,
+ GTH_ASPECT_RATIO_16x9,
+ GTH_ASPECT_RATIO_185x100,
+ GTH_ASPECT_RATIO_239x100,
+ GTH_ASPECT_RATIO_CUSTOM
+} GthAspectRatio;
+
+
+typedef enum {
GTH_OVERWRITE_SKIP,
GTH_OVERWRITE_RENAME,
GTH_OVERWRITE_ASK,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]