gthumb r2379 - in trunk: . data data/glade libgthumb src
- From: mjc svn gnome org
- To: svn-commits-list gnome org
- Subject: gthumb r2379 - in trunk: . data data/glade libgthumb src
- Date: Tue, 5 Aug 2008 13:01:22 +0000 (UTC)
Author: mjc
Date: Tue Aug 5 13:01:22 2008
New Revision: 2379
URL: http://svn.gnome.org/viewvc/gthumb?rev=2379&view=rev
Log:
2008-08-05 Michael J. Chudobiak <mjc svn gnome org>
* NEWS:
* data/glade/gthumb_tools.glade:
* data/gthumb.schemas.in:
* libgthumb/async-pixbuf-ops.c: (scale_step), (_gdk_pixbuf_scale):
* libgthumb/async-pixbuf-ops.h:
* libgthumb/preferences.h:
* src/dlg-scale-series.c: (ok_cb), (dlg_scale_series):
Allow swapping of height and width during scale-series for
best fit. Bug #507216. Tweaked version of the patch by
Roman Ovseytsev <romovs gmail com>.
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/data/glade/gthumb_tools.glade
trunk/data/gthumb.schemas.in
trunk/libgthumb/async-pixbuf-ops.c
trunk/libgthumb/async-pixbuf-ops.h
trunk/libgthumb/preferences.h
trunk/src/dlg-scale-series.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Tue Aug 5 13:01:22 2008
@@ -34,6 +34,8 @@
adjust step)
* Added preference to ignore audio and video files. Bug #467468.
* Made UI for selecting a web album theme more obvious. Bug #501570.
+ * Allow swapping of height and width during scale-series for
+ best fit. Bug #507216.
Bugfixes:
Modified: trunk/data/glade/gthumb_tools.glade
==============================================================================
--- trunk/data/glade/gthumb_tools.glade (original)
+++ trunk/data/glade/gthumb_tools.glade Tue Aug 5 13:01:22 2008
@@ -3204,6 +3204,25 @@
<property name="fill">False</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkCheckButton" id="ss_allow_swap_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes" context="yes">Swap height and width for best _fit</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">True</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
Modified: trunk/data/gthumb.schemas.in
==============================================================================
--- trunk/data/gthumb.schemas.in (original)
+++ trunk/data/gthumb.schemas.in Tue Aug 5 13:01:22 2008
@@ -1597,6 +1597,19 @@
</locale>
</schema>
+ <schema>
+ <key>/schemas/apps/gthumb/dialogs/scale_series/allow_swap_width_height</key>
+ <applyto>/apps/gthumb/dialogs/scale_series/allow_swap_width_height</applyto>
+ <owner>gthumb</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short></short>
+ <long>
+ </long>
+ </locale>
+ </schema>
+
<!-- Web Album -->
<schema>
Modified: trunk/libgthumb/async-pixbuf-ops.c
==============================================================================
--- trunk/libgthumb/async-pixbuf-ops.c (original)
+++ trunk/libgthumb/async-pixbuf-ops.c Tue Aug 5 13:01:22 2008
@@ -1556,6 +1556,7 @@
typedef struct {
gboolean percentage;
gboolean keep_ratio;
+ gboolean allow_swap;
int width;
int height;
} ScaleData;
@@ -1567,22 +1568,32 @@
ScaleData *data = pixop->data;
int w, h;
int new_w, new_h;
+ int max_w, max_h;
w = gdk_pixbuf_get_width (pixop->src);
h = gdk_pixbuf_get_height (pixop->src);
+ if (data->allow_swap && ((h > w && data->width > data->height) ||
+ (h < w && data->width < data->height))) {
+ max_w = data->height;
+ max_h = data->width;
+ } else {
+ max_w = data->width;
+ max_h = data->height;
+ }
+
if (data->percentage) {
- new_w = w * ((double)data->width / 100.0);
- new_h = h * ((double)data->height / 100.0);
+ new_w = w * ((double)max_w / 100.0);
+ new_h = h * ((double)max_h / 100.0);
} else if (data->keep_ratio) {
new_w = w;
new_h = h;
scale_keeping_ratio (&new_w, &new_h,
- data->width, data->height,
+ max_w, max_h,
TRUE);
} else {
- new_w = data->width;
- new_h = data->height;
+ new_w = max_w;
+ new_h = max_h;
}
if ((new_w > 1) && (new_h > 1)) {
@@ -1606,6 +1617,7 @@
GdkPixbuf *dest,
gboolean percentage,
gboolean keep_ratio,
+ gboolean allow_swap,
int width,
int height)
{
@@ -1615,6 +1627,7 @@
data = g_new0 (ScaleData, 1);
data->percentage = percentage;
data->keep_ratio = keep_ratio;
+ data->allow_swap = allow_swap;
data->width = width;
data->height = height;
Modified: trunk/libgthumb/async-pixbuf-ops.h
==============================================================================
--- trunk/libgthumb/async-pixbuf-ops.h (original)
+++ trunk/libgthumb/async-pixbuf-ops.h Tue Aug 5 13:01:22 2008
@@ -70,6 +70,7 @@
GdkPixbuf *dest,
gboolean percentage,
gboolean keep_ratio,
+ gboolean allow_swap,
int width,
int height);
Modified: trunk/libgthumb/preferences.h
==============================================================================
--- trunk/libgthumb/preferences.h (original)
+++ trunk/libgthumb/preferences.h Tue Aug 5 13:01:22 2008
@@ -168,6 +168,7 @@
#define PREF_SCALE_SERIES_WIDTH "/apps/gthumb/dialogs/scale_series/width"
#define PREF_SCALE_SERIES_HEIGHT "/apps/gthumb/dialogs/scale_series/height"
+#define PREF_SCALE_SERIES_ALLOW_SWAP "/apps/gthumb/dialogs/scale_series/allow_swap_width_height"
#define PREF_WEB_ALBUM_DESTINATION "/apps/gthumb/dialogs/web_album/destination"
#define PREF_WEB_ALBUM_DESTINATIONS "/apps/gthumb/dialogs/web_album/destinations"
Modified: trunk/src/dlg-scale-series.c
==============================================================================
--- trunk/src/dlg-scale-series.c (original)
+++ trunk/src/dlg-scale-series.c Tue Aug 5 13:01:22 2008
@@ -71,6 +71,7 @@
GtkWidget *ss_height_spinbutton;
GtkWidget *ss_unit_optionmenu;
GtkWidget *ss_keep_ratio_checkbutton;
+ GtkWidget *ss_allow_swap_checkbutton;
GtkWidget *ss_dest_filechooserbutton;
GtkWidget *ss_om_combobox;
GtkWidget *ss_remove_orig_checkbutton;
@@ -111,7 +112,7 @@
DialogData *data)
{
GthPixbufOp *pixop;
- gboolean keep_ratio;
+ gboolean keep_ratio, allow_swap;
int width, height;
#define is_active(x) gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (x))
@@ -149,6 +150,9 @@
keep_ratio = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->ss_keep_ratio_checkbutton));
eel_gconf_set_boolean (PREF_SCALE_KEEP_RATIO, keep_ratio);
+ allow_swap = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->ss_allow_swap_checkbutton));
+ eel_gconf_set_boolean (PREF_SCALE_SERIES_ALLOW_SWAP, allow_swap);
+
width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (data->ss_width_spinbutton));
eel_gconf_set_integer (PREF_SCALE_SERIES_WIDTH, width);
@@ -160,6 +164,7 @@
pixop = _gdk_pixbuf_scale (NULL, NULL,
data->percentage,
keep_ratio,
+ allow_swap,
width,
height);
data->bop = gth_batch_op_new (pixop, data);
@@ -242,6 +247,7 @@
data->ss_width_spinbutton = glade_xml_get_widget (data->gui, "ss_width_spinbutton");
data->ss_height_spinbutton = glade_xml_get_widget (data->gui, "ss_height_spinbutton");
data->ss_keep_ratio_checkbutton = glade_xml_get_widget (data->gui, "ss_keep_ratio_checkbutton");
+ data->ss_allow_swap_checkbutton = glade_xml_get_widget (data->gui, "ss_allow_swap_checkbutton");
data->ss_unit_optionmenu = glade_xml_get_widget (data->gui, "ss_unit_optionmenu");
data->ss_jpeg_radiobutton = glade_xml_get_widget (data->gui, "ss_jpeg_radiobutton");
data->ss_png_radiobutton = glade_xml_get_widget (data->gui, "ss_png_radiobutton");
@@ -278,6 +284,8 @@
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->ss_keep_ratio_checkbutton),
eel_gconf_get_boolean (PREF_SCALE_KEEP_RATIO, TRUE));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->ss_allow_swap_checkbutton),
+ eel_gconf_get_boolean (PREF_SCALE_SERIES_ALLOW_SWAP, TRUE));
/* image type */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]