gthumb r2230 - in trunk: . libgthumb
- From: mjc svn gnome org
- To: svn-commits-list gnome org
- Subject: gthumb r2230 - in trunk: . libgthumb
- Date: Tue, 29 Jan 2008 14:34:59 +0000 (GMT)
Author: mjc
Date: Tue Jan 29 14:34:58 2008
New Revision: 2230
URL: http://svn.gnome.org/viewvc/gthumb?rev=2230&view=rev
Log:
2008-01-29 Michael J. Chudobiak <mjc svn gnome org>
* libgthumb/gth-exiv2-utils.cpp:
Further tweaks to the way fractions are displayed.
Modified:
trunk/ChangeLog
trunk/libgthumb/gth-exiv2-utils.cpp
Modified: trunk/libgthumb/gth-exiv2-utils.cpp
==============================================================================
--- trunk/libgthumb/gth-exiv2-utils.cpp (original)
+++ trunk/libgthumb/gth-exiv2-utils.cpp Tue Jan 29 14:34:58 2008
@@ -350,13 +350,16 @@
for (int i(0); i < res.size(); ++i) {
int a, b;
if (sscanf ( res[i].c_str(), "%d/%d", &a, &b) == 2) {
- // Convert fractional data like 123/246 to a decimal
- // value like 0.5.
- stream << (float)a/(float)b << " ";
- if (b != 1)
- // Include the original fraction, unless the
- // denominator was "1".
- stream << "(" << res[i] << ") ";
+ // Format fractional data in a user-friendly way
+ if (b == 1)
+ // example: "255/1" -> "255"
+ stream << a << " ";
+ else if (a == 1)
+ // example: "1/60" -> "1/60"
+ stream << res[i] << " ";
+ else
+ // example: "17/40" -> "0.425 (17/40)"
+ stream << (float)a/(float)b << " (" << res[i] << ") ";
}
else stream << res[i] << " ";
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]