adv. opt. patch for xscanimage...

Matto Marjanovic (maddog@mir.com)
Tue, 16 Dec 1997 03:39:31 -0500

Here is a "diff -u" patch for gtkglue.c, to change the behavior of xscanimage
with respect to backend options flagged as "advanced".

It does two things:
a) For all individual options flagged as "advanced", panel_build will only
display the option if the "Show advanced" button is toggled. Group
identifiers flagged as "advanced" are handled the same as before.
b) panel_rebuild is called whenever the "Show advanced" button is toggled
on or off.

I figure as long as the option panel is getting rebuilt everytime a set_option
comes back with RELOAD_OPTIONS flagged, it can't hurt to rebuild it when the
advanced toggle is pressed.
This way, you can place advanced enhancement options in the enhancement group,
etc, and it all looks nice and neat...

(Looks sweet with the latest Microtek backend.)

-matt m.

--- gtkglue.c Sun Nov 16 17:11:44 1997
+++ gtkglue.c.mm Tue Dec 16 02:25:48 1997
@@ -939,6 +939,7 @@
break;

case SANE_TYPE_BOOL:
+ if ((opt->cap & SANE_CAP_ADVANCED) && !(dialog->advanced)) break;
assert (opt->size == sizeof (SANE_Word));
status = sane_control_option (dialog->dev, i, SANE_ACTION_GET_VALUE,
&val, 0);
@@ -950,6 +951,7 @@
break;

case SANE_TYPE_INT:
+ if ((opt->cap & SANE_CAP_ADVANCED) && !(dialog->advanced)) break;
if (opt->size != sizeof (SANE_Word))
{
vector_opts[num_vector_opts++] = i;
@@ -1000,6 +1002,7 @@
break;

case SANE_TYPE_FIXED:
+ if ((opt->cap & SANE_CAP_ADVANCED) && !(dialog->advanced)) break;
if (opt->size != sizeof (SANE_Word))
{
vector_opts[num_vector_opts++] = i;
@@ -1060,6 +1063,7 @@
break;

case SANE_TYPE_STRING:
+ if ((opt->cap & SANE_CAP_ADVANCED) && !(dialog->advanced)) break;
buf = malloc (opt->size);
status = sane_control_option (dialog->dev, i, SANE_ACTION_GET_VALUE,
buf, 0);
@@ -1094,6 +1098,7 @@
break;

case SANE_TYPE_BUTTON:
+ if ((opt->cap & SANE_CAP_ADVANCED) && !(dialog->advanced)) break;
button = gtk_button_new ();
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) push_button_callback, elem);
@@ -1132,7 +1137,10 @@
if (num_vector_opts)
vector_new (dialog, main_hbox, num_vector_opts, vector_opts);

- gsg_set_advanced (dialog, preferences.advanced);
+ if (dialog->advanced)
+ gtk_widget_show (dialog->advanced_vbox);
+ else
+ gtk_widget_hide (dialog->advanced_vbox);
gtk_widget_show (main_hbox);
}

@@ -1313,10 +1321,7 @@
gsg_set_advanced (GSGDialog *dialog, int advanced)
{
dialog->advanced = advanced;
- if (advanced)
- gtk_widget_show (dialog->advanced_vbox);
- else
- gtk_widget_hide (dialog->advanced_vbox);
+ panel_rebuild (dialog);
}

void

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com