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.
14 #include "GuiDialog.h"
16 #include "qt_helpers.h"
18 #include <boost/assert.hpp>
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.
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",
38 #ifdef HAVE_LIBAIKSAURUS
42 "texinfo", "toc", "url", "view-source", "vspace", "wrap", "listings" };
44 char const * const * const end_dialognames =
45 dialognames + (sizeof(dialognames) / sizeof(char *));
49 cmpCStr(char const * name) : name_(name) {}
50 bool operator()(char const * other) {
51 return strcmp(other, name_) == 0;
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);
104 bool Dialogs::isValidName(string const & name) const
106 return std::find_if(dialognames, end_dialognames,
107 cmpCStr(name.c_str())) != end_dialognames;
111 Dialog * Dialogs::build(string const & name)
113 BOOST_ASSERT(isValidName(name));
115 if (name == "aboutlyx")
116 return createGuiAbout(lyxview_);
117 if (name == "bibitem")
118 return createGuiBibitem(lyxview_);
119 if (name == "bibtex")
120 return createGuiBibtex(lyxview_);
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_);
138 return createGuiERT(lyxview_);
139 if (name == "external")
140 return createGuiExternal(lyxview_);
142 return createGuiShowFile(lyxview_);
143 if (name == "findreplace")
144 return createGuiSearch(lyxview_);
146 return createGuiFloat(lyxview_);
147 if (name == "graphics")
148 return createGuiGraphics(lyxview_);
149 if (name == "include")
150 return createGuiInclude(lyxview_);
152 return createGuiIndex(lyxview_);
153 if (name == "nomenclature")
154 return createGuiNomenclature(lyxview_);
156 return createGuiLabel(lyxview_);
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_);
166 return createGuiNote(lyxview_);
167 if (name == "paragraph")
168 return createGuiParagraph(lyxview_);
170 return createGuiPreferences(lyxview_);
172 return createGuiPrint(lyxview_);
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_);
190 return createGuiToc(lyxview_);
192 return createGuiURL(lyxview_);
193 if (name == "vspace")
194 return createGuiVSpace(lyxview_);
196 return createGuiWrap(lyxview_);
197 if (name == "listings")
198 return createGuiListings(lyxview_);
204 /// Are the tooltips on or off?
205 bool Dialogs::tooltipsEnabled()
210 } // namespace frontend