comparison src/preferences.c @ 222:77f1bcc6c161

various exif improvements based on patch by Uwe Ohse try to compute 35mm focal length
author nadvornik
date Wed, 02 Apr 2008 20:44:40 +0000
parents f4a0555794a9
children 73efc1ba150f
comparison
equal deleted inserted replaced
221:79ef86f3b325 222:77f1bcc6c161
26 #include "utilops.h" 26 #include "utilops.h"
27 #include "ui_fileops.h" 27 #include "ui_fileops.h"
28 #include "ui_misc.h" 28 #include "ui_misc.h"
29 #include "ui_tabcomp.h" 29 #include "ui_tabcomp.h"
30 #include "ui_utildlg.h" 30 #include "ui_utildlg.h"
31 #include "bar_exif.h"
32 #include "exif.h"
31 33
32 #include <math.h> 34 #include <math.h>
33 35
34 36
35 #define EDITOR_NAME_MAX_LENGTH 32 37 #define EDITOR_NAME_MAX_LENGTH 32
328 color_profile_screen_file = NULL; 330 color_profile_screen_file = NULL;
329 buf = gtk_entry_get_text(GTK_ENTRY(color_profile_screen_file_entry)); 331 buf = gtk_entry_get_text(GTK_ENTRY(color_profile_screen_file_entry));
330 if (buf && strlen(buf) > 0) color_profile_screen_file = g_strdup(buf); 332 if (buf && strlen(buf) > 0) color_profile_screen_file = g_strdup(buf);
331 #endif 333 #endif
332 334
335 for (i=0; ExifUIList[i].key; i++)
336 {
337 ExifUIList[i].current = ExifUIList[i].temp;
338 }
339
333 l_conf = layout_config_get(layout_widget, &new_style); 340 l_conf = layout_config_get(layout_widget, &new_style);
334 341
335 if (new_style != layout_style || 342 if (new_style != layout_style ||
336 (l_conf == NULL) != (layout_order == NULL) || 343 (l_conf == NULL) != (layout_order == NULL) ||
337 !layout_order || 344 !layout_order ||
393 /* 400 /*
394 *----------------------------------------------------------------------------- 401 *-----------------------------------------------------------------------------
395 * config window setup (private) 402 * config window setup (private)
396 *----------------------------------------------------------------------------- 403 *-----------------------------------------------------------------------------
397 */ 404 */
405
406 static void exif_item_cb(GtkWidget *combo, gpointer data)
407 {
408 gint *option = data;
409 *option = gtk_combo_box_get_active(GTK_COMBO_BOX(combo));
410 }
411
412 static void exif_item(GtkWidget *table, gint column, gint row,
413 const gchar *text, gint option, gint *option_c)
414 {
415 GtkWidget *combo;
416 gint current = 0;
417
418 *option_c = option;
419
420 pref_table_label(table, column, row, text, 0.0);
421
422 combo = gtk_combo_box_new_text();
423
424 /* note: the order is important, it must match the values of
425 * EXIF_UI_OFF, _IFSET, _ON */
426 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Never"));
427 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("If set"));
428 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Always"));
429
430 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), option);
431
432 g_signal_connect(G_OBJECT(combo), "changed",
433 G_CALLBACK(exif_item_cb), option_c);
434
435 gtk_table_attach(GTK_TABLE(table), combo,
436 column + 1, column + 2, row, row + 1,
437 GTK_EXPAND | GTK_FILL, 0, 0, 0);
438 gtk_widget_show(combo);
439 }
398 440
399 static void quality_menu_cb(GtkWidget *combo, gpointer data) 441 static void quality_menu_cb(GtkWidget *combo, gpointer data)
400 { 442 {
401 gint *option = data; 443 gint *option = data;
402 444
1215 button = pref_button_new(NULL, GTK_STOCK_HELP, NULL, FALSE, 1257 button = pref_button_new(NULL, GTK_STOCK_HELP, NULL, FALSE,
1216 G_CALLBACK(editor_help_cb), NULL); 1258 G_CALLBACK(editor_help_cb), NULL);
1217 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); 1259 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1218 gtk_widget_show(button); 1260 gtk_widget_show(button);
1219 1261
1262 /* exif tab */
1263
1264 scrolled = gtk_scrolled_window_new(NULL, NULL);
1265 gtk_container_set_border_width(GTK_CONTAINER(scrolled), PREF_PAD_BORDER);
1266 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
1267 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
1268
1269 label = gtk_label_new(_("Exif"));
1270 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled, label);
1271 gtk_widget_show(scrolled);
1272
1273 viewport = gtk_viewport_new(NULL, NULL);
1274 gtk_viewport_set_shadow_type(GTK_VIEWPORT(viewport), GTK_SHADOW_NONE);
1275 gtk_container_add(GTK_CONTAINER(scrolled), viewport);
1276 gtk_widget_show(viewport);
1277
1278 vbox = gtk_vbox_new(FALSE, 0);
1279 gtk_container_add(GTK_CONTAINER(viewport), vbox);
1280 gtk_widget_show(vbox);
1281
1282 group = pref_group_new(vbox, FALSE, _("What to show in properties dialog:"),
1283 GTK_ORIENTATION_VERTICAL);
1284 table = pref_table_new(group, 2, 2, FALSE, FALSE);
1285
1286 for (i = 0; ExifUIList[i].key; i++)
1287 {
1288 static gint cc;
1289 const gchar *title;
1290
1291 title = exif_get_description_by_key(ExifUIList[i].key);
1292 exif_item(table, 0, i, title, ExifUIList[i].current,
1293 &ExifUIList[i].temp);
1294 }
1295
1220 /* advanced entry tab */ 1296 /* advanced entry tab */
1221 1297
1222 scrolled = gtk_scrolled_window_new(NULL, NULL); 1298 scrolled = gtk_scrolled_window_new(NULL, NULL);
1223 gtk_container_set_border_width(GTK_CONTAINER(scrolled), PREF_PAD_BORDER); 1299 gtk_container_set_border_width(GTK_CONTAINER(scrolled), PREF_PAD_BORDER);
1224 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), 1300 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),