*** empty log message ***

DEVEL_2_0_BRANCH-1
Oliver Rauch 2000-11-23 21:30:01 +00:00
rodzic 6618a0fb67
commit 3389a2d4cd
11 zmienionych plików z 0 dodań i 6086 usunięć

Plik diff jest za duży Load Diff

Wyświetl plik

@ -1,119 +0,0 @@
#ifndef gtkglue_h
#define gtkglue_h
#include <sys/types.h>
#include <gtk/gtk.h>
#include <sane/config.h>
#include <sane/sane.h>
struct GSGDialog;
typedef void (*GSGCallback) (struct GSGDialog *dialog, void *arg);
typedef enum
{
GSG_TL_X, /* top-left x */
GSG_TL_Y, /* top-left y */
GSG_BR_X, /* bottom-right x */
GSG_BR_Y /* bottom-right y */
}
GSGCornerCoordinates;
typedef struct
{
/* The option number of the well-known options. Each of these may
be -1 in case the backend doesn't define the respective option. */
int preview;
int dpi;
int coord[4];
}
GSGWellKnownOptions;
typedef struct
{
gchar *label;
struct GSGDialogElement *elem;
gint index;
}
GSGMenuItem;
typedef struct GSGDialogElement
{
struct GSGDialog *dialog; /* wasteful, but is there a better solution? */
GtkWidget *automatic; /* auto button for options that support this */
GtkWidget *widget;
GtkObject *data;
int menu_size; /* # of items in menu (if any) */
GSGMenuItem *menu;
}
GSGDialogElement;
typedef struct GSGDialog
{
GtkWidget *window;
GtkWidget *main_hbox;
GtkWidget *advanced_vbox;
GtkTooltips *tooltips;
GdkColor tooltips_fg;
GdkColor tooltips_bg;
SANE_Handle *dev;
const char *dev_name;
GSGWellKnownOptions well_known;
int num_elements;
GSGDialogElement *element;
gint idle_id;
u_int rebuild : 1;
u_int advanced : 1;
/* This callback gets invoked whenever the backend notifies us
that the option descriptors have changed. */
GSGCallback option_reload_callback;
void *option_reload_arg;
/* This callback gets invoked whenever the backend notifies us
that the parameters have changed. */
GSGCallback param_change_callback;
void *param_change_arg;
}
GSGDialog;
extern int gsg_message_dialog_active;
/* Construct the path and return it in filename_ret (this buffer must
be at least max_len bytes long). The path is constructed as
follows:
~/.sane/${PROG_NAME}/${PREFIX}${DEV_NAME}${POSTFIX}
If PROG_NAME is NULL, an empty string is used and the leading slash
is removed. On success, 0 is returned, on error a negative number and
ERRNO is set to the appropriate value. */
extern int gsg_make_path (size_t max_len, char *filename_ret,
const char *prog_name,
const char *prefix, const char *dev_name,
const char *postfix);
extern void gsg_message (gchar *title, gchar * message);
extern void gsg_error (gchar * error_message);
extern void gsg_warning (gchar * warning_message);
extern int gsg_get_filename (const char *label, const char *default_name,
size_t max_len, char *filename);
extern GSGDialog *gsg_create_dialog (GtkWidget *window,
const char *device_name,
GSGCallback option_reload_callback,
void *option_reload_arg,
GSGCallback param_callback,
void *param_arg);
extern void gsg_sync (GSGDialog *dialog);
extern void gsg_refresh_dialog (GSGDialog *dialog);
extern void gsg_update_scan_window (GSGDialog *dialog);
extern void gsg_set_advanced (GSGDialog *dialog, int advanced);
extern void gsg_set_tooltips (GSGDialog *dialog, int enable);
extern void gsg_set_sensitivity (GSGDialog *dialog, int sensitive);
extern void gsg_destroy_dialog (GSGDialog * dialog);
#define gsg_dialog_get_device(dialog) ((dialog)->dev)
#endif /* gtkglue_h */

Wyświetl plik

@ -1,181 +0,0 @@
/* sane - Scanner Access Now Easy.
Copyright (C) 1997 David Mosberger-Tang
This file is part of the SANE package.
SANE is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
SANE 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 General Public
License for more details.
You should have received a copy of the GNU General Public License
along with sane; see the file COPYING. If not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <preferences.h>
#include <sane/sane.h>
#include <sane/sanei.h>
#include <sane/sanei_wire.h>
#include <sane/sanei_codec_ascii.h>
#define POFFSET(field) ((char *) &((Preferences *) 0)->field - (char *) 0)
#define PFIELD(p,offset,type) (*((type *)(((char *)(p)) + (offset))))
Preferences preferences =
{
0, /* no preferred device (must be 0 or malloced!) */
0, /* no default filename */
0, /* advanced user */
1, /* tooltips enabled */
10.0, /* length unit */
1, /* preserve_preview */
0, /* preview_own_cmap */
1.0 /* preview_gamma */
};
static void w_string (Wire *w, Preferences *p, long offset);
static void w_double (Wire *w, Preferences *p, long offset);
static void w_int (Wire *w, Preferences *p, long offset);
static struct
{
SANE_String name;
void (*codec) (Wire *w, Preferences *p, long offset);
long offset;
}
desc[] =
{
{"device", w_string, POFFSET(device)},
{"filename", w_string, POFFSET(filename)},
{"advanced", w_int, POFFSET(advanced)},
{"tool-tips", w_int, POFFSET(tooltips_enabled)},
{"length-unit", w_double, POFFSET(length_unit)},
{"preserve-preview", w_int, POFFSET(preserve_preview)},
{"preview-own-cmap", w_int, POFFSET(preview_own_cmap)},
{"preview-gamma", w_double, POFFSET(preview_gamma)},
};
static void
w_string (Wire *w, Preferences *p, long offset)
{
SANE_String string;
if (w->direction == WIRE_ENCODE)
string = PFIELD (p, offset, char *);
sanei_w_string (w, &string);
if (w->direction == WIRE_DECODE)
{
if (w->status == 0)
{
const char **field;
field = &PFIELD (p, offset, const char *);
if (*field)
free ((char *) *field);
*field = string ? strdup (string) : 0;
}
sanei_w_free (w, (WireCodecFunc) sanei_w_string, &string);
}
}
static void
w_double (Wire *w, Preferences *p, long offset)
{
SANE_Word word;
if (w->direction == WIRE_ENCODE)
word = SANE_FIX (PFIELD (p, offset, double));
sanei_w_word (w, &word);
if (w->direction == WIRE_DECODE)
{
if (w->status == 0)
PFIELD (p, offset, double) = SANE_UNFIX (word);
sanei_w_free (w, (WireCodecFunc) sanei_w_word, &word);
}
}
static void
w_int (Wire *w, Preferences *p, long offset)
{
SANE_Word word;
if (w->direction == WIRE_ENCODE)
word = PFIELD (p, offset, int);
sanei_w_word (w, &word);
if (w->direction == WIRE_DECODE)
{
if (w->status == 0)
PFIELD (p, offset, int) = word;
sanei_w_free (w, (WireCodecFunc) sanei_w_word, &word);
}
}
void
preferences_save (int fd)
{
Wire w;
int i;
w.io.fd = fd;
w.io.read = read;
w.io.write = write;
sanei_w_init (&w, sanei_codec_ascii_init);
sanei_w_set_dir (&w, WIRE_ENCODE);
for (i = 0; i < NELEMS (desc); ++i)
{
sanei_w_string (&w, &desc[i].name);
(*desc[i].codec) (&w, &preferences, desc[i].offset);
}
sanei_w_set_dir (&w, WIRE_DECODE); /* flush it out */
}
void
preferences_restore (int fd)
{
SANE_String name;
Wire w;
int i;
w.io.fd = fd;
w.io.read = read;
w.io.write = write;
sanei_w_init (&w, sanei_codec_ascii_init);
sanei_w_set_dir (&w, WIRE_DECODE);
while (1)
{
sanei_w_space (&w, 3);
if (w.status)
return;
sanei_w_string (&w, &name);
if (w.status || !name)
return;
for (i = 0; i < NELEMS (desc); ++i)
{
if (strcmp (name, desc[i].name) == 0)
{
(*desc[i].codec) (&w, &preferences, desc[i].offset);
break;
}
}
}
}

Wyświetl plik

@ -1,24 +0,0 @@
#ifndef preferences_h
#define preferences_h
#include <sane/sane.h>
typedef struct
{
const char *device; /* name of preferred device (or NULL) */
const char *filename; /* default filename */
int advanced; /* advanced user? */
int tooltips_enabled; /* should tooltips be disabled? */
double length_unit; /* 1.0==mm, 10.0==cm, 25.4==inches, etc. */
int preserve_preview; /* save/restore preview image(s)? */
int preview_own_cmap; /* install colormap for preview */
double preview_gamma; /* gamma value for previews */
}
Preferences;
extern Preferences preferences;
extern void preferences_save (int fd);
extern void preferences_restore (int fd);
#endif /* preferences_h */

Plik diff jest za duży Load Diff

Wyświetl plik

@ -1,86 +0,0 @@
/* sane - Scanner Access Now Easy.
Copyright (C) 1997 David Mosberger-Tang
This file is part of the SANE package.
SANE is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
SANE 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 General Public License
for more details.
You should have received a copy of the GNU General Public License
along with sane; see the file COPYING. If not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef preview_h
#define preview_h
#include <sys/types.h>
#include <sane/config.h>
#include <sane/sane.h>
typedef struct
{
GSGDialog *dialog; /* the dialog for this preview */
SANE_Value_Type surface_type;
SANE_Unit surface_unit;
float surface[4]; /* the corners of the scan surface (device coords) */
float aspect; /* the aspect ratio of the scan surface */
int saved_dpi_valid;
SANE_Word saved_dpi;
int saved_coord_valid[4];
SANE_Word saved_coord[4];
/* desired/user-selected preview-window size: */
int preview_width;
int preview_height;
u_char *preview_row;
int scanning;
time_t image_last_time_updated;
gint input_tag;
SANE_Parameters params;
int image_offset;
int image_x;
int image_y;
int image_width;
int image_height;
u_char *image_data; /* 3 * image_width * image_height bytes */
GdkGC *gc;
int selection_drag;
struct
{
int active;
int coord[4];
}
selection, previous_selection;
GtkWidget *top; /* top-level widget */
GtkWidget *hruler;
GtkWidget *vruler;
GtkWidget *viewport;
GtkWidget *window; /* the preview window */
GtkWidget *cancel; /* the cancel button */
}
Preview;
/* Create a new preview based on the info in DIALOG. */
extern Preview *preview_new (GSGDialog *dialog);
/* Some of the parameters may have changed---update the preview. */
extern void preview_update (Preview *p);
/* Acquire a preview image and display it. */
extern void preview_scan (Preview *p);
/* Destroy a preview. */
extern void preview_destroy (Preview *p);
#endif /* preview_h */

Wyświetl plik

@ -1,90 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
* Hacked (C) 1996 Tristan Tarrant
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include "progress.h"
static const int progress_x = 5;
static const int progress_y = 5;
void
progress_cancel (GtkWidget * widget, gpointer data)
{
Progress_t *p = (Progress_t *) data;
(*p->callback) ();
}
Progress_t *
progress_new (char *title, char *text,
GtkSignalFunc callback, gpointer callback_data)
{
GtkWidget *button, *label;
GtkBox *vbox, *hbox;
Progress_t *p;
p = (Progress_t *) malloc (sizeof (Progress_t));
p->callback = callback;
p->shell = gtk_dialog_new ();
gtk_widget_set_uposition (p->shell, progress_x, progress_y);
gtk_window_set_title (GTK_WINDOW (p->shell), title);
vbox = GTK_BOX (GTK_DIALOG (p->shell)->vbox);
hbox = GTK_BOX (GTK_DIALOG (p->shell)->action_area);
gtk_container_border_width (GTK_CONTAINER (vbox), 7);
label = gtk_label_new (text);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_box_pack_start (vbox, label, FALSE, TRUE, 0);
p->pbar = gtk_progress_bar_new ();
gtk_widget_set_usize (p->pbar, 200, 20);
gtk_box_pack_start (vbox, p->pbar, TRUE, TRUE, 0);
button = gtk_toggle_button_new_with_label ("Cancel");
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) progress_cancel, p);
gtk_box_pack_start (hbox, button, TRUE, TRUE, 0);
gtk_widget_show (label);
gtk_widget_show (p->pbar);
gtk_widget_show (button);
gtk_widget_show (GTK_WIDGET (p->shell));
return p;
}
void
progress_free (Progress_t * p)
{
if (p)
{
gtk_widget_destroy (p->shell);
free (p);
}
}
void
progress_update (Progress_t * p, gfloat newval)
{
if (p)
gtk_progress_bar_update (GTK_PROGRESS_BAR (p->pbar), newval);
}

Wyświetl plik

@ -1,34 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef progress_h
#define progress_h
typedef struct Progress_t
{
GtkSignalFunc callback;
gpointer callback_data;
GtkWidget *shell;
GtkWidget *pbar;
}
Progress_t;
extern Progress_t *progress_new (char *, char *, GtkSignalFunc, void *);
extern void progress_free (Progress_t *);
extern void progress_update (Progress_t *, gfloat);
#endif /* progress_h */

Wyświetl plik

@ -1,21 +0,0 @@
# style <name> [= <name>]
# {
# <option>
# }
#
# widget <widget_set> style <style_name>
# widget_class <widget_class_set> style <style_name>
# accelerator <widget_name> <accelerator>
style "progressbar"
{
bg[PRELIGHT] = { 22500, 53280, 22500 } # green
}
style "curve"
{
fg[NORMAL] = { 58000, 0, 0 } # red
}
widget "*GtkCurve" style "curve"
widget "*GtkProgressBar" style "progressbar"

Plik diff jest za duży Load Diff

Plik diff jest za duży Load Diff