diff options
author | Mattia Rizzolo <mattia@mapreri.org> | 2014-10-03 14:05:03 +0000 |
---|---|---|
committer | Mattia Rizzolo <mattia@mapreri.org> | 2014-10-03 14:05:03 +0000 |
commit | 817e6294b42b3e4435f1b99728afc1dca84a6445 (patch) | |
tree | 75bc563b5fe4149fe7e5cbf7a5c2cbcee5ea0fb3 /src/xsane-setup.c | |
parent | e7e90b72fd3161c5d55fed49e100781dfa3e9408 (diff) |
Imported Upstream version 0.97upstream/0.97
Diffstat (limited to 'src/xsane-setup.c')
-rw-r--r-- | src/xsane-setup.c | 508 |
1 files changed, 378 insertions, 130 deletions
diff --git a/src/xsane-setup.c b/src/xsane-setup.c index be15672..b420643 100644 --- a/src/xsane-setup.c +++ b/src/xsane-setup.c @@ -3,7 +3,7 @@ xsane-setup.c Oliver Rauch <Oliver.Rauch@rauch-domain.de> - Copyright (C) 1998-2002 Oliver Rauch + Copyright (C) 1998-2005 Oliver Rauch This file is part of the XSANE package. This program is free software; you can redistribute it and/or modify @@ -30,6 +30,7 @@ #include "xsane-preview.h" #include "xsane-save.h" #include "xsane-gamma.h" +#include "xsane-batch-scan.h" #ifdef HAVE_LIBPNG #ifdef HAVE_LIBZ @@ -86,6 +87,7 @@ static void xsane_mail_notebook(GtkWidget *notebook); #endif static void xsane_display_notebook(GtkWidget *notebook); static void xsane_enhance_notebook_sensitivity(int lineart_mode); +static void xsane_setup_show_range_mode_callback(GtkWidget *widget, gpointer data); static void xsane_setup_lineart_mode_callback(GtkWidget *widget, gpointer data); static void xsane_enhance_notebook(GtkWidget *notebook); @@ -147,7 +149,8 @@ void xsane_new_printer(void) void xsane_update_int(GtkWidget *widget, int *val) { - char *start, *end; + const char *start; + char *end; int v; DBG(DBG_proc, "xsane_update_init\n"); @@ -185,7 +188,8 @@ static void xsane_update_scale(GtkWidget *widget, double *val) static void xsane_update_geometry_double(GtkWidget *widget, double *val, double length_multiplier) { - char *start, *end; + const char *start; + char *end; double v; DBG(DBG_proc, "xsane_update_geometry_double\n"); @@ -208,7 +212,8 @@ static void xsane_update_geometry_double(GtkWidget *widget, double *val, double /* returns 0 if value is unchaned */ static int xsane_update_double(GtkWidget *widget, double *val) { - char *start, *end; + const char *start; + char *end; double v; int value_changed = 0; @@ -294,7 +299,7 @@ static void xsane_setup_printer_menu_build(GtkWidget *option_menu) { printer_item = gtk_menu_item_new_with_label(preferences.printer[i]->name); gtk_container_add(GTK_CONTAINER(printer_menu), printer_item); - gtk_signal_connect(GTK_OBJECT(printer_item), "activate", (GtkSignalFunc) xsane_setup_printer_callback, (void *) i); + g_signal_connect(GTK_OBJECT(printer_item), "activate", (GtkSignalFunc) xsane_setup_printer_callback, (void *) i); gtk_widget_show(printer_item); } @@ -445,6 +450,8 @@ static void xsane_setup_display_apply_changes(GtkWidget *widget, gpointer data) xsane_update_bool(xsane_setup.main_window_fixed_button, &preferences.main_window_fixed); xsane_update_bool(xsane_setup.preview_own_cmap_button, &preferences.preview_own_cmap); + preferences.show_range_mode = xsane_setup.show_range_mode; + xsane_update_double(xsane_setup.preview_gamma_entry, &preferences.preview_gamma); xsane_update_double(xsane_setup.preview_gamma_red_entry, &preferences.preview_gamma_red); xsane_update_double(xsane_setup.preview_gamma_green_entry, &preferences.preview_gamma_green); @@ -453,13 +460,15 @@ static void xsane_setup_display_apply_changes(GtkWidget *widget, gpointer data) xsane_update_double(xsane_setup.preview_oversampling_entry, &preferences.preview_oversampling); - if (preferences.doc_viewer) + if (preferences.browser) { - free((void *) preferences.doc_viewer); + free((void *) preferences.browser); } - preferences.doc_viewer = strdup(gtk_entry_get_text(GTK_ENTRY(xsane_setup.doc_viewer_entry))); + preferences.browser = strdup(gtk_entry_get_text(GTK_ENTRY(xsane_setup.browser_entry))); xsane_update_gamma_curve(TRUE /* update raw */); + + xsane_batch_scan_update_icon_list(); /* update gamma of batch scan icons */ } /* ---------------------------------------------------------------------------------------------------------------------- */ @@ -598,6 +607,7 @@ static void xsane_setup_image_apply_changes(GtkWidget *widget, gpointer data) preferences.tiff_compression1_nr = xsane_setup.tiff_compression1_nr; #endif + xsane_update_bool(xsane_setup.save_pnm16_as_ascii_button, &preferences.save_pnm16_as_ascii); xsane_update_bool(xsane_setup.reduce_16bit_to_8bit_button, &preferences.reduce_16bit_to_8bit); xsane_define_maximum_output_size(); @@ -681,6 +691,20 @@ static void xsane_setup_ocr_apply_changes(GtkWidget *widget, gpointer data) free((void *) preferences.ocr_outputfile_option); } preferences.ocr_outputfile_option = strdup(gtk_entry_get_text(GTK_ENTRY(xsane_setup.ocr_outputfile_option_entry))); + + xsane_update_bool(xsane_setup.ocr_use_gui_pipe_entry, &preferences.ocr_use_gui_pipe); + + if (preferences.ocr_gui_outfd_option) + { + free((void *) preferences.ocr_gui_outfd_option); + } + preferences.ocr_gui_outfd_option = strdup(gtk_entry_get_text(GTK_ENTRY(xsane_setup.ocr_gui_outfd_option_entry))); + + if (preferences.ocr_progress_keyword) + { + free((void *) preferences.ocr_progress_keyword); + } + preferences.ocr_progress_keyword = strdup(gtk_entry_get_text(GTK_ENTRY(xsane_setup.ocr_progress_keyword_entry))); } /* ---------------------------------------------------------------------------------------------------------------------- */ @@ -754,7 +778,7 @@ static void xsane_permission_toggled(GtkWidget *widget, gpointer data) { int mask = (int) data; int *permission = 0; - gchar *name = gtk_widget_get_name(widget); + const gchar *name = gtk_widget_get_name(widget); DBG(DBG_proc, "xsane_permission_toggled\n"); @@ -795,17 +819,17 @@ static void xsane_permission_box(GtkWidget *parent, gchar *name, gchar *descript gtk_box_pack_start(GTK_BOX(parent), hbox, FALSE, FALSE, 2); label = gtk_label_new(TEXT_SETUP_PERMISSION_USER); - gtk_widget_set_usize(label, 75, 0); + gtk_widget_set_size_request(label, 75, -1); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); gtk_widget_show(label); label = gtk_label_new(TEXT_SETUP_PERMISSION_GROUP); - gtk_widget_set_usize(label, 75, 0); + gtk_widget_set_size_request(label, 75, -1); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); gtk_widget_show(label); label = gtk_label_new(TEXT_SETUP_PERMISSION_ALL); - gtk_widget_set_usize(label, 75, 0); + gtk_widget_set_size_request(label, 75, -1); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); gtk_widget_show(label); @@ -819,9 +843,9 @@ static void xsane_permission_box(GtkWidget *parent, gchar *name, gchar *descript button = gtk_toggle_button_new_with_label("r"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 256 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_READ); - gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_size_request(button, 21, -1); gtk_widget_set_name(button, name); - gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 256); + g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 256); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); gtk_widget_show(button); gtk_widget_set_sensitive(button, user_sensitivity); @@ -829,9 +853,9 @@ static void xsane_permission_box(GtkWidget *parent, gchar *name, gchar *descript button = gtk_toggle_button_new_with_label("w"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 128 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_WRITE); - gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_size_request(button, 21, -1); gtk_widget_set_name(button, name); - gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 128); + g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 128); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); gtk_widget_show(button); gtk_widget_set_sensitive(button, user_sensitivity); @@ -839,9 +863,9 @@ static void xsane_permission_box(GtkWidget *parent, gchar *name, gchar *descript button = gtk_toggle_button_new_with_label("x"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 64 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_EXECUTE); - gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_size_request(button, 21, -1); gtk_widget_set_name(button, name); - gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 64); + g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 64); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); gtk_widget_show(button); gtk_widget_set_sensitive(button, x_sensitivity & user_sensitivity); @@ -857,27 +881,27 @@ static void xsane_permission_box(GtkWidget *parent, gchar *name, gchar *descript button = gtk_toggle_button_new_with_label("r"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 32 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_READ); - gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_size_request(button, 21, -1); gtk_widget_set_name(button, name); - gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 32); + g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 32); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); gtk_widget_show(button); button = gtk_toggle_button_new_with_label("w"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 16 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_WRITE); - gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_size_request(button, 21, -1); gtk_widget_set_name(button, name); - gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 16); + g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 16); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); gtk_widget_show(button); button = gtk_toggle_button_new_with_label("x"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 8 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_EXECUTE); - gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_size_request(button, 21, -1); gtk_widget_set_name(button, name); - gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 8); + g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 8); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); gtk_widget_show(button); gtk_widget_set_sensitive(button, x_sensitivity); @@ -893,27 +917,27 @@ static void xsane_permission_box(GtkWidget *parent, gchar *name, gchar *descript button = gtk_toggle_button_new_with_label("r"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 4 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_READ); - gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_size_request(button, 21, -1); gtk_widget_set_name(button, name); - gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 4); + g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 4); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); gtk_widget_show(button); button = gtk_toggle_button_new_with_label("w"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 2 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_WRITE); - gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_size_request(button, 21, -1); gtk_widget_set_name(button, name); - gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 2); + g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 2); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); gtk_widget_show(button); button = gtk_toggle_button_new_with_label("x"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), *permission & 1 ); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_PERMISSION_EXECUTE); - gtk_widget_set_usize(button, 21, 0); + gtk_widget_set_size_request(button, 21, -1); gtk_widget_set_name(button, name); - gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 1); + g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_permission_toggled, (void *) 1); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); gtk_widget_show(button); gtk_widget_set_sensitive(button, x_sensitivity); @@ -952,7 +976,7 @@ static void xsane_printer_notebook(GtkWidget *notebook) gtk_widget_show(setup_vbox); frame = gtk_frame_new(0); - gtk_container_set_border_width(GTK_CONTAINER(frame), 4); + gtk_container_set_border_width(GTK_CONTAINER(frame), 7); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); gtk_box_pack_start(GTK_BOX(setup_vbox), frame, TRUE, TRUE, 0); /* sizeable framehight */ gtk_widget_show(frame); @@ -990,7 +1014,7 @@ static void xsane_printer_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PRINTER_NAME); - gtk_widget_set_usize(text, 250, 0); + gtk_widget_set_size_request(text, 250, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.printer[preferences.printernr]->name); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -1008,7 +1032,7 @@ static void xsane_printer_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PRINTER_COMMAND); - gtk_widget_set_usize(text, 250, 0); + gtk_widget_set_size_request(text, 250, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.printer[preferences.printernr]->command); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -1026,7 +1050,7 @@ static void xsane_printer_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_COPY_NUMBER_OPTION); - gtk_widget_set_usize(text, 250, 0); + gtk_widget_set_size_request(text, 250, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.printer[preferences.printernr]->copy_number_option); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -1048,7 +1072,7 @@ static void xsane_printer_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PRINTER_LINEART_RESOLUTION); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); snprintf(buf, sizeof(buf), "%d", preferences.printer[preferences.printernr]->lineart_resolution); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -1068,7 +1092,7 @@ static void xsane_printer_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PRINTER_GRAYSCALE_RESOLUTION); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); snprintf(buf, sizeof(buf), "%d", preferences.printer[preferences.printernr]->grayscale_resolution); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -1088,7 +1112,7 @@ static void xsane_printer_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PRINTER_COLOR_RESOLUTION); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); snprintf(buf, sizeof(buf), "%d", preferences.printer[preferences.printernr]->color_resolution); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -1112,7 +1136,7 @@ static void xsane_printer_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PRINTER_WIDTH); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); snprintf(buf, sizeof(buf), "%4.3f", preferences.printer[preferences.printernr]->width / preferences.length_unit); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -1132,7 +1156,7 @@ static void xsane_printer_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PRINTER_HEIGHT); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); snprintf(buf, sizeof(buf), "%4.3f", preferences.printer[preferences.printernr]->height / preferences.length_unit); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -1152,7 +1176,7 @@ static void xsane_printer_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PRINTER_LEFTOFFSET); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); snprintf(buf, sizeof(buf), "%4.3f", preferences.printer[preferences.printernr]->leftoffset / preferences.length_unit); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -1172,7 +1196,7 @@ static void xsane_printer_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PRINTER_BOTTOMOFFSET); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); snprintf(buf, sizeof(buf), "%4.3f", preferences.printer[preferences.printernr]->bottomoffset / preferences.length_unit); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -1195,7 +1219,7 @@ static void xsane_printer_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PRINTER_GAMMA); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); snprintf(buf, sizeof(buf), "%1.2f", preferences.printer[preferences.printernr]->gamma); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -1214,7 +1238,7 @@ static void xsane_printer_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PRINTER_GAMMA_RED); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); snprintf(buf, sizeof(buf), "%1.2f", preferences.printer[preferences.printernr]->gamma_red); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -1233,7 +1257,7 @@ static void xsane_printer_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PRINTER_GAMMA_GREEN); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); snprintf(buf, sizeof(buf), "%1.2f", preferences.printer[preferences.printernr]->gamma_green); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -1252,7 +1276,7 @@ static void xsane_printer_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PRINTER_GAMMA_BLUE); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); snprintf(buf, sizeof(buf), "%1.2f", preferences.printer[preferences.printernr]->gamma_blue); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -1268,18 +1292,22 @@ static void xsane_printer_notebook(GtkWidget *notebook) hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); +#ifdef HAVE_GTK2 + button = gtk_button_new_from_stock(GTK_STOCK_APPLY); +#else button = gtk_button_new_with_label(BUTTON_APPLY); - gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_printer_apply_changes, printer_option_menu); +#endif + g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_printer_apply_changes, printer_option_menu); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_widget_show(button); button = gtk_button_new_with_label(BUTTON_ADD_PRINTER); - gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_printer_new, printer_option_menu); + g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_printer_new, printer_option_menu); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_widget_show(button); button = gtk_button_new_with_label(BUTTON_DELETE_PRINTER); - gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_printer_delete, printer_option_menu); + g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_printer_delete, printer_option_menu); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_widget_show(button); @@ -1290,7 +1318,7 @@ static void xsane_printer_notebook(GtkWidget *notebook) static void xsane_setup_browse_tmp_path_callback(GtkWidget *widget, gpointer data) { - gchar *old_tmp_path; + const gchar *old_tmp_path; char tmp_path[256]; char windowname[256]; @@ -1300,7 +1328,7 @@ static void xsane_setup_browse_tmp_path_callback(GtkWidget *widget, gpointer dat strncpy(tmp_path, old_tmp_path, sizeof(tmp_path)); snprintf(windowname, sizeof(windowname), "%s %s", xsane.prog_name, WINDOW_TMP_PATH); - xsane_back_gtk_get_filename(windowname, tmp_path, sizeof(tmp_path), tmp_path, TRUE, FALSE, TRUE); + xsane_back_gtk_get_filename(windowname, tmp_path, sizeof(tmp_path), tmp_path, NULL, TRUE, FALSE, TRUE, FALSE); gtk_entry_set_text(GTK_ENTRY(xsane_setup.tmp_path_entry), tmp_path); } @@ -1324,7 +1352,7 @@ static void xsane_saving_notebook(GtkWidget *notebook) gtk_widget_show(setup_vbox); frame = gtk_frame_new(0); - gtk_container_set_border_width(GTK_CONTAINER(frame), 4); + gtk_container_set_border_width(GTK_CONTAINER(frame), 7); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); gtk_box_pack_start(GTK_BOX(setup_vbox), frame, TRUE, TRUE, 0); /* sizeable framehight */ gtk_widget_show(frame); @@ -1344,7 +1372,7 @@ static void xsane_saving_notebook(GtkWidget *notebook) gtk_widget_show(label); text = gtk_entry_new_with_max_length(255); - gtk_widget_set_usize(text, 70, 0); /* set minimum size */ + gtk_widget_set_size_request(text, 70, -1); /* set minimum size */ xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_TMP_PATH); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.tmp_path); gtk_box_pack_start(GTK_BOX(hbox), text, TRUE, TRUE, 4); @@ -1352,7 +1380,7 @@ static void xsane_saving_notebook(GtkWidget *notebook) xsane_setup.tmp_path_entry = text; button = gtk_button_new_with_label(BUTTON_BROWSE); - gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_browse_tmp_path_callback, NULL); + g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_browse_tmp_path_callback, NULL); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 2); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_BUTTON_TMP_PATH_BROWSE); gtk_widget_show(button); @@ -1414,7 +1442,7 @@ static void xsane_saving_notebook(GtkWidget *notebook) filename_counter_len_menu = gtk_menu_new(); - for (i=0; i <= 10; i++) + for (i=0; i <= 9; i++) { if (i) { @@ -1426,8 +1454,7 @@ static void xsane_saving_notebook(GtkWidget *notebook) } filename_counter_len_item = gtk_menu_item_new_with_label(buf); gtk_container_add(GTK_CONTAINER(filename_counter_len_menu), filename_counter_len_item); - gtk_signal_connect(GTK_OBJECT(filename_counter_len_item), "activate", - (GtkSignalFunc) xsane_setup_filename_counter_len_callback, (void *) i); + g_signal_connect(GTK_OBJECT(filename_counter_len_item), "activate", (GtkSignalFunc) xsane_setup_filename_counter_len_callback, (void *) i); gtk_widget_show(filename_counter_len_item); if (preferences.filename_counter_len == i) { @@ -1465,8 +1492,12 @@ static void xsane_saving_notebook(GtkWidget *notebook) hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); +#ifdef HAVE_GTK2 + button = gtk_button_new_from_stock(GTK_STOCK_APPLY); +#else button = gtk_button_new_with_label(BUTTON_APPLY); - gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_saving_apply_changes, NULL); +#endif + g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_saving_apply_changes, NULL); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_widget_show(button); @@ -1534,7 +1565,7 @@ static void xsane_image_notebook(GtkWidget *notebook) gtk_widget_show(setup_vbox); frame = gtk_frame_new(0); - gtk_container_set_border_width(GTK_CONTAINER(frame), 4); + gtk_container_set_border_width(GTK_CONTAINER(frame), 7); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); gtk_box_pack_start(GTK_BOX(setup_vbox), frame, TRUE, TRUE, 0); /* sizeable framehight */ gtk_widget_show(frame); @@ -1544,6 +1575,17 @@ static void xsane_image_notebook(GtkWidget *notebook) gtk_widget_show(vbox); + /* save pnm16 as ascii */ + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + button = gtk_check_button_new_with_label(RADIO_BUTTON_SAVE_PNM16_AS_ASCII); + xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_SAVE_PNM16_AS_ASCII); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), preferences.save_pnm16_as_ascii); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 2); + gtk_widget_show(button); + gtk_widget_show(hbox); + xsane_setup.save_pnm16_as_ascii_button = button; + /* reduce 16bit to 8bit */ hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); @@ -1571,18 +1613,18 @@ static void xsane_image_notebook(GtkWidget *notebook) #endif #ifdef HAVE_LIBJPEG - xsane_scale_new(GTK_BOX(vbox), TEXT_SETUP_JPEG_QUALITY, DESC_JPEG_QUALITY, 0.0, 100.0, 1.0, 10.0, 0.0, 0, + xsane_range_new(GTK_BOX(vbox), TEXT_SETUP_JPEG_QUALITY, DESC_JPEG_QUALITY, 0.0, 100.0, 1.0, 10.0, 0, &preferences.jpeg_quality, (GtkObject **) &xsane_setup.jpeg_image_quality_scale, 0, TRUE); #else #ifdef HAVE_LIBTIFF - xsane_scale_new(GTK_BOX(vbox), TEXT_SETUP_JPEG_QUALITY, DESC_JPEG_QUALITY, 0.0, 100.0, 1.0, 10.0, 0.0, 0, + xsane_range_new(GTK_BOX(vbox), TEXT_SETUP_JPEG_QUALITY, DESC_JPEG_QUALITY, 0.0, 100.0, 1.0, 10.0, 0, &preferences.jpeg_quality, (GtkObject **) &xsane_setup.jpeg_image_quality_scale, 0, TRUE); #endif #endif #ifdef HAVE_LIBPNG #ifdef HAVE_LIBZ - xsane_scale_new(GTK_BOX(vbox), TEXT_SETUP_PNG_COMPRESSION, DESC_PNG_COMPRESSION, 0.0, Z_BEST_COMPRESSION, 1.0, 10.0, 0.0, 0, + xsane_range_new(GTK_BOX(vbox), TEXT_SETUP_PNG_COMPRESSION, DESC_PNG_COMPRESSION, 0.0, Z_BEST_COMPRESSION, 1.0, 10.0, 0, &preferences.png_compression, (GtkObject **) &xsane_setup.pnm_image_compression_scale, 0, TRUE); #endif #endif @@ -1610,8 +1652,7 @@ static void xsane_image_notebook(GtkWidget *notebook) { tiff_compression_item = gtk_menu_item_new_with_label(tiff_compression16_strings[i-1].name); gtk_container_add(GTK_CONTAINER(tiff_compression_menu), tiff_compression_item); - gtk_signal_connect(GTK_OBJECT(tiff_compression_item), "activate", - (GtkSignalFunc) xsane_setup_tiff_compression16_callback, (void *) tiff_compression16_strings[i-1].number); + g_signal_connect(GTK_OBJECT(tiff_compression_item), "activate", (GtkSignalFunc) xsane_setup_tiff_compression16_callback, (void *) tiff_compression16_strings[i-1].number); gtk_widget_show(tiff_compression_item); if (tiff_compression16_strings[i-1].number == preferences.tiff_compression16_nr) { @@ -1646,8 +1687,7 @@ static void xsane_image_notebook(GtkWidget *notebook) { tiff_compression_item = gtk_menu_item_new_with_label(tiff_compression8_strings[i-1].name); gtk_container_add(GTK_CONTAINER(tiff_compression_menu), tiff_compression_item); - gtk_signal_connect(GTK_OBJECT(tiff_compression_item), "activate", - (GtkSignalFunc) xsane_setup_tiff_compression8_callback, (void *) tiff_compression8_strings[i-1].number); + g_signal_connect(GTK_OBJECT(tiff_compression_item), "activate", (GtkSignalFunc) xsane_setup_tiff_compression8_callback, (void *) tiff_compression8_strings[i-1].number); gtk_widget_show(tiff_compression_item); if (tiff_compression8_strings[i-1].number == preferences.tiff_compression8_nr) { @@ -1683,8 +1723,7 @@ static void xsane_image_notebook(GtkWidget *notebook) { tiff_compression_item = gtk_menu_item_new_with_label(tiff_compression1_strings[i-1].name); gtk_container_add(GTK_CONTAINER(tiff_compression_menu), tiff_compression_item); - gtk_signal_connect(GTK_OBJECT(tiff_compression_item), "activate", - (GtkSignalFunc) xsane_setup_tiff_compression1_callback, (void *) tiff_compression1_strings[i-1].number); + g_signal_connect(GTK_OBJECT(tiff_compression_item), "activate", (GtkSignalFunc) xsane_setup_tiff_compression1_callback, (void *) tiff_compression1_strings[i-1].number); gtk_widget_show(tiff_compression_item); if (tiff_compression1_strings[i-1].number == preferences.tiff_compression1_nr) { @@ -1707,8 +1746,12 @@ static void xsane_image_notebook(GtkWidget *notebook) hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); +#ifdef HAVE_GTK2 + button = gtk_button_new_from_stock(GTK_STOCK_APPLY); +#else button = gtk_button_new_with_label(BUTTON_APPLY); - gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_image_apply_changes, NULL); +#endif + g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_image_apply_changes, NULL); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_widget_show(button); @@ -1717,10 +1760,39 @@ static void xsane_image_notebook(GtkWidget *notebook) /* ---------------------------------------------------------------------------------------------------------------------- */ +typedef struct +{ + char *identifier; + char *fax_command; + char *fax_receiver_option; + char *fax_postscript_option; + char *fax_normal_option; + char *fax_fine_option; +} fax_program_options_type; + +fax_program_options_type fax_program[] = +{ + {" hylafax ", "sendfax", "-d", "", "-l", "-m"}, + {" mgetty+sendfax ", "faxspool", "", "", "-n", ""}, + {" efax ", "fax send", "", "", "-l", ""}, +}; + +static void xsane_fax_notebook_set_faxprogram_default_callback(GtkWidget *widget, int program_number) +{ + gtk_entry_set_text(GTK_ENTRY(xsane_setup.fax_command_entry), (char *) fax_program[program_number].fax_command); + gtk_entry_set_text(GTK_ENTRY(xsane_setup.fax_receiver_option_entry), (char *) fax_program[program_number].fax_receiver_option); + gtk_entry_set_text(GTK_ENTRY(xsane_setup.fax_postscript_option_entry), (char *) fax_program[program_number].fax_postscript_option); + gtk_entry_set_text(GTK_ENTRY(xsane_setup.fax_normal_option_entry), (char *) fax_program[program_number].fax_normal_option); + gtk_entry_set_text(GTK_ENTRY(xsane_setup.fax_fine_option_entry), (char *) fax_program[program_number].fax_fine_option); +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + static void xsane_fax_notebook(GtkWidget *notebook) { GtkWidget *setup_vbox, *vbox, *hbox, *button, *label, *text, *frame; char buf[64]; + int i; DBG(DBG_proc, "xsane_fax_notebook\n"); @@ -1733,7 +1805,7 @@ static void xsane_fax_notebook(GtkWidget *notebook) gtk_widget_show(setup_vbox); frame = gtk_frame_new(0); - gtk_container_set_border_width(GTK_CONTAINER(frame), 4); + gtk_container_set_border_width(GTK_CONTAINER(frame), 7); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); gtk_box_pack_start(GTK_BOX(setup_vbox), frame, TRUE, TRUE, 0); /* sizeable framehight */ gtk_widget_show(frame); @@ -1753,7 +1825,7 @@ static void xsane_fax_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_FAX_COMMAND); - gtk_widget_set_usize(text, 250, 0); + gtk_widget_set_size_request(text, 250, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.fax_command); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -1772,7 +1844,7 @@ static void xsane_fax_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_FAX_RECEIVER_OPT); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.fax_receiver_option); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -1791,7 +1863,7 @@ static void xsane_fax_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_FAX_POSTSCRIPT_OPT); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.fax_postscript_option); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -1810,7 +1882,7 @@ static void xsane_fax_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_FAX_NORMAL_OPT); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.fax_normal_option); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -1829,7 +1901,7 @@ static void xsane_fax_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_FAX_FINE_OPT); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.fax_fine_option); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -1837,6 +1909,26 @@ static void xsane_fax_notebook(GtkWidget *notebook) xsane_setup.fax_fine_option_entry = text; + /* fax set program default options : */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_FAX_PROGRAM_DEFAULTS); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); + + for (i=0; i < sizeof(fax_program)/sizeof(fax_program_options_type); i++) + { + button = gtk_button_new_with_label(fax_program[i].identifier); + g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_fax_notebook_set_faxprogram_default_callback, (void *) i); + gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 10); + gtk_widget_show(button); + } + + gtk_widget_show(hbox); + + xsane_separator_new(vbox, 2); @@ -1851,7 +1943,7 @@ static void xsane_fax_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_FAX_VIEWER); - gtk_widget_set_usize(text, 250, 0); + gtk_widget_set_size_request(text, 250, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.fax_viewer); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -1873,7 +1965,7 @@ static void xsane_fax_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_FAX_WIDTH); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); snprintf(buf, sizeof(buf), "%4.3f", preferences.fax_width / preferences.length_unit); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -1893,7 +1985,7 @@ static void xsane_fax_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_FAX_HEIGHT); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); snprintf(buf, sizeof(buf), "%4.3f", preferences.fax_height / preferences.length_unit); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -1913,7 +2005,7 @@ static void xsane_fax_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_FAX_LEFTOFFSET); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); snprintf(buf, sizeof(buf), "%4.3f", preferences.fax_leftoffset / preferences.length_unit); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -1933,7 +2025,7 @@ static void xsane_fax_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_FAX_BOTTOMOFFSET); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); snprintf(buf, sizeof(buf), "%4.3f", preferences.fax_bottomoffset / preferences.length_unit); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -1948,8 +2040,12 @@ static void xsane_fax_notebook(GtkWidget *notebook) hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); +#ifdef HAVE_GTK2 + button = gtk_button_new_from_stock(GTK_STOCK_APPLY); +#else button = gtk_button_new_with_label(BUTTON_APPLY); - gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_fax_apply_changes, NULL); +#endif + g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_fax_apply_changes, NULL); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_widget_show(button); @@ -1986,7 +2082,7 @@ static void xsane_mail_notebook(GtkWidget *notebook) gtk_widget_show(setup_vbox); frame = gtk_frame_new(0); - gtk_container_set_border_width(GTK_CONTAINER(frame), 4); + gtk_container_set_border_width(GTK_CONTAINER(frame), 7); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); gtk_box_pack_start(GTK_BOX(setup_vbox), frame, TRUE, TRUE, 0); /* sizeable framehight */ gtk_widget_show(frame); @@ -2006,7 +2102,7 @@ static void xsane_mail_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_MAIL_FROM); - gtk_widget_set_usize(text, 250, 0); + gtk_widget_set_size_request(text, 250, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.mail_from); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2024,7 +2120,7 @@ static void xsane_mail_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_MAIL_REPLY_TO); - gtk_widget_set_usize(text, 250, 0); + gtk_widget_set_size_request(text, 250, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.mail_reply_to); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2045,7 +2141,7 @@ static void xsane_mail_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_SMTP_SERVER); - gtk_widget_set_usize(text, 250, 0); + gtk_widget_set_size_request(text, 250, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.mail_smtp_server); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2063,7 +2159,7 @@ static void xsane_mail_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_SMTP_PORT); - gtk_widget_set_usize(text, 50, 0); + gtk_widget_set_size_request(text, 50, -1); snprintf(buf, sizeof(buf), "%d", preferences.mail_smtp_port); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -2083,7 +2179,7 @@ static void xsane_mail_notebook(GtkWidget *notebook) hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); button = gtk_check_button_new_with_label(RADIO_BUTTON_POP3_AUTHENTIFICATION); - gtk_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_setup_pop3_authentification_callback, (void *) pop3_vbox); + g_signal_connect(GTK_OBJECT(button), "toggled", (GtkSignalFunc) xsane_setup_pop3_authentification_callback, (void *) pop3_vbox); xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_POP3_AUTHENTIFICATION); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), preferences.mail_pop3_authentification); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 2); @@ -2105,7 +2201,7 @@ static void xsane_mail_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_POP3_SERVER); - gtk_widget_set_usize(text, 250, 0); + gtk_widget_set_size_request(text, 250, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.mail_pop3_server); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2123,7 +2219,7 @@ static void xsane_mail_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_POP3_PORT); - gtk_widget_set_usize(text, 50, 0); + gtk_widget_set_size_request(text, 50, -1); snprintf(buf, sizeof(buf), "%d", preferences.mail_pop3_port); gtk_entry_set_text(GTK_ENTRY(text), (char *) buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -2142,7 +2238,7 @@ static void xsane_mail_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_POP3_USER); - gtk_widget_set_usize(text, 250, 0); + gtk_widget_set_size_request(text, 250, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.mail_pop3_user); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2167,7 +2263,7 @@ static void xsane_mail_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_POP3_PASS); - gtk_widget_set_usize(text, 250, 0); + gtk_widget_set_size_request(text, 250, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) password); gtk_entry_set_visibility(GTK_ENTRY(text), 0); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); @@ -2191,7 +2287,7 @@ static void xsane_mail_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_MAIL_VIEWER); - gtk_widget_set_usize(text, 250, 0); + gtk_widget_set_size_request(text, 250, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.mail_viewer); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2206,8 +2302,12 @@ static void xsane_mail_notebook(GtkWidget *notebook) hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); +#ifdef HAVE_GTK2 + button = gtk_button_new_from_stock(GTK_STOCK_APPLY); +#else button = gtk_button_new_with_label(BUTTON_APPLY); - gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_mail_apply_changes, NULL); +#endif + g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_mail_apply_changes, NULL); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_widget_show(button); @@ -2219,7 +2319,7 @@ static void xsane_mail_notebook(GtkWidget *notebook) static void xsane_ocr_notebook(GtkWidget *notebook) { - GtkWidget *setup_vbox, *vbox, *hbox, *label, *text, *frame; + GtkWidget *setup_vbox, *vbox, *hbox, *label, *text, *frame, *button; DBG(DBG_proc, "xsane_ocr_notebook\n"); @@ -2232,7 +2332,7 @@ static void xsane_ocr_notebook(GtkWidget *notebook) gtk_widget_show(setup_vbox); frame = gtk_frame_new(0); - gtk_container_set_border_width(GTK_CONTAINER(frame), 4); + gtk_container_set_border_width(GTK_CONTAINER(frame), 7); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); gtk_box_pack_start(GTK_BOX(setup_vbox), frame, TRUE, TRUE, 0); /* sizeable framehight */ gtk_widget_show(frame); @@ -2241,7 +2341,7 @@ static void xsane_ocr_notebook(GtkWidget *notebook) gtk_container_add(GTK_CONTAINER(frame), vbox); gtk_widget_show(vbox); - /* ocrcommand : */ + /* ocr command : */ hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); @@ -2252,7 +2352,7 @@ static void xsane_ocr_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_OCR_COMMAND); - gtk_widget_set_usize(text, 250, 0); + gtk_widget_set_size_request(text, 250, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.ocr_command); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2260,7 +2360,7 @@ static void xsane_ocr_notebook(GtkWidget *notebook) xsane_setup.ocr_command_entry = text; - /* ocrinputfileoption : */ + /* ocr inputfile option : */ hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); @@ -2271,7 +2371,7 @@ static void xsane_ocr_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_OCR_INPUTFILE_OPT); - gtk_widget_set_usize(text, 250, 0); + gtk_widget_set_size_request(text, 250, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.ocr_inputfile_option); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2279,7 +2379,7 @@ static void xsane_ocr_notebook(GtkWidget *notebook) xsane_setup.ocr_inputfile_option_entry = text; - /* ocroutputfileoption : */ + /* ocr outputfile option : */ hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); @@ -2290,12 +2390,79 @@ static void xsane_ocr_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_OCR_OUTPUTFILE_OPT); - gtk_widget_set_usize(text, 250, 0); + gtk_widget_set_size_request(text, 250, -1); gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.ocr_outputfile_option); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); gtk_widget_show(hbox); xsane_setup.ocr_outputfile_option_entry = text; + + + /* ocr use gui pipe button */ + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + button = gtk_check_button_new_with_label(RADIO_BUTTON_OCR_USE_GUI_PIPE); + xsane_back_gtk_set_tooltip(xsane.tooltips, button, DESC_OCR_USE_GUI_PIPE_OPT); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), preferences.ocr_use_gui_pipe); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 2); + gtk_widget_show(button); + gtk_widget_show(hbox); + xsane_setup.ocr_use_gui_pipe_entry = button; + + + /* ocr gui outfd option : */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_OCR_OUTFD_OPT); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_OCR_OUTFD_OPT); + gtk_widget_set_size_request(text, 250, -1); + gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.ocr_gui_outfd_option); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.ocr_gui_outfd_option_entry = text; + + + /* ocr progress keyword : */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + + label = gtk_label_new(TEXT_SETUP_OCR_PROGRESS_KEYWORD); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + text = gtk_entry_new(); + xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_OCR_PROGRESS_KEYWORD); + gtk_widget_set_size_request(text, 250, -1); + gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.ocr_progress_keyword); + gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); + gtk_widget_show(text); + gtk_widget_show(hbox); + xsane_setup.ocr_progress_keyword_entry = text; + + xsane_separator_new(vbox, 4); + + /* apply button */ + + hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); + +#ifdef HAVE_GTK2 + button = gtk_button_new_from_stock(GTK_STOCK_APPLY); +#else + button = gtk_button_new_with_label(BUTTON_APPLY); +#endif + g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_ocr_apply_changes, NULL); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); + gtk_widget_show(button); + gtk_widget_show(hbox); } /* ---------------------------------------------------------------------------------------------------------------------- */ @@ -2303,7 +2470,18 @@ static void xsane_ocr_notebook(GtkWidget *notebook) static void xsane_display_notebook(GtkWidget *notebook) { GtkWidget *setup_vbox, *vbox, *hbox, *button, *label, *text, *frame; + GtkWidget *show_range_mode_option_menu, *show_range_mode_menu, *show_range_mode_item; char buf[64]; + int i, select = 1; + + typedef struct show_range_mode_t + { + char *name; + int number; + } show_range_mode; + +#define SHOW_RANGE_MODE_NUMBER 5 + show_range_mode show_range_mode_strings[SHOW_RANGE_MODE_NUMBER]; DBG(DBG_proc, "xsane_display_notebook\n"); @@ -2316,7 +2494,7 @@ static void xsane_display_notebook(GtkWidget *notebook) gtk_widget_show(setup_vbox); frame = gtk_frame_new(0); - gtk_container_set_border_width(GTK_CONTAINER(frame), 4); + gtk_container_set_border_width(GTK_CONTAINER(frame), 7); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); gtk_box_pack_start(GTK_BOX(setup_vbox), frame, TRUE, TRUE, 0); /* sizeable framehight */ gtk_widget_show(frame); @@ -2352,7 +2530,59 @@ static void xsane_display_notebook(GtkWidget *notebook) xsane_separator_new(vbox, 2); + + /* show range type menu */ + /* bit 0 (val 1) : show scale */ + /* bit 1 (val 2) : show scrollbar */ + /* bit 2 (val 4) : show spinbutton */ + /* bit 3 (val 8) : show scale val */ + show_range_mode_strings[0].name = MENU_ITEM_RANGE_SCALE; + show_range_mode_strings[0].number = 9; /* 1 + 8 = scale + value */ + show_range_mode_strings[1].name = MENU_ITEM_RANGE_SCROLLBAR; + show_range_mode_strings[1].number = 10; /* 2 + 4 = scrollbar + value */ + show_range_mode_strings[2].name = MENU_ITEM_RANGE_SPINBUTTON; + show_range_mode_strings[2].number = 4; + show_range_mode_strings[3].name = MENU_ITEM_RANGE_SCALE_SPIN; + show_range_mode_strings[3].number = 5; /* 1 + 4 = scale + spinbutton */ + show_range_mode_strings[4].name = MENU_ITEM_RANGE_SCROLL_SPIN; + show_range_mode_strings[4].number = 6; /* 2 + 4 = scrollbar + spinbutton */ + + hbox = gtk_hbox_new(FALSE, 2); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 2); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + + label = gtk_label_new(TEXT_SETUP_SHOW_RANGE_MODE); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_widget_show(label); + + show_range_mode_option_menu = gtk_option_menu_new(); + xsane_back_gtk_set_tooltip(xsane.tooltips, show_range_mode_option_menu, DESC_SHOW_RANGE_MODE); + gtk_box_pack_end(GTK_BOX(hbox), show_range_mode_option_menu, FALSE, FALSE, 2); + gtk_widget_show(show_range_mode_option_menu); + gtk_widget_show(hbox); + + show_range_mode_menu = gtk_menu_new(); + + for (i=1; i <= SHOW_RANGE_MODE_NUMBER; i++) + { + show_range_mode_item = gtk_menu_item_new_with_label(show_range_mode_strings[i-1].name); + gtk_container_add(GTK_CONTAINER(show_range_mode_menu), show_range_mode_item); + g_signal_connect(GTK_OBJECT(show_range_mode_item), "activate", (GtkSignalFunc) xsane_setup_show_range_mode_callback, (void *) show_range_mode_strings[i-1].number); + gtk_widget_show(show_range_mode_item); + if (show_range_mode_strings[i-1].number == preferences.show_range_mode) + { + select = i-1; + } + } + + gtk_option_menu_set_menu(GTK_OPTION_MENU(show_range_mode_option_menu), show_range_mode_menu); + gtk_option_menu_set_history(GTK_OPTION_MENU(show_range_mode_option_menu), select); + xsane_setup.show_range_mode = preferences.show_range_mode; + + xsane_separator_new(vbox, 2); + + /* preview oversampling value: */ hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); @@ -2366,7 +2596,7 @@ static void xsane_display_notebook(GtkWidget *notebook) snprintf(buf, sizeof(buf), "%1.2f", preferences.preview_oversampling); text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PREVIEW_OVERSAMPLING); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); gtk_entry_set_text(GTK_ENTRY(text), buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2389,7 +2619,7 @@ static void xsane_display_notebook(GtkWidget *notebook) snprintf(buf, sizeof(buf), "%1.2f", preferences.preview_gamma); text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PREVIEW_GAMMA); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); gtk_entry_set_text(GTK_ENTRY(text), buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2408,7 +2638,7 @@ static void xsane_display_notebook(GtkWidget *notebook) snprintf(buf, sizeof(buf), "%1.2f", preferences.preview_gamma_red); text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PREVIEW_GAMMA_RED); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); gtk_entry_set_text(GTK_ENTRY(text), buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2427,7 +2657,7 @@ static void xsane_display_notebook(GtkWidget *notebook) snprintf(buf, sizeof(buf), "%1.2f", preferences.preview_gamma_green); text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PREVIEW_GAMMA_GREEN); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); gtk_entry_set_text(GTK_ENTRY(text), buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2446,7 +2676,7 @@ static void xsane_display_notebook(GtkWidget *notebook) snprintf(buf, sizeof(buf), "%1.2f", preferences.preview_gamma_blue); text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PREVIEW_GAMMA_BLUE); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); gtk_entry_set_text(GTK_ENTRY(text), buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2479,12 +2709,12 @@ static void xsane_display_notebook(GtkWidget *notebook) text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_DOC_VIEWER); - gtk_widget_set_usize(text, 250, 0); - gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.doc_viewer); + gtk_widget_set_size_request(text, 250, -1); + gtk_entry_set_text(GTK_ENTRY(text), (char *) preferences.browser); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); gtk_widget_show(hbox); - xsane_setup.doc_viewer_entry = text; + xsane_setup.browser_entry = text; xsane_separator_new(vbox, 4); @@ -2495,8 +2725,12 @@ static void xsane_display_notebook(GtkWidget *notebook) hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); +#ifdef HAVE_GTK2 + button = gtk_button_new_from_stock(GTK_STOCK_APPLY); +#else button = gtk_button_new_with_label(BUTTON_APPLY); - gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_display_apply_changes, NULL); +#endif + g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_display_apply_changes, NULL); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_widget_show(button); @@ -2534,6 +2768,13 @@ static void xsane_enhance_notebook_sensitivity(int lineart_mode) /* ---------------------------------------------------------------------------------------------------------------------- */ +static void xsane_setup_show_range_mode_callback(GtkWidget *widget, gpointer data) +{ + xsane_setup.show_range_mode = (int) data; +} + +/* ---------------------------------------------------------------------------------------------------------------------- */ + static void xsane_setup_lineart_mode_callback(GtkWidget *widget, gpointer data) { xsane_setup.lineart_mode = (int) data; @@ -2611,7 +2852,7 @@ static void xsane_enhance_notebook(GtkWidget *notebook) gtk_widget_show(setup_vbox); frame = gtk_frame_new(0); - gtk_container_set_border_width(GTK_CONTAINER(frame), 4); + gtk_container_set_border_width(GTK_CONTAINER(frame), 7); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); gtk_box_pack_start(GTK_BOX(setup_vbox), frame, TRUE, TRUE, 0); /* sizeable framehight */ gtk_widget_show(frame); @@ -2648,8 +2889,7 @@ static void xsane_enhance_notebook(GtkWidget *notebook) { lineart_mode_item = gtk_menu_item_new_with_label(lineart_mode_strings[i-1].name); gtk_container_add(GTK_CONTAINER(lineart_mode_menu), lineart_mode_item); - gtk_signal_connect(GTK_OBJECT(lineart_mode_item), "activate", - (GtkSignalFunc) xsane_setup_lineart_mode_callback, (void *) lineart_mode_strings[i-1].number); + g_signal_connect(GTK_OBJECT(lineart_mode_item), "activate", (GtkSignalFunc) xsane_setup_lineart_mode_callback, (void *) lineart_mode_strings[i-1].number); gtk_widget_show(lineart_mode_item); if (lineart_mode_strings[i-1].number == xsane.lineart_mode) { @@ -2675,7 +2915,7 @@ static void xsane_enhance_notebook(GtkWidget *notebook) snprintf(buf, sizeof(buf), "%1.2f", xsane.threshold_min); text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PREVIEW_THRESHOLD_MIN); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); gtk_entry_set_text(GTK_ENTRY(text), buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2695,7 +2935,7 @@ static void xsane_enhance_notebook(GtkWidget *notebook) snprintf(buf, sizeof(buf), "%1.2f", xsane.threshold_max); text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PREVIEW_THRESHOLD_MAX); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); gtk_entry_set_text(GTK_ENTRY(text), buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2715,7 +2955,7 @@ static void xsane_enhance_notebook(GtkWidget *notebook) snprintf(buf, sizeof(buf), "%1.2f", xsane.threshold_mul); text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PREVIEW_THRESHOLD_MUL); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); gtk_entry_set_text(GTK_ENTRY(text), buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2735,7 +2975,7 @@ static void xsane_enhance_notebook(GtkWidget *notebook) snprintf(buf, sizeof(buf), "%1.2f", xsane.threshold_off); text = gtk_entry_new(); xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_PREVIEW_THRESHOLD_OFF); - gtk_widget_set_usize(text, 80, 0); + gtk_widget_set_size_request(text, 80, -1); gtk_entry_set_text(GTK_ENTRY(text), buf); gtk_box_pack_end(GTK_BOX(hbox), text, FALSE, FALSE, 2); gtk_widget_show(text); @@ -2783,7 +3023,7 @@ static void xsane_enhance_notebook(GtkWidget *notebook) { gray_item = gtk_menu_item_new_with_label(_BGT(opt->constraint.string_list[i])); gtk_container_add(GTK_CONTAINER(gray_menu), gray_item); - gtk_signal_connect(GTK_OBJECT(gray_item), "activate", (GtkSignalFunc) xsane_setup_grayscale_mode_callback, (void *) opt->constraint.string_list[i]); + g_signal_connect(GTK_OBJECT(gray_item), "activate", (GtkSignalFunc) xsane_setup_grayscale_mode_callback, (void *) opt->constraint.string_list[i]); gtk_widget_show(gray_item); if (xsane.grayscale_scanmode) @@ -2873,8 +3113,7 @@ static void xsane_enhance_notebook(GtkWidget *notebook) snprintf(buf, sizeof(buf), "%d x %d pixel", j, j); preview_pipette_range_item = gtk_menu_item_new_with_label(buf); gtk_container_add(GTK_CONTAINER(preview_pipette_range_menu), preview_pipette_range_item); - gtk_signal_connect(GTK_OBJECT(preview_pipette_range_item), "activate", - (GtkSignalFunc) xsane_setup_preview_pipette_range_callback, (void *) j); + g_signal_connect(GTK_OBJECT(preview_pipette_range_item), "activate", (GtkSignalFunc) xsane_setup_preview_pipette_range_callback, (void *) j); gtk_widget_show(preview_pipette_range_item); if (preferences.preview_pipette_range == j) { @@ -2915,7 +3154,7 @@ static void xsane_enhance_notebook(GtkWidget *notebook) adf_item = gtk_menu_item_new_with_label(MENU_ITEM_SELECTION_NONE); gtk_container_add(GTK_CONTAINER(adf_menu), adf_item); - gtk_signal_connect(GTK_OBJECT(adf_item), "activate", (GtkSignalFunc) xsane_setup_adf_mode_callback, NULL); + g_signal_connect(GTK_OBJECT(adf_item), "activate", (GtkSignalFunc) xsane_setup_adf_mode_callback, NULL); gtk_widget_show(adf_item); opt = xsane_get_option_descriptor(xsane.dev, xsane.well_known.scansource); @@ -2938,7 +3177,7 @@ static void xsane_enhance_notebook(GtkWidget *notebook) { adf_item = gtk_menu_item_new_with_label(_BGT(opt->constraint.string_list[i])); gtk_container_add(GTK_CONTAINER(adf_menu), adf_item); - gtk_signal_connect(GTK_OBJECT(adf_item), "activate", (GtkSignalFunc) xsane_setup_adf_mode_callback, (void *) opt->constraint.string_list[i]); + g_signal_connect(GTK_OBJECT(adf_item), "activate", (GtkSignalFunc) xsane_setup_adf_mode_callback, (void *) opt->constraint.string_list[i]); gtk_widget_show(adf_item); @@ -2977,8 +3216,12 @@ static void xsane_enhance_notebook(GtkWidget *notebook) hbox = gtk_hbox_new(/* homogeneous */ FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); +#ifdef HAVE_GTK2 + button = gtk_button_new_from_stock(GTK_STOCK_APPLY); +#else button = gtk_button_new_with_label(BUTTON_APPLY); - gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_enhance_apply_changes, NULL); +#endif + g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_enhance_apply_changes, NULL); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_widget_show(button); @@ -2998,18 +3241,16 @@ void xsane_setup_dialog(GtkWidget *widget, gpointer data) device_options_changed = 0; - xsane_clear_histogram(&xsane.histogram_raw); - xsane_clear_histogram(&xsane.histogram_enh); xsane_set_sensitivity(FALSE); xsane.preview->calibration = 1; /* show monitor calibration image */ - setup_dialog = gtk_window_new(GTK_WINDOW_DIALOG); + setup_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(setup_dialog), GTK_WIN_POS_MOUSE); snprintf(buf, sizeof(buf), "%s %s", xsane.prog_name, WINDOW_SETUP); gtk_window_set_title(GTK_WINDOW(setup_dialog), buf); - gtk_signal_connect(GTK_OBJECT(setup_dialog), "destroy", (GtkSignalFunc) xsane_destroy_setup_dialog_callback, setup_dialog); + g_signal_connect(GTK_OBJECT(setup_dialog), "destroy", (GtkSignalFunc) xsane_destroy_setup_dialog_callback, setup_dialog); xsane_set_window_icon(setup_dialog, 0); /* set the main vbox */ @@ -3043,16 +3284,23 @@ void xsane_setup_dialog(GtkWidget *widget, gpointer data) gtk_container_set_border_width(GTK_CONTAINER(hbox), 5); gtk_widget_show(hbox); - +#ifdef HAVE_GTK2 + button = gtk_button_new_from_stock(GTK_STOCK_OK); +#else button = gtk_button_new_with_label(BUTTON_OK); +#endif GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); - gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_options_ok_callback, setup_dialog); + g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_setup_options_ok_callback, setup_dialog); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_widget_grab_default(button); gtk_widget_show(button); +#ifdef HAVE_GTK2 + button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); +#else button = gtk_button_new_with_label(BUTTON_CANCEL); - gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_close_setup_dialog_callback, setup_dialog); +#endif + g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_close_setup_dialog_callback, setup_dialog); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_widget_show(button); |