]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlPrefs.h
fix crash due to invalidated iterator
[lyx.git] / src / frontends / controllers / ControlPrefs.h
1 // -*- C++ -*-
2 /**
3  * \file ControlPrefs.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef CONTROLPREFS_H
13 #define CONTROLPREFS_H
14
15 #include "Dialog.h"
16 #include "converter.h"
17 #include "format.h"
18 #include "lyxrc.h"
19 #include "mover.h"
20
21 #include <string>
22 #include <vector>
23
24 class LColor_color;
25
26 namespace lyx {
27 namespace frontend {
28
29 class ControlPrefs : public Dialog::Controller {
30 public:
31         ControlPrefs(Dialog &);
32         ///
33         virtual bool initialiseParams(std::string const &);
34         ///
35         virtual void clearParams() {}
36         ///
37         virtual void dispatchParams();
38         ///
39         virtual bool isBufferDependent() const { return false; }
40
41         LyXRC & rc() { return rc_; }
42         LyXRC const & rc() const { return rc_; }
43
44         Converters & converters() { return converters_; }
45         Converters const & converters() const { return converters_; }
46
47         Formats & formats() { return formats_; }
48         Formats const & formats() const { return formats_; }
49
50         Movers & movers() { return movers_; }
51         Movers const & movers() const { return movers_; }
52
53         /// various file pickers
54         std::string const browsebind(std::string const & file) const;
55         std::string const browseUI(std::string const & file) const;
56         std::string const browsekbmap(std::string const & file) const;
57         std::string const browsedict(std::string const & file) const;
58
59         /// general browse
60         std::string const browse(std::string const & file,
61                                  std::string const & title) const;
62
63         /// browse directory
64         std::string const browsedir(std::string const & path,
65                                     std::string const & title) const;
66
67         /// redraw widgets (for xforms color change)
68         void redrawGUI();
69
70         /// set a color
71         void setColor(LColor_color col, std::string const & hex);
72
73         /// update the screen fonts after change
74         void updateScreenFonts();
75
76         /// adjust the prefs paper sizes
77         PAPER_SIZE const toPaperSize(int i) const;
78         /// adjust the prefs paper sizes
79         int const fromPaperSize(PAPER_SIZE papersize) const;
80
81 private:
82         /// temporary lyxrc
83         LyXRC rc_;
84
85         /// temporary converters
86         Converters converters_;
87
88         /// temporary formats
89         Formats formats_;
90
91         /// temporary movers
92         Movers movers_;
93
94         /// A list of colors to be dispatched
95         std::vector<std::string> colors_;
96
97         bool redraw_gui_;
98         bool update_screen_font_;
99 };
100
101 } // namespace frontend
102 } // namespace lyx
103
104 #endif // CONTROLPREFS_H