1 /* mnote-canon-tag.c 2 * 3 * Copyright (c) 2002 Lutz Mueller <lutz (at) users.sourceforge.net> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the 17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301 USA. 19 */ 20 21 #include <config.h> 22 #include "mnote-canon-tag.h" 23 24 #include <stdlib.h> 25 26 #include <libexif/i18n.h> 27 28 static const struct { 29 MnoteCanonTag tag; 30 const char *name; 31 const char *title; 32 const char *description; 33 } table[] = { 34 #ifndef NO_VERBOSE_TAG_STRINGS 35 {MNOTE_CANON_TAG_SETTINGS_1, "Settings1", N_("Settings (First Part)"), ""}, 36 {MNOTE_CANON_TAG_FOCAL_LENGTH, "FocalLength", N_("Focal Length"), ""}, 37 {MNOTE_CANON_TAG_SETTINGS_2, "Settings2", N_("Settings (Second Part)"), ""}, 38 {MNOTE_CANON_TAG_PANORAMA, "Panorama", N_("Panorama"), ""}, 39 {MNOTE_CANON_TAG_IMAGE_TYPE, "ImageType", N_("Image Type"), ""}, 40 {MNOTE_CANON_TAG_FIRMWARE, "FirmwareVersion", N_("Firmware Version"), ""}, 41 {MNOTE_CANON_TAG_IMAGE_NUMBER, "ImageNumber", N_("Image Number"), ""}, 42 {MNOTE_CANON_TAG_OWNER, "OwnerName", N_("Owner Name"), ""}, 43 {MNOTE_CANON_TAG_COLOR_INFORMATION, "ColorInformation", N_("Color Information"), ""}, 44 {MNOTE_CANON_TAG_SERIAL_NUMBER, "SerialNumber", N_("Serial Number"), ""}, 45 {MNOTE_CANON_TAG_CUSTOM_FUNCS, "CustomFunctions", N_("Custom Functions"), ""}, 46 #endif 47 {0, NULL, NULL, NULL} 48 }; 49 50 static const struct { 51 MnoteCanonTag tag; 52 unsigned int subtag; 53 const char *name; 54 } table_sub[] = { 55 #ifndef NO_VERBOSE_TAG_STRINGS 56 {MNOTE_CANON_TAG_SETTINGS_1, 0, N_("Macro Mode")}, 57 {MNOTE_CANON_TAG_SETTINGS_1, 1, N_("Self-timer")}, 58 {MNOTE_CANON_TAG_SETTINGS_1, 2, N_("Quality")}, 59 {MNOTE_CANON_TAG_SETTINGS_1, 3, N_("Flash Mode")}, 60 {MNOTE_CANON_TAG_SETTINGS_1, 4, N_("Drive Mode")}, 61 {MNOTE_CANON_TAG_SETTINGS_1, 6, N_("Focus Mode")}, 62 {MNOTE_CANON_TAG_SETTINGS_1, 8, N_("Record Mode")}, 63 {MNOTE_CANON_TAG_SETTINGS_1, 9, N_("Image Size")}, 64 {MNOTE_CANON_TAG_SETTINGS_1, 10, N_("Easy Shooting Mode")}, 65 {MNOTE_CANON_TAG_SETTINGS_1, 11, N_("Digital Zoom")}, 66 {MNOTE_CANON_TAG_SETTINGS_1, 12, N_("Contrast")}, 67 {MNOTE_CANON_TAG_SETTINGS_1, 13, N_("Saturation")}, 68 {MNOTE_CANON_TAG_SETTINGS_1, 14, N_("Sharpness")}, 69 {MNOTE_CANON_TAG_SETTINGS_1, 15, N_("ISO")}, 70 {MNOTE_CANON_TAG_SETTINGS_1, 16, N_("Metering Mode")}, 71 {MNOTE_CANON_TAG_SETTINGS_1, 17, N_("Focus Range")}, 72 {MNOTE_CANON_TAG_SETTINGS_1, 18, N_("AF Point")}, 73 {MNOTE_CANON_TAG_SETTINGS_1, 19, N_("Exposure Mode")}, 74 {MNOTE_CANON_TAG_SETTINGS_1, 21, N_("Lens Type")}, 75 {MNOTE_CANON_TAG_SETTINGS_1, 22, N_("Long Focal Length of Lens")}, 76 {MNOTE_CANON_TAG_SETTINGS_1, 23, N_("Short Focal Length of Lens")}, 77 {MNOTE_CANON_TAG_SETTINGS_1, 24, N_("Focal Units per mm")}, 78 {MNOTE_CANON_TAG_SETTINGS_1, 25, N_("Maximal Aperture")}, 79 {MNOTE_CANON_TAG_SETTINGS_1, 26, N_("Minimal Aperture")}, 80 {MNOTE_CANON_TAG_SETTINGS_1, 27, N_("Flash Activity")}, 81 {MNOTE_CANON_TAG_SETTINGS_1, 28, N_("Flash Details")}, 82 {MNOTE_CANON_TAG_SETTINGS_1, 31, N_("Focus Mode")}, 83 {MNOTE_CANON_TAG_SETTINGS_1, 32, N_("AE Setting")}, 84 {MNOTE_CANON_TAG_SETTINGS_1, 33, N_("Image Stabilization")}, 85 {MNOTE_CANON_TAG_SETTINGS_1, 34, N_("Display Aperture")}, 86 {MNOTE_CANON_TAG_SETTINGS_1, 35, N_("Zoom Source Width")}, 87 {MNOTE_CANON_TAG_SETTINGS_1, 36, N_("Zoom Target Width")}, 88 {MNOTE_CANON_TAG_SETTINGS_1, 39, N_("Photo Effect")}, 89 {MNOTE_CANON_TAG_SETTINGS_1, 40, N_("Manual Flash Output")}, 90 {MNOTE_CANON_TAG_SETTINGS_1, 41, N_("Color Tone")}, 91 {MNOTE_CANON_TAG_FOCAL_LENGTH, 0, N_("Focal Type")}, 92 {MNOTE_CANON_TAG_FOCAL_LENGTH, 1, N_("Focal Length")}, 93 {MNOTE_CANON_TAG_FOCAL_LENGTH, 2, N_("Focal Plane X Size")}, 94 {MNOTE_CANON_TAG_FOCAL_LENGTH, 3, N_("Focal Plane Y Size")}, 95 {MNOTE_CANON_TAG_SETTINGS_2, 0, N_("Auto ISO")}, 96 {MNOTE_CANON_TAG_SETTINGS_2, 1, N_("Shot ISO")}, 97 {MNOTE_CANON_TAG_SETTINGS_2, 2, N_("Measured EV")}, 98 {MNOTE_CANON_TAG_SETTINGS_2, 3, N_("Target Aperture")}, 99 {MNOTE_CANON_TAG_SETTINGS_2, 4, N_("Target Exposure Time")}, 100 {MNOTE_CANON_TAG_SETTINGS_2, 5, N_("Exposure Compensation")}, 101 {MNOTE_CANON_TAG_SETTINGS_2, 6, N_("White Balance")}, 102 {MNOTE_CANON_TAG_SETTINGS_2, 7, N_("Slow Shutter")}, 103 {MNOTE_CANON_TAG_SETTINGS_2, 8, N_("Sequence Number")}, 104 {MNOTE_CANON_TAG_SETTINGS_2, 12, N_("Flash Guide Number")}, 105 {MNOTE_CANON_TAG_SETTINGS_2, 13, N_("AF Point")}, 106 {MNOTE_CANON_TAG_SETTINGS_2, 14, N_("Flash Exposure Compensation")}, 107 {MNOTE_CANON_TAG_SETTINGS_2, 15, N_("AE Bracketing")}, 108 {MNOTE_CANON_TAG_SETTINGS_2, 16, N_("AE Bracket Value")}, 109 {MNOTE_CANON_TAG_SETTINGS_2, 18, N_("Focus Distance Upper")}, 110 {MNOTE_CANON_TAG_SETTINGS_2, 19, N_("Focus Distance Lower")}, 111 {MNOTE_CANON_TAG_SETTINGS_2, 20, N_("FNumber")}, 112 {MNOTE_CANON_TAG_SETTINGS_2, 21, N_("Exposure Time")}, 113 {MNOTE_CANON_TAG_SETTINGS_2, 23, N_("Bulb Duration")}, 114 {MNOTE_CANON_TAG_SETTINGS_2, 25, N_("Camera Type")}, 115 {MNOTE_CANON_TAG_SETTINGS_2, 26, N_("Auto Rotate")}, 116 {MNOTE_CANON_TAG_SETTINGS_2, 27, N_("ND Filter")}, 117 {MNOTE_CANON_TAG_SETTINGS_2, 28, N_("Self-timer")}, 118 {MNOTE_CANON_TAG_SETTINGS_2, 32, N_("Manual Flash Output")}, 119 {MNOTE_CANON_TAG_PANORAMA, 2, N_("Panorama Frame")}, 120 {MNOTE_CANON_TAG_PANORAMA, 5, N_("Panorama Direction")}, 121 {MNOTE_CANON_TAG_COLOR_INFORMATION, 0, N_("Tone Curve")}, 122 {MNOTE_CANON_TAG_COLOR_INFORMATION, 2, N_("Sharpness Frequency")}, 123 {MNOTE_CANON_TAG_COLOR_INFORMATION, 7, N_("White Balance")}, 124 {MNOTE_CANON_TAG_COLOR_INFORMATION, 9, N_("Picture Style")}, 125 #endif 126 {0, 0, NULL} 127 }; 128 129 const char * 130 mnote_canon_tag_get_name (MnoteCanonTag t) 131 { 132 unsigned int i; 133 134 for (i = 0; i < sizeof (table) / sizeof (table[0]); i++) 135 if (table[i].tag == t) return table[i].name; /* do not translate */ 136 return NULL; 137 } 138 139 const char * 140 mnote_canon_tag_get_name_sub (MnoteCanonTag t, unsigned int s, ExifDataOption o) 141 { 142 unsigned int i; 143 int tag_found = 0; 144 145 for (i = 0; i < sizeof (table_sub) / sizeof (table_sub[0]); i++) { 146 if (table_sub[i].tag == t) { 147 if (table_sub[i].subtag == s) 148 return table_sub[i].name; 149 tag_found = 1; 150 } 151 } 152 if (!tag_found || !(o & EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS)) 153 return mnote_canon_tag_get_name (t); 154 else 155 return NULL; 156 } 157 158 const char * 159 mnote_canon_tag_get_title (MnoteCanonTag t) 160 { 161 unsigned int i; 162 163 bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); 164 for (i = 0; i < sizeof (table) / sizeof (table[0]); i++) 165 if (table[i].tag == t) return (_(table[i].title)); 166 return NULL; 167 } 168 169 const char * 170 mnote_canon_tag_get_title_sub (MnoteCanonTag t, unsigned int s, ExifDataOption o) 171 { 172 unsigned int i; 173 int tag_found = 0; 174 175 for (i = 0; i < sizeof (table_sub) / sizeof (table_sub[0]); i++) { 176 if (table_sub[i].tag == t) { 177 if (table_sub[i].subtag == s) 178 return _(table_sub[i].name); 179 tag_found = 1; 180 } 181 } 182 if (!tag_found || !(o & EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS)) 183 return mnote_canon_tag_get_title (t); 184 else 185 return NULL; 186 } 187 188 const char * 189 mnote_canon_tag_get_description (MnoteCanonTag t) 190 { 191 unsigned int i; 192 193 for (i = 0; i < sizeof (table) / sizeof (table[0]); i++) 194 if (table[i].tag == t) { 195 if (!table[i].description || !*table[i].description) 196 return ""; 197 bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); 198 return _(table[i].description); 199 } 200 return NULL; 201 } 202