summaryrefslogtreecommitdiff
path: root/src/libexif/canon/mnote-canon-tag.c
blob: 447caab2501d65b9027bd48f485f57a36858afda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/* mnote-canon-tag.c
 *
 * Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#include <config.h>
#include "mnote-canon-tag.h"

#include <stdlib.h>

#include <libexif/i18n.h>

static const struct {
	MnoteCanonTag tag;
	const char *name;
	const char *title;
	const char *description;
} table[] = {
#ifndef NO_VERBOSE_TAG_STRINGS
	{MNOTE_CANON_TAG_SETTINGS_1, "Settings1", N_("Settings (first part)"), ""},
	{MNOTE_CANON_TAG_FOCAL_LENGTH, "FocalLength", N_("Focal length"), ""},
	{MNOTE_CANON_TAG_SETTINGS_2, "Settings2", N_("Settings (second part)"), ""},
	{MNOTE_CANON_TAG_PANORAMA, "Panorama", N_("Panorama"), ""},
	{MNOTE_CANON_TAG_IMAGE_TYPE, "ImageType", N_("Image type"), ""},
	{MNOTE_CANON_TAG_FIRMWARE, "FirmwareVersion", N_("Firmware version"), ""},
	{MNOTE_CANON_TAG_IMAGE_NUMBER, "ImageNumber", N_("Image number"), ""},
	{MNOTE_CANON_TAG_OWNER, "OwnerName", N_("Owner name"), ""},
	{MNOTE_CANON_TAG_COLOR_INFORMATION, "ColorInformation", N_("Color information"), ""},
	{MNOTE_CANON_TAG_SERIAL_NUMBER, "SerialNumber", N_("Serial number"), ""},
	{MNOTE_CANON_TAG_CUSTOM_FUNCS, "CustomFunctions", N_("Custom functions"), ""},
#endif
	{0, NULL, NULL, NULL}
};

static const struct {
	MnoteCanonTag tag;
	unsigned int subtag;
	const char *name;
} table_sub[] = {
#ifndef NO_VERBOSE_TAG_STRINGS
	{MNOTE_CANON_TAG_SETTINGS_1,  0, N_("Macro mode")},
	{MNOTE_CANON_TAG_SETTINGS_1,  1, N_("Self-timer")},
	{MNOTE_CANON_TAG_SETTINGS_1,  2, N_("Quality")},
	{MNOTE_CANON_TAG_SETTINGS_1,  3, N_("Flash mode")},
	{MNOTE_CANON_TAG_SETTINGS_1,  4, N_("Drive mode")},
	{MNOTE_CANON_TAG_SETTINGS_1,  6, N_("Focus mode")},
	{MNOTE_CANON_TAG_SETTINGS_1,  8, N_("Record mode")},
	{MNOTE_CANON_TAG_SETTINGS_1,  9, N_("Image size")},
	{MNOTE_CANON_TAG_SETTINGS_1, 10, N_("Easy shooting mode")},
	{MNOTE_CANON_TAG_SETTINGS_1, 11, N_("Digital zoom")},
	{MNOTE_CANON_TAG_SETTINGS_1, 12, N_("Contrast")},
	{MNOTE_CANON_TAG_SETTINGS_1, 13, N_("Saturation")},
	{MNOTE_CANON_TAG_SETTINGS_1, 14, N_("Sharpness")},
	{MNOTE_CANON_TAG_SETTINGS_1, 15, N_("ISO")},
	{MNOTE_CANON_TAG_SETTINGS_1, 16, N_("Metering mode")},
	{MNOTE_CANON_TAG_SETTINGS_1, 17, N_("Focus range")},
	{MNOTE_CANON_TAG_SETTINGS_1, 18, N_("AF point")},
	{MNOTE_CANON_TAG_SETTINGS_1, 19, N_("Exposure mode")},
	{MNOTE_CANON_TAG_SETTINGS_1, 21, N_("Lens type")},
	{MNOTE_CANON_TAG_SETTINGS_1, 22, N_("Long focal length of lens")},
	{MNOTE_CANON_TAG_SETTINGS_1, 23, N_("Short focal length of lens")},
	{MNOTE_CANON_TAG_SETTINGS_1, 24, N_("Focal units per mm")},
	{MNOTE_CANON_TAG_SETTINGS_1, 25, N_("Maximal aperture")},
	{MNOTE_CANON_TAG_SETTINGS_1, 26, N_("Minimal aperture")},
	{MNOTE_CANON_TAG_SETTINGS_1, 27, N_("Flash activity")},
	{MNOTE_CANON_TAG_SETTINGS_1, 28, N_("Flash details")},
	{MNOTE_CANON_TAG_SETTINGS_1, 31, N_("Focus mode")},
	{MNOTE_CANON_TAG_SETTINGS_1, 32, N_("AE setting")},
	{MNOTE_CANON_TAG_SETTINGS_1, 33, N_("Image stabilization")},
	{MNOTE_CANON_TAG_SETTINGS_1, 34, N_("Display aperture")},
	{MNOTE_CANON_TAG_SETTINGS_1, 35, N_("Zoom source width")},
	{MNOTE_CANON_TAG_SETTINGS_1, 36, N_("Zoom target width")},
	{MNOTE_CANON_TAG_SETTINGS_1, 39, N_("Photo effect")},
	{MNOTE_CANON_TAG_SETTINGS_1, 40, N_("Manual flash output")},
	{MNOTE_CANON_TAG_SETTINGS_1, 41, N_("Color tone")},
	{MNOTE_CANON_TAG_FOCAL_LENGTH, 0, N_("Focal type")},
	{MNOTE_CANON_TAG_FOCAL_LENGTH, 1, N_("Focal length")},
	{MNOTE_CANON_TAG_FOCAL_LENGTH, 2, N_("Focal plane x size")},
	{MNOTE_CANON_TAG_FOCAL_LENGTH, 3, N_("Focal plane y size")},
	{MNOTE_CANON_TAG_SETTINGS_2, 0, N_("Auto ISO")},
	{MNOTE_CANON_TAG_SETTINGS_2, 1, N_("Shot ISO")},
	{MNOTE_CANON_TAG_SETTINGS_2, 2, N_("Measured EV")},
	{MNOTE_CANON_TAG_SETTINGS_2, 3, N_("Target aperture")},
	{MNOTE_CANON_TAG_SETTINGS_2, 4, N_("Target exposure time")},
	{MNOTE_CANON_TAG_SETTINGS_2, 5, N_("Exposure compensation")},
	{MNOTE_CANON_TAG_SETTINGS_2, 6, N_("White balance")},
	{MNOTE_CANON_TAG_SETTINGS_2, 7, N_("Slow shutter")},
	{MNOTE_CANON_TAG_SETTINGS_2, 8, N_("Sequence number")},
	{MNOTE_CANON_TAG_SETTINGS_2, 12, N_("Flash guide number")},
	{MNOTE_CANON_TAG_SETTINGS_2, 13, N_("AF point")},
	{MNOTE_CANON_TAG_SETTINGS_2, 14, N_("Flash exposure compensation")},
	{MNOTE_CANON_TAG_SETTINGS_2, 15, N_("AE bracketing")},
	{MNOTE_CANON_TAG_SETTINGS_2, 16, N_("AE bracket value")},
	{MNOTE_CANON_TAG_SETTINGS_2, 18, N_("Focus distance upper")},
	{MNOTE_CANON_TAG_SETTINGS_2, 19, N_("Focus distance lower")},
	{MNOTE_CANON_TAG_SETTINGS_2, 20, N_("FNumber")},
	{MNOTE_CANON_TAG_SETTINGS_2, 21, N_("Exposure time")},
	{MNOTE_CANON_TAG_SETTINGS_2, 23, N_("Bulb duration")},
	{MNOTE_CANON_TAG_SETTINGS_2, 25, N_("Camera type")},
	{MNOTE_CANON_TAG_SETTINGS_2, 26, N_("Auto rotate")},
	{MNOTE_CANON_TAG_SETTINGS_2, 27, N_("ND filter")},
	{MNOTE_CANON_TAG_SETTINGS_2, 28, N_("Self-timer")},
	{MNOTE_CANON_TAG_SETTINGS_2, 32, N_("Manual flash output")},
	{MNOTE_CANON_TAG_PANORAMA, 2, N_("Panorama frame")},
	{MNOTE_CANON_TAG_PANORAMA, 5, N_("Panorama direction")},
	{MNOTE_CANON_TAG_COLOR_INFORMATION, 0, N_("Tone curve")},
	{MNOTE_CANON_TAG_COLOR_INFORMATION, 2, N_("Sharpness frequency")},
	{MNOTE_CANON_TAG_COLOR_INFORMATION, 7, N_("White balance")},
	{MNOTE_CANON_TAG_COLOR_INFORMATION, 9, N_("Picture style")},
#endif
	{0, 0, NULL}
};

const char *
mnote_canon_tag_get_name (MnoteCanonTag t)
{
	unsigned int i;

	for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
		if (table[i].tag == t) return table[i].name; /* do not translate */
	return NULL;
}

const char *
mnote_canon_tag_get_name_sub (MnoteCanonTag t, unsigned int s, ExifDataOption o)
{
	unsigned int i;
	int tag_found = 0;

	for (i = 0; i < sizeof (table_sub) / sizeof (table_sub[0]); i++) {
		if (table_sub[i].tag == t) {
			if (table_sub[i].subtag == s)
				return table_sub[i].name;
			tag_found = 1;
		}
	}
	if (!tag_found || !(o & EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS))
		return mnote_canon_tag_get_name (t);
	else
		return NULL;
}

const char *
mnote_canon_tag_get_title (MnoteCanonTag t)
{
	unsigned int i;

	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); 
	for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
		if (table[i].tag == t) return (_(table[i].title));
	return NULL;
}

const char *
mnote_canon_tag_get_title_sub (MnoteCanonTag t, unsigned int s, ExifDataOption o)
{
	unsigned int i;
	int tag_found = 0;

	for (i = 0; i < sizeof (table_sub) / sizeof (table_sub[0]); i++) {
		if (table_sub[i].tag == t) {
			if (table_sub[i].subtag == s)
				return _(table_sub[i].name);
			tag_found = 1;
		}
	}
	if (!tag_found || !(o & EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS))
		return mnote_canon_tag_get_title (t);
	else
		return NULL;
}

const char *
mnote_canon_tag_get_description (MnoteCanonTag t)
{
	unsigned int i;

	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
	for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
		if (table[i].tag == t) {
			if (!*table[i].description)
				return "";
			return (_(table[i].description));
		}
	return NULL;
}