1 | // This file is part of SmallBASIC |
2 | // |
3 | // Copyright(C) 2001-2019 Chris Warren-Smith. |
4 | // |
5 | // This program is distributed under the terms of the GPL v2.0 or later |
6 | // Download the GNU Public License (GPL) from www.gnu.org |
7 | // |
8 | |
9 | #ifndef PROFILE_H |
10 | #define PROFILE_H |
11 | |
12 | #include <FL/Fl_Rect.H> |
13 | #include "ui/strlib.h" |
14 | #include "ui/textedit.h" |
15 | |
16 | using namespace strlib; |
17 | |
18 | struct MainWindow; |
19 | struct EditorWidget; |
20 | class HelpWidget; |
21 | |
22 | struct Profile { |
23 | Profile(); |
24 | |
25 | bool createBackups() const { return _createBackups; } |
26 | int getFontSize() const { return _fontSize; } |
27 | void loadConfig(EditorWidget *editor); |
28 | void loadEditTheme(int themeId); |
29 | void restore(MainWindow *wnd); |
30 | void restoreAppPosition(Fl_Window *wnd); |
31 | void setAppPosition(Fl_Rect rect) { _appPosition = rect; } |
32 | void setEditTheme(EditorWidget *editor); |
33 | void setHelpTheme(HelpWidget *help, int themeId = -1); |
34 | void setFont(Fl_Font font) { _font = font; } |
35 | void setFontSize(int size) { _fontSize = size; } |
36 | void save(MainWindow *wnd); |
37 | void updateTheme(); |
38 | |
39 | private: |
40 | Fl_Font _font; |
41 | Fl_Rect _appPosition; |
42 | EditTheme _theme; |
43 | EditTheme _helpTheme; |
44 | bool _loaded; |
45 | int _createBackups; |
46 | int _lineNumbers; |
47 | int _fontSize; |
48 | int _indentLevel; |
49 | int _themeId; |
50 | int _helpThemeId; |
51 | |
52 | int nextInteger(const char *s, int len, int &index); |
53 | Fl_Rect restoreRect(Properties<String *> *profile, const char *key); |
54 | void restoreStyles(Properties<String *> *profile); |
55 | void restoreTabs(MainWindow *wnd, Properties<String *> *profile); |
56 | void restoreValue(Properties<String *> *profile, const char *key, int *value); |
57 | void restoreWindowPos(MainWindow *wnd, Fl_Rect &rc); |
58 | void saveRect(FILE *fp, const char *key, Fl_Rect *wnd); |
59 | void saveStyles(FILE *fp); |
60 | void saveTabs(FILE *fp, MainWindow *wnd); |
61 | void saveValue(FILE *fp, const char *key, const char *value); |
62 | void saveValue(FILE *fp, const char *key, int value); |
63 | }; |
64 | |
65 | #endif |
66 | |
67 | |