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.
6 * \author Angus Leeming
8 * Full author contact details are available in file CREDITS.
15 #include <boost/assert.hpp>
24 // This list should be kept in sync with the list of insets in
25 // src/insets/Inset.cpp. I.e., if a dialog goes with an inset, the
26 // dialog should have the same name as the inset.
28 char const * const dialognames[] = {
29 "aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
30 "citation", "document", "embedding", "errorlist", "ert", "external", "file",
31 "findreplace", "float", "graphics", "include", "index", "nomenclature", "label", "log",
32 "mathdelimiter", "mathmatrix", "note", "paragraph",
33 "prefs", "print", "ref", "sendto", "spellchecker","tabular", "tabularcreate",
35 #ifdef HAVE_LIBAIKSAURUS
39 "texinfo", "toc", "href", "view-source", "vspace", "wrap", "listings" };
41 char const * const * const end_dialognames =
42 dialognames + (sizeof(dialognames) / sizeof(char *));
46 cmpCStr(char const * name) : name_(name) {}
47 bool operator()(char const * other) {
48 return strcmp(other, name_) == 0;
57 // will be replaced by a proper factory...
58 Dialog * createGuiAbout(LyXView & lv);
59 Dialog * createGuiBibitem(LyXView & lv);
60 Dialog * createGuiBibtex(LyXView & lv);
61 Dialog * createGuiBox(LyXView & lv);
62 Dialog * createGuiBranch(LyXView & lv);
63 Dialog * createGuiChanges(LyXView & lv);
64 Dialog * createGuiCharacter(LyXView & lv);
65 Dialog * createGuiCitation(LyXView & lv);
66 Dialog * createGuiDelimiter(LyXView & lv);
67 Dialog * createGuiDocument(LyXView & lv);
68 Dialog * createGuiEmbeddedFiles(LyXView & lv);
69 Dialog * createGuiErrorList(LyXView & lv);
70 Dialog * createGuiERT(LyXView & lv);
71 Dialog * createGuiExternal(LyXView & lv);
72 Dialog * createGuiFloat(LyXView & lv);
73 Dialog * createGuiGraphics(LyXView & lv);
74 Dialog * createGuiInclude(LyXView & lv);
75 Dialog * createGuiIndex(LyXView & lv);
76 Dialog * createGuiLabel(LyXView & lv);
77 Dialog * createGuiListings(LyXView & lv);
78 Dialog * createGuiLog(LyXView & lv);
79 Dialog * createGuiMathMatrix(LyXView & lv);
80 Dialog * createGuiNomenclature(LyXView & lv);
81 Dialog * createGuiNote(LyXView & lv);
82 Dialog * createGuiParagraph(LyXView & lv);
83 Dialog * createGuiPreferences(LyXView & lv);
84 Dialog * createGuiPrint(LyXView & lv);
85 Dialog * createGuiRef(LyXView & lv);
86 Dialog * createGuiSearch(LyXView & lv);
87 Dialog * createGuiSendTo(LyXView & lv);
88 Dialog * createGuiShowFile(LyXView & lv);
89 Dialog * createGuiSpellchecker(LyXView & lv);
90 Dialog * createGuiTabularCreate(LyXView & lv);
91 Dialog * createGuiTabular(LyXView & lv);
92 Dialog * createGuiTexInfo(LyXView & lv);
93 Dialog * createGuiToc(LyXView & lv);
94 Dialog * createGuiThesaurus(LyXView & lv);
95 Dialog * createGuiHyperlink(LyXView & lv);
96 Dialog * createGuiVSpace(LyXView & lv);
97 Dialog * createGuiViewSource(LyXView & lv);
98 Dialog * createGuiWrap(LyXView & lv);
101 bool Dialogs::isValidName(string const & name) const
103 return std::find_if(dialognames, end_dialognames,
104 cmpCStr(name.c_str())) != end_dialognames;
108 Dialog * Dialogs::build(string const & name)
110 BOOST_ASSERT(isValidName(name));
112 if (name == "aboutlyx")
113 return createGuiAbout(lyxview_);
114 if (name == "bibitem")
115 return createGuiBibitem(lyxview_);
116 if (name == "bibtex")
117 return createGuiBibtex(lyxview_);
119 return createGuiBox(lyxview_);
120 if (name == "branch")
121 return createGuiBranch(lyxview_);
122 if (name == "changes")
123 return createGuiChanges(lyxview_);
124 if (name == "character")
125 return createGuiCharacter(lyxview_);
126 if (name == "citation")
127 return createGuiCitation(lyxview_);
128 if (name == "document")
129 return createGuiDocument(lyxview_);
130 if (name == "embedding")
131 return createGuiEmbeddedFiles(lyxview_);
132 if (name == "errorlist")
133 return createGuiErrorList(lyxview_);
135 return createGuiERT(lyxview_);
136 if (name == "external")
137 return createGuiExternal(lyxview_);
139 return createGuiShowFile(lyxview_);
140 if (name == "findreplace")
141 return createGuiSearch(lyxview_);
143 return createGuiFloat(lyxview_);
144 if (name == "graphics")
145 return createGuiGraphics(lyxview_);
146 if (name == "include")
147 return createGuiInclude(lyxview_);
149 return createGuiIndex(lyxview_);
150 if (name == "nomenclature")
151 return createGuiNomenclature(lyxview_);
153 return createGuiLabel(lyxview_);
155 return createGuiLog(lyxview_);
156 if (name == "view-source")
157 return createGuiViewSource(lyxview_);
158 if (name == "mathdelimiter")
159 return createGuiDelimiter(lyxview_);
160 if (name == "mathmatrix")
161 return createGuiMathMatrix(lyxview_);
163 return createGuiNote(lyxview_);
164 if (name == "paragraph")
165 return createGuiParagraph(lyxview_);
167 return createGuiPreferences(lyxview_);
169 return createGuiPrint(lyxview_);
171 return createGuiRef(lyxview_);
172 if (name == "sendto")
173 return createGuiSendTo(lyxview_);
174 if (name == "spellchecker")
175 return createGuiSpellchecker(lyxview_);
176 if (name == "tabular")
177 return createGuiTabular(lyxview_);
178 if (name == "tabularcreate")
179 return createGuiTabularCreate(lyxview_);
180 if (name == "texinfo")
181 return createGuiTexInfo(lyxview_);
182 #ifdef HAVE_LIBAIKSAURUS
183 if (name == "thesaurus")
184 return createGuiThesaurus(lyxview_);
187 return createGuiToc(lyxview_);
189 return createGuiHyperlink(lyxview_);
190 if (name == "vspace")
191 return createGuiVSpace(lyxview_);
193 return createGuiWrap(lyxview_);
194 if (name == "listings")
195 return createGuiListings(lyxview_);
201 /// Are the tooltips on or off?
202 bool Dialogs::tooltipsEnabled()
207 } // namespace frontend