]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/GuiCharacter.h
Make code a bit easier to read
[lyx.git] / src / frontends / qt / GuiCharacter.h
1 // -*- C++ -*-
2 /**
3  * \file GuiCharacter.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  * \author Edwin Leuven
9  * \author John Levon
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef GUICHARACTER_H
15 #define GUICHARACTER_H
16
17 #include "GuiDialog.h"
18 #include "ui_CharacterUi.h"
19 #include "Font.h"
20
21 #include <QAction>
22
23 #include <utility>
24
25 #ifdef IGNORE
26 #undef IGNORE
27 #endif
28
29 namespace lyx {
30 namespace frontend {
31
32 enum FontDeco {
33         ///
34         IGNORE,
35         ///
36         UNDERBAR,
37         ///
38         STRIKEOUT,
39         ///
40         XOUT,
41         ///
42         UULINE,
43         ///
44         UWAVE,
45         ///
46         INHERIT,
47         ///
48         NONE
49 };
50
51 typedef std::pair<QString, FontFamily> FamilyPair;
52 typedef std::pair<QString, FontFamily> FamilyPair;
53 typedef std::pair<QString, FontSeries> SeriesPair;
54 typedef std::pair<QString, FontShape>  ShapePair;
55 typedef std::pair<QString, FontSize>   SizePair;
56 typedef std::pair<QString, FontDeco>  BarPair;
57 typedef std::pair<QString, QString>    LanguagePair;
58
59 class GuiCharacter : public GuiDialog, public Ui::CharacterUi
60 {
61         Q_OBJECT
62
63 public:
64         GuiCharacter(GuiView & lv);
65
66 protected Q_SLOTS:
67         void change_adaptor();
68         void on_emphCB_clicked();
69         void on_nounCB_clicked();
70         void on_nospellcheckCB_clicked();
71         void resetToDefault();
72         void resetToNoChange();
73         void checkRestoreDefaults();
74
75 private:
76         /// \name Dialog inherited methods
77         //@{
78         void applyView() override;
79         void updateContents() override;
80         bool initialiseParams(std::string const & data) override;
81         void clearParams() override {}
82         void dispatchParams() override;
83         bool isBufferDependent() const override { return true; }
84         FuncCode getLfun() const override { return LFUN_TEXTSTYLE_UPDATE; }
85         void saveSession(QSettings & settings) const override;
86         void restoreSession() override;
87         //@}
88
89         ///
90         void paramsToDialog(Font const & font);
91         ///
92         void setBar(FontInfo & fi, FontDeco val);
93         ///
94         void setStrike(FontInfo & fi, FontDeco val);
95
96         QList<FamilyPair> family;
97         QList<SeriesPair> series;
98         QList<ShapePair>  shape;
99         QList<SizePair>   size;
100         QList<BarPair>    bar;
101         QList<BarPair>    strike;
102         QList<ColorCode> color;
103         QList<LanguagePair> language;
104
105         ///
106         Font font_;
107         ///
108         bool emph_;
109         ///
110         bool noun_;
111         ///
112         bool nospellcheck_;
113
114         ///
115         QAction * resetdefault_ = new QAction(this);
116         ///
117         QAction * resetnochange_ = new QAction(this);
118 };
119
120 } // namespace frontend
121 } // namespace lyx
122
123 #endif // GUICHARACTER_H