Skip to content

Commit

Permalink
Change the prefix of formatted exif tags to a more explicit "formatte…
Browse files Browse the repository at this point in the history
…d." prefix

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.
  • Loading branch information
Laurent Monin committed May 3, 2008
1 parent e01df05 commit 1000ac5
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 46 deletions.
26 changes: 13 additions & 13 deletions src/bar_exif.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@
#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"},
Expand Down
2 changes: 1 addition & 1 deletion src/cache-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
53 changes: 26 additions & 27 deletions src/exif-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;
Expand All @@ -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;

Expand All @@ -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;
Expand All @@ -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;

Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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 = "";
Expand Down Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@

#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"
Expand Down
6 changes: 3 additions & 3 deletions src/preferences.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
));
Expand Down

0 comments on commit 1000ac5

Please sign in to comment.