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"
17 #include "DialogView.h"
20 #include "GuiBibitem.h"
21 #include "GuiBibtex.h"
23 #include "GuiBranch.h"
24 #include "GuiChanges.h"
25 #include "GuiCharacter.h"
26 #include "GuiCitation.h"
27 #include "GuiDelimiter.h"
28 #include "GuiDocument.h"
29 #include "GuiEmbeddedFiles.h"
30 #include "GuiErrorList.h"
32 #include "GuiExternal.h"
34 #include "GuiGraphics.h"
35 #include "GuiInclude.h"
37 #include "GuiMathMatrix.h"
38 #include "GuiNomencl.h"
39 #include "GuiListings.h"
42 #include "GuiParagraph.h"
46 #include "GuiSearch.h"
47 #include "GuiSendto.h"
48 #include "GuiShowFile.h"
49 #include "GuiSpellchecker.h"
50 #include "GuiTabular.h"
51 #include "GuiTabularCreate.h"
52 #include "GuiTexinfo.h"
55 #include "GuiViewSource.h"
56 #include "TocWidget.h"
58 #include "GuiVSpace.h"
61 #ifdef HAVE_LIBAIKSAURUS
62 #include "ControlThesaurus.h"
63 #include "GuiThesaurus.h"
66 // Uncomment this if you prefer dock widget
67 //#define USE_DOCK_WIDGET
69 #include "qt_helpers.h"
71 #include <boost/assert.hpp>
80 char const * const dialognames[] = {
81 "aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
82 "citation", "document", "embedding", "errorlist", "ert", "external", "file",
83 "findreplace", "float", "graphics", "include", "index", "nomenclature", "label", "log",
84 "mathdelimiter", "mathmatrix", "note", "paragraph",
85 "prefs", "print", "ref", "sendto", "spellchecker","tabular", "tabularcreate",
87 #ifdef HAVE_LIBAIKSAURUS
91 "texinfo", "toc", "url", "view-source", "vspace", "wrap", "listings" };
93 char const * const * const end_dialognames =
94 dialognames + (sizeof(dialognames) / sizeof(char *));
98 cmpCStr(char const * name) : name_(name) {}
99 bool operator()(char const * other) {
100 return strcmp(other, name_) == 0;
110 bool Dialogs::isValidName(string const & name) const
112 return std::find_if(dialognames, end_dialognames,
113 cmpCStr(name.c_str())) != end_dialognames;
117 Dialog * Dialogs::build(string const & name)
119 BOOST_ASSERT(isValidName(name));
122 GuiViewBase & guiview = static_cast<GuiViewBase &>(lyxview_);
124 if (name == "aboutlyx") {
125 dialog = new GuiAboutDialog(lyxview_);
126 } else if (name == "bibitem") {
127 dialog = new GuiBibitemDialog(lyxview_);
128 } else if (name == "bibtex") {
129 dialog = new GuiBibtexDialog(lyxview_);
130 } else if (name == "box") {
131 dialog = new GuiBoxDialog(lyxview_);
132 } else if (name == "branch") {
133 dialog = new GuiBranchDialog(lyxview_);
134 } else if (name == "changes") {
135 dialog = new GuiChangesDialog(lyxview_);
136 } else if (name == "character") {
137 dialog = new GuiCharacterDialog(lyxview_);
138 } else if (name == "citation") {
139 dialog = new GuiCitationDialog(lyxview_);
140 } else if (name == "document") {
141 dialog = new GuiDocumentDialog(lyxview_);
142 } else if (name == "embedding") {
143 dialog = new DockView<ControlEmbeddedFiles, GuiEmbeddedFilesDialog>(
144 guiview, name, Qt::RightDockWidgetArea);
145 } else if (name == "errorlist") {
146 dialog = new GuiErrorListDialog(lyxview_);
147 } else if (name == "ert") {
148 dialog = new GuiERTDialog(lyxview_);
149 } else if (name == "external") {
150 dialog = new GuiExternalDialog(lyxview_);
151 } else if (name == "file") {
152 dialog = new GuiShowFileDialog(lyxview_);
153 } else if (name == "findreplace") {
154 dialog = new GuiSearchDialog(lyxview_);
155 } else if (name == "float") {
156 dialog = new GuiFloatDialog(lyxview_);
157 } else if (name == "graphics") {
158 dialog = new GuiGraphicsDialog(lyxview_);
159 } else if (name == "include") {
160 dialog = new GuiIncludeDialog(lyxview_);
161 } else if (name == "index") {
162 dialog = new GuiIndexDialog(lyxview_);
163 } else if (name == "nomenclature") {
164 dialog = new GuiNomenclDialog(lyxview_);
165 } else if (name == "label") {
166 dialog = new GuiLabelDialog(lyxview_);
167 } else if (name == "log") {
168 dialog = new GuiLogDialog(lyxview_);
169 } else if (name == "view-source") {
170 dialog = new DockView<ControlViewSource, GuiViewSourceDialog>(
171 guiview, name, Qt::BottomDockWidgetArea);
172 } else if (name == "mathdelimiter") {
173 dialog = new GuiDelimiterDialog(lyxview_);
174 } else if (name == "mathmatrix") {
175 dialog = new GuiMathMatrixDialog(lyxview_);
176 } else if (name == "note") {
177 dialog = new GuiNoteDialog(lyxview_);
178 } else if (name == "paragraph") {
179 #ifdef USE_DOCK_WIDGET
180 DockView<ControlParagraph, GuiParagraph> * dv =
181 new DockView<ControlParagraph, GuiParagraph>(guiview, name,
182 Qt::TopDockWidgetArea);
184 DialogView<ControlParagraph, GuiParagraph> * dv =
185 new DialogView<ControlParagraph, GuiParagraph>(guiview, name);
188 } else if (name == "prefs") {
189 dialog = new GuiPrefsDialog(lyxview_);
190 } else if (name == "print") {
191 dialog = new GuiPrintDialog(lyxview_);
192 } else if (name == "ref") {
193 dialog = new GuiRefDialog(lyxview_);
194 } else if (name == "sendto") {
195 dialog = new GuiSendtoDialog(lyxview_);
196 } else if (name == "spellchecker") {
197 dialog = new GuiSpellcheckerDialog(lyxview_);
198 } else if (name == "tabular") {
199 dialog = new GuiTabularDialog(lyxview_);
200 } else if (name == "tabularcreate") {
201 dialog = new GuiTabularCreateDialog(lyxview_);
202 } else if (name == "texinfo") {
203 dialog = new GuiTexinfoDialog(lyxview_);
204 #ifdef HAVE_LIBAIKSAURUS
205 } else if (name == "thesaurus") {
206 dialog = new GuiThesaurusDialog(lyxview_);
208 } else if (name == "toc") {
210 // On Mac show as a drawer at the right
211 dialog = new DockView<GuiToc, TocWidget>(guiview, name,
212 Qt::RightDockWidgetArea, Qt::Drawer);
214 dialog = new DockView<GuiToc, TocWidget>(guiview, name);
216 } else if (name == "url") {
217 dialog = new GuiURLDialog(lyxview_);
218 } else if (name == "vspace") {
219 dialog = new GuiVSpaceDialog(lyxview_);
220 } else if (name == "wrap") {
221 dialog = new GuiWrapDialog(lyxview_);
222 } else if (name == "listings") {
223 dialog = new GuiListingsDialog(lyxview_);
230 /// Are the tooltips on or off?
231 bool Dialogs::tooltipsEnabled()
236 } // namespace frontend