1 /* Copyright (c) 2006 by Arkkra Enterprises */
2 /* All rights reserved */
7 // Classes for Config menu item off of main toolbar
9 #include <FL/Fl_Double_Window.H>
10 #include <FL/Fl_Input.H>
11 #include <FL/Fl_Secret_Input.H>
12 #include <FL/Fl_Button.H>
13 #include <FL/Fl_Return_Button.H>
14 #include <FL/Fl_Check_Button.H>
15 #include <FL/Fl_Choice.H>
16 #include <FL/Fl_Value_Input.H>
20 // Class for window that asks user for file locations
22 class FileLocations_dialog : Fl_Double_Window {
27 FileLocations_dialog(void);
28 ~FileLocations_dialog();
31 static void Apply_cb(Fl_Widget *, void *);
32 static void Cancel_cb(Fl_Widget *, void *);
39 // Populuate fields with current values
40 void set_current_values(void);
43 Fl_Input * mup_program_p;
44 Fl_Input * mup_documentation_p;
45 Fl_Input * music_files_p;
49 Fl_Return_Button * apply_p;
54 // Class for window that asks user for preferences, like editor font, size, etc.
56 class Preferences_dialog : Fl_Double_Window {
61 Preferences_dialog(void);
62 ~Preferences_dialog();
65 static void Apply_cb(Fl_Widget *, void * data);
66 static void Cancel_cb(Fl_Widget *, void * data);
67 static void fontchg_cb(Fl_Widget *, void * data);
75 // Populate fields with current values
76 void set_current_values(void);
78 // Populate size menu as appropriate for the given font
79 void set_size_list(Fl_Font font, uchar curr_size);
84 Fl_Check_Button * auto_display_p;
85 Fl_Check_Button * auto_save_p;
86 Fl_Value_Input * tooltips_delay_p;
87 Fl_Return_Button * apply_p;
92 // Class for user to fill out registration form
94 class RegistrationForm_dialog : public Fl_Double_Window
97 RegistrationForm_dialog(void);
98 ~RegistrationForm_dialog(void);
101 static void SaveForm_cb(Fl_Widget *, void * data);
102 static void Cancel_cb(Fl_Widget *, void * data);
109 // Fill in the form and write it out for user to mail with payment.
110 void generate_form(void);
111 // Fill in the value in the blank before or after the given place.
112 // If can't fit entire value, returns pointer to how far it got,
113 // otherwise returns zero.
114 const char * fill_in(bool before, char *place, const char * const value);
115 // Calculate sales tax due.
116 double sales_tax(void);
120 Fl_Input * address_p;
123 Fl_Input * postal_code_p;
124 Fl_Input * country_p;
126 Fl_Input * how_heard_p;
127 Fl_Check_Button * Windows_p;
128 Fl_Check_Button * Mac_p;
129 Fl_Check_Button * Linux_p;
130 Fl_Check_Button * other_p;
131 Fl_Input * other_OS_p;
132 Fl_Check_Button * mailing_list_p;
133 Positive_Int_Input * num_regs_p;
135 Fl_Return_Button * save_form_p;
136 Fl_Button * cancel_p;
140 // Class for user to enter registration key after paying.
142 class RegistrationKey_dialog : public Fl_Double_Window {
144 RegistrationKey_dialog(void);
145 ~RegistrationKey_dialog();
148 static void OK_cb(Fl_Widget *, void *);
149 static void Cancel_cb(Fl_Widget *, void *);
157 Fl_Secret_Input * key_p;
158 Fl_Return_Button * OK_p;
159 Fl_Button * cancel_p;
162 // Class for the Config menu item on main toolbar
170 static void FileLocations_cb(Fl_Widget *, void *);
171 static void Preferences_cb(Fl_Widget *, void *);
172 static void RegistrationForm_cb(Fl_Widget *, void *);
173 static void RegistrationKey_cb(Fl_Widget *, void *);
175 // Convert font name to Fl_Font value
176 static Fl_Font fontvalue(const char *);
180 void FileLocations(void);
181 void Preferences(void);
182 void RegistrationForm(void);
183 void RegistrationKey(void);
186 FileLocations_dialog * locations_p;
187 Preferences_dialog * preferences_p;
188 RegistrationForm_dialog * registrationform_p;
189 RegistrationKey_dialog * registrationkey_p;
193 // Any class that wants to be notified of changes in user preference
194 // for font and size should register a callback function of this type
195 // using the Font_change_registration class. The first arg will be user
196 // data the registrant wants to have passed to it. The second argument
197 // is the new font, and the third argument is the new size.
198 typedef void (*Font_change_callback)(void *, Fl_Font, unsigned char);
200 // Any class that wants to be notified of changes in user preference
201 // in font/size should instantiate an instance of this class.
202 class Font_change_registration {
204 Font_change_registration(Font_change_callback func, void * arg);
205 ~Font_change_registration(void);
207 // This runs all the registered callbacks
208 static void run_callbacks(Fl_Font font, unsigned char size);
211 // Linked list of callbacks
212 static Font_change_registration * list_p;
213 Font_change_registration * next;
215 // What function to call back, and what to pass it.
216 Font_change_callback callback;