2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-04-26 03:53:02 +00:00
|
|
|
* \file qt4/Dialogs.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Angus Leeming
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "Dialogs.h"
|
|
|
|
|
|
|
|
#include <boost/assert.hpp>
|
|
|
|
|
|
|
|
using std::string;
|
|
|
|
|
2007-08-14 09:54:59 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2007-10-02 21:01:25 +00:00
|
|
|
// This list should be kept in sync with the list of insets in
|
|
|
|
// src/insets/Inset.cpp. I.e., if a dialog goes with an inset, the
|
|
|
|
// dialog should have the same name as the inset.
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
char const * const dialognames[] = {
|
|
|
|
"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
|
2007-08-31 15:42:35 +00:00
|
|
|
"citation", "document", "embedding", "errorlist", "ert", "external", "file",
|
2006-11-04 17:55:36 +00:00
|
|
|
"findreplace", "float", "graphics", "include", "index", "nomenclature", "label", "log",
|
2007-04-19 21:42:42 +00:00
|
|
|
"mathdelimiter", "mathmatrix", "note", "paragraph",
|
2006-03-05 17:24:44 +00:00
|
|
|
"prefs", "print", "ref", "sendto", "spellchecker","tabular", "tabularcreate",
|
|
|
|
|
|
|
|
#ifdef HAVE_LIBAIKSAURUS
|
|
|
|
"thesaurus",
|
|
|
|
#endif
|
|
|
|
|
2007-10-13 19:06:09 +00:00
|
|
|
"texinfo", "toc", "href", "view-source", "vspace", "wrap", "listings" };
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
char const * const * const end_dialognames =
|
|
|
|
dialognames + (sizeof(dialognames) / sizeof(char *));
|
|
|
|
|
|
|
|
class cmpCStr {
|
|
|
|
public:
|
|
|
|
cmpCStr(char const * name) : name_(name) {}
|
|
|
|
bool operator()(char const * other) {
|
|
|
|
return strcmp(other, name_) == 0;
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
char const * name_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace anon
|
|
|
|
|
2007-10-05 20:43:26 +00:00
|
|
|
// will be replaced by a proper factory...
|
2007-10-05 21:06:08 +00:00
|
|
|
Dialog * createGuiAbout(LyXView & lv);
|
|
|
|
Dialog * createGuiBibitem(LyXView & lv);
|
|
|
|
Dialog * createGuiBibtex(LyXView & lv);
|
|
|
|
Dialog * createGuiBox(LyXView & lv);
|
|
|
|
Dialog * createGuiBranch(LyXView & lv);
|
|
|
|
Dialog * createGuiChanges(LyXView & lv);
|
|
|
|
Dialog * createGuiCharacter(LyXView & lv);
|
|
|
|
Dialog * createGuiCitation(LyXView & lv);
|
|
|
|
Dialog * createGuiDelimiter(LyXView & lv);
|
|
|
|
Dialog * createGuiDocument(LyXView & lv);
|
|
|
|
Dialog * createGuiErrorList(LyXView & lv);
|
|
|
|
Dialog * createGuiERT(LyXView & lv);
|
|
|
|
Dialog * createGuiExternal(LyXView & lv);
|
|
|
|
Dialog * createGuiFloat(LyXView & lv);
|
|
|
|
Dialog * createGuiGraphics(LyXView & lv);
|
|
|
|
Dialog * createGuiInclude(LyXView & lv);
|
|
|
|
Dialog * createGuiIndex(LyXView & lv);
|
|
|
|
Dialog * createGuiLabel(LyXView & lv);
|
|
|
|
Dialog * createGuiListings(LyXView & lv);
|
|
|
|
Dialog * createGuiLog(LyXView & lv);
|
2007-10-07 20:34:09 +00:00
|
|
|
Dialog * createGuiMathMatrix(LyXView & lv);
|
2007-10-07 14:41:49 +00:00
|
|
|
Dialog * createGuiNomenclature(LyXView & lv);
|
2007-10-05 20:43:26 +00:00
|
|
|
Dialog * createGuiNote(LyXView & lv);
|
2007-10-07 10:31:37 +00:00
|
|
|
Dialog * createGuiParagraph(LyXView & lv);
|
2007-10-07 09:47:12 +00:00
|
|
|
Dialog * createGuiPreferences(LyXView & lv);
|
2007-10-05 21:06:08 +00:00
|
|
|
Dialog * createGuiPrint(LyXView & lv);
|
2007-10-05 19:04:38 +00:00
|
|
|
Dialog * createGuiRef(LyXView & lv);
|
2007-10-05 21:06:08 +00:00
|
|
|
Dialog * createGuiSearch(LyXView & lv);
|
2007-10-06 20:09:40 +00:00
|
|
|
Dialog * createGuiSendTo(LyXView & lv);
|
2007-10-05 21:06:08 +00:00
|
|
|
Dialog * createGuiShowFile(LyXView & lv);
|
|
|
|
Dialog * createGuiSpellchecker(LyXView & lv);
|
|
|
|
Dialog * createGuiTabularCreate(LyXView & lv);
|
|
|
|
Dialog * createGuiTabular(LyXView & lv);
|
2007-10-06 08:47:08 +00:00
|
|
|
Dialog * createGuiTexInfo(LyXView & lv);
|
2007-10-06 20:35:44 +00:00
|
|
|
Dialog * createGuiToc(LyXView & lv);
|
2007-10-05 21:06:08 +00:00
|
|
|
Dialog * createGuiThesaurus(LyXView & lv);
|
2007-10-13 19:06:09 +00:00
|
|
|
Dialog * createGuiHyperlink(LyXView & lv);
|
2007-10-05 21:06:08 +00:00
|
|
|
Dialog * createGuiVSpace(LyXView & lv);
|
2007-10-06 15:03:58 +00:00
|
|
|
Dialog * createGuiViewSource(LyXView & lv);
|
2007-10-05 20:16:05 +00:00
|
|
|
Dialog * createGuiWrap(LyXView & lv);
|
2007-10-05 19:04:38 +00:00
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
bool Dialogs::isValidName(string const & name) const
|
|
|
|
{
|
|
|
|
return std::find_if(dialognames, end_dialognames,
|
|
|
|
cmpCStr(name.c_str())) != end_dialognames;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
Dialog * Dialogs::build(string const & name)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
BOOST_ASSERT(isValidName(name));
|
|
|
|
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "aboutlyx")
|
|
|
|
return createGuiAbout(lyxview_);
|
|
|
|
if (name == "bibitem")
|
2007-10-07 10:31:37 +00:00
|
|
|
return createGuiBibitem(lyxview_);
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "bibtex")
|
|
|
|
return createGuiBibtex(lyxview_);
|
|
|
|
if (name == "box")
|
|
|
|
return createGuiBox(lyxview_);
|
|
|
|
if (name == "branch")
|
|
|
|
return createGuiBranch(lyxview_);
|
|
|
|
if (name == "changes")
|
|
|
|
return createGuiChanges(lyxview_);
|
|
|
|
if (name == "character")
|
|
|
|
return createGuiCharacter(lyxview_);
|
|
|
|
if (name == "citation")
|
|
|
|
return createGuiCitation(lyxview_);
|
|
|
|
if (name == "document")
|
2007-10-06 22:43:21 +00:00
|
|
|
return createGuiDocument(lyxview_);
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "errorlist")
|
|
|
|
return createGuiErrorList(lyxview_);
|
|
|
|
if (name == "ert")
|
|
|
|
return createGuiERT(lyxview_);
|
|
|
|
if (name == "external")
|
2007-10-07 08:55:20 +00:00
|
|
|
return createGuiExternal(lyxview_);
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "file")
|
|
|
|
return createGuiShowFile(lyxview_);
|
|
|
|
if (name == "findreplace")
|
2007-10-06 20:54:31 +00:00
|
|
|
return createGuiSearch(lyxview_);
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "float")
|
|
|
|
return createGuiFloat(lyxview_);
|
|
|
|
if (name == "graphics")
|
2007-10-06 22:16:14 +00:00
|
|
|
return createGuiGraphics(lyxview_);
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "include")
|
|
|
|
return createGuiInclude(lyxview_);
|
|
|
|
if (name == "index")
|
2007-10-07 14:59:01 +00:00
|
|
|
return createGuiIndex(lyxview_);
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "nomenclature")
|
2007-10-07 14:41:49 +00:00
|
|
|
return createGuiNomenclature(lyxview_);
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "label")
|
2007-10-07 14:59:01 +00:00
|
|
|
return createGuiLabel(lyxview_);
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "log")
|
|
|
|
return createGuiLog(lyxview_);
|
|
|
|
if (name == "view-source")
|
|
|
|
return createGuiViewSource(lyxview_);
|
|
|
|
if (name == "mathdelimiter")
|
2007-10-07 20:34:09 +00:00
|
|
|
return createGuiDelimiter(lyxview_);
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "mathmatrix")
|
2007-10-07 20:34:09 +00:00
|
|
|
return createGuiMathMatrix(lyxview_);
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "note")
|
|
|
|
return createGuiNote(lyxview_);
|
2007-10-07 10:10:41 +00:00
|
|
|
if (name == "paragraph")
|
|
|
|
return createGuiParagraph(lyxview_);
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "prefs")
|
2007-10-07 09:47:12 +00:00
|
|
|
return createGuiPreferences(lyxview_);
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "print")
|
2007-10-06 21:31:01 +00:00
|
|
|
return createGuiPrint(lyxview_);
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "ref")
|
|
|
|
return createGuiRef(lyxview_);
|
|
|
|
if (name == "sendto")
|
2007-10-06 20:09:40 +00:00
|
|
|
return createGuiSendTo(lyxview_);
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "spellchecker")
|
|
|
|
return createGuiSpellchecker(lyxview_);
|
|
|
|
if (name == "tabular")
|
|
|
|
return createGuiTabular(lyxview_);
|
|
|
|
if (name == "tabularcreate")
|
|
|
|
return createGuiTabularCreate(lyxview_);
|
|
|
|
if (name == "texinfo")
|
|
|
|
return createGuiTexInfo(lyxview_);
|
2006-03-05 17:24:44 +00:00
|
|
|
#ifdef HAVE_LIBAIKSAURUS
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "thesaurus")
|
2007-10-06 19:59:13 +00:00
|
|
|
return createGuiThesaurus(lyxview_);
|
2006-03-05 17:24:44 +00:00
|
|
|
#endif
|
2007-10-06 20:35:44 +00:00
|
|
|
if (name == "toc")
|
|
|
|
return createGuiToc(lyxview_);
|
2007-10-13 19:06:09 +00:00
|
|
|
if (name == "href")
|
|
|
|
return createGuiHyperlink(lyxview_);
|
2007-10-06 19:51:03 +00:00
|
|
|
if (name == "vspace")
|
|
|
|
return createGuiVSpace(lyxview_);
|
|
|
|
if (name == "wrap")
|
|
|
|
return createGuiWrap(lyxview_);
|
|
|
|
if (name == "listings")
|
|
|
|
return createGuiListings(lyxview_);
|
|
|
|
|
|
|
|
return 0;
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Are the tooltips on or off?
|
|
|
|
bool Dialogs::tooltipsEnabled()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2007-08-14 09:54:59 +00:00
|
|
|
} // namespace frontend
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|