]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/diaprint_callbacks.c
small patch from Dekel, begin introducing the real boost framework, get rid of the...
[lyx.git] / src / frontends / gnome / diaprint_callbacks.c
1 /* This file is part of
2  * ====================================================== 
3  * 
4  *           LyX, The Document Processor
5  *       
6  *          Copyright 2000 The LyX Team.
7  *
8  * ====================================================== */
9
10 /* Print dialog callbacks
11  * Controls the state of the widgets
12  */
13
14 #ifdef HAVE_CONFIG_H
15 #  include <config.h>
16 #endif
17
18 #include <gnome.h>
19
20 #include "diaprint_callbacks.h"
21 #include "diaprint_interface.h"
22 #include "support.h"
23
24
25 void
26 diaprint_set_printdest_state( GtkWidget *wid, gboolean active_is_printer )
27 {
28   if (active_is_printer)
29     {
30       gtk_widget_set_sensitive(lookup_widget(wid, "printto_printcommand"), TRUE);
31       gtk_widget_set_sensitive(lookup_widget(wid, "printto_fileentry"), FALSE);  
32     }
33   else
34     {
35       gtk_widget_set_sensitive(lookup_widget(wid, "printto_printcommand"), FALSE);
36       gtk_widget_set_sensitive(lookup_widget(wid, "printto_fileentry"), TRUE);  
37     }
38 }
39
40 void
41 diaprint_set_pages_state( GtkWidget *wid, gboolean active_pages )
42 {
43   gtk_widget_set_sensitive(lookup_widget(wid, "print_from"), active_pages);
44   gtk_widget_set_sensitive(lookup_widget(wid, "print_to"), active_pages);  
45 }
46
47 void
48 diaprint_on_diaprint_show              (GtkWidget       *widget,
49                                         gpointer         user_data)
50 {
51   diaprint_set_printdest_state(widget,
52                                gtk_toggle_button_get_active
53                                (GTK_TOGGLE_BUTTON(lookup_widget(widget, "printto_printer")))
54                                );
55   diaprint_set_pages_state(widget, 
56                            gtk_toggle_button_get_active
57                            (GTK_TOGGLE_BUTTON(lookup_widget(widget, "print_pages")))
58                            );
59 }
60
61 void
62 diaprint_on_printto_file_toggled       (GtkToggleButton *togglebutton,
63                                         gpointer         user_data)
64 {
65   diaprint_set_printdest_state(GTK_WIDGET(togglebutton), FALSE);
66 }
67
68
69 void
70 diaprint_on_printto_printer_toggled    (GtkToggleButton *togglebutton,
71                                         gpointer         user_data)
72 {
73   diaprint_set_printdest_state(GTK_WIDGET(togglebutton), TRUE);
74 }
75
76 void
77 diaprint_on_print_pages_toggled        (GtkToggleButton *togglebutton,
78                                         gpointer         user_data)
79 {
80   diaprint_set_pages_state(GTK_WIDGET(togglebutton),
81                            gtk_toggle_button_get_active(togglebutton));
82 }
83
84 void
85 diaprint_on_print_from_changed         (GtkEditable     *editable,
86                                         gpointer         user_data)
87 {
88   GtkSpinButton * to;
89   GtkAdjustment * a;
90   int nmin, v;
91
92   nmin = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(editable) );
93   to = GTK_SPIN_BUTTON(lookup_widget(GTK_WIDGET(editable), "print_to"));
94   a = gtk_spin_button_get_adjustment(to);
95   v = gtk_spin_button_get_value_as_int(to);
96
97   a->lower = nmin;
98   if (v < nmin)
99     gtk_spin_button_set_value(to, nmin);
100   else
101     gtk_spin_button_set_value(to, v);    
102 }
103
104