2001-08-19 13:25:15 +00:00
|
|
|
/**
|
2003-03-26 12:43:48 +00:00
|
|
|
* \file qt2/Dialogs.C
|
2002-09-24 13:57:09 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-01-26 10:16:05 +00:00
|
|
|
*
|
2002-10-20 01:48:28 +00:00
|
|
|
* \author Angus Leeming
|
2002-09-24 13:57:09 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2001-01-26 10:16:05 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "Dialogs.h"
|
|
|
|
|
|
|
|
#include "ControlAboutlyx.h"
|
|
|
|
#include "ControlBibtex.h"
|
2003-12-05 16:22:36 +00:00
|
|
|
#include "ControlBox.h"
|
2003-10-23 11:58:01 +00:00
|
|
|
#include "ControlBranch.h"
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "ControlChanges.h"
|
|
|
|
#include "ControlCharacter.h"
|
|
|
|
#include "ControlCitation.h"
|
2004-03-30 19:18:14 +00:00
|
|
|
#include "ControlDocument.h"
|
2003-05-13 21:15:48 +00:00
|
|
|
#include "ControlErrorList.h"
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "ControlERT.h"
|
|
|
|
#include "ControlExternal.h"
|
|
|
|
#include "ControlFloat.h"
|
|
|
|
#include "ControlGraphics.h"
|
|
|
|
#include "ControlInclude.h"
|
|
|
|
#include "ControlLog.h"
|
2003-06-17 12:53:35 +00:00
|
|
|
#include "ControlMath.h"
|
2003-07-15 12:48:24 +00:00
|
|
|
#include "ControlNote.h"
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "ControlParagraph.h"
|
2004-03-31 18:51:11 +00:00
|
|
|
#include "ControlPrefs.h"
|
2004-03-28 14:12:33 +00:00
|
|
|
#include "ControlPrint.h"
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "ControlRef.h"
|
2004-01-26 00:43:56 +00:00
|
|
|
#include "ControlSearch.h"
|
2004-03-27 23:11:46 +00:00
|
|
|
#include "ControlSendto.h"
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "ControlShowFile.h"
|
2004-03-31 19:51:55 +00:00
|
|
|
#include "ControlSpellchecker.h"
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "ControlTabular.h"
|
|
|
|
#include "ControlTabularCreate.h"
|
|
|
|
#include "ControlToc.h"
|
2003-11-29 09:39:35 +00:00
|
|
|
#include "ControlVSpace.h"
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "ControlWrap.h"
|
|
|
|
|
2003-09-29 10:50:51 +00:00
|
|
|
#include "Qt2BC.h"
|
|
|
|
#include "ButtonController.h"
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "QAbout.h"
|
|
|
|
#include "QBibitem.h"
|
|
|
|
#include "QBibtex.h"
|
2003-12-05 16:22:36 +00:00
|
|
|
#include "QBox.h"
|
2003-10-23 11:58:01 +00:00
|
|
|
#include "QBranch.h"
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "QChanges.h"
|
|
|
|
#include "QCharacter.h"
|
|
|
|
#include "QCitation.h"
|
2004-03-30 19:18:14 +00:00
|
|
|
#include "QDocument.h"
|
2003-05-13 21:15:48 +00:00
|
|
|
#include "QErrorList.h"
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "QERT.h"
|
|
|
|
#include "QExternal.h"
|
|
|
|
#include "QFloat.h"
|
|
|
|
// Here would be an appropriate point to lecture on the evils
|
|
|
|
// of the Qt headers, those most fucked up of disgusting ratholes.
|
|
|
|
// But I won't.
|
|
|
|
#undef signals
|
|
|
|
#include "QGraphics.h"
|
|
|
|
#include "QInclude.h"
|
|
|
|
#include "QIndex.h"
|
|
|
|
#include "QLog.h"
|
2003-06-12 14:21:04 +00:00
|
|
|
#include "QMath.h"
|
2003-07-15 12:48:24 +00:00
|
|
|
#include "QNote.h"
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "QParagraph.h"
|
2004-03-31 18:51:11 +00:00
|
|
|
#include "QPrefs.h"
|
2004-03-28 14:12:33 +00:00
|
|
|
#include "QPrint.h"
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "QRef.h"
|
2004-01-26 00:43:56 +00:00
|
|
|
#include "QSearch.h"
|
2004-03-27 23:11:46 +00:00
|
|
|
#include "QSendto.h"
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "QShowFile.h"
|
2004-03-31 19:51:55 +00:00
|
|
|
#include "QSpellchecker.h"
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "QTabular.h"
|
|
|
|
#include "QTabularCreate.h"
|
2003-06-19 17:16:12 +00:00
|
|
|
#include "QTexinfo.h"
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "QToc.h"
|
|
|
|
#include "QURL.h"
|
2003-11-29 09:39:35 +00:00
|
|
|
#include "QVSpace.h"
|
2003-03-26 12:41:27 +00:00
|
|
|
#include "QWrap.h"
|
|
|
|
|
|
|
|
#ifdef HAVE_LIBAIKSAURUS
|
|
|
|
#include "ControlThesaurus.h"
|
|
|
|
#include "QThesaurus.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
using std::string;
|
|
|
|
|
2003-03-26 12:41:27 +00:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2004-01-26 00:43:56 +00:00
|
|
|
char const * const dialognames[] = {
|
|
|
|
"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
|
2004-03-30 19:18:14 +00:00
|
|
|
"citation", "document", "error", "errorlist", "ert", "external", "file",
|
|
|
|
"findreplace", "float", "graphics", "include", "index", "label", "log",
|
2004-03-31 18:51:11 +00:00
|
|
|
"mathpanel", "mathdelimiter", "mathmatrix", "note", "paragraph", "prefs",
|
2004-03-31 19:51:55 +00:00
|
|
|
"print", "ref", "sendto", "spellchecker","tabular", "tabularcreate",
|
2003-03-26 12:41:27 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LIBAIKSAURUS
|
|
|
|
"thesaurus",
|
|
|
|
#endif
|
|
|
|
|
2004-03-31 19:51:55 +00:00
|
|
|
"texinfo", "toc", "url", "vspace", "wrap" };
|
2003-03-26 12:41:27 +00:00
|
|
|
|
|
|
|
char const * const * const end_dialognames =
|
|
|
|
dialognames + (sizeof(dialognames) / sizeof(char *));
|
2002-08-15 19:07:17 +00:00
|
|
|
|
2003-03-26 12:41:27 +00:00
|
|
|
struct cmpCStr {
|
|
|
|
cmpCStr(char const * name) : name_(name) {}
|
|
|
|
bool operator()(char const * other) {
|
|
|
|
return strcmp(other, name_) == 0;
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
char const * name_;
|
|
|
|
};
|
2002-08-15 19:07:17 +00:00
|
|
|
|
2003-03-26 12:41:27 +00:00
|
|
|
|
|
|
|
} // namespace anon
|
|
|
|
|
|
|
|
|
|
|
|
bool Dialogs::isValidName(string const & name) const
|
2001-01-26 10:16:05 +00:00
|
|
|
{
|
2003-09-29 10:50:51 +00:00
|
|
|
return std::find_if(dialognames, end_dialognames,
|
2003-03-26 12:41:27 +00:00
|
|
|
cmpCStr(name.c_str())) != end_dialognames;
|
2001-03-15 16:34:44 +00:00
|
|
|
}
|
2002-04-16 22:37:46 +00:00
|
|
|
|
2002-04-23 08:16:27 +00:00
|
|
|
|
2003-03-26 12:41:27 +00:00
|
|
|
Dialog * Dialogs::build(string const & name)
|
2002-04-16 22:37:46 +00:00
|
|
|
{
|
2003-03-26 12:41:27 +00:00
|
|
|
if (!isValidName(name))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
Dialog * dialog = new Dialog(lyxview_, name);
|
|
|
|
dialog->bc().view(new Qt2BC(dialog->bc()));
|
|
|
|
|
2003-06-19 17:16:12 +00:00
|
|
|
if (name == "aboutlyx") {
|
2003-03-26 12:41:27 +00:00
|
|
|
dialog->setController(new ControlAboutlyx(*dialog));
|
|
|
|
dialog->setView(new QAbout(*dialog));
|
|
|
|
dialog->bc().bp(new OkCancelPolicy);
|
|
|
|
} else if (name == "bibitem") {
|
|
|
|
dialog->setController(new ControlCommand(*dialog, name));
|
|
|
|
dialog->setView(new QBibitem(*dialog));
|
|
|
|
dialog->bc().bp(new OkCancelReadOnlyPolicy);
|
|
|
|
} else if (name == "bibtex") {
|
|
|
|
dialog->setController(new ControlBibtex(*dialog));
|
|
|
|
dialog->setView(new QBibtex(*dialog));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
2003-12-05 16:22:36 +00:00
|
|
|
} else if (name == "box") {
|
|
|
|
dialog->setController(new ControlBox(*dialog));
|
|
|
|
dialog->setView(new QBox(*dialog));
|
|
|
|
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
2003-10-23 11:58:01 +00:00
|
|
|
} else if (name == "branch") {
|
|
|
|
dialog->setController(new ControlBranch(*dialog));
|
|
|
|
dialog->setView(new QBranch(*dialog));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
2003-03-26 12:41:27 +00:00
|
|
|
} else if (name == "changes") {
|
|
|
|
dialog->setController(new ControlChanges(*dialog));
|
|
|
|
dialog->setView(new QChanges(*dialog));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
|
|
|
} else if (name == "character") {
|
|
|
|
dialog->setController(new ControlCharacter(*dialog));
|
|
|
|
dialog->setView(new QCharacter(*dialog));
|
|
|
|
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
|
|
|
} else if (name == "citation") {
|
|
|
|
dialog->setController(new ControlCitation(*dialog));
|
|
|
|
dialog->setView(new QCitation(*dialog));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
2004-03-30 19:18:14 +00:00
|
|
|
} else if (name == "document") {
|
|
|
|
dialog->setController(new ControlDocument(*dialog));
|
|
|
|
dialog->setView(new QDocument(*dialog));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
2003-05-13 21:15:48 +00:00
|
|
|
} else if (name == "errorlist") {
|
|
|
|
dialog->setController(new ControlErrorList(*dialog));
|
|
|
|
dialog->setView(new QErrorList(*dialog));
|
|
|
|
dialog->bc().bp(new OkCancelPolicy);
|
2003-03-26 12:41:27 +00:00
|
|
|
} else if (name == "ert") {
|
|
|
|
dialog->setController(new ControlERT(*dialog));
|
|
|
|
dialog->setView(new QERT(*dialog));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
|
|
|
} else if (name == "external") {
|
|
|
|
dialog->setController(new ControlExternal(*dialog));
|
|
|
|
dialog->setView(new QExternal(*dialog));
|
2003-06-04 09:16:29 +00:00
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
2003-03-26 12:41:27 +00:00
|
|
|
} else if (name == "file") {
|
|
|
|
dialog->setController(new ControlShowFile(*dialog));
|
|
|
|
dialog->setView(new QShowFile(*dialog));
|
|
|
|
dialog->bc().bp(new OkCancelPolicy);
|
2004-01-26 00:43:56 +00:00
|
|
|
} else if (name == "findreplace") {
|
|
|
|
dialog->setController(new ControlSearch(*dialog));
|
|
|
|
dialog->setView(new QSearch(*dialog));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
2003-03-26 12:41:27 +00:00
|
|
|
} else if (name == "float") {
|
|
|
|
dialog->setController(new ControlFloat(*dialog));
|
|
|
|
dialog->setView(new QFloat(*dialog));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
|
|
|
} else if (name == "graphics") {
|
|
|
|
dialog->setController(new ControlGraphics(*dialog));
|
|
|
|
dialog->setView(new QGraphics(*dialog));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
|
|
|
} else if (name == "include") {
|
|
|
|
dialog->setController(new ControlInclude(*dialog));
|
|
|
|
dialog->setView(new QInclude(*dialog));
|
|
|
|
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
|
|
|
} else if (name == "index") {
|
|
|
|
dialog->setController(new ControlCommand(*dialog, name));
|
|
|
|
dialog->setView(new QIndex(*dialog,
|
2003-05-22 18:14:36 +00:00
|
|
|
_("LyX: Index Entry"),
|
2003-03-26 12:41:27 +00:00
|
|
|
qt_("&Keyword")));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
|
|
|
} else if (name == "label") {
|
|
|
|
dialog->setController(new ControlCommand(*dialog, name));
|
|
|
|
dialog->setView(new QIndex(*dialog,
|
2003-05-22 18:14:36 +00:00
|
|
|
_("LyX: Label"),
|
2003-03-26 12:41:27 +00:00
|
|
|
qt_("&Label")));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
2003-12-05 13:37:23 +00:00
|
|
|
} else if (name == "log") {
|
2003-03-26 12:41:27 +00:00
|
|
|
dialog->setController(new ControlLog(*dialog));
|
|
|
|
dialog->setView(new QLog(*dialog));
|
|
|
|
dialog->bc().bp(new OkCancelPolicy);
|
2003-06-17 13:16:25 +00:00
|
|
|
} else if (name == "mathpanel") {
|
2003-06-17 12:53:35 +00:00
|
|
|
dialog->setController(new ControlMath(*dialog));
|
2003-06-12 14:21:04 +00:00
|
|
|
dialog->setView(new QMath(*dialog));
|
|
|
|
dialog->bc().bp(new IgnorantPolicy);
|
2003-06-17 00:30:47 +00:00
|
|
|
} else if (name == "mathdelimiter") {
|
2003-06-17 12:53:35 +00:00
|
|
|
dialog->setController(new ControlMath(*dialog));
|
2003-06-17 00:30:47 +00:00
|
|
|
dialog->setView(new QMathDelimiter(*dialog));
|
|
|
|
dialog->bc().bp(new IgnorantPolicy);
|
|
|
|
} else if (name == "mathmatrix") {
|
2003-06-17 12:53:35 +00:00
|
|
|
dialog->setController(new ControlMath(*dialog));
|
2003-06-17 00:30:47 +00:00
|
|
|
dialog->setView(new QMathMatrix(*dialog));
|
|
|
|
dialog->bc().bp(new IgnorantPolicy);
|
2003-07-15 12:48:24 +00:00
|
|
|
} else if (name == "note") {
|
|
|
|
dialog->setController(new ControlNote(*dialog));
|
|
|
|
dialog->setView(new QNote(*dialog));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
2003-03-26 12:41:27 +00:00
|
|
|
} else if (name == "paragraph") {
|
|
|
|
dialog->setController(new ControlParagraph(*dialog));
|
|
|
|
dialog->setView(new QParagraph(*dialog));
|
|
|
|
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
2004-03-31 18:51:11 +00:00
|
|
|
} else if (name == "prefs") {
|
|
|
|
dialog->setController(new ControlPrefs(*dialog));
|
|
|
|
dialog->setView(new QPrefs(*dialog));
|
|
|
|
dialog->bc().bp(new OkApplyCancelPolicy);
|
2004-03-28 14:12:33 +00:00
|
|
|
} else if (name == "print") {
|
|
|
|
dialog->setController(new ControlPrint(*dialog));
|
|
|
|
dialog->setView(new QPrint(*dialog));
|
|
|
|
dialog->bc().bp(new OkApplyCancelPolicy);
|
2003-03-26 12:41:27 +00:00
|
|
|
} else if (name == "ref") {
|
|
|
|
dialog->setController(new ControlRef(*dialog));
|
|
|
|
dialog->setView(new QRef(*dialog));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
2004-03-27 23:11:46 +00:00
|
|
|
} else if (name == "sendto") {
|
|
|
|
dialog->setController(new ControlSendto(*dialog));
|
|
|
|
dialog->setView(new QSendto(*dialog));
|
|
|
|
dialog->bc().bp(new OkApplyCancelPolicy);
|
2004-03-31 19:51:55 +00:00
|
|
|
} else if (name == "spellchecker") {
|
|
|
|
dialog->setController(new ControlSpellchecker(*dialog));
|
|
|
|
dialog->setView(new QSpellchecker(*dialog));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
2003-03-26 12:41:27 +00:00
|
|
|
} else if (name == "tabular") {
|
|
|
|
dialog->setController(new ControlTabular(*dialog));
|
|
|
|
dialog->setView(new QTabular(*dialog));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
|
|
|
} else if (name == "tabularcreate") {
|
|
|
|
dialog->setController(new ControlTabularCreate(*dialog));
|
|
|
|
dialog->setView(new QTabularCreate(*dialog));
|
|
|
|
dialog->bc().bp(new IgnorantPolicy);
|
2003-06-19 17:16:12 +00:00
|
|
|
} else if (name == "texinfo") {
|
|
|
|
dialog->setController(new ControlTexinfo(*dialog));
|
|
|
|
dialog->setView(new QTexinfo(*dialog));
|
|
|
|
dialog->bc().bp(new OkCancelPolicy);
|
2003-03-26 12:41:27 +00:00
|
|
|
#ifdef HAVE_LIBAIKSAURUS
|
|
|
|
} else if (name == "thesaurus") {
|
|
|
|
dialog->setController(new ControlThesaurus(*dialog));
|
|
|
|
dialog->setView(new QThesaurus(*dialog));
|
|
|
|
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
|
|
|
#endif
|
|
|
|
} else if (name == "toc") {
|
|
|
|
dialog->setController(new ControlToc(*dialog));
|
|
|
|
dialog->setView(new QToc(*dialog));
|
|
|
|
dialog->bc().bp(new OkCancelPolicy);
|
|
|
|
} else if (name == "url") {
|
|
|
|
dialog->setController(new ControlCommand(*dialog, name));
|
|
|
|
dialog->setView(new QURL(*dialog));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
2003-11-29 09:39:35 +00:00
|
|
|
} else if (name == "vspace") {
|
|
|
|
dialog->setController(new ControlVSpace(*dialog));
|
|
|
|
dialog->setView(new QVSpace(*dialog));
|
|
|
|
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
2003-03-26 12:41:27 +00:00
|
|
|
} else if (name == "wrap") {
|
|
|
|
dialog->setController(new ControlWrap(*dialog));
|
|
|
|
dialog->setView(new QWrap(*dialog));
|
|
|
|
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
|
|
|
}
|
|
|
|
|
|
|
|
return dialog;
|
2002-04-23 08:16:27 +00:00
|
|
|
}
|
2002-08-15 19:07:17 +00:00
|
|
|
|
|
|
|
|
2003-03-26 12:41:27 +00:00
|
|
|
void Dialogs::toggleTooltips()
|
2002-08-15 19:07:17 +00:00
|
|
|
{}
|
2003-03-26 12:41:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
/// Are the tooltips on or off?
|
|
|
|
bool Dialogs::tooltipsEnabled()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|