summaryrefslogtreecommitdiff
path: root/src/xsane-fax-project.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xsane-fax-project.c')
-rw-r--r--src/xsane-fax-project.c93
1 files changed, 78 insertions, 15 deletions
diff --git a/src/xsane-fax-project.c b/src/xsane-fax-project.c
index 8f23bf2..4b7b770 100644
--- a/src/xsane-fax-project.c
+++ b/src/xsane-fax-project.c
@@ -3,7 +3,7 @@
xsane-fax-project.c
Oliver Rauch <Oliver.Rauch@rauch-domain.de>
- Copyright (C) 1998-2005 Oliver Rauch
+ Copyright (C) 1998-2007 Oliver Rauch
This file is part of the XSANE package.
This program is free software; you can redistribute it and/or modify
@@ -57,6 +57,7 @@ void xsane_fax_dialog(void);
void xsane_fax_project_save(void);
static gint xsane_fax_dialog_delete();
+static void xsane_fax_project_browse_filename_callback(GtkWidget *widget, gpointer data);
static void xsane_fax_receiver_changed_callback(GtkWidget *widget, gpointer data);
static void xsane_fax_project_changed_callback(GtkWidget *widget, gpointer data);
static void xsane_fax_fine_mode_callback(GtkWidget *widget);
@@ -86,8 +87,9 @@ void xsane_fax_dialog()
GtkWidget *fax_dialog, *fax_scan_vbox, *fax_project_vbox, *hbox, *fax_project_exists_hbox, *button;
GtkWidget *scrolled_window, *list;
char buf[64];
- GtkWidget *pixmapwidget, *text;
+ GtkWidget *text;
GtkWidget *pages_frame;
+ GtkWidget *pixmapwidget;
GdkBitmap *mask;
GdkPixmap *pixmap;
@@ -119,10 +121,8 @@ void xsane_fax_dialog()
gtk_container_set_border_width(GTK_CONTAINER(hbox), 2);
gtk_box_pack_start(GTK_BOX(fax_scan_vbox), hbox, FALSE, FALSE, 1);
- pixmap = gdk_pixmap_create_from_xpm_d(xsane.dialog->window, &mask, xsane.bg_trans, (gchar **) fax_xpm);
- pixmapwidget = gtk_image_new_from_pixmap(pixmap, mask);
- gtk_box_pack_start(GTK_BOX(hbox), pixmapwidget, FALSE, FALSE, 2);
- gdk_drawable_unref(pixmap);
+ button = xsane_button_new_with_pixmap(xsane.dialog->window, hbox, fax_xpm, DESC_FAX_PROJECT_BROWSE,
+ (GtkSignalFunc) xsane_fax_project_browse_filename_callback, NULL);
text = gtk_entry_new();
xsane_back_gtk_set_tooltip(xsane.tooltips, text, DESC_FAXPROJECT);
@@ -134,7 +134,6 @@ void xsane_fax_dialog()
xsane.project_entry = text;
xsane.project_entry_box = hbox;
- gtk_widget_show(pixmapwidget);
gtk_widget_show(text);
gtk_widget_show(hbox);
@@ -582,6 +581,64 @@ static void xsane_fax_receiver_changed_callback(GtkWidget *widget, gpointer data
gtk_progress_bar_update(GTK_PROGRESS_BAR(xsane.project_progress_bar), 0.0);
}
+/* ----------------------------------------------------------------------------------------------------------------- */
+
+void xsane_fax_project_set_filename(gchar *filename)
+{
+ g_signal_handlers_block_by_func(GTK_OBJECT(xsane.project_entry), (GtkSignalFunc) xsane_fax_project_changed_callback, NULL);
+ gtk_entry_set_text(GTK_ENTRY(xsane.project_entry), (char *) filename); /* update filename in entry */
+ gtk_entry_set_position(GTK_ENTRY(xsane.project_entry), strlen(filename)); /* set cursor to right position of filename */
+
+ g_signal_handlers_unblock_by_func(GTK_OBJECT(xsane.project_entry), (GtkSignalFunc) xsane_fax_project_changed_callback, NULL);
+}
+
+/* ----------------------------------------------------------------------------------------------------------------- */
+
+static void xsane_fax_project_browse_filename_callback(GtkWidget *widget, gpointer data)
+{
+ char filename[PATH_MAX];
+ char windowname[TEXTBUFSIZE];
+
+ DBG(DBG_proc, "xsane_fax_project_browse_filename_callback\n");
+
+ xsane_set_sensitivity(FALSE);
+
+ if (preferences.fax_project) /* make sure a correct filename is defined */
+ {
+ strncpy(filename, preferences.fax_project, sizeof(filename));
+ filename[sizeof(filename) - 1] = '\0';
+ }
+ else /* no filename given, take standard filename */
+ {
+ strcpy(filename, OUT_FILENAME);
+ }
+
+ snprintf(windowname, sizeof(windowname), "%s %s %s", xsane.prog_name, WINDOW_FAX_PROJECT_BROWSE, xsane.device_text);
+
+ umask((mode_t) preferences.directory_umask); /* define new file permissions */
+ if (!xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, NULL, NULL, XSANE_FILE_CHOOSER_ACTION_SELECT_PROJECT, FALSE, 0, 0))
+ {
+
+ if (preferences.fax_project)
+ {
+ free((void *) preferences.fax_project);
+ }
+
+ preferences.fax_project = strdup(filename);
+
+ xsane_set_sensitivity(TRUE);
+ xsane_fax_project_set_filename(filename);
+
+ xsane_fax_project_load();
+ }
+ else
+ {
+ xsane_set_sensitivity(TRUE);
+ }
+ umask(XSANE_DEFAULT_UMASK); /* define new file permissions */
+
+}
+
/* ---------------------------------------------------------------------------------------------------------------------- */
static void xsane_fax_project_changed_callback(GtkWidget *widget, gpointer data)
@@ -761,20 +818,21 @@ static void xsane_fax_entry_rename_callback(GtkWidget *widget, gpointer list)
#ifdef HAVE_GTK2
- button = gtk_button_new_from_stock(GTK_STOCK_OK);
+ button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
#else
- button = gtk_button_new_with_label(BUTTON_OK);
+ button = gtk_button_new_with_label(BUTTON_CANCEL);
#endif
- g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_fax_entry_rename_button_callback, (void *) 1);
+ g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_fax_entry_rename_button_callback, (void *) -1);
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0);
gtk_widget_show(button);
+
#ifdef HAVE_GTK2
- button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
+ button = gtk_button_new_from_stock(GTK_STOCK_OK);
#else
- button = gtk_button_new_with_label(BUTTON_CANCEL);
+ button = gtk_button_new_with_label(BUTTON_OK);
#endif
- g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_fax_entry_rename_button_callback, (void *) -1);
+ g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_fax_entry_rename_button_callback, (void *) 1);
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0);
gtk_widget_show(button);
@@ -833,7 +891,7 @@ static void xsane_fax_entry_insert_callback(GtkWidget *widget, gpointer list)
umask((mode_t) preferences.directory_umask); /* define new file permissions */
- if (!xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, NULL, TRUE, FALSE, FALSE, FALSE)) /* filename is selected */
+ if (!xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, NULL, NULL, XSANE_FILE_CHOOSER_ACTION_OPEN, FALSE, XSANE_FILE_FILTER_ALL | XSANE_FILE_FILTER_IMAGES, XSANE_FILE_FILTER_IMAGES)) /* filename is selected */
{
FILE *sourcefile;
@@ -1082,7 +1140,12 @@ static int xsane_fax_convert_pnm_to_ps(char *source_filename, char *fax_filename
preferences.fax_width * 72.0/MM_PER_INCH, /* paper_width */
preferences.fax_height * 72.0/MM_PER_INCH, /* paper_height */
0 /* portrait top left */,
- preferences.fax_ps_flatdecoded, /* use ps level 3 zlib compression */
+ preferences.fax_ps_flatedecoded, /* use ps level 3 zlib compression */
+ NULL, /* hTransform */
+ 0 /* do not apply ICM profile */,
+ 0, NULL, /* no CSA */
+ 0, NULL, 0, /* no CRD */
+ 0, /* intent */
xsane.project_progress_bar,
&cancel_save);
fclose(outfile);