]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormPreferences.h
patch from Dekel + some simplifications
[lyx.git] / src / frontends / xforms / FormPreferences.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *       
7  *          Copyright 1995 Matthias Ettrich
8  *          Copyright 1995-2000 The LyX Team.
9  *
10  *          This file copyright 1999-2000
11  *          Allan Rae
12  *======================================================*/
13 /* FormPreferences.h
14  * FormPreferences Interface Class
15  */
16
17 #ifndef FORMPREFERENCES_H
18 #define FORMPREFERENCES_H
19
20 #include "FormBase.h"
21
22 #ifdef __GNUG_
23 #pragma interface
24 #endif
25
26 class LyXView;
27 class Dialogs;
28
29 struct FD_form_preferences;
30 struct FD_form_lnf_misc;
31 struct FD_form_screen_fonts;
32 struct FD_form_interface;
33 struct FD_form_printer;
34 struct FD_form_paths;
35 struct FD_form_outer_tab;
36 struct FD_form_inputs_misc;
37 struct FD_form_outputs_misc;
38 struct FD_form_spellchecker;
39 struct FD_form_language;
40 struct FD_form_colours;
41 class  Combox;
42
43 /** This class provides an XForms implementation of the FormPreferences Dialog.
44     The preferences dialog allows users to set/save their preferences.
45  */
46 class FormPreferences : public FormBaseBI {
47 public:
48         /// #FormPreferences x(LyXFunc ..., Dialogs ...);#
49         FormPreferences(LyXView *, Dialogs *);
50         ///
51         ~FormPreferences();
52         ///
53         static void ComboLanguageCB(int, void *, Combox *);
54         ///
55         static void FeedbackCB(FL_OBJECT *, long);
56         ///
57         static int FeedbackPost(FL_OBJECT *ob, int, FL_Coord, FL_Coord,
58                                 int, void *);
59
60 private:
61         ///
62         enum State {
63                 ///
64                 COLOURS,
65                 ///
66                 INPUTSMISC,
67                 ///
68                 INTERFACE,
69                 ///
70                 LANGUAGE,
71                 ///
72                 LOOKNFEELMISC,
73                 ///
74                 OUTPUTSMISC,
75                 ///
76                 PATHS,
77                 ///
78                 PRINTER,
79                 ///
80                 SCREENFONTS,
81                 ///
82                 SPELLCHECKER
83         };
84
85         /// Update the dialog.
86         virtual void update();
87         ///
88         virtual void hide();
89         /// OK from dialog
90         virtual void ok();
91         /// Apply from dialog
92         virtual void apply();
93         /// Restore from dialog
94         virtual void restore();
95         /// Filter the inputs -- return true if entries are valid
96         virtual bool input(FL_OBJECT *, long);
97         /// Build the dialog
98         virtual void build();
99         /// control which feedback message is output
100         void feedback( FL_OBJECT * ob );
101         ///
102         virtual FL_FORM * form() const;
103         ///
104         void applyColours();
105         ///
106         void applyInputsMisc();
107         ///
108         void applyInterface();
109         ///
110         void applyLanguage();
111         ///
112         void applyLnFmisc();
113         ///
114         void applyOutputsMisc();
115         ///
116         void applyPaths();
117         ///
118         void applyPrinter();
119         ///
120         void applyScreenFonts();
121         ///
122         void applySpellChecker();
123         ///
124         void buildColours();
125         ///
126         void buildInputsMisc();
127         ///
128         void buildInterface();
129         ///
130         void buildLanguage();
131         ///
132         void addLanguages( Combox & );
133         ///
134         void buildLnFmisc();
135         ///
136         void buildOutputsMisc();
137         ///
138         void buildPaths();
139         ///
140         void buildPrinter();
141         ///
142         void buildScreenFonts();
143         ///
144         void buildSpellchecker();
145         ///
146         void feedbackColours(FL_OBJECT const * const);
147         ///
148         void feedbackInputsMisc(FL_OBJECT const * const);
149         ///
150         void feedbackInterface(FL_OBJECT const * const);
151         ///
152         void feedbackLanguage(FL_OBJECT const * const);
153         ///
154         void feedbackLnFmisc(FL_OBJECT const * const);
155         ///
156         void feedbackOutputsMisc(FL_OBJECT const * const);
157         ///
158         void feedbackPaths(FL_OBJECT const * const);
159         ///
160         void feedbackPrinter(FL_OBJECT const * const);
161         ///
162         void feedbackScreenFonts(FL_OBJECT const * const);
163         ///
164         void feedbackSpellChecker(FL_OBJECT const * const);
165         ///
166         bool inputLanguage(FL_OBJECT const * const);
167         ///
168         bool inputPaths(FL_OBJECT const * const);
169         ///
170         bool inputScreenFonts();
171         ///
172         bool inputSpellChecker(FL_OBJECT const * const);
173         ///
174         void updateColours();
175         ///
176         void updateInputsMisc();
177         ///
178         void updateInterface();
179         ///
180         void updateLanguage();
181         ///
182         void updateLnFmisc();
183         ///
184         void updateOutputsMisc();
185         ///
186         void updatePaths();
187         ///
188         void updatePrinter();
189         ///
190         void updateScreenFonts();
191         ///
192         void updateSpellChecker();
193
194         ///
195         bool WriteableDir( string const & ) const;
196         ///
197         bool ReadableDir( string const & ) const;
198         ///
199         bool WriteableFile( string const &, string const & = string() ) const;
200         ///
201         void setPostHandler( FL_OBJECT * ) const;
202
203         ///
204         FD_form_preferences * build_preferences();
205         ///
206         FD_form_outer_tab * build_outer_tab();
207         ///
208         FD_form_colours * build_colours();
209         ///
210         FD_form_inputs_misc * build_inputs_misc();
211         ///
212         FD_form_interface * build_interface();
213         ///
214         FD_form_language * build_language();
215         ///
216         FD_form_lnf_misc * build_lnf_misc();
217         ///
218         FD_form_outputs_misc * build_outputs_misc();
219         ///
220         FD_form_paths * build_paths();
221         ///
222         FD_form_printer * build_printer();
223         ///
224         FD_form_screen_fonts * build_screen_fonts();
225         ///
226         FD_form_spellchecker * build_spellchecker();
227
228         /// Real GUI implementation.
229         FD_form_preferences * dialog_;
230         /// Outputs tabfolder
231         FD_form_outer_tab * outputs_tab_;
232         /// HCI configuration
233         FD_form_outer_tab * look_n_feel_tab_;
234         /// reLyX and other import/input stuff
235         FD_form_outer_tab * inputs_tab_;
236         /// Spellchecker, language stuff, etc
237         FD_form_outer_tab * usage_tab_;
238         ///
239         FD_form_colours * colours_;
240         ///
241         FD_form_inputs_misc * inputs_misc_;
242         ///
243         FD_form_interface * interface_;
244         ///
245         FD_form_language * language_;
246         ///
247         FD_form_lnf_misc * lnf_misc_;
248         ///
249         FD_form_outputs_misc * outputs_misc_;
250         ///
251         FD_form_paths * paths_;
252         ///
253         FD_form_printer * printer_;
254         ///
255         FD_form_screen_fonts * screen_fonts_;
256         ///
257         FD_form_spellchecker * spellchecker_;
258         ///
259         Combox * combo_default_lang;
260         ///
261         Combox * combo_kbmap_1;
262         ///
263         Combox * combo_kbmap_2;
264 };
265
266 #endif