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 "ButtonController.h"
19 #include "GuiBibitem.h"
20 #include "GuiBibtex.h"
22 #include "GuiBranch.h"
23 #include "GuiChanges.h"
24 #include "GuiCharacter.h"
25 #include "GuiCitation.h"
26 #include "GuiDelimiter.h"
27 #include "GuiDocument.h"
28 #include "GuiEmbeddedFiles.h"
29 #include "GuiErrorList.h"
31 #include "GuiExternal.h"
33 #include "GuiGraphics.h"
34 #include "GuiInclude.h"
36 #include "GuiMathMatrix.h"
37 #include "GuiNomencl.h"
38 #include "GuiListings.h"
41 #include "GuiParagraph.h"
45 #include "GuiSearch.h"
46 #include "GuiSendto.h"
47 #include "GuiShowFile.h"
48 #include "GuiSpellchecker.h"
49 #include "GuiTabular.h"
50 #include "GuiTabularCreate.h"
51 #include "GuiTexinfo.h"
54 #include "GuiViewSource.h"
55 #include "TocWidget.h"
57 #include "GuiVSpace.h"
60 #ifdef HAVE_LIBAIKSAURUS
61 #include "ControlThesaurus.h"
62 #include "GuiThesaurus.h"
65 #include "qt_helpers.h"
67 #include <boost/assert.hpp>
76 char const * const dialognames[] = {
77 "aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
78 "citation", "document", "embedding", "errorlist", "ert", "external", "file",
79 "findreplace", "float", "graphics", "include", "index", "nomenclature", "label", "log",
80 "mathdelimiter", "mathmatrix", "note", "paragraph",
81 "prefs", "print", "ref", "sendto", "spellchecker","tabular", "tabularcreate",
83 #ifdef HAVE_LIBAIKSAURUS
87 "texinfo", "toc", "url", "view-source", "vspace", "wrap", "listings" };
89 char const * const * const end_dialognames =
90 dialognames + (sizeof(dialognames) / sizeof(char *));
94 cmpCStr(char const * name) : name_(name) {}
95 bool operator()(char const * other) {
96 return strcmp(other, name_) == 0;
106 bool Dialogs::isValidName(string const & name) const
108 return std::find_if(dialognames, end_dialognames,
109 cmpCStr(name.c_str())) != end_dialognames;
113 Dialog * Dialogs::build(string const & name)
115 BOOST_ASSERT(isValidName(name));
118 GuiViewBase & guiview = static_cast<GuiViewBase &>(lyxview_);
120 if (name == "aboutlyx") {
121 dialog = new GuiAboutDialog(lyxview_);
122 } else if (name == "bibitem") {
123 dialog = new GuiBibitemDialog(lyxview_);
124 } else if (name == "bibtex") {
125 dialog = new GuiBibtexDialog(lyxview_);
126 } else if (name == "box") {
127 dialog = new GuiBoxDialog(lyxview_);
128 } else if (name == "branch") {
129 dialog = new GuiBranchDialog(lyxview_);
130 } else if (name == "changes") {
131 dialog = new GuiChangesDialog(lyxview_);
132 } else if (name == "character") {
133 dialog = new GuiCharacterDialog(lyxview_);
134 } else if (name == "citation") {
135 dialog = new GuiCitationDialog(lyxview_);
136 } else if (name == "document") {
137 dialog = new GuiDocumentDialog(lyxview_);
138 } else if (name == "embedding") {
139 dialog = new GuiEmbeddedFilesDialog(lyxview_);
140 } else if (name == "errorlist") {
141 dialog = new GuiErrorListDialog(lyxview_);
142 } else if (name == "ert") {
143 dialog = new GuiERTDialog(lyxview_);
144 } else if (name == "external") {
145 dialog = new GuiExternalDialog(lyxview_);
146 } else if (name == "file") {
147 dialog = new GuiShowFileDialog(lyxview_);
148 } else if (name == "findreplace") {
149 dialog = new GuiSearchDialog(lyxview_);
150 } else if (name == "float") {
151 dialog = new GuiFloatDialog(lyxview_);
152 } else if (name == "graphics") {
153 dialog = new GuiGraphicsDialog(lyxview_);
154 } else if (name == "include") {
155 dialog = new GuiIncludeDialog(lyxview_);
156 } else if (name == "index") {
157 dialog = new GuiIndexDialog(lyxview_);
158 } else if (name == "nomenclature") {
159 dialog = new GuiNomenclDialog(lyxview_);
160 } else if (name == "label") {
161 dialog = new GuiLabelDialog(lyxview_);
162 } else if (name == "log") {
163 dialog = new GuiLogDialog(lyxview_);
164 } else if (name == "view-source") {
165 dialog = new DockView<ControlViewSource, GuiViewSourceDialog>(
166 guiview, name, Qt::BottomDockWidgetArea);
167 } else if (name == "mathdelimiter") {
168 dialog = new GuiDelimiterDialog(lyxview_);
169 } else if (name == "mathmatrix") {
170 dialog = new GuiMathMatrixDialog(lyxview_);
171 } else if (name == "note") {
172 dialog = new GuiNoteDialog(lyxview_);
173 } else if (name == "paragraph") {
174 dialog = new GuiParagraphDialog(lyxview_);
175 } else if (name == "prefs") {
176 dialog = new GuiPrefsDialog(lyxview_);
177 } else if (name == "print") {
178 dialog = new GuiPrintDialog(lyxview_);
179 } else if (name == "ref") {
180 dialog = new GuiRefDialog(lyxview_);
181 } else if (name == "sendto") {
182 dialog = new GuiSendtoDialog(lyxview_);
183 } else if (name == "spellchecker") {
184 dialog = new GuiSpellcheckerDialog(lyxview_);
185 } else if (name == "tabular") {
186 dialog = new GuiTabularDialog(lyxview_);
187 } else if (name == "tabularcreate") {
188 dialog = new GuiTabularCreateDialog(lyxview_);
189 } else if (name == "texinfo") {
190 dialog = new GuiTexinfoDialog(lyxview_);
191 #ifdef HAVE_LIBAIKSAURUS
192 } else if (name == "thesaurus") {
193 dialog = new GuiThesaurusDialog(lyxview_);
195 } else if (name == "toc") {
196 // On Mac show as a drawer at the right
197 dialog = new DockView<GuiToc, TocWidget>(
198 guiview, name, Qt::RightDockWidgetArea, Qt::Drawer);
199 } else if (name == "url") {
200 dialog = new GuiURLDialog(lyxview_);
201 } else if (name == "vspace") {
202 dialog = new GuiVSpaceDialog(lyxview_);
203 } else if (name == "wrap") {
204 dialog = new GuiWrapDialog(lyxview_);
205 } else if (name == "listings") {
206 dialog = new GuiListingsDialog(lyxview_);
213 /// Are the tooltips on or off?
214 bool Dialogs::tooltipsEnabled()
219 } // namespace frontend