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 DockView<ControlEmbeddedFiles, GuiEmbeddedFilesDialog>(
140 guiview, name, Qt::RightDockWidgetArea);
141 } else if (name == "errorlist") {
142 dialog = new GuiErrorListDialog(lyxview_);
143 } else if (name == "ert") {
144 dialog = new GuiERTDialog(lyxview_);
145 } else if (name == "external") {
146 dialog = new GuiExternalDialog(lyxview_);
147 } else if (name == "file") {
148 dialog = new GuiShowFileDialog(lyxview_);
149 } else if (name == "findreplace") {
150 dialog = new GuiSearchDialog(lyxview_);
151 } else if (name == "float") {
152 dialog = new GuiFloatDialog(lyxview_);
153 } else if (name == "graphics") {
154 dialog = new GuiGraphicsDialog(lyxview_);
155 } else if (name == "include") {
156 dialog = new GuiIncludeDialog(lyxview_);
157 } else if (name == "index") {
158 dialog = new GuiIndexDialog(lyxview_);
159 } else if (name == "nomenclature") {
160 dialog = new GuiNomenclDialog(lyxview_);
161 } else if (name == "label") {
162 dialog = new GuiLabelDialog(lyxview_);
163 } else if (name == "log") {
164 dialog = new GuiLogDialog(lyxview_);
165 } else if (name == "view-source") {
166 dialog = new DockView<ControlViewSource, GuiViewSourceDialog>(
167 guiview, name, Qt::BottomDockWidgetArea);
168 } else if (name == "mathdelimiter") {
169 dialog = new GuiDelimiterDialog(lyxview_);
170 } else if (name == "mathmatrix") {
171 dialog = new GuiMathMatrixDialog(lyxview_);
172 } else if (name == "note") {
173 dialog = new GuiNoteDialog(lyxview_);
174 } else if (name == "paragraph") {
175 dialog = new GuiParagraphDialog(lyxview_);
176 } else if (name == "prefs") {
177 dialog = new GuiPrefsDialog(lyxview_);
178 } else if (name == "print") {
179 dialog = new GuiPrintDialog(lyxview_);
180 } else if (name == "ref") {
181 dialog = new GuiRefDialog(lyxview_);
182 } else if (name == "sendto") {
183 dialog = new GuiSendtoDialog(lyxview_);
184 } else if (name == "spellchecker") {
185 dialog = new GuiSpellcheckerDialog(lyxview_);
186 } else if (name == "tabular") {
187 dialog = new GuiTabularDialog(lyxview_);
188 } else if (name == "tabularcreate") {
189 dialog = new GuiTabularCreateDialog(lyxview_);
190 } else if (name == "texinfo") {
191 dialog = new GuiTexinfoDialog(lyxview_);
192 #ifdef HAVE_LIBAIKSAURUS
193 } else if (name == "thesaurus") {
194 dialog = new GuiThesaurusDialog(lyxview_);
196 } else if (name == "toc") {
198 // On Mac show as a drawer at the right
199 dialog = new DockView<GuiToc, TocWidget>(guiview, name,
200 Qt::RightDockWidgetArea, Qt::Drawer);
202 dialog = new DockView<GuiToc, TocWidget>(guiview, name);
204 } else if (name == "url") {
205 dialog = new GuiURLDialog(lyxview_);
206 } else if (name == "vspace") {
207 dialog = new GuiVSpaceDialog(lyxview_);
208 } else if (name == "wrap") {
209 dialog = new GuiWrapDialog(lyxview_);
210 } else if (name == "listings") {
211 dialog = new GuiListingsDialog(lyxview_);
218 /// Are the tooltips on or off?
219 bool Dialogs::tooltipsEnabled()
224 } // namespace frontend