Change the prefix of formatted exif tags to a more explicit "formatted." prefix
authorLaurent Monin <geeqie@norz.org>
Sat, 3 May 2008 20:40:50 +0000 (20:40 +0000)
committerLaurent Monin <geeqie@norz.org>
Sat, 3 May 2008 20:40:50 +0000 (20:40 +0000)
instead of the shorter "f".
Warning: custom overlay info string has to be modified since old names are no
more recognized, one can reset it to default through Preferences > Advanced.

src/bar_exif.c
src/cache-loader.c
src/exif-common.c
src/main.h
src/preferences.c

index d4398b8..100d91a 100644 (file)
 #define BAR_EXIF_DATA_COLUMN_WIDTH 250
 
 ExifUI ExifUIList[]={
-       { 0, 0, EXIF_UI_IFSET,  "fCamera"},
-       { 0, 0, EXIF_UI_IFSET,  "fDateTime"},
-       { 0, 0, EXIF_UI_IFSET,  "fShutterSpeed"},
-       { 0, 0, EXIF_UI_IFSET,  "fAperture"},
-       { 0, 0, EXIF_UI_IFSET,  "fExposureBias"},
-       { 0, 0, EXIF_UI_IFSET,  "fISOSpeedRating"},
-       { 0, 0, EXIF_UI_IFSET,  "fFocalLength"},
-       { 0, 0, EXIF_UI_IFSET,  "fFocalLength35mmFilm"},
-       { 0, 0, EXIF_UI_IFSET,  "fFlash"},
-       { 0, 0, EXIF_UI_IFSET,  "fSubjectDistance"},
+       { 0, 0, EXIF_UI_IFSET,  "formatted.Camera"},
+       { 0, 0, EXIF_UI_IFSET,  "formatted.DateTime"},
+       { 0, 0, EXIF_UI_IFSET,  "formatted.ShutterSpeed"},
+       { 0, 0, EXIF_UI_IFSET,  "formatted.Aperture"},
+       { 0, 0, EXIF_UI_IFSET,  "formatted.ExposureBias"},
+       { 0, 0, EXIF_UI_IFSET,  "formatted.ISOSpeedRating"},
+       { 0, 0, EXIF_UI_IFSET,  "formatted.FocalLength"},
+       { 0, 0, EXIF_UI_IFSET,  "formatted.FocalLength35mmFilm"},
+       { 0, 0, EXIF_UI_IFSET,  "formatted.Flash"},
+       { 0, 0, EXIF_UI_IFSET,  "formatted.SubjectDistance"},
        { 0, 0, EXIF_UI_IFSET,  "Exif.Photo.ExposureProgram"},
        { 0, 0, EXIF_UI_IFSET,  "Exif.Photo.MeteringMode"},
        { 0, 0, EXIF_UI_IFSET,  "Exif.Photo.LightSource"},
-       { 0, 0, EXIF_UI_IFSET,  "fColorProfile"},
-       { 0, 0, EXIF_UI_IFSET,  "fSubjectDistance"},
-       { 0, 0, EXIF_UI_IFSET,  "fResolution"},
+       { 0, 0, EXIF_UI_IFSET,  "formatted.ColorProfile"},
+       { 0, 0, EXIF_UI_IFSET,  "formatted.SubjectDistance"},
+       { 0, 0, EXIF_UI_IFSET,  "formatted.Resolution"},
        { 0, 0, EXIF_UI_IFSET,  "Exif.Image.Orientation"},
        { 0, 0, EXIF_UI_IFSET,  "Exif.Image.ImageDescription"},
        { 0, 0, EXIF_UI_IFSET,  "Exif.Image.Copyright"},
index cd6d81c..770955b 100644 (file)
@@ -131,7 +131,7 @@ static gboolean cache_loader_process(CacheLoader *cl)
                        {
                        gchar *text;
 
-                       text = exif_get_data_as_text(exif, "fDateTime");
+                       text = exif_get_data_as_text(exif, "formatted.DateTime");
                        if (text)
                                {
                                struct tm t = { 0 };
index 3c13575..d00ffe5 100644 (file)
@@ -131,7 +131,7 @@ static gint remove_suffix(gchar *str, const gchar *suffix, gint suffix_len)
        return TRUE;
 }
 
-static gchar *exif_build_fCamera(ExifData *exif)
+static gchar *exif_build_formatted_Camera(ExifData *exif)
 {
        gchar *text;
        gchar *make = exif_get_data_as_text(exif, "Exif.Image.Make");
@@ -184,7 +184,7 @@ static gchar *exif_build_fCamera(ExifData *exif)
        return text;
 }
 
-static gchar *exif_build_fDateTime(ExifData *exif)
+static gchar *exif_build_formatted_DateTime(ExifData *exif)
 {
        gchar *text = exif_get_data_as_text(exif, "Exif.Photo.DateTimeOriginal");
        gchar *subsec = NULL;
@@ -205,7 +205,7 @@ static gchar *exif_build_fDateTime(ExifData *exif)
        return text;
 }
 
-static gchar *exif_build_fShutterSpeed(ExifData *exif)
+static gchar *exif_build_formatted_ShutterSpeed(ExifData *exif)
 {
        ExifRational *r;
 
@@ -230,7 +230,7 @@ static gchar *exif_build_fShutterSpeed(ExifData *exif)
        return NULL;
 }
 
-static gchar *exif_build_fAperture(ExifData *exif)
+static gchar *exif_build_formatted_Aperture(ExifData *exif)
 {
        double n;
 
@@ -241,7 +241,7 @@ static gchar *exif_build_fAperture(ExifData *exif)
        return g_strdup_printf("f/%.1f", n);
 }
 
-static gchar *exif_build_fExposureBias(ExifData *exif)
+static gchar *exif_build_formatted_ExposureBias(ExifData *exif)
 {
        ExifRational *r;
        gint sign;
@@ -254,7 +254,7 @@ static gchar *exif_build_fExposureBias(ExifData *exif)
        return g_strdup_printf("%+.1f", n);
 }
 
-static gchar *exif_build_fFocalLength(ExifData *exif)
+static gchar *exif_build_formatted_FocalLength(ExifData *exif)
 {
        double n;
 
@@ -263,7 +263,7 @@ static gchar *exif_build_fFocalLength(ExifData *exif)
        return g_strdup_printf("%.0f mm", n);
 }
 
-static gchar *exif_build_fFocalLength35mmFilm(ExifData *exif)
+static gchar *exif_build_formatted_FocalLength35mmFilm(ExifData *exif)
 {
        gint n;
        double f, c;
@@ -284,7 +284,7 @@ static gchar *exif_build_fFocalLength35mmFilm(ExifData *exif)
        return NULL;
 }
 
-static gchar *exif_build_fISOSpeedRating(ExifData *exif)
+static gchar *exif_build_formatted_ISOSpeedRating(ExifData *exif)
 {
        gchar *text;
 
@@ -294,7 +294,7 @@ static gchar *exif_build_fISOSpeedRating(ExifData *exif)
        return text;
 }
 
-static gchar *exif_build_fSubjectDistance(ExifData *exif)
+static gchar *exif_build_formatted_SubjectDistance(ExifData *exif)
 {
        ExifRational *r;
        gint sign;
@@ -311,7 +311,7 @@ static gchar *exif_build_fSubjectDistance(ExifData *exif)
        return g_strdup_printf("%.3f m", n);
 }
 
-static gchar *exif_build_fFlash(ExifData *exif)
+static gchar *exif_build_formatted_Flash(ExifData *exif)
 {
        /* grr, flash is a bitmask... */
        GString *string;
@@ -361,7 +361,7 @@ static gchar *exif_build_fFlash(ExifData *exif)
        return text;
 }
 
-static gchar *exif_build_fResolution(ExifData *exif)
+static gchar *exif_build_formatted_Resolution(ExifData *exif)
 {
        ExifRational *rx, *ry;
        gchar *units;
@@ -380,7 +380,7 @@ static gchar *exif_build_fResolution(ExifData *exif)
        return text;
 }
 
-static gchar *exif_build_fColorProfile(ExifData *exif)
+static gchar *exif_build_formatted_ColorProfile(ExifData *exif)
 {
        const gchar *name = "";
        const gchar *source = "";
@@ -434,28 +434,27 @@ static gchar *exif_build_fColorProfile(ExifData *exif)
 
 
 /* List of custom formatted pseudo-exif tags */
-#define EXIF_FORMATTED_TAG(name, label) { #name, label, exif_build##_##name }
+#define EXIF_FORMATTED_TAG(name, label) { "formatted."#name, label, exif_build_formatted##_##name }
 
 ExifFormattedText ExifFormattedList[] = {
-       EXIF_FORMATTED_TAG(fCamera,             N_("Camera")),
-       EXIF_FORMATTED_TAG(fDateTime,           N_("Date")),
-       EXIF_FORMATTED_TAG(fShutterSpeed,       N_("Shutter speed")),
-       EXIF_FORMATTED_TAG(fAperture,           N_("Aperture")),
-       EXIF_FORMATTED_TAG(fExposureBias,       N_("Exposure bias")),
-       EXIF_FORMATTED_TAG(fISOSpeedRating,     N_("ISO sensitivity")),
-       EXIF_FORMATTED_TAG(fFocalLength,        N_("Focal length")),
-       EXIF_FORMATTED_TAG(fFocalLength35mmFilm,N_("Focal length 35mm")),
-       EXIF_FORMATTED_TAG(fSubjectDistance,    N_("Subject distance")),
-       EXIF_FORMATTED_TAG(fFlash,              N_("Flash")),
-       EXIF_FORMATTED_TAG(fResolution,         N_("Resolution")),
-       EXIF_FORMATTED_TAG(fColorProfile,       N_("Color profile")),
+       EXIF_FORMATTED_TAG(Camera,              N_("Camera")),
+       EXIF_FORMATTED_TAG(DateTime,            N_("Date")),
+       EXIF_FORMATTED_TAG(ShutterSpeed,        N_("Shutter speed")),
+       EXIF_FORMATTED_TAG(Aperture,            N_("Aperture")),
+       EXIF_FORMATTED_TAG(ExposureBias,        N_("Exposure bias")),
+       EXIF_FORMATTED_TAG(ISOSpeedRating,      N_("ISO sensitivity")),
+       EXIF_FORMATTED_TAG(FocalLength,         N_("Focal length")),
+       EXIF_FORMATTED_TAG(FocalLength35mmFilm, N_("Focal length 35mm")),
+       EXIF_FORMATTED_TAG(SubjectDistance,     N_("Subject distance")),
+       EXIF_FORMATTED_TAG(Flash,               N_("Flash")),
+       EXIF_FORMATTED_TAG(Resolution,          N_("Resolution")),
+       EXIF_FORMATTED_TAG(ColorProfile,        N_("Color profile")),
        { NULL, NULL, NULL }
 };
 
 gchar *exif_get_formatted_by_key(ExifData *exif, const gchar *key, gint *key_valid)
 {
-       /* must begin with f, else not formatted */
-       if (key[0] == 'f')
+       if (strncmp(key, "formatted.", 10) == 0)
                {
                gint i;
 
index 5d3754e..0d7a6e5 100644 (file)
 
 #define DEFAULT_OVERLAY_INFO   "%collection%(%number%/%total%) [%zoom%] <b>%name%</b>\n" \
                                "%res%|%date%|%size%\n" \
-                               "%fAperture%|%fShutterSpeed%|%fISOSpeedRating%|%fFocalLength%|%fExposureBias%\n" \
-                               "%fCamera%|%fFlash%" \
+                               "%formatted.Aperture%|%formatted.ShutterSpeed%|%formatted.ISOSpeedRating%|%formatted.FocalLength%|%formatted.ExposureBias%\n" \
+                               "%formatted.Camera%|%formatted.Flash%" \
 
 
 #include "typedefs.h"
index fb22219..83c6714 100644 (file)
@@ -1339,11 +1339,11 @@ static void config_tab_advanced(GtkWidget *notebook)
        _("<i>%name%</i> results in the filename of the picture.\n"
          "Also available: <i>%collection%</i>, <i>%number%</i>, <i>%total%</i>, <i>%date%</i>,\n"
          "<i>%size%</i> (filesize), <i>%width%</i>, <i>%height%</i>, <i>%res%</i> (resolution)\n"
-         "To access exif data use the exif name, e. g. <i>%fCamera%</i> is the formatted camera name,\n"
+         "To access exif data use the exif name, e. g. <i>%formatted.Camera%</i> is the formatted camera name,\n"
          "<i>%Exif.Photo.DateTimeOriginal%</i> the date of the original shot.\n"
-         "<i>%fCamera:20</i> notation will truncate the displayed data to 20 characters and will add 3 dots at the end to denote the truncation.\n"
+         "<i>%formatted.Camera:20</i> notation will truncate the displayed data to 20 characters and will add 3 dots at the end to denote the truncation.\n"
          "If two or more variables are connected with the |-sign, it prints available variables with a separator.\n"
-         "<i>%fShutterSpeed%</i>|<i>%fISOSpeedRating%</i>|<i>%fFocalLength%</i> could show \"1/20s - 400 - 80 mm\" or \"1/200 - 80 mm\",\n"
+         "<i>%formatted.ShutterSpeed%</i>|<i>%formatted.ISOSpeedRating%</i>|<i>%formatted.FocalLength%</i> could show \"1/20s - 400 - 80 mm\" or \"1/200 - 80 mm\",\n"
          "if there's no ISO information in the Exif data.\n"
          "If a line is empty, it is removed. This allows to add lines that totally disappear when no data is available.\n"
 ));