]> git.lyx.org Git - features.git/blob - src/frontends/qt4/Dialogs.cpp
math stuff
[features.git] / src / frontends / qt4 / Dialogs.cpp
1 /**
2  * \file qt4/Dialogs.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "Dialogs.h"
14 #include "GuiDialog.h"
15
16 #include "qt_helpers.h"
17
18 #include <boost/assert.hpp>
19
20 using std::string;
21
22 namespace lyx {
23 namespace frontend {
24
25 namespace {
26
27 // This list should be kept in sync with the list of insets in
28 // src/insets/Inset.cpp.  I.e., if a dialog goes with an inset, the
29 // dialog should have the same name as the inset.
30
31 char const * const dialognames[] = {
32 "aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
33 "citation", "document", "embedding", "errorlist", "ert", "external", "file",
34 "findreplace", "float", "graphics", "include", "index", "nomenclature", "label", "log",
35 "mathdelimiter", "mathmatrix", "note", "paragraph",
36 "prefs", "print", "ref", "sendto", "spellchecker","tabular", "tabularcreate",
37
38 #ifdef HAVE_LIBAIKSAURUS
39 "thesaurus",
40 #endif
41
42 "texinfo", "toc", "url", "view-source", "vspace", "wrap", "listings" };
43
44 char const * const * const end_dialognames =
45         dialognames + (sizeof(dialognames) / sizeof(char *));
46
47 class cmpCStr {
48 public:
49         cmpCStr(char const * name) : name_(name) {}
50         bool operator()(char const * other) {
51                 return strcmp(other, name_) == 0;
52         }
53 private:
54         char const * name_;
55 };
56
57
58 } // namespace anon
59
60 // will be replaced by a proper factory...
61 Dialog * createGuiAbout(LyXView & lv);
62 Dialog * createGuiBibitem(LyXView & lv);
63 Dialog * createGuiBibtex(LyXView & lv);
64 Dialog * createGuiBox(LyXView & lv);
65 Dialog * createGuiBranch(LyXView & lv);
66 Dialog * createGuiChanges(LyXView & lv);
67 Dialog * createGuiCharacter(LyXView & lv);
68 Dialog * createGuiCitation(LyXView & lv);
69 Dialog * createGuiDelimiter(LyXView & lv);
70 Dialog * createGuiDocument(LyXView & lv);
71 Dialog * createGuiEmbeddedFiles(LyXView & lv);
72 Dialog * createGuiErrorList(LyXView & lv);
73 Dialog * createGuiERT(LyXView & lv);
74 Dialog * createGuiExternal(LyXView & lv);
75 Dialog * createGuiFloat(LyXView & lv);
76 Dialog * createGuiGraphics(LyXView & lv);
77 Dialog * createGuiInclude(LyXView & lv);
78 Dialog * createGuiIndex(LyXView & lv);
79 Dialog * createGuiLabel(LyXView & lv);
80 Dialog * createGuiListings(LyXView & lv);
81 Dialog * createGuiLog(LyXView & lv);
82 Dialog * createGuiMathMatrix(LyXView & lv);
83 Dialog * createGuiNomenclature(LyXView & lv);
84 Dialog * createGuiNote(LyXView & lv);
85 Dialog * createGuiParagraph(LyXView & lv);
86 Dialog * createGuiPreferences(LyXView & lv);
87 Dialog * createGuiPrint(LyXView & lv);
88 Dialog * createGuiRef(LyXView & lv);
89 Dialog * createGuiSearch(LyXView & lv);
90 Dialog * createGuiSendTo(LyXView & lv);
91 Dialog * createGuiShowFile(LyXView & lv);
92 Dialog * createGuiSpellchecker(LyXView & lv);
93 Dialog * createGuiTabularCreate(LyXView & lv);
94 Dialog * createGuiTabular(LyXView & lv);
95 Dialog * createGuiTexInfo(LyXView & lv);
96 Dialog * createGuiToc(LyXView & lv);
97 Dialog * createGuiThesaurus(LyXView & lv);
98 Dialog * createGuiURL(LyXView & lv);
99 Dialog * createGuiVSpace(LyXView & lv);
100 Dialog * createGuiViewSource(LyXView & lv);
101 Dialog * createGuiWrap(LyXView & lv);
102
103
104 bool Dialogs::isValidName(string const & name) const
105 {
106         return std::find_if(dialognames, end_dialognames,
107                             cmpCStr(name.c_str())) != end_dialognames;
108 }
109
110
111 Dialog * Dialogs::build(string const & name)
112 {
113         BOOST_ASSERT(isValidName(name));
114
115         if (name == "aboutlyx")
116                 return createGuiAbout(lyxview_);
117         if (name == "bibitem")
118                 return createGuiBibitem(lyxview_);
119         if (name == "bibtex")
120                 return createGuiBibtex(lyxview_);
121         if (name == "box")
122                 return createGuiBox(lyxview_);
123         if (name == "branch")
124                 return createGuiBranch(lyxview_);
125         if (name == "changes")
126                 return createGuiChanges(lyxview_);
127         if (name == "character")
128                 return createGuiCharacter(lyxview_);
129         if (name == "citation")
130                 return createGuiCitation(lyxview_);
131         if (name == "document")
132                 return createGuiDocument(lyxview_);
133         if (name == "embedding")
134                 return createGuiEmbeddedFiles(lyxview_);
135         if (name == "errorlist")
136                 return createGuiErrorList(lyxview_);
137         if (name == "ert")
138                 return createGuiERT(lyxview_);
139         if (name == "external")
140                 return createGuiExternal(lyxview_);
141         if (name == "file")
142                 return createGuiShowFile(lyxview_);
143         if (name == "findreplace")
144                 return createGuiSearch(lyxview_);
145         if (name == "float")
146                 return createGuiFloat(lyxview_);
147         if (name == "graphics")
148                 return createGuiGraphics(lyxview_);
149         if (name == "include")
150                 return createGuiInclude(lyxview_);
151         if (name == "index")
152                 return createGuiIndex(lyxview_);
153         if (name == "nomenclature")
154                 return createGuiNomenclature(lyxview_);
155         if (name == "label")
156                 return createGuiLabel(lyxview_);
157         if (name == "log")
158                 return createGuiLog(lyxview_);
159         if (name == "view-source")
160                 return createGuiViewSource(lyxview_);
161         if (name == "mathdelimiter")
162                 return createGuiDelimiter(lyxview_);
163         if (name == "mathmatrix")
164                 return createGuiMathMatrix(lyxview_);
165         if (name == "note")
166                 return createGuiNote(lyxview_);
167         if (name == "paragraph")
168                 return createGuiParagraph(lyxview_);
169         if (name == "prefs")
170                 return createGuiPreferences(lyxview_);
171         if (name == "print")
172                 return createGuiPrint(lyxview_);
173         if (name == "ref")
174                 return createGuiRef(lyxview_);
175         if (name == "sendto")
176                 return createGuiSendTo(lyxview_);
177         if (name == "spellchecker")
178                 return createGuiSpellchecker(lyxview_);
179         if (name == "tabular")
180                 return createGuiTabular(lyxview_);
181         if (name == "tabularcreate")
182                 return createGuiTabularCreate(lyxview_);
183         if (name == "texinfo")
184                 return createGuiTexInfo(lyxview_);
185 #ifdef HAVE_LIBAIKSAURUS
186         if (name == "thesaurus")
187                 return createGuiThesaurus(lyxview_);
188 #endif
189         if (name == "toc")
190                 return createGuiToc(lyxview_);
191         if (name == "url")
192                 return createGuiURL(lyxview_);
193         if (name == "vspace")
194                 return createGuiVSpace(lyxview_);
195         if (name == "wrap")
196                 return createGuiWrap(lyxview_);
197         if (name == "listings")
198                 return createGuiListings(lyxview_);
199
200         return 0;
201 }
202
203
204 /// Are the tooltips on or off?
205 bool Dialogs::tooltipsEnabled()
206 {
207         return false;
208 }
209
210 } // namespace frontend
211 } // namespace lyx