mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Hold on to your hats.
Qt users should autogen.sh Gnome users --- you're on your own ;-) Happy recompiling. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6253 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
db1f06d914
commit
cda53633ff
@ -1,3 +1,8 @@
|
||||
2003-02-21 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ui/default.ui: use the new 'dialog-show-new-inset "name"' instead
|
||||
of 'citation-insert', 'reference-insert' and 'bibtex-insert'.
|
||||
|
||||
2003-02-25 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* reLyX/BasicLyX.pm (regularizeLatexLength, getAsLyXLength):
|
||||
|
@ -195,8 +195,8 @@ Menuset
|
||||
Submenu "Math|h" "insert_math"
|
||||
Separator
|
||||
Submenu "Special Character|S" "insert_special"
|
||||
Item "Citation Reference...|C" "citation-insert"
|
||||
Item "Cross Reference...|R" "reference-insert"
|
||||
Item "Citation Reference...|C" "dialog-show-new-inset citation"
|
||||
Item "Cross Reference...|R" "dialog-show-new-inset ref"
|
||||
Item "Label...|L" "label-insert"
|
||||
Item "Footnote|F" "footnote-insert"
|
||||
Item "Marginal Note|M" "marginalnote-insert"
|
||||
@ -285,7 +285,7 @@ Menuset
|
||||
Item "Table of Contents|C" "toc-insert"
|
||||
FloatListInsert
|
||||
Item "Index List|I" "index-print"
|
||||
Item "BibTeX Reference...|B" "bibtex-insert"
|
||||
Item "BibTeX Reference...|B" "dialog-show-new-inset bibtex"
|
||||
End
|
||||
|
||||
Menu "insert_file"
|
||||
|
@ -40,8 +40,10 @@
|
||||
#include "iterators.h"
|
||||
#include "lyxfind.h"
|
||||
|
||||
#include "insets/insetbibitem.h"
|
||||
#include "insets/insetbibtex.h"
|
||||
#include "insets/insetcite.h"
|
||||
#include "insets/insetert.h"
|
||||
#include "insets/insetfloatlist.h"
|
||||
#include "insets/insetgraphics.h"
|
||||
#include "insets/insetinclude.h"
|
||||
@ -51,6 +53,7 @@
|
||||
#include "insets/insetref.h"
|
||||
#include "insets/insettext.h"
|
||||
#include "insets/insettoc.h"
|
||||
#include "insets/inseturl.h"
|
||||
|
||||
#include "mathed/formulabase.h"
|
||||
|
||||
@ -1095,22 +1098,6 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
|
||||
MenuInsertLabel(bv_, ev.argument);
|
||||
break;
|
||||
|
||||
case LFUN_REF_INSERT:
|
||||
if (ev.argument.empty()) {
|
||||
InsetCommandParams p("ref");
|
||||
owner_->getDialogs().createRef(p.getAsString());
|
||||
} else {
|
||||
InsetCommandParams p;
|
||||
p.setFromString(ev.argument);
|
||||
|
||||
InsetRef * inset = new InsetRef(p, *buffer_);
|
||||
if (!insertInset(inset))
|
||||
delete inset;
|
||||
else
|
||||
updateInset(inset, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_BOOKMARK_SAVE:
|
||||
savePosition(strToUnsignedInt(ev.argument));
|
||||
break;
|
||||
@ -1185,69 +1172,211 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
|
||||
mathDispatch(FuncRequest(bv_, ev.action, ev.argument));
|
||||
break;
|
||||
|
||||
case LFUN_CITATION_INSERT:
|
||||
{
|
||||
InsetCommandParams p;
|
||||
p.setFromString(ev.argument);
|
||||
case LFUN_BIBITEM_APPLY: {
|
||||
InsetCommandParams params;
|
||||
InsetCommandMailer::string2params(ev.argument, params);
|
||||
|
||||
InsetCitation * inset = new InsetCitation(p);
|
||||
if (!insertInset(inset))
|
||||
delete inset;
|
||||
else {
|
||||
inset->setLoadingBuffer(bv_->buffer(), false);
|
||||
updateInset(inset, true);
|
||||
InsetBase * base =
|
||||
owner_->getDialogs().getOpenInset("bibitem");
|
||||
InsetBibitem * inset = 0;
|
||||
if (base) {
|
||||
inset = dynamic_cast<InsetBibitem *>(base);
|
||||
if (!inset)
|
||||
break;
|
||||
|
||||
if (params.getContents() !=
|
||||
inset->params().getContents()) {
|
||||
bv_->ChangeCitationsIfUnique(
|
||||
inset->params().getContents(),
|
||||
params.getContents());
|
||||
}
|
||||
inset->setParams(params);
|
||||
} else {
|
||||
inset = new InsetBibitem(params);
|
||||
if (!insertInset(inset)) {
|
||||
delete inset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
updateInset(inset, true);
|
||||
|
||||
// We need to do a redraw because the maximum
|
||||
// InsetBibitem width could have changed
|
||||
#warning please check you mean repaint() not update(),
|
||||
#warning and whether the repaint() is needed at all
|
||||
bv_->repaint();
|
||||
bv_->fitCursor();
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_BIBTEX_APPLY: {
|
||||
InsetCommandParams params;
|
||||
InsetCommandMailer::string2params(ev.argument, params);
|
||||
|
||||
InsetBase * base =
|
||||
owner_->getDialogs().getOpenInset("bibtex");
|
||||
InsetBibtex * inset = 0;
|
||||
if (base) {
|
||||
inset = dynamic_cast<InsetBibtex *>(base);
|
||||
if (!inset)
|
||||
break;
|
||||
|
||||
if (params.getContents() !=
|
||||
inset->params().getContents()) {
|
||||
bv_->ChangeCitationsIfUnique(
|
||||
inset->params().getContents(),
|
||||
params.getContents());
|
||||
}
|
||||
inset->setParams(params);
|
||||
} else {
|
||||
inset = new InsetBibtex(params);
|
||||
if (!insertInset(inset)) {
|
||||
delete inset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
updateInset(inset, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_CITATION_APPLY: {
|
||||
InsetCommandParams params;
|
||||
InsetCommandMailer::string2params(ev.argument, params);
|
||||
|
||||
InsetBase * base =
|
||||
owner_->getDialogs().getOpenInset("citation");
|
||||
InsetCitation * inset = 0;
|
||||
if (base) {
|
||||
inset = dynamic_cast<InsetCitation *>(base);
|
||||
if (!inset)
|
||||
break;
|
||||
|
||||
inset->setParams(params);
|
||||
} else {
|
||||
inset = new InsetCitation(params);
|
||||
if (!insertInset(inset)) {
|
||||
delete inset;
|
||||
break;
|
||||
} else {
|
||||
inset->setLoadingBuffer(bv_->buffer(), false);
|
||||
}
|
||||
}
|
||||
updateInset(inset, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_ERT_APPLY: {
|
||||
InsetBase * base = owner_->getDialogs().getOpenInset("ert");
|
||||
InsetERT * inset = 0;
|
||||
if (base) {
|
||||
inset = dynamic_cast<InsetERT *>(base);
|
||||
if (!inset)
|
||||
break;
|
||||
} else {
|
||||
inset = new InsetERT(bv_->buffer()->params);
|
||||
if (!insertInset(inset)) {
|
||||
delete inset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
InsetERT::ERTStatus status;
|
||||
InsetERTMailer::string2params(ev.argument, status);
|
||||
|
||||
inset->status(bv_, status);
|
||||
updateInset(inset, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_INSERT_BIBTEX:
|
||||
{
|
||||
// ale970405+lasgoutt970425
|
||||
// The argument can be up to two tokens separated
|
||||
// by a space. The first one is the bibstyle.
|
||||
string const db = token(ev.argument, ' ', 0);
|
||||
string bibstyle = token(ev.argument, ' ', 1);
|
||||
if (bibstyle.empty())
|
||||
bibstyle = "plain";
|
||||
case LFUN_INDEX_APPLY: {
|
||||
InsetCommandParams params;
|
||||
InsetCommandMailer::string2params(ev.argument, params);
|
||||
|
||||
InsetCommandParams p("BibTeX", db, bibstyle);
|
||||
InsetBibtex * inset = new InsetBibtex(p);
|
||||
InsetBase * base = owner_->getDialogs().getOpenInset("index");
|
||||
InsetIndex * inset = 0;
|
||||
if (base) {
|
||||
inset = dynamic_cast<InsetIndex *>(base);
|
||||
if (!inset)
|
||||
break;
|
||||
|
||||
if (insertInset(inset)) {
|
||||
if (ev.argument.empty())
|
||||
inset->edit(bv_);
|
||||
} else
|
||||
delete inset;
|
||||
}
|
||||
break;
|
||||
|
||||
// BibTeX data bases
|
||||
case LFUN_BIBDB_ADD:
|
||||
{
|
||||
InsetBibtex * inset =
|
||||
static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
|
||||
if (inset) {
|
||||
inset->addDatabase(ev.argument);
|
||||
inset->setParams(params);
|
||||
} else {
|
||||
InsetIndex * inset = new InsetIndex(params);
|
||||
if (!insertInset(inset)) {
|
||||
delete inset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
updateInset(inset, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_BIBDB_DEL:
|
||||
{
|
||||
InsetBibtex * inset =
|
||||
static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
|
||||
if (inset)
|
||||
inset->delDatabase(ev.argument);
|
||||
case LFUN_REF_APPLY: {
|
||||
InsetCommandParams params;
|
||||
InsetCommandMailer::string2params(ev.argument, params);
|
||||
|
||||
InsetBase * base = owner_->getDialogs().getOpenInset("ref");
|
||||
InsetRef * inset = 0;
|
||||
if (base) {
|
||||
inset = dynamic_cast<InsetRef *>(base);
|
||||
if (!inset)
|
||||
break;
|
||||
|
||||
inset->setParams(params);
|
||||
} else {
|
||||
InsetRef * inset = new InsetRef(params, *buffer_);
|
||||
if (!insertInset(inset)) {
|
||||
delete inset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
updateInset(inset, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_BIBTEX_STYLE:
|
||||
{
|
||||
InsetBibtex * inset =
|
||||
static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
|
||||
if (inset)
|
||||
inset->setOptions(ev.argument);
|
||||
case LFUN_TOC_APPLY: {
|
||||
InsetCommandParams params;
|
||||
InsetCommandMailer::string2params(ev.argument, params);
|
||||
|
||||
InsetBase * base = owner_->getDialogs().getOpenInset("toc");
|
||||
InsetTOC * inset = 0;
|
||||
if (base) {
|
||||
InsetTOC * inset = dynamic_cast<InsetTOC *>(base);
|
||||
if (!inset)
|
||||
break;
|
||||
|
||||
inset->setParams(params);
|
||||
} else {
|
||||
InsetTOC * inset = new InsetTOC(params);
|
||||
if (!insertInset(inset)) {
|
||||
delete inset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
updateInset(inset, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_URL_APPLY: {
|
||||
InsetCommandParams params;
|
||||
InsetCommandMailer::string2params(ev.argument, params);
|
||||
|
||||
InsetBase * base = owner_->getDialogs().getOpenInset("url");
|
||||
InsetUrl * inset = 0;
|
||||
if (base) {
|
||||
inset = dynamic_cast<InsetUrl *>(base);
|
||||
if (!inset)
|
||||
break;
|
||||
|
||||
inset->setParams(params);
|
||||
} else {
|
||||
InsetUrl * inset = new InsetUrl(params);
|
||||
if (!insertInset(inset)) {
|
||||
delete inset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
updateInset(inset, true);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -4,6 +4,21 @@
|
||||
* toc.C: make TocItem store an id not a Paragraph *
|
||||
(bug #913)
|
||||
|
||||
2003-02-21 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* commandtags.h: Retire LFUN_CITATION_INSERT, LFUN_CITATION_CREATE,
|
||||
LFUN_INSERT_BIBTEX, LFUN_BIBTEX_STYLE, LFUN_BIBDB_ADD, LFUN_BIBDB_DEL.
|
||||
Bring to life LFUN_DIALOG_SHOW_NEW_INSET, LFUN_DIALOG_SHOW_NEXT_INSET,
|
||||
LFUN_DIALOG_UPDATE, LFUN_DIALOG_HIDE, LFUN_DIALOG_DISCONNECT_INSET,
|
||||
LFUN_BIBITEM_APPLY, LFUN_BIBTEX_APPLY, LFUN_CITATION_APPLY,
|
||||
LFUN_INDEX_APPLY, LFUN_REF_APPLY, LFUN_TOC_APPLY, LFUN_URL_APPLY,
|
||||
|
||||
* BufferView_pimpl.C (dispatch):
|
||||
* LyXAction.C (init):
|
||||
* factory.C (createInset):
|
||||
* lyxfunc.C (getStatus, dispatch):
|
||||
* text3.C (dispatch): retire old LFUNs and bring new ones to life.
|
||||
|
||||
2003-02-21 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* BufferView_pimpl.C (MenuInsertLyXFile):
|
||||
|
@ -100,11 +100,6 @@ void LyXAction::init()
|
||||
NoBuffer|ReadOnly },
|
||||
{ LFUN_LEFTSEL, "backward-select",
|
||||
N_("Select previous char"), ReadOnly },
|
||||
{ LFUN_BIBDB_ADD, "bibtex-database-add", "", Noop },
|
||||
{ LFUN_BIBDB_DEL, "bibtex-database-del", "", Noop },
|
||||
{ LFUN_INSERT_BIBTEX, "bibtex-insert", N_("Insert BibTeX"),
|
||||
Noop },
|
||||
{ LFUN_BIBTEX_STYLE, "bibtex-style", "", Noop },
|
||||
{ LFUN_BOOKMARK_GOTO, "bookmark-goto", "", ReadOnly },
|
||||
{ LFUN_BOOKMARK_SAVE, "bookmark-save", "", ReadOnly },
|
||||
{ LFUN_BREAKLINE, "break-line", "", Noop },
|
||||
@ -151,9 +146,6 @@ void LyXAction::init()
|
||||
ReadOnly },
|
||||
{ LFUN_RIGHT, "char-forward", N_("Go one char forward"),
|
||||
ReadOnly },
|
||||
{ LFUN_CITATION_CREATE, "citation-insert",
|
||||
N_("Insert citation"), Noop },
|
||||
{ LFUN_CITATION_INSERT, "", "internal only", Noop },
|
||||
{ LFUN_EXEC_COMMAND, "command-execute", "", NoBuffer },
|
||||
{ LFUN_PREFIX, "command-prefix",
|
||||
N_("Execute command"), NoBuffer },
|
||||
@ -245,8 +237,8 @@ void LyXAction::init()
|
||||
Noop },
|
||||
{ LFUN_INSET_OPTARG, "optional-insert", N_("Insert Optional Argument"),
|
||||
Noop },
|
||||
{ LFUN_INSERT_BIBITEM, "bibitem-insert", N_("Insert Bibliography Key"),
|
||||
Noop },
|
||||
{ LFUN_INSERT_BIBITEM, "bibitem-insert",
|
||||
N_("Insert Bibliography Key"), Noop },
|
||||
{ LFUN_LANGUAGE, "language", N_("Change language"), Noop },
|
||||
{ LFUN_LATEX_LOG, "latex-view-log", N_("View LaTeX log"),
|
||||
ReadOnly },
|
||||
@ -416,7 +408,26 @@ void LyXAction::init()
|
||||
{ LFUN_ACCEPT_CHANGE, "accept-change", N_("Accept selected change"), Noop },
|
||||
{ LFUN_REJECT_CHANGE, "reject-change", N_("Reject selected change"), Noop },
|
||||
{ LFUN_ACCEPT_ALL_CHANGES, "accept-all-changes", N_("Accept all changes"), Noop },
|
||||
{ LFUN_REJECT_ALL_CHANGES, "reject-all-changes", N_("Reject all changes"), Noop },
|
||||
{ LFUN_REJECT_ALL_CHANGES, "reject-all-changes", N_("Reject all changes"), Noop },
|
||||
|
||||
{ LFUN_DIALOG_SHOW_NEW_INSET, "dialog-show-new-inset",
|
||||
N_("Show the inset's dialog"), Noop },
|
||||
{ LFUN_DIALOG_SHOW_NEW_INSET, "dialog-show-next-inset",
|
||||
N_("Show the inset's dialog"), Noop },
|
||||
{ LFUN_DIALOG_UPDATE, "dialog-update",
|
||||
N_("Update the dialog"), Noop },
|
||||
{ LFUN_DIALOG_HIDE, "dialog-hide",
|
||||
N_("Hide the dialog"), Noop },
|
||||
{ LFUN_DIALOG_DISCONNECT_INSET, "dialog-disconnect-inset",
|
||||
N_("Disconnect the dialog from the current inset"), Noop },
|
||||
{ LFUN_BIBITEM_APPLY, "bibitem-apply", "", Noop },
|
||||
{ LFUN_BIBTEX_APPLY, "bibtex-apply", "", Noop },
|
||||
{ LFUN_CITATION_APPLY, "citation-apply", "", Noop },
|
||||
{ LFUN_ERT_APPLY, "ert-apply", "", Noop },
|
||||
{ LFUN_INDEX_APPLY, "index-apply", "", Noop },
|
||||
{ LFUN_REF_APPLY, "ref-apply", "", Noop },
|
||||
{ LFUN_TOC_APPLY, "toc-apply", "", Noop },
|
||||
{ LFUN_URL_APPLY, "url-apply", "", Noop },
|
||||
{ LFUN_NOACTION, "", "", Noop }
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// -*- C++ -*-
|
||||
// -*- C++ --*
|
||||
/* ======================================================================= *\
|
||||
Docu : To add a new function:
|
||||
- add a new enum constant immediately before LFUN_LASTACTION
|
||||
@ -190,8 +190,6 @@ enum kb_action {
|
||||
LFUN_MENUNEWTMPLT, // Asger 1997-02-02
|
||||
LFUN_MENURELOAD, // Asger 1997-02-02
|
||||
LFUN_RECONFIGURE, // 170 // Asger 1997-02-14
|
||||
LFUN_CITATION_INSERT, // AAS 97-02-23
|
||||
LFUN_INSERT_BIBTEX, // AAS 97-02-23
|
||||
LFUN_INDEX_PRINT, // Lgb 97-02-27
|
||||
LFUN_APROPOS, // Asger 1997-02-27
|
||||
LFUN_LATEX_LOG, // Lgb 97-04-05
|
||||
@ -203,9 +201,6 @@ enum kb_action {
|
||||
LFUN_TOC_INSERT, // Lgb 97-05-27
|
||||
LFUN_FLOAT_LIST, // Lgb 20010503
|
||||
LFUN_READ_ONLY_TOGGLE, // Lgb 97-05-27
|
||||
LFUN_BIBDB_ADD, // Ale 970530
|
||||
LFUN_BIBDB_DEL, // Ale 970530
|
||||
LFUN_BIBTEX_STYLE, // 190 // Ale 970530
|
||||
LFUN_GETTIP, // Ale 970603
|
||||
LFUN_VC_REGISTER, // Lgb 97-07-01
|
||||
LFUN_VC_CHECKIN, // Lgb 97-07-01
|
||||
@ -258,7 +253,6 @@ enum kb_action {
|
||||
LFUN_INSET_LIST, // Lgb 20000627
|
||||
LFUN_INSET_THEOREM, // Lgb 20000630
|
||||
#endif
|
||||
LFUN_CITATION_CREATE, // 240 // Angus 20000705
|
||||
LFUN_INSET_CAPTION, // Lgb 20000718
|
||||
LFUN_SWITCHBUFFER, // and where is this coming from?
|
||||
LFUN_INSERT_URL, // Angus 20000726
|
||||
@ -296,7 +290,20 @@ enum kb_action {
|
||||
LFUN_REJECT_CHANGE, // Levon 20021016
|
||||
LFUN_ACCEPT_ALL_CHANGES, // Levon 20021016
|
||||
LFUN_REJECT_ALL_CHANGES, // Levon 20021016
|
||||
LFUN_INSERT_BIBITEM, // André 14 Feb 2003
|
||||
LFUN_INSERT_BIBITEM, // André 14 Feb 2003
|
||||
LFUN_DIALOG_SHOW_NEW_INSET,
|
||||
LFUN_DIALOG_SHOW_NEXT_INSET,
|
||||
LFUN_DIALOG_UPDATE,
|
||||
LFUN_DIALOG_HIDE,
|
||||
LFUN_DIALOG_DISCONNECT_INSET,
|
||||
LFUN_BIBITEM_APPLY,
|
||||
LFUN_BIBTEX_APPLY,
|
||||
LFUN_CITATION_APPLY,
|
||||
LFUN_ERT_APPLY,
|
||||
LFUN_INDEX_APPLY,
|
||||
LFUN_REF_APPLY,
|
||||
LFUN_TOC_APPLY,
|
||||
LFUN_URL_APPLY,
|
||||
LFUN_LASTACTION /* this marks the end of the table */
|
||||
};
|
||||
|
||||
|
@ -97,17 +97,22 @@ Inset * createInset(FuncRequest const & cmd)
|
||||
return 0;
|
||||
|
||||
case LFUN_INDEX_INSERT: {
|
||||
string const entry = cmd.argument.empty() ?
|
||||
"index" : cmd.argument;
|
||||
InsetCommandParams icp;
|
||||
icp.setFromString(entry);
|
||||
// Try and generate a valid index entry.
|
||||
InsetCommandParams icp("index");
|
||||
string const contents = cmd.argument.empty() ?
|
||||
bv->getLyXText()->getStringToIndex(bv) :
|
||||
cmd.argument;
|
||||
icp.setContents(contents);
|
||||
|
||||
if (icp.getContents().empty())
|
||||
icp.setContents(bv->getLyXText()->getStringToIndex(bv));
|
||||
if (!icp.getContents().empty())
|
||||
return new InsetIndex(icp);
|
||||
|
||||
bv->owner()->getDialogs().createIndex();
|
||||
string data = InsetCommandMailer::params2string(icp);
|
||||
LyXView * lv = bv->owner();
|
||||
|
||||
if (icp.getContents().empty()) {
|
||||
lv->getDialogs().show("index", data, 0);
|
||||
} else {
|
||||
FuncRequest fr(bv, LFUN_INDEX_APPLY, data);
|
||||
lv->dispatch(fr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,14 @@
|
||||
2003-02-21 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.[Ch]: simplify the dialog interface by using a few
|
||||
methods to do generic things like 'show' a dialog. Individual
|
||||
dialogs are invoked through a string 'name'.
|
||||
Use methods 'hideAll' etc to replace signals of the same name: more
|
||||
transparent code.
|
||||
|
||||
* guiapi.[Ch]: provide a C-interface to the new Dialogs::show
|
||||
method. Retire the old functions that called dead Dialogs methods.
|
||||
|
||||
2003-02-21 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Timeout.[Ch]: define a Timeout::Impl abstract base class from
|
||||
|
@ -11,8 +11,11 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "Dialogs.h"
|
||||
#include "controllers/Dialog.h"
|
||||
#include "controllers/ButtonControllerBase.h"
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
|
||||
// Note that static boost signals break some compilers, so this wrapper
|
||||
// initialises the signal dynamically when it is first invoked.
|
||||
@ -39,3 +42,145 @@ boost::signal0<void> & Dialogs::redrawGUI()
|
||||
static BugfixSignal<boost::signal0<void> > thesignal;
|
||||
return thesignal();
|
||||
}
|
||||
|
||||
|
||||
Dialogs::Dialogs(LyXView & lyxview)
|
||||
: lyxview_(lyxview)
|
||||
{
|
||||
// Connect signals
|
||||
redrawGUI().connect(boost::bind(&Dialogs::redraw, this));
|
||||
|
||||
// All this is slated to go
|
||||
init_pimpl();
|
||||
// reduce the number of connections needed in
|
||||
// dialogs by a simple connection here.
|
||||
hideAllSignal.connect(hideBufferDependentSignal);
|
||||
}
|
||||
|
||||
|
||||
Dialog * Dialogs::find(string const & name)
|
||||
{
|
||||
if (!isValidName(name))
|
||||
return 0;
|
||||
|
||||
std::map<string, DialogPtr>::iterator it =
|
||||
dialogs_.find(name);
|
||||
|
||||
if (it == dialogs_.end()) {
|
||||
dialogs_[name] = DialogPtr(build(name));
|
||||
return dialogs_[name].get();
|
||||
}
|
||||
|
||||
return it->second.get();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::show(string const & name, string const & data, InsetBase * inset)
|
||||
{
|
||||
Dialog * dialog = find(name);
|
||||
if (!dialog)
|
||||
return;
|
||||
|
||||
dialog->show(data);
|
||||
open_insets_[name] = inset;
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::update(string const & name, string const & data)
|
||||
{
|
||||
Dialog * dialog = find(name);
|
||||
if (!dialog)
|
||||
return;
|
||||
|
||||
if (dialog->isVisible())
|
||||
dialog->update(data);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::hide(string const & name)
|
||||
{
|
||||
Dialog * dialog = find(name);
|
||||
if (!dialog)
|
||||
return;
|
||||
|
||||
if (dialog->isVisible())
|
||||
dialog->hide();
|
||||
open_insets_[name] = 0;
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::disconnect(string const & name)
|
||||
{
|
||||
if (!isValidName(name))
|
||||
return;
|
||||
|
||||
open_insets_[name] = 0;
|
||||
}
|
||||
|
||||
|
||||
InsetBase * Dialogs::getOpenInset(string const & name) const
|
||||
{
|
||||
if (!isValidName(name))
|
||||
return 0;
|
||||
|
||||
std::map<string, InsetBase *>::const_iterator it =
|
||||
open_insets_.find(name);
|
||||
return it == open_insets_.end() ? 0 : it->second;
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::hideAll() const
|
||||
{
|
||||
std::map<string, DialogPtr>::const_iterator it = dialogs_.begin();
|
||||
std::map<string, DialogPtr>::const_iterator end = dialogs_.end();
|
||||
|
||||
for(; it != end; ++it) {
|
||||
it->second->hide();
|
||||
}
|
||||
hideAllSignal();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::hideBufferDependent() const
|
||||
{
|
||||
std::map<string, DialogPtr>::const_iterator it = dialogs_.begin();
|
||||
std::map<string, DialogPtr>::const_iterator end = dialogs_.end();
|
||||
|
||||
for(; it != end; ++it) {
|
||||
Dialog * dialog = it->second.get();
|
||||
if (dialog->controller().isBufferDependent())
|
||||
dialog->hide();
|
||||
}
|
||||
hideBufferDependentSignal();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::updateBufferDependent(bool switched) const
|
||||
{
|
||||
std::map<string, DialogPtr>::const_iterator it = dialogs_.begin();
|
||||
std::map<string, DialogPtr>::const_iterator end = dialogs_.end();
|
||||
|
||||
for(; it != end; ++it) {
|
||||
Dialog * dialog = it->second.get();
|
||||
if (switched && dialog->controller().isBufferDependent()) {
|
||||
dialog->hide();
|
||||
} else {
|
||||
// A bit clunky, but the dialog will request
|
||||
// that the kernel provides it with the necessary
|
||||
// data.
|
||||
dialog->RestoreButton();
|
||||
}
|
||||
}
|
||||
updateBufferDependentSignal(switched);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::redraw() const
|
||||
{
|
||||
std::map<string, DialogPtr>::const_iterator it = dialogs_.begin();
|
||||
std::map<string, DialogPtr>::const_iterator end = dialogs_.end();
|
||||
|
||||
for(; it != end; ++it) {
|
||||
it->second->redraw();
|
||||
}
|
||||
}
|
||||
|
@ -19,10 +19,12 @@
|
||||
#include <boost/signals/signal0.hpp>
|
||||
#include <boost/signals/signal1.hpp>
|
||||
|
||||
class Dialog;
|
||||
class InsetBase;
|
||||
class LyXView;
|
||||
|
||||
class InsetCommand;
|
||||
class InsetError;
|
||||
class InsetERT;
|
||||
class InsetExternal;
|
||||
class InsetFloat;
|
||||
class InsetWrap;
|
||||
@ -59,46 +61,34 @@ public:
|
||||
/// Are the tooltips on or off?
|
||||
static bool tooltipsEnabled();
|
||||
|
||||
/**@name Global Hide and Update Signals */
|
||||
/// Signals slated to go
|
||||
//@{
|
||||
boost::signal0<void> hideAllSignal;
|
||||
boost::signal0<void> hideBufferDependentSignal;
|
||||
boost::signal1<void, bool> updateBufferDependentSignal;
|
||||
//@}
|
||||
|
||||
/// Hide all visible dialogs
|
||||
boost::signal0<void> hideAll;
|
||||
|
||||
void hideAll() const;
|
||||
/// Hide any dialogs that require a buffer for them to operate
|
||||
boost::signal0<void> hideBufferDependent;
|
||||
|
||||
void hideBufferDependent() const;
|
||||
/** Update visible, buffer-dependent dialogs
|
||||
If the bool is true then a buffer change has occurred
|
||||
else its still the same buffer.
|
||||
*/
|
||||
boost::signal1<void, bool> updateBufferDependent;
|
||||
//@}
|
||||
void updateBufferDependent(bool) const ;
|
||||
|
||||
/**@name Dialog Access Signals.
|
||||
Put into some sort of alphabetical order */
|
||||
//@{
|
||||
///
|
||||
void showAboutlyx();
|
||||
/// show the key and label of a bibliography entry
|
||||
void showBibitem(InsetCommand * ic);
|
||||
/// show the bibtex dialog
|
||||
void showBibtex(InsetCommand * ic);
|
||||
///
|
||||
void showCharacter();
|
||||
/// connected to the character dialog also
|
||||
void setUserFreeFont();
|
||||
///
|
||||
void showCitation(InsetCommand *);
|
||||
///
|
||||
void createCitation(string const &);
|
||||
///
|
||||
void showDocument();
|
||||
///
|
||||
void showError(InsetError *);
|
||||
///
|
||||
void showERT(InsetERT *);
|
||||
///
|
||||
void updateERT(InsetERT *);
|
||||
/// show the external inset dialog
|
||||
void showExternal(InsetExternal *);
|
||||
/// show the contents of a file.
|
||||
@ -113,10 +103,6 @@ public:
|
||||
void showGraphics(InsetGraphics *);
|
||||
/// show the details of a LyX file include inset
|
||||
void showInclude(InsetInclude *);
|
||||
///
|
||||
void showIndex(InsetCommand *);
|
||||
///
|
||||
void createIndex();
|
||||
/// show the LaTeX log or build file
|
||||
void showLogFile();
|
||||
/// display the top-level maths panel
|
||||
@ -138,10 +124,6 @@ public:
|
||||
///
|
||||
void showPrint();
|
||||
///
|
||||
void showRef(InsetCommand *);
|
||||
///
|
||||
void createRef(string const &);
|
||||
///
|
||||
void showSearch();
|
||||
///
|
||||
void showSendto();
|
||||
@ -157,23 +139,54 @@ public:
|
||||
void showTexinfo();
|
||||
/// show the thesaurus dialog
|
||||
void showThesaurus(string const &);
|
||||
///
|
||||
void showTOC(InsetCommand *);
|
||||
///
|
||||
void createTOC(string const &);
|
||||
///
|
||||
void showUrl(InsetCommand *);
|
||||
///
|
||||
void createUrl(string const &);
|
||||
/// show the version control log
|
||||
void showVCLogFile();
|
||||
//@}
|
||||
|
||||
/** name == "bibtex", "citation" etc
|
||||
data is generated by the Inset::write method, to be read by the
|
||||
Inset::read method in the frontends.
|
||||
inset is stored. On a subsequent Apply from the frontends, the
|
||||
stored inset will be modified. If no inset is stored, then a
|
||||
new one will be created at the current cursor position.
|
||||
*/
|
||||
void show(string const & name, string const & data, InsetBase * inset);
|
||||
/** name == "citation", "bibtex" etc.
|
||||
Update the contents of the dialog.
|
||||
*/
|
||||
void update(string const & name, string const & data);
|
||||
///
|
||||
void Dialogs::hide(string const & name);
|
||||
///
|
||||
void disconnect(string const & name);
|
||||
///
|
||||
InsetBase * getOpenInset(string const & name) const;
|
||||
private:
|
||||
/// Use the Pimpl idiom to hide the internals.
|
||||
///
|
||||
void redraw() const;
|
||||
///
|
||||
bool isValidName(string const & name) const;
|
||||
///
|
||||
Dialog * find(string const & name);
|
||||
///
|
||||
Dialog * build(string const & name);
|
||||
|
||||
///
|
||||
LyXView & lyxview_;
|
||||
///
|
||||
std::map<string, InsetBase *> open_insets_;
|
||||
|
||||
///
|
||||
typedef boost::shared_ptr<Dialog> DialogPtr;
|
||||
///
|
||||
std::map<string, DialogPtr> dialogs_;
|
||||
|
||||
/// the stuff below is slated to go...
|
||||
void init_pimpl();
|
||||
///
|
||||
class Impl;
|
||||
/// The pointer never changes although *pimpl_'s contents may.
|
||||
boost::scoped_ptr<Impl> const pimpl_;
|
||||
///
|
||||
Impl * pimpl_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,3 +1,24 @@
|
||||
2003-02-21 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialog.[Ch]:
|
||||
* Kernel.[Ch]: a new, transparent MCV split of the dialogs code.
|
||||
|
||||
* ControlBibitem.[Ch]:
|
||||
* ControlBibtex.[Ch]:
|
||||
* ControlCitation.[Ch]:
|
||||
* ControlCommand.[Ch]:
|
||||
* ControlError.[Ch]:
|
||||
* ControlIndex.[Ch]:
|
||||
* ControlRef.[Ch]:
|
||||
* ControlToc.[Ch]:
|
||||
* ControlUrl.[Ch]: New MCV design leads to cleaner code for the
|
||||
individual controllers too.
|
||||
Move 'apply' code into the LyX kernel.
|
||||
|
||||
* ControlConnections.C: temporary renaming of Dialogs::signals.
|
||||
|
||||
* Makefile.am: add new files.
|
||||
|
||||
2003-02-21 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ControlBibtex.C (Browse):
|
||||
|
@ -11,31 +11,9 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "ControlBibitem.h"
|
||||
#include "BufferView.h"
|
||||
|
||||
|
||||
ControlBibitem::ControlBibitem(LyXView & lv, Dialogs & d)
|
||||
: ControlCommand(lv, d)
|
||||
ControlBibitem::ControlBibitem(Dialog & d)
|
||||
: ControlCommand(d, LFUN_BIBITEM_APPLY)
|
||||
{}
|
||||
|
||||
|
||||
void ControlBibitem::applyParamsToInset()
|
||||
{
|
||||
// FIXME:
|
||||
// confirm, is this only necessary for FormBibTeX ???
|
||||
if (params().getContents() != inset()->params().getContents())
|
||||
bufferview()->ChangeCitationsIfUnique(inset()->params().getContents(),
|
||||
params().getContents());
|
||||
|
||||
inset()->setParams(params());
|
||||
bufferview()->updateInset(inset(), true);
|
||||
|
||||
// We need to do a redraw because the maximum
|
||||
// InsetBibKey width could have changed
|
||||
#warning please check you mean repaint() not update(),
|
||||
#warning and whether the repaint() is needed at all
|
||||
bufferview()->repaint();
|
||||
bufferview()->fitCursor();
|
||||
}
|
||||
|
@ -21,12 +21,7 @@
|
||||
class ControlBibitem : public ControlCommand {
|
||||
public:
|
||||
///
|
||||
ControlBibitem(LyXView &, Dialogs &);
|
||||
private:
|
||||
/// Dispatch the changed parameters to the kernel.
|
||||
virtual void applyParamsToInset();
|
||||
/// not needed.
|
||||
virtual void applyParamsNoInset() {}
|
||||
ControlBibitem(Dialog &);
|
||||
};
|
||||
|
||||
#endif // CONTROLBIBITEM_H
|
||||
|
@ -12,44 +12,20 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "ControlBibtex.h"
|
||||
#include "Kernel.h"
|
||||
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "lyxrc.h"
|
||||
#include "helper_funcs.h"
|
||||
#include "tex_helpers.h"
|
||||
#include "gettext.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
|
||||
using std::pair;
|
||||
|
||||
|
||||
ControlBibtex::ControlBibtex(LyXView & lv, Dialogs & d)
|
||||
: ControlCommand(lv, d)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
void ControlBibtex::applyParamsToInset()
|
||||
{
|
||||
if (params().getContents() != inset()->params().getContents())
|
||||
bufferview()->ChangeCitationsIfUnique(inset()->params().getContents(),
|
||||
params().getContents());
|
||||
|
||||
inset()->setParams(params());
|
||||
bufferview()->updateInset(inset(), true);
|
||||
|
||||
// We need to do a redraw because the maximum
|
||||
// InsetBibKey width could have changed
|
||||
#warning are you sure you need this repaint() ?
|
||||
bufferview()->repaint();
|
||||
bufferview()->fitCursor();
|
||||
}
|
||||
|
||||
|
||||
void ControlBibtex::applyParamsNoInset()
|
||||
ControlBibtex::ControlBibtex(Dialog & d)
|
||||
: ControlCommand(d, LFUN_BIBTEX_APPLY)
|
||||
{}
|
||||
|
||||
|
||||
@ -59,7 +35,7 @@ string const ControlBibtex::Browse(string const & in_name,
|
||||
{
|
||||
pair<string, string> dir1(_("Documents|#o#O"),
|
||||
string(lyxrc.document_path));
|
||||
return browseRelFile(in_name, buffer()->filePath(),
|
||||
return browseRelFile(in_name, kernel().buffer()->filePath(),
|
||||
title, pattern, false, dir1);
|
||||
}
|
||||
|
||||
|
@ -16,12 +16,14 @@
|
||||
|
||||
#include "ControlCommand.h"
|
||||
|
||||
|
||||
/** A controller for Bibtex dialogs.
|
||||
*/
|
||||
class ControlBibtex : public ControlCommand {
|
||||
public:
|
||||
///
|
||||
ControlBibtex(LyXView &, Dialogs &);
|
||||
ControlBibtex(Dialog &);
|
||||
|
||||
/// Browse for a file
|
||||
string const Browse(string const &, string const &, string const &);
|
||||
/// get the list of bst files
|
||||
@ -31,11 +33,7 @@ public:
|
||||
/// build filelists of all availabe bib/bst/cls/sty-files. done through
|
||||
/// kpsewhich and an external script, saved in *Files.lst
|
||||
void rescanBibStyles() const;
|
||||
private:
|
||||
/// Dispatch the changed parameters to the kernel.
|
||||
virtual void applyParamsToInset();
|
||||
///
|
||||
virtual void applyParamsNoInset();
|
||||
};
|
||||
|
||||
|
||||
#endif // CONTROLBIBTEX_H
|
||||
|
@ -10,8 +10,9 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "ControlCitation.h"
|
||||
#include "Kernel.h"
|
||||
|
||||
#include "buffer.h"
|
||||
|
||||
using std::vector;
|
||||
@ -21,21 +22,17 @@ using std::pair;
|
||||
vector<biblio::CiteStyle> ControlCitation::citeStyles_;
|
||||
|
||||
|
||||
ControlCitation::ControlCitation(LyXView & lv, Dialogs & d)
|
||||
: ControlCommand(lv, d, LFUN_CITATION_INSERT)
|
||||
ControlCitation::ControlCitation(Dialog & d)
|
||||
: ControlCommand(d, LFUN_CITATION_APPLY)
|
||||
{}
|
||||
|
||||
|
||||
void ControlCitation::clearDaughterParams()
|
||||
void ControlCitation::initialiseParams(string const & data)
|
||||
{
|
||||
bibkeysInfo_.clear();
|
||||
}
|
||||
ControlCommand::initialiseParams(data);
|
||||
|
||||
|
||||
void ControlCitation::setDaughterParams()
|
||||
{
|
||||
vector<pair<string,string> > blist;
|
||||
buffer()->fillWithBibKeys(blist);
|
||||
kernel().buffer()->fillWithBibKeys(blist);
|
||||
|
||||
typedef std::map<string, string>::value_type InfoMapValue;
|
||||
|
||||
@ -55,6 +52,14 @@ void ControlCitation::setDaughterParams()
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ControlCitation::clearParams()
|
||||
{
|
||||
ControlCommand::clearParams();
|
||||
bibkeysInfo_.clear();
|
||||
}
|
||||
|
||||
|
||||
biblio::InfoMap const & ControlCitation::bibkeysInfo() const
|
||||
{
|
||||
return bibkeysInfo_;
|
||||
@ -63,7 +68,7 @@ biblio::InfoMap const & ControlCitation::bibkeysInfo() const
|
||||
|
||||
bool ControlCitation::usingNatbib() const
|
||||
{
|
||||
return buffer()->params.use_natbib;
|
||||
return kernel().buffer()->params.use_natbib;
|
||||
}
|
||||
|
||||
|
||||
@ -74,7 +79,7 @@ vector<string> const ControlCitation::getCiteStrings(string const & key) const
|
||||
vector<biblio::CiteStyle> const cs =
|
||||
biblio::getCiteStyles(usingNatbib());
|
||||
|
||||
if (buffer()->params.use_numerical_citations)
|
||||
if (kernel().buffer()->params.use_numerical_citations)
|
||||
styles = biblio::getNumericalStrings(key, bibkeysInfo_, cs);
|
||||
else
|
||||
styles = biblio::getAuthorYearStrings(key, bibkeysInfo_, cs);
|
||||
|
@ -21,7 +21,17 @@
|
||||
class ControlCitation : public ControlCommand {
|
||||
public:
|
||||
///
|
||||
ControlCitation(LyXView &, Dialogs &);
|
||||
ControlCitation(Dialog &);
|
||||
|
||||
///
|
||||
virtual void initialiseParams(string const & data);
|
||||
/// clean-up on hide.
|
||||
virtual void clearParams();
|
||||
|
||||
/** Disconnect from the inset when the Apply button is pressed.
|
||||
* Allows easy insertion of multiple citations.
|
||||
*/
|
||||
virtual bool disconnectOnApply() const { return true; }
|
||||
|
||||
/// Returns a reference to the map of stored keys
|
||||
biblio::InfoMap const & bibkeysInfo() const;
|
||||
@ -36,15 +46,6 @@ public:
|
||||
return citeStyles_;
|
||||
}
|
||||
private:
|
||||
/// create the InfoMap of keys and data
|
||||
virtual void setDaughterParams();
|
||||
///
|
||||
virtual void clearDaughterParams();
|
||||
|
||||
/** disconnect from the inset when the Apply button is pressed.
|
||||
Allows easy insertion of multiple citations. */
|
||||
virtual bool disconnectOnApply() { return true; }
|
||||
|
||||
/// The info associated with each key
|
||||
biblio::InfoMap bibkeysInfo_;
|
||||
|
||||
|
@ -10,44 +10,38 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "ControlCommand.h"
|
||||
#include "Kernel.h"
|
||||
|
||||
#include "BufferView.h"
|
||||
#include "funcrequest.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "insets/insetcommand.h"
|
||||
|
||||
|
||||
ControlCommand::ControlCommand(LyXView & lv, Dialogs & d, kb_action ac)
|
||||
: ControlInset<InsetCommand, InsetCommandParams>(lv, d),
|
||||
ControlCommand::ControlCommand(Dialog & dialog, kb_action ac)
|
||||
: Dialog::Controller(dialog),
|
||||
action_(ac)
|
||||
{}
|
||||
|
||||
|
||||
InsetCommandParams const ControlCommand::getParams(string const & arg)
|
||||
void ControlCommand::initialiseParams(string const & data)
|
||||
{
|
||||
InsetCommandParams params;
|
||||
params.setFromString(arg);
|
||||
return params;
|
||||
InsetCommandMailer::string2params(data, params_);
|
||||
}
|
||||
|
||||
|
||||
InsetCommandParams const ControlCommand::getParams(InsetCommand const & inset)
|
||||
void ControlCommand::clearParams()
|
||||
{
|
||||
return inset.params();
|
||||
params_.setCmdName(string());
|
||||
params_.setOptions(string());
|
||||
params_.setContents(string());
|
||||
}
|
||||
|
||||
|
||||
void ControlCommand::applyParamsToInset()
|
||||
{
|
||||
inset()->setParams(params());
|
||||
bufferview()->updateInset(inset(), true);
|
||||
}
|
||||
|
||||
|
||||
void ControlCommand::applyParamsNoInset()
|
||||
void ControlCommand::dispatchParams()
|
||||
{
|
||||
if (action_ == LFUN_NOACTION)
|
||||
return;
|
||||
lyxfunc().dispatch(FuncRequest(action_, params().getAsString()));
|
||||
|
||||
FuncRequest fr(action_, InsetCommandMailer::params2string(params_));
|
||||
kernel().dispatch(fr);
|
||||
}
|
||||
|
@ -10,41 +10,38 @@
|
||||
*
|
||||
* ControlCommand is a controller class for dialogs that create or modify
|
||||
* an inset derived from InsetCommand.
|
||||
*
|
||||
* The class is likely to be changed as other Inset controllers are created
|
||||
* and it becomes clear just what functionality can be moved back into
|
||||
* ControlInset.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CONTROLCOMMAND_H
|
||||
#define CONTROLCOMMAND_H
|
||||
|
||||
|
||||
#include "ControlInset.h"
|
||||
#include "insets/insetcommand.h"
|
||||
#include "Dialog.h"
|
||||
#include "insets/insetcommandparams.h"
|
||||
#include "commandtags.h" // kb_action
|
||||
|
||||
/** The Inset dialog controller. Connects/disconnects signals, launches
|
||||
GUI-dependent View and returns the output from this View to the kernel.
|
||||
*/
|
||||
class ControlCommand
|
||||
: public ControlInset<InsetCommand, InsetCommandParams>
|
||||
{
|
||||
|
||||
class ControlCommand : public Dialog::Controller {
|
||||
public:
|
||||
///
|
||||
ControlCommand(LyXView &, Dialogs &, kb_action=LFUN_NOACTION);
|
||||
private:
|
||||
/// Dispatch the changed parameters to the kernel.
|
||||
virtual void applyParamsToInset();
|
||||
ControlCommand(Dialog &, kb_action=LFUN_NOACTION);
|
||||
///
|
||||
virtual void applyParamsNoInset();
|
||||
/// get the parameters from the string passed to createInset.
|
||||
virtual InsetCommandParams const getParams(string const &);
|
||||
/// get the parameters from the inset passed to showInset.
|
||||
virtual InsetCommandParams const getParams(InsetCommand const &);
|
||||
InsetCommandParams & params() { return params_; }
|
||||
///
|
||||
InsetCommandParams const & params() const { return params_; }
|
||||
///
|
||||
virtual void initialiseParams(string const & data);
|
||||
/// clean-up on hide.
|
||||
virtual void clearParams();
|
||||
/// clean-up on hide.
|
||||
virtual void dispatchParams();
|
||||
///
|
||||
virtual bool isBufferDependent() const { return true; }
|
||||
|
||||
/// Controls what is done in LyXFunc::Dispatch()
|
||||
private:
|
||||
///
|
||||
InsetCommandParams params_;
|
||||
/// Flags what action is taken by Kernel::dispatch()
|
||||
kb_action const action_;
|
||||
};
|
||||
|
||||
|
@ -125,7 +125,7 @@ ControlConnectBI::ControlConnectBI(LyXView & lv, Dialogs & d)
|
||||
|
||||
void ControlConnectBI::connect()
|
||||
{
|
||||
h_ = d_.hideAll.connect(boost::bind(&ControlConnectBI::hide, this));
|
||||
h_ = d_.hideAllSignal.connect(boost::bind(&ControlConnectBI::hide, this));
|
||||
ControlConnectBase::connect();
|
||||
}
|
||||
|
||||
@ -136,9 +136,9 @@ ControlConnectBD::ControlConnectBD(LyXView & lv, Dialogs & d)
|
||||
|
||||
void ControlConnectBD::connect()
|
||||
{
|
||||
u_ = d_.updateBufferDependent.
|
||||
u_ = d_.updateBufferDependentSignal.
|
||||
connect(boost::bind(&ControlConnectBD::updateSlot, this, _1));
|
||||
h_ = d_.hideBufferDependent.
|
||||
h_ = d_.hideBufferDependentSignal.
|
||||
connect(boost::bind(&ControlConnectBD::hide, this));
|
||||
ControlConnectBase::connect();
|
||||
}
|
||||
|
@ -11,52 +11,29 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "ControlERT.h"
|
||||
|
||||
// sorry this is just a temporary hack we should include vspace.h! (Jug)
|
||||
extern const char * stringFromUnit(int);
|
||||
#include "funcrequest.h"
|
||||
|
||||
|
||||
ControlERT::ControlERT(LyXView & lv, Dialogs & d)
|
||||
: ControlInset<InsetERT, ERTParams>(lv, d)
|
||||
ControlERT::ControlERT(Dialog & parent)
|
||||
: Dialog::Controller(parent), status_(InsetERT::Collapsed)
|
||||
{}
|
||||
|
||||
|
||||
void ControlERT::applyParamsToInset()
|
||||
void ControlERT::initialiseParams(string const & data)
|
||||
{
|
||||
inset()->status(bufferview(), params().status);
|
||||
InsetERTMailer::string2params(data, status_);
|
||||
}
|
||||
|
||||
|
||||
void ControlERT::applyParamsNoInset()
|
||||
void ControlERT::clearParams()
|
||||
{
|
||||
status_ = InsetERT::Collapsed;
|
||||
}
|
||||
|
||||
|
||||
ERTParams const ControlERT::getParams(InsetERT const & inset)
|
||||
void ControlERT::dispatchParams()
|
||||
{
|
||||
return ERTParams(inset);
|
||||
}
|
||||
|
||||
|
||||
ERTParams::ERTParams()
|
||||
: status(InsetERT::Collapsed)
|
||||
{}
|
||||
|
||||
|
||||
ERTParams::ERTParams(InsetERT const & inset)
|
||||
: status(inset.status())
|
||||
{}
|
||||
|
||||
|
||||
bool operator==(ERTParams const & p1, ERTParams const & p2)
|
||||
{
|
||||
return (p1.status == p2.status);
|
||||
}
|
||||
|
||||
|
||||
bool operator!=(ERTParams const & p1, ERTParams const & p2)
|
||||
{
|
||||
return !(p1 == p2);
|
||||
FuncRequest fr(LFUN_ERT_APPLY, InsetERTMailer::params2string(status_));
|
||||
kernel().dispatch(fr);
|
||||
}
|
||||
|
@ -13,47 +13,30 @@
|
||||
#ifndef CONTROLERT_H
|
||||
#define CONTROLERT_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Dialog.h"
|
||||
#include "insets/insetert.h" // InsetERT::ERTStatus
|
||||
|
||||
|
||||
#include "ControlInset.h"
|
||||
#include "insets/insetert.h" // InsetERT::Status
|
||||
|
||||
/** This should be moved back into insetert.h and InsetERT should
|
||||
contain an instance of it. */
|
||||
|
||||
struct ERTParams {
|
||||
///
|
||||
ERTParams();
|
||||
///
|
||||
ERTParams(InsetERT const &);
|
||||
///
|
||||
InsetERT::ERTStatus status;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
bool operator==(ERTParams const &, ERTParams const &);
|
||||
///
|
||||
bool operator!=(ERTParams const &, ERTParams const &);
|
||||
|
||||
|
||||
/** A controller for ERT dialogs.
|
||||
*/
|
||||
class ControlERT : public ControlInset<InsetERT, ERTParams> {
|
||||
class ControlERT : public Dialog::Controller {
|
||||
public:
|
||||
///
|
||||
ControlERT(LyXView &, Dialogs &);
|
||||
private:
|
||||
/// Dispatch the changed parameters to the kernel.
|
||||
virtual void applyParamsToInset();
|
||||
ControlERT(Dialog &);
|
||||
///
|
||||
virtual void applyParamsNoInset();
|
||||
/// get the parameters from the string passed to createInset.
|
||||
virtual ERTParams const getParams(string const &)
|
||||
{ return ERTParams(); }
|
||||
/// get the parameters from the inset passed to showInset.
|
||||
virtual ERTParams const getParams(InsetERT const &);
|
||||
InsetERT::ERTStatus status() const { return status_; }
|
||||
///
|
||||
void setStatus(InsetERT::ERTStatus status) { status_ = status; }
|
||||
///
|
||||
virtual void initialiseParams(string const & data);
|
||||
/// clean-up on hide.
|
||||
virtual void clearParams();
|
||||
/// clean-up on hide.
|
||||
virtual void dispatchParams();
|
||||
///
|
||||
virtual bool isBufferDependent() const { return true; }
|
||||
private:
|
||||
///
|
||||
InsetERT::ERTStatus status_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -10,17 +10,22 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "ControlError.h"
|
||||
#include "insets/inseterror.h"
|
||||
|
||||
|
||||
ControlError::ControlError(LyXView & lv, Dialogs & d)
|
||||
: ControlInset<InsetError, string>(lv, d)
|
||||
ControlError::ControlError(Dialog & parent)
|
||||
: Dialog::Controller(parent)
|
||||
{}
|
||||
|
||||
|
||||
string const ControlError::getParams(InsetError const & inset)
|
||||
void ControlError::initialiseParams(string const & data)
|
||||
{
|
||||
return inset.getContents();
|
||||
params_ = data;
|
||||
}
|
||||
|
||||
|
||||
void ControlError::clearParams()
|
||||
{
|
||||
params_.clear();
|
||||
}
|
||||
|
||||
|
@ -13,26 +13,28 @@
|
||||
#define CONTROLERROR_H
|
||||
|
||||
|
||||
#include "ControlInset.h"
|
||||
#include "insets/inseterror.h" // needed for proper instantiation of GUI<>.
|
||||
#include "Dialog.h"
|
||||
|
||||
class InsetError;
|
||||
|
||||
/** A controller for LaTeX Error dialogs.
|
||||
*/
|
||||
class ControlError : public ControlInset<InsetError, string> {
|
||||
class ControlError : public Dialog::Controller {
|
||||
public:
|
||||
///
|
||||
ControlError(LyXView &, Dialogs &);
|
||||
private:
|
||||
/// not needed.
|
||||
virtual void applyParamsToInset() {}
|
||||
ControlError(Dialog &);
|
||||
///
|
||||
virtual void applyParamsNoInset() {}
|
||||
/// get the parameters from the string passed to createInset.
|
||||
virtual string const getParams(string const &) { return string(); }
|
||||
/// get the parameters from the inset passed to showInset.
|
||||
virtual string const getParams(InsetError const &);
|
||||
virtual void initialiseParams(string const &);
|
||||
///
|
||||
virtual void clearParams();
|
||||
///
|
||||
virtual void dispatchParams() {}
|
||||
///
|
||||
virtual bool isBufferDependent() const { return true; }
|
||||
///
|
||||
string & params() { return params_; }
|
||||
///
|
||||
string const & params() const { return params_; }
|
||||
///
|
||||
private:
|
||||
string params_;
|
||||
};
|
||||
|
||||
#endif // CONTROLERROR_H
|
||||
|
@ -14,6 +14,6 @@
|
||||
#include "ControlIndex.h"
|
||||
|
||||
|
||||
ControlIndex::ControlIndex(LyXView & lv, Dialogs & d)
|
||||
: ControlCommand(lv, d, LFUN_INDEX_INSERT)
|
||||
ControlIndex::ControlIndex(Dialog & d)
|
||||
: ControlCommand(d, LFUN_INDEX_APPLY)
|
||||
{}
|
||||
|
@ -20,7 +20,7 @@
|
||||
class ControlIndex : public ControlCommand {
|
||||
public:
|
||||
///
|
||||
ControlIndex(LyXView &, Dialogs &);
|
||||
ControlIndex(Dialog &);
|
||||
};
|
||||
|
||||
#endif // CONTROLINDEX_H
|
||||
|
@ -24,8 +24,8 @@ using std::vector;
|
||||
extern BufferList bufferlist;
|
||||
|
||||
|
||||
ControlRef::ControlRef(LyXView & lv, Dialogs & d)
|
||||
: ControlCommand(lv, d, LFUN_REF_INSERT)
|
||||
ControlRef::ControlRef(Dialog & d)
|
||||
: ControlCommand(d, LFUN_REF_APPLY)
|
||||
{}
|
||||
|
||||
|
||||
@ -33,21 +33,21 @@ vector<string> const ControlRef::getLabelList(string const & name) const
|
||||
{
|
||||
Buffer const * buf = bufferlist.getBuffer(MakeAbsPath(name));
|
||||
if (!buf)
|
||||
buf = buffer();
|
||||
buf = kernel().buffer();
|
||||
return buf->getLabelList();
|
||||
}
|
||||
|
||||
|
||||
void ControlRef::gotoRef(string const & ref)
|
||||
{
|
||||
lyxfunc().dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"), false);
|
||||
lyxfunc().dispatch(FuncRequest(LFUN_REF_GOTO, ref));
|
||||
kernel().dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"), false);
|
||||
kernel().dispatch(FuncRequest(LFUN_REF_GOTO, ref));
|
||||
}
|
||||
|
||||
|
||||
void ControlRef::gotoBookmark()
|
||||
{
|
||||
lyxfunc().dispatch(FuncRequest(LFUN_BOOKMARK_GOTO, "0"), false);
|
||||
kernel().dispatch(FuncRequest(LFUN_BOOKMARK_GOTO, "0"), false);
|
||||
}
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ vector<string> const ControlRef::getBufferList() const
|
||||
int ControlRef::getBufferNum() const
|
||||
{
|
||||
vector<string> buffers = bufferlist.getFileNames();
|
||||
string const name = buffer()->fileName();
|
||||
string const name = kernel().buffer()->fileName();
|
||||
vector<string>::const_iterator cit =
|
||||
find(buffers.begin(), buffers.end(), name);
|
||||
if (cit == buffers.end())
|
||||
|
@ -14,13 +14,15 @@
|
||||
|
||||
|
||||
#include "ControlCommand.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
/** A controller for the Ref Dialog.
|
||||
*/
|
||||
class ControlRef : public ControlCommand {
|
||||
public:
|
||||
///
|
||||
ControlRef(LyXView &, Dialogs &);
|
||||
ControlRef(Dialog &);
|
||||
///
|
||||
std::vector<string> const getLabelList(string const &) const;
|
||||
///
|
||||
@ -36,7 +38,7 @@ public:
|
||||
private:
|
||||
/** disconnect from the inset when the Apply button is pressed.
|
||||
Allows easy insertion of multiple references. */
|
||||
virtual bool disconnectOnApply() { return true; }
|
||||
virtual bool disconnectOnApply() const { return true; }
|
||||
};
|
||||
|
||||
#endif // CONTROLREF_H
|
||||
|
@ -10,10 +10,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "ControlToc.h"
|
||||
#include "toc.h"
|
||||
|
||||
#include "support/lstrings.h" // tostr
|
||||
|
||||
using std::vector;
|
||||
@ -21,20 +18,20 @@ using std::vector;
|
||||
class Buffer;
|
||||
|
||||
|
||||
ControlToc::ControlToc(LyXView & lv, Dialogs & d)
|
||||
: ControlCommand(lv, d, LFUN_TOC_INSERT)
|
||||
ControlToc::ControlToc(Dialog & d)
|
||||
: ControlCommand(d, LFUN_TOC_APPLY)
|
||||
{}
|
||||
|
||||
|
||||
void ControlToc::goTo(toc::TocItem const & item) const
|
||||
void ControlToc::goTo(toc::TocItem const & item)
|
||||
{
|
||||
item.goTo(lv_);
|
||||
item.goTo(kernel().lyxview());
|
||||
}
|
||||
|
||||
|
||||
vector<string> const ControlToc::getTypes() const
|
||||
{
|
||||
return toc::getTypes(buffer());
|
||||
return toc::getTypes(kernel().buffer());
|
||||
}
|
||||
|
||||
|
||||
@ -43,11 +40,11 @@ toc::Toc const ControlToc::getContents(string const & type) const
|
||||
toc::Toc empty_list;
|
||||
|
||||
// This shouldn't be possible...
|
||||
if (!bufferIsAvailable()) {
|
||||
if (!kernel().isBufferAvailable()) {
|
||||
return empty_list;
|
||||
}
|
||||
|
||||
toc::TocList tmp = toc::getTocList(buffer());
|
||||
toc::TocList tmp = toc::getTocList(kernel().buffer());
|
||||
toc::TocList::iterator it = tmp.find(type);
|
||||
if (it == tmp.end()) {
|
||||
return empty_list;
|
||||
|
@ -13,19 +13,19 @@
|
||||
#define CONTROLTOC_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include "ControlCommand.h"
|
||||
#include "toc.h"
|
||||
#include <vector>
|
||||
|
||||
/** A controller for TOC dialogs.
|
||||
*/
|
||||
class ControlToc : public ControlCommand {
|
||||
public:
|
||||
///
|
||||
ControlToc(LyXView &, Dialogs &);
|
||||
ControlToc(Dialog &);
|
||||
|
||||
/// Goto this paragraph id
|
||||
void goTo(toc::TocItem const &) const;
|
||||
void goTo(toc::TocItem const &);
|
||||
|
||||
/// Return the list of types available
|
||||
std::vector<string> const getTypes() const;
|
||||
|
@ -14,6 +14,6 @@
|
||||
#include "ControlUrl.h"
|
||||
|
||||
|
||||
ControlUrl::ControlUrl(LyXView & lv, Dialogs & d)
|
||||
: ControlCommand(lv, d, LFUN_INSERT_URL)
|
||||
ControlUrl::ControlUrl(Dialog & d)
|
||||
: ControlCommand(d, LFUN_URL_APPLY)
|
||||
{}
|
||||
|
@ -21,7 +21,7 @@ class ControlUrl : public ControlCommand
|
||||
{
|
||||
public:
|
||||
///
|
||||
ControlUrl(LyXView &, Dialogs &);
|
||||
ControlUrl(Dialog &);
|
||||
};
|
||||
|
||||
#endif // CONTROLURL_H
|
||||
|
165
src/frontends/controllers/Dialog.C
Normal file
165
src/frontends/controllers/Dialog.C
Normal file
@ -0,0 +1,165 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file Dialog.C
|
||||
* 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 "Dialog.h"
|
||||
|
||||
#include "ButtonControllerBase.h"
|
||||
#include "support/LAssert.h"
|
||||
|
||||
|
||||
Dialog::Dialog(LyXView & lv, string const & name)
|
||||
: is_closing_(false), kernel_(lv), name_(name)
|
||||
{}
|
||||
|
||||
|
||||
void Dialog::ApplyButton()
|
||||
{
|
||||
apply();
|
||||
bc().apply();
|
||||
}
|
||||
|
||||
|
||||
void Dialog::OKButton()
|
||||
{
|
||||
is_closing_ = true;
|
||||
apply();
|
||||
is_closing_ = false;
|
||||
hide();
|
||||
bc().ok();
|
||||
}
|
||||
|
||||
|
||||
void Dialog::CancelButton()
|
||||
{
|
||||
hide();
|
||||
bc().cancel();
|
||||
}
|
||||
|
||||
|
||||
void Dialog::RestoreButton()
|
||||
{
|
||||
// Tell the kernel that a request to refresh the dialog's contents
|
||||
// has been received. It's up to the kernel to supply the necessary
|
||||
// info by calling Dialog::update().
|
||||
kernel().updateDialog(name_);
|
||||
bc().restore();
|
||||
}
|
||||
|
||||
|
||||
void Dialog::show(string const & data)
|
||||
{
|
||||
if (controller().isBufferDependent() && !kernel().isBufferAvailable())
|
||||
return;
|
||||
|
||||
controller().initialiseParams(data);
|
||||
bc().readOnly(kernel().isBufferReadonly());
|
||||
view().show();
|
||||
|
||||
// The widgets may not be valid, so refresh the button controller
|
||||
bc().refresh();
|
||||
}
|
||||
|
||||
|
||||
void Dialog::update(string const & data)
|
||||
{
|
||||
if (controller().isBufferDependent() && !kernel().isBufferAvailable())
|
||||
return;
|
||||
|
||||
controller().initialiseParams(data);
|
||||
|
||||
bc().readOnly(kernel().isBufferReadonly());
|
||||
view().update();
|
||||
|
||||
// The widgets may not be valid, so refresh the button controller
|
||||
bc().refresh();
|
||||
}
|
||||
|
||||
|
||||
void Dialog::hide()
|
||||
{
|
||||
if (!view().isVisible())
|
||||
return;
|
||||
|
||||
controller().clearParams();
|
||||
view().hide();
|
||||
}
|
||||
|
||||
|
||||
void Dialog::apply()
|
||||
{
|
||||
if (kernel().isBufferReadonly())
|
||||
return;
|
||||
|
||||
view().apply();
|
||||
controller().dispatchParams();
|
||||
|
||||
if (controller().disconnectOnApply() && !is_closing_) {
|
||||
kernel().disconnect(name());
|
||||
controller().initialiseParams(string());
|
||||
view().update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Dialog::isVisible() const
|
||||
{
|
||||
return view().isVisible();
|
||||
}
|
||||
|
||||
|
||||
void Dialog::redraw()
|
||||
{
|
||||
view().redraw();
|
||||
}
|
||||
|
||||
|
||||
ButtonControllerBase & Dialog::bc() const
|
||||
{
|
||||
lyx::Assert(bc_ptr_.get());
|
||||
return *bc_ptr_.get();
|
||||
}
|
||||
|
||||
|
||||
Dialog::Controller & Dialog::controller() const
|
||||
{
|
||||
lyx::Assert(controller_ptr_.get());
|
||||
return *controller_ptr_.get();
|
||||
}
|
||||
|
||||
|
||||
Dialog::View & Dialog::view() const
|
||||
{
|
||||
lyx::Assert(view_ptr_.get());
|
||||
return *view_ptr_.get();
|
||||
}
|
||||
|
||||
|
||||
void Dialog::setButtonController(ButtonControllerBase * bc)
|
||||
{
|
||||
lyx::Assert(bc && !bc_ptr_.get());
|
||||
bc_ptr_.reset(bc);
|
||||
}
|
||||
|
||||
|
||||
void Dialog::setController(Controller * i)
|
||||
{
|
||||
lyx::Assert(i && !controller_ptr_.get());
|
||||
controller_ptr_.reset(i);
|
||||
}
|
||||
|
||||
|
||||
void Dialog::setView(View * v)
|
||||
{
|
||||
lyx::Assert(v && !view_ptr_.get());
|
||||
view_ptr_.reset(v);
|
||||
}
|
201
src/frontends/controllers/Dialog.h
Normal file
201
src/frontends/controllers/Dialog.h
Normal file
@ -0,0 +1,201 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file Dialog.h
|
||||
* 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
|
||||
*
|
||||
* The dialogs use a Model-Controller-View split, instantiated here
|
||||
* by class Dialog.
|
||||
*/
|
||||
|
||||
#ifndef DIALOG_H
|
||||
#define DIALOG_H
|
||||
|
||||
|
||||
#include "Kernel.h"
|
||||
#include "LString.h"
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
|
||||
class LyXView;
|
||||
class ButtonControllerBase;
|
||||
|
||||
|
||||
class Dialog : boost::noncopyable {
|
||||
public:
|
||||
/** the Dialog's "name" is the means with which a dialog identifies
|
||||
* itself to the kernel.
|
||||
*/
|
||||
Dialog(LyXView &, string const & name);
|
||||
|
||||
///
|
||||
string const & name() const { return name_; }
|
||||
|
||||
/** These methods are publicly accessible because they are invoked
|
||||
by the View.
|
||||
*/
|
||||
//@{
|
||||
///
|
||||
void ApplyButton();
|
||||
///
|
||||
void OKButton();
|
||||
///
|
||||
void CancelButton();
|
||||
///
|
||||
void RestoreButton();
|
||||
//@}
|
||||
|
||||
/** These methods are publicly accessible because they are invoked
|
||||
* by the Dialogs class.
|
||||
*/
|
||||
//@{
|
||||
/** Some dialogs, eg the Tabular or Preferences dialog, can extract
|
||||
the information they require from the kernel. These dialogs will
|
||||
probably be passed an empty string by the calling Dialogs class.
|
||||
The inset dialogs, however, require information specific to
|
||||
an individual inset. This information will be encoded in "data"
|
||||
and must be translated into a set of parameters that can be
|
||||
updated from the dialog.
|
||||
*/
|
||||
void show(string const & data = string());
|
||||
///
|
||||
void update(string const & data = string());
|
||||
///
|
||||
void hide();
|
||||
///
|
||||
bool isVisible() const;
|
||||
/// (Eg, the GUI colours have been changed.)
|
||||
void redraw();
|
||||
//@}
|
||||
|
||||
/** When Applying it's useful to know whether the dialog is about
|
||||
* to close or not (no point refreshing the display for example).
|
||||
*/
|
||||
bool isClosing() const { return is_closing_; }
|
||||
|
||||
/// The LyX kernel is made available through this.
|
||||
Kernel & kernel() { return kernel_; }
|
||||
|
||||
/** Different dialogs will have different
|
||||
Controllers, Views and ButtonControllers.
|
||||
*/
|
||||
//@{
|
||||
///
|
||||
class Controller;
|
||||
///
|
||||
class View;
|
||||
|
||||
///
|
||||
void setController(Controller *);
|
||||
///
|
||||
void setView(View *);
|
||||
///
|
||||
void setButtonController(ButtonControllerBase *);
|
||||
|
||||
///
|
||||
Controller & controller() const;
|
||||
///
|
||||
ButtonControllerBase & bc() const;
|
||||
private:
|
||||
///
|
||||
View & view() const;
|
||||
//@}
|
||||
|
||||
///
|
||||
void apply();
|
||||
|
||||
///
|
||||
bool is_closing_;
|
||||
///
|
||||
Kernel kernel_;
|
||||
///
|
||||
string name_;
|
||||
///
|
||||
boost::scoped_ptr<ButtonControllerBase> bc_ptr_;
|
||||
///
|
||||
boost::scoped_ptr<Controller> controller_ptr_;
|
||||
///
|
||||
boost::scoped_ptr<View> view_ptr_;
|
||||
};
|
||||
|
||||
|
||||
class Dialog::Controller : boost::noncopyable {
|
||||
public:
|
||||
///
|
||||
Controller(Dialog & parent) : parent_(parent) {}
|
||||
///
|
||||
virtual ~Controller() {}
|
||||
///
|
||||
virtual void initialiseParams(string const & data) = 0;
|
||||
///
|
||||
virtual void clearParams() = 0;
|
||||
///
|
||||
virtual void dispatchParams() = 0;
|
||||
///
|
||||
virtual bool isBufferDependent() const = 0;
|
||||
///
|
||||
virtual bool disconnectOnApply() const { return false; }
|
||||
///
|
||||
Kernel & kernel() { return parent_.kernel(); }
|
||||
///
|
||||
Kernel const & kernel() const { return parent_.kernel(); }
|
||||
|
||||
private:
|
||||
///
|
||||
Dialog & parent_;
|
||||
};
|
||||
|
||||
|
||||
class Dialog::View : boost::noncopyable {
|
||||
public:
|
||||
///
|
||||
View(Dialog & parent) : p_(parent) {}
|
||||
///
|
||||
virtual ~View() {}
|
||||
|
||||
/// Apply changes to LyX data from dialog.
|
||||
virtual void apply() = 0;
|
||||
/// Hide the dialog.
|
||||
virtual void hide() = 0;
|
||||
/// Redraw the dialog (e.g. if the colors have been remapped).
|
||||
virtual void redraw() {}
|
||||
/// Create the dialog if necessary, update it and display it.
|
||||
virtual void show() = 0;
|
||||
/// Update dialog before/whilst showing it.
|
||||
virtual void update() = 0;
|
||||
///
|
||||
virtual bool isVisible() const = 0;
|
||||
|
||||
/** Defaults to nothing. Can be used by the controller, however, to
|
||||
* indicate to the view that something has changed and that the
|
||||
* dialog therefore needs updating.
|
||||
*/
|
||||
virtual void partialUpdate(int) {}
|
||||
|
||||
///
|
||||
Dialog & dialog() { return p_; }
|
||||
///
|
||||
Dialog const & dialog() const { return p_; }
|
||||
|
||||
///
|
||||
Kernel & kernel() { return p_.kernel(); }
|
||||
///
|
||||
Kernel const & kernel() const { return p_.kernel(); }
|
||||
|
||||
///
|
||||
Controller & getController() { return p_.controller(); }
|
||||
///
|
||||
Controller const & getController() const { return p_.controller(); }
|
||||
|
||||
protected:
|
||||
///
|
||||
Dialog & p_;
|
||||
};
|
||||
|
||||
|
||||
#endif // DIALOG_H
|
84
src/frontends/controllers/Kernel.C
Normal file
84
src/frontends/controllers/Kernel.C
Normal file
@ -0,0 +1,84 @@
|
||||
#include "Kernel.h"
|
||||
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "funcrequest.h"
|
||||
#include "lyxfunc.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "frontends/LyXView.h"
|
||||
|
||||
Kernel::Kernel(LyXView & lyxview)
|
||||
: lyxview_(lyxview)
|
||||
{}
|
||||
|
||||
|
||||
void Kernel::dispatch(FuncRequest const & fr, bool verbose) const
|
||||
{
|
||||
lyxview_.getLyXFunc().dispatch(fr, verbose);
|
||||
}
|
||||
|
||||
|
||||
void Kernel::updateDialog(string const & name) const
|
||||
{
|
||||
dispatch(FuncRequest(LFUN_DIALOG_UPDATE, name));
|
||||
}
|
||||
|
||||
|
||||
void Kernel::disconnect(string const & name) const
|
||||
{
|
||||
lyxview_.getDialogs().disconnect(name);
|
||||
}
|
||||
|
||||
bool Kernel::isBufferAvailable() const
|
||||
{
|
||||
if (!lyxview_.view().get())
|
||||
return false;
|
||||
return lyxview_.view()->available();
|
||||
}
|
||||
|
||||
|
||||
bool Kernel::isBufferReadonly() const
|
||||
{
|
||||
if (!lyxview_.buffer())
|
||||
return true;
|
||||
return lyxview_.buffer()->isReadonly();
|
||||
}
|
||||
|
||||
|
||||
Kernel::DocTypes Kernel::docType() const
|
||||
{
|
||||
if (!buffer())
|
||||
return LATEX;
|
||||
|
||||
if (buffer()->isLatex())
|
||||
return LATEX;
|
||||
if (buffer()->isLiterate())
|
||||
return LITERATE;
|
||||
if (buffer()->isLinuxDoc())
|
||||
return LINUXDOC;
|
||||
|
||||
return DOCBOOK;
|
||||
}
|
||||
|
||||
BufferView * Kernel::bufferview()
|
||||
{
|
||||
return lyxview_.view().get();
|
||||
}
|
||||
|
||||
|
||||
BufferView const * Kernel::bufferview() const
|
||||
{
|
||||
return lyxview_.view().get();
|
||||
}
|
||||
|
||||
|
||||
Buffer * Kernel::buffer()
|
||||
{
|
||||
return lyxview_.buffer();
|
||||
}
|
||||
|
||||
|
||||
Buffer const * Kernel::buffer() const
|
||||
{
|
||||
return lyxview_.buffer();
|
||||
}
|
65
src/frontends/controllers/Kernel.h
Normal file
65
src/frontends/controllers/Kernel.h
Normal file
@ -0,0 +1,65 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
#ifndef KERNEL_H
|
||||
#define KERNEL_H
|
||||
|
||||
|
||||
#include "LString.h"
|
||||
|
||||
|
||||
class Buffer;
|
||||
class BufferView;
|
||||
class FuncRequest;
|
||||
class LyXView;
|
||||
|
||||
|
||||
class Kernel {
|
||||
public:
|
||||
///
|
||||
enum DocTypes {
|
||||
///
|
||||
LATEX,
|
||||
///
|
||||
LITERATE,
|
||||
///
|
||||
LINUXDOC,
|
||||
///
|
||||
DOCBOOK
|
||||
};
|
||||
|
||||
///
|
||||
Kernel(LyXView &);
|
||||
///
|
||||
void dispatch(FuncRequest const &, bool verbose = false) const;
|
||||
/** The Dialog has received a request from the user to update
|
||||
its contents. It must, therefore, ask the kernel to provide
|
||||
this information to Dialog 'name'.
|
||||
*/
|
||||
void updateDialog(string const & name) const;
|
||||
///
|
||||
void disconnect(string const & name) const;
|
||||
///
|
||||
bool isBufferAvailable() const;
|
||||
///
|
||||
bool isBufferReadonly() const;
|
||||
///
|
||||
DocTypes docType() const;
|
||||
///
|
||||
LyXView & lyxview() { return lyxview_; }
|
||||
///
|
||||
LyXView const & lyxview() const { return lyxview_; }
|
||||
///
|
||||
Buffer * buffer();
|
||||
///
|
||||
Buffer const * buffer() const;
|
||||
///
|
||||
BufferView * bufferview();
|
||||
///
|
||||
BufferView const * bufferview() const;
|
||||
|
||||
private:
|
||||
LyXView & lyxview_;
|
||||
};
|
||||
|
||||
|
||||
#endif // KERNEL_H
|
@ -8,6 +8,10 @@ INCLUDES = -I$(top_srcdir)/src \
|
||||
EXTRA_DIST = ButtonController.tmpl ControlDialog.tmpl ControlInset.tmpl
|
||||
|
||||
libcontrollers_la_SOURCES= \
|
||||
Dialog.C \
|
||||
Dialog.h \
|
||||
Kernel.C \
|
||||
Kernel.h \
|
||||
biblio.C \
|
||||
biblio.h \
|
||||
character.C \
|
||||
|
@ -12,52 +12,32 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "Dialogs_impl.h"
|
||||
|
||||
Dialogs::Dialogs(LyXView & lv)
|
||||
: pimpl_(new Impl(lv, *this))
|
||||
|
||||
void Dialogs::init_pimpl()
|
||||
{
|
||||
// reduce the number of connections needed in
|
||||
// dialogs by a simple connection here.
|
||||
hideAll.connect(hideBufferDependent);
|
||||
pimpl_ = new Impl(lyxview_, *this);
|
||||
}
|
||||
|
||||
|
||||
Dialogs::~Dialogs()
|
||||
{}
|
||||
|
||||
|
||||
void Dialogs::toggleTooltips()
|
||||
{
|
||||
Tooltips::toggleEnabled();
|
||||
}
|
||||
|
||||
|
||||
/// Are the tooltips on or off?
|
||||
bool Dialogs::tooltipsEnabled()
|
||||
{
|
||||
return Tooltips::enabled();
|
||||
delete pimpl_;
|
||||
}
|
||||
|
||||
|
||||
Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
: aboutlyx(lv, d),
|
||||
bibitem(lv, d),
|
||||
bibtex(lv, d),
|
||||
character(lv, d),
|
||||
changes(lv, d),
|
||||
citation(lv, d),
|
||||
document(lv, d),
|
||||
error(lv, d),
|
||||
ert(lv, d),
|
||||
external(lv, d),
|
||||
file(lv, d),
|
||||
floats(lv, d),
|
||||
forks(lv, d),
|
||||
graphics(lv, d),
|
||||
include(lv, d),
|
||||
index(lv, d),
|
||||
logfile(lv, d),
|
||||
mathpanel(lv, d),
|
||||
minipage(lv, d),
|
||||
@ -65,7 +45,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
preamble(lv, d),
|
||||
preferences(lv, d),
|
||||
print(lv, d),
|
||||
ref(lv, d),
|
||||
search(lv, d),
|
||||
sendto(lv, d),
|
||||
spellchecker(lv, d),
|
||||
@ -76,8 +55,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
thesaurus(lv, d),
|
||||
#endif
|
||||
|
||||
toc(lv, d),
|
||||
url(lv, d),
|
||||
vclogfile(lv, d),
|
||||
wrap(lv, d)
|
||||
{}
|
||||
|
@ -21,18 +21,6 @@ void Dialogs::showAboutlyx()
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showBibitem(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->bibitem.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showBibtex(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->bibtex.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showCharacter()
|
||||
{
|
||||
pimpl_->character.controller().show();
|
||||
@ -45,42 +33,12 @@ void Dialogs::setUserFreeFont()
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showCitation(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->citation.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createCitation(string const & s)
|
||||
{
|
||||
pimpl_->citation.controller().createInset(s);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showDocument()
|
||||
{
|
||||
pimpl_->document.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showError(InsetError * ie)
|
||||
{
|
||||
pimpl_->error.controller().showInset(ie);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showERT(InsetERT * ie)
|
||||
{
|
||||
pimpl_->ert.controller().showInset(ie);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::updateERT(InsetERT * ie)
|
||||
{
|
||||
pimpl_->ert.controller().showInset(ie);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showExternal(InsetExternal * ie)
|
||||
{
|
||||
pimpl_->external.controller().showInset(ie);
|
||||
@ -117,18 +75,6 @@ void Dialogs::showInclude(InsetInclude * ii)
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showIndex(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->index.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createIndex()
|
||||
{
|
||||
pimpl_->index.controller().createInset(string());
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showLogFile()
|
||||
{
|
||||
pimpl_->logfile.controller().show();
|
||||
@ -187,18 +133,6 @@ void Dialogs::showPrint()
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showRef(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->ref.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createRef(string const & s)
|
||||
{
|
||||
pimpl_->ref.controller().createInset(s);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showSearch()
|
||||
{
|
||||
pimpl_->search.controller().show();
|
||||
@ -256,30 +190,6 @@ void Dialogs::showThesaurus(string const &)
|
||||
#endif
|
||||
|
||||
|
||||
void Dialogs::showTOC(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->toc.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createTOC(string const & s)
|
||||
{
|
||||
pimpl_->toc.controller().createInset(s);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showUrl(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->url.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createUrl(string const & s)
|
||||
{
|
||||
pimpl_->url.controller().createInset(s);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showVCLogFile()
|
||||
{
|
||||
pimpl_->vclogfile.controller().show();
|
||||
|
150
src/frontends/gnome/Dialogs3.C
Normal file
150
src/frontends/gnome/Dialogs3.C
Normal file
@ -0,0 +1,150 @@
|
||||
/**
|
||||
* \file qt2/Dialogs3.C
|
||||
* 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 "Dialog.h"
|
||||
|
||||
#include "ControlBibitem.h"
|
||||
#include "ControlBibtex.h"
|
||||
#include "ControlCitation.h"
|
||||
#include "ControlError.h"
|
||||
#include "ControlERT.h"
|
||||
#include "ControlIndex.h"
|
||||
#include "ControlRef.h"
|
||||
#include "ControlToc.h"
|
||||
#include "ControlUrl.h"
|
||||
|
||||
#include "FormBibitem.h"
|
||||
#include "forms/form_bibitem.h"
|
||||
|
||||
#include "FormBibtex.h"
|
||||
#include "forms/form_bibtex.h"
|
||||
|
||||
#include "FormCitation.h"
|
||||
#include "forms/form_citation.h"
|
||||
|
||||
#include "GError.h"
|
||||
#include "GERT.h"
|
||||
|
||||
#include "FormIndex.h"
|
||||
#include "forms/form_index.h"
|
||||
|
||||
#include "FormRef.h"
|
||||
#include "forms/form_ref.h"
|
||||
|
||||
#include "FormToc.h"
|
||||
#include "forms/form_toc.h"
|
||||
|
||||
#include "GUrl.h"
|
||||
|
||||
#include "gnomeBC.h"
|
||||
#include "ButtonController.h"
|
||||
|
||||
|
||||
typedef ButtonController<OkCancelPolicy, gnomeBC>
|
||||
OkCancelBC;
|
||||
|
||||
typedef ButtonController<OkCancelReadOnlyPolicy, gnomeBC>
|
||||
OkCancelReadOnlyBC;
|
||||
|
||||
typedef ButtonController<NoRepeatedApplyReadOnlyPolicy, gnomeBC>
|
||||
NoRepeatedApplyReadOnlyBC;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
char const * const dialognames[] = { "bibitem", "bibtex", "citation",
|
||||
"error", "ert", "index", "ref",
|
||||
"toc", "url" };
|
||||
|
||||
char const * const * const end_dialognames =
|
||||
dialognames + (sizeof(dialognames) / sizeof(char *));
|
||||
|
||||
struct cmpCStr {
|
||||
cmpCStr(char const * name) : name_(name) {}
|
||||
bool operator()(char const * other) {
|
||||
return strcmp(other, name_) == 0;
|
||||
}
|
||||
private:
|
||||
char const * name_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
bool Dialogs::isValidName(string const & name) const
|
||||
{
|
||||
return std::find_if(dialognames, end_dialognames,
|
||||
cmpCStr(name.c_str())) != end_dialognames;
|
||||
}
|
||||
|
||||
|
||||
Dialog * Dialogs::build(string const & name)
|
||||
{
|
||||
if (!isValidName(name))
|
||||
return 0;
|
||||
|
||||
Dialog * dialog = new Dialog(lyxview_, name);
|
||||
|
||||
if (name == "bibitem") {
|
||||
dialog->setController(new ControlBibitem(*dialog));
|
||||
dialog->setView(new FormBibitem(*dialog));
|
||||
dialog->setButtonController(new OkCancelReadOnlyBC);
|
||||
} else if (name == "bibtex") {
|
||||
dialog->setController(new ControlBibtex(*dialog));
|
||||
dialog->setView(new FormBibtex(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "citation") {
|
||||
dialog->setController(new ControlCitation(*dialog));
|
||||
dialog->setView(new FormCitation(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "error") {
|
||||
dialog->setController(new ControlError(*dialog));
|
||||
dialog->setView(new GError(*dialog));
|
||||
dialog->setButtonController(new OkCancelBC);
|
||||
} else if (name == "ert") {
|
||||
dialog->setController(new ControlERT(*dialog));
|
||||
dialog->setView(new GERT(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "index") {
|
||||
dialog->setController(new ControlIndex(*dialog));
|
||||
dialog->setView(new FormIndex(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "ref") {
|
||||
dialog->setController(new ControlRef(*dialog));
|
||||
dialog->setView(new FormRef(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "toc") {
|
||||
dialog->setController(new ControlToc(*dialog));
|
||||
dialog->setView(new FormToc(*dialog));
|
||||
dialog->setButtonController(new OkCancelBC);
|
||||
} else if (name == "url") {
|
||||
dialog->setController(new ControlUrl(*dialog));
|
||||
dialog->setView(new GURL(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
}
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::toggleTooltips()
|
||||
{
|
||||
Tooltips::toggleEnabled();
|
||||
}
|
||||
|
||||
|
||||
bool Dialogs::tooltipsEnabled()
|
||||
{
|
||||
return Tooltips::enabled();
|
||||
}
|
@ -22,14 +22,6 @@
|
||||
#include "ControlAboutlyx.h"
|
||||
#include "GAbout.h"
|
||||
|
||||
#include "ControlBibitem.h"
|
||||
#include "FormBibitem.h"
|
||||
#include "forms/form_bibitem.h"
|
||||
|
||||
#include "ControlBibtex.h"
|
||||
#include "FormBibtex.h"
|
||||
#include "forms/form_bibtex.h"
|
||||
|
||||
#include "FormBrowser.h"
|
||||
#include "forms/form_browser.h"
|
||||
|
||||
@ -37,10 +29,6 @@
|
||||
#include "FormCharacter.h"
|
||||
#include "forms/form_character.h"
|
||||
|
||||
#include "ControlCitation.h"
|
||||
#include "FormCitation.h"
|
||||
#include "forms/form_citation.h"
|
||||
|
||||
#include "ControlChanges.h"
|
||||
#include "GChanges.h"
|
||||
|
||||
@ -157,31 +145,16 @@
|
||||
typedef GUI<ControlAboutlyx, GAbout, OkCancelPolicy, gnomeBC>
|
||||
AboutlyxDialog;
|
||||
|
||||
typedef GUI<ControlBibitem, FormBibitem, OkCancelReadOnlyPolicy, xformsBC>
|
||||
BibitemDialog;
|
||||
|
||||
typedef GUI<ControlBibtex, FormBibtex, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
BibtexDialog;
|
||||
|
||||
typedef GUI<ControlCharacter, FormCharacter, OkApplyCancelReadOnlyPolicy, xformsBC>
|
||||
CharacterDialog;
|
||||
|
||||
typedef GUI<ControlChanges, GChanges, NoRepeatedApplyReadOnlyPolicy, gnomeBC>
|
||||
ChangesDialog;
|
||||
|
||||
typedef GUI<ControlCitation, FormCitation, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
CitationDialog;
|
||||
|
||||
typedef GUI<ControlDocument, FormDocument, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
DocumentDialog;
|
||||
|
||||
typedef GUI<ControlError, GErrorDialog, OkCancelPolicy, gnomeBC>
|
||||
ErrorDialog;
|
||||
|
||||
typedef GUI<ControlERT, GERT, NoRepeatedApplyReadOnlyPolicy, gnomeBC>
|
||||
ERTDialog;
|
||||
|
||||
typedef GUI<ControlExternal, FormExternal, OkApplyCancelReadOnlyPolicy, xformsBC>
|
||||
ypedef GUI<ControlExternal, FormExternal, OkApplyCancelReadOnlyPolicy, xformsBC>
|
||||
ExternalDialog;
|
||||
|
||||
typedef GUI<ControlShowFile, FormShowFile, OkCancelPolicy, xformsBC>
|
||||
@ -199,9 +172,6 @@ GraphicsDialog;
|
||||
typedef GUI<ControlInclude, FormInclude, OkCancelReadOnlyPolicy, xformsBC>
|
||||
IncludeDialog;
|
||||
|
||||
typedef GUI<ControlIndex, FormIndex, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
IndexDialog;
|
||||
|
||||
typedef GUI<ControlLog, GLog, OkCancelPolicy, gnomeBC>
|
||||
LogFileDialog;
|
||||
|
||||
@ -223,9 +193,6 @@ PreferencesDialog;
|
||||
typedef GUI<ControlPrint, FormPrint, OkApplyCancelPolicy, xformsBC>
|
||||
PrintDialog;
|
||||
|
||||
typedef GUI<ControlRef, FormRef, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
RefDialog;
|
||||
|
||||
typedef GUI<ControlSearch, FormSearch, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
SearchDialog;
|
||||
|
||||
@ -249,12 +216,6 @@ typedef GUI<ControlThesaurus, FormThesaurus, OkApplyCancelReadOnlyPolicy, xforms
|
||||
ThesaurusDialog;
|
||||
#endif
|
||||
|
||||
typedef GUI<ControlToc, FormToc, OkCancelPolicy, xformsBC>
|
||||
TocDialog;
|
||||
|
||||
typedef GUI<ControlUrl, GUrl, NoRepeatedApplyReadOnlyPolicy, gnomeBC>
|
||||
UrlDialog;
|
||||
|
||||
typedef GUI<ControlVCLog, FormVCLog, OkCancelPolicy, xformsBC>
|
||||
VCLogFileDialog;
|
||||
|
||||
@ -265,21 +226,15 @@ struct Dialogs::Impl {
|
||||
Impl(LyXView & lv, Dialogs & d);
|
||||
|
||||
AboutlyxDialog aboutlyx;
|
||||
BibitemDialog bibitem;
|
||||
BibtexDialog bibtex;
|
||||
CharacterDialog character;
|
||||
ChangesDialog changes;
|
||||
CitationDialog citation;
|
||||
DocumentDialog document;
|
||||
ErrorDialog error;
|
||||
ERTDialog ert;
|
||||
ExternalDialog external;
|
||||
FileDialog file;
|
||||
FloatDialog floats;
|
||||
ForksDialog forks;
|
||||
GraphicsDialog graphics;
|
||||
IncludeDialog include;
|
||||
IndexDialog index;
|
||||
LogFileDialog logfile;
|
||||
MathPanelDialog mathpanel;
|
||||
MinipageDialog minipage;
|
||||
@ -287,7 +242,6 @@ struct Dialogs::Impl {
|
||||
PreambleDialog preamble;
|
||||
PreferencesDialog preferences;
|
||||
PrintDialog print;
|
||||
RefDialog ref;
|
||||
SearchDialog search;
|
||||
SendtoDialog sendto;
|
||||
SpellcheckerDialog spellchecker;
|
||||
@ -299,8 +253,6 @@ struct Dialogs::Impl {
|
||||
ThesaurusDialog thesaurus;
|
||||
#endif
|
||||
|
||||
TocDialog toc;
|
||||
UrlDialog url;
|
||||
VCLogFileDialog vclogfile;
|
||||
WrapDialog wrap;
|
||||
};
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <gtkmm/textview.h>
|
||||
|
||||
GErrorDialog::GErrorDialog()
|
||||
: GnomeCB<ControlError>("GError")
|
||||
: GControlledView<ControlError>("GError")
|
||||
{}
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
|
||||
#include "ControlError.h"
|
||||
#include "GnomeBase.h"
|
||||
#include "GView.h"
|
||||
|
||||
namespace Gtk {
|
||||
|
||||
@ -27,7 +27,7 @@ class TextView;
|
||||
/**
|
||||
* This class implements the dialog to show error messages.
|
||||
*/
|
||||
class GErrorDialog : public GnomeCB<ControlError> {
|
||||
class GErrorDialog : public GControlledView<ControlError> {
|
||||
public:
|
||||
///
|
||||
GErrorDialog();
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <gtkmm/button.h>
|
||||
|
||||
GUrl::GUrl()
|
||||
: GnomeCB<ControlUrl>("GUrl")
|
||||
: GControlledView<ControlUrl>("GUrl")
|
||||
{}
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
|
||||
#include "ControlUrl.h"
|
||||
#include "GnomeBase.h"
|
||||
#include "GView.h"
|
||||
|
||||
namespace Gtk {
|
||||
class Button;
|
||||
@ -26,7 +26,7 @@ class Entry;
|
||||
/**
|
||||
* This class implements the dialog to insert/modify urls.
|
||||
*/
|
||||
class GUrl : public GnomeCB<ControlUrl> {
|
||||
class GUrl : public GControlledView<ControlUrl> {
|
||||
public:
|
||||
///
|
||||
GUrl();
|
||||
|
118
src/frontends/gnome/GView.C
Normal file
118
src/frontends/gnome/GView.C
Normal file
@ -0,0 +1,118 @@
|
||||
/**
|
||||
* \file GView.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Baruch Even
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include "GView.h"
|
||||
#include "support/LAssert.h"
|
||||
#include "debug.h"
|
||||
#include "support/filetools.h"
|
||||
#include "ControlButtons.h"
|
||||
#include <glib.h>
|
||||
#include <gtkmm/dialog.h>
|
||||
|
||||
GView::GView(string const & name)
|
||||
: ViewBase(),
|
||||
updating_(false),
|
||||
file_(name + ".glade"),
|
||||
title_(name),
|
||||
widget_name_(name),
|
||||
xml_(0),
|
||||
dialog_(0)
|
||||
{
|
||||
loadXML();
|
||||
}
|
||||
|
||||
GView::~GView()
|
||||
{}
|
||||
|
||||
gnomeBC & GView::bc()
|
||||
{
|
||||
return static_cast<gnomeBC &>(getController().bc());
|
||||
}
|
||||
|
||||
void GView::loadXML()
|
||||
{
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Change this before declaring it production code! (be 20010325)
|
||||
#endif
|
||||
string const path("src/frontends/gnome/dialogs/;frontends/gnome/dialogs/;");
|
||||
|
||||
string const file = FileOpenSearch(path, file_, "glade");
|
||||
|
||||
if (file.empty()) {
|
||||
lyxerr << "Cannot find glade file. Aborting." << std::endl;
|
||||
lyx::Assert(true);
|
||||
}
|
||||
|
||||
lyxerr[Debug::GUI] << "Glade file to open is " << file << '\n';
|
||||
|
||||
xml_ = Gnome::Glade::Xml::create (file, widget_name_);
|
||||
}
|
||||
|
||||
|
||||
void GView::show()
|
||||
{
|
||||
update();
|
||||
dialog()->show();
|
||||
}
|
||||
|
||||
|
||||
void GView::hide()
|
||||
{
|
||||
dialog()->hide();
|
||||
}
|
||||
|
||||
bool GView::isValid()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void GView::OKClicked()
|
||||
{
|
||||
lyxerr[Debug::GUI] << "GView::OKClicked()\n";
|
||||
getController().OKButton();
|
||||
}
|
||||
|
||||
void GView::CancelClicked()
|
||||
{
|
||||
lyxerr[Debug::GUI] << "GView::CancelClicked()\n";
|
||||
getController().CancelButton();
|
||||
}
|
||||
|
||||
void GView::ApplyClicked()
|
||||
{
|
||||
lyxerr[Debug::GUI] << "GView::ApplyClicked()\n";
|
||||
getController().ApplyButton();
|
||||
}
|
||||
|
||||
void GView::RestoreClicked()
|
||||
{
|
||||
lyxerr[Debug::GUI] << "GView::RestoreClicked()\n";
|
||||
getController().RestoreButton();
|
||||
}
|
||||
|
||||
void GView::InputChanged()
|
||||
{
|
||||
bc().valid(isValid());
|
||||
}
|
||||
|
||||
Gtk::Dialog * GView::dialog()
|
||||
{
|
||||
if (!dialog_)
|
||||
dialog_ = getWidget<Gtk::Dialog>(widget_name_);
|
||||
|
||||
return dialog_;
|
||||
}
|
||||
|
||||
bool GView::isVisible() const
|
||||
{
|
||||
return dialog_ && dialog_->is_visible();
|
||||
}
|
131
src/frontends/gnome/GView.h
Normal file
131
src/frontends/gnome/GView.h
Normal file
@ -0,0 +1,131 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GView.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Baruch Even
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
#ifndef GView_H
|
||||
#define GView_H
|
||||
|
||||
|
||||
#include "gnome_helpers.h"
|
||||
|
||||
#include <sigc++/sigc++.h>
|
||||
#include <libglademm/xml.h>
|
||||
|
||||
#include "ViewBase.h"
|
||||
#include "gnomeBC.h"
|
||||
|
||||
namespace Gtk {
|
||||
class Dialog;
|
||||
};
|
||||
|
||||
/**
|
||||
* This is a base class for Gnome dialogs. It handles all the common
|
||||
* work that is needed for all dialogs.
|
||||
*/
|
||||
class GView : public ViewBase, public SigC::Object {
|
||||
public:
|
||||
///
|
||||
GView(string const & name);
|
||||
///
|
||||
virtual ~GView();
|
||||
|
||||
protected:
|
||||
/// Get the widget named 'name' from the xml representation.
|
||||
template <class T>
|
||||
T* getWidget(const string & name) const;
|
||||
|
||||
/// Get the dialog we use.
|
||||
Gtk::Dialog * dialog();
|
||||
|
||||
/// Show the dialog.
|
||||
void show();
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
/// Build the dialog. Also connects signals and prepares it for work.
|
||||
virtual void build() = 0;
|
||||
/// Dialog is valid
|
||||
virtual bool isValid();
|
||||
/// dialog is visible
|
||||
virtual bool isVisible() const;
|
||||
/// Default OK behaviour
|
||||
virtual void OKClicked();
|
||||
/// Default Cancel behaviour
|
||||
virtual void CancelClicked();
|
||||
/// Default Restore behaviour
|
||||
virtual void RestoreClicked();
|
||||
/// Default apply behaviour
|
||||
virtual void ApplyClicked();
|
||||
/// Default changed input behaviour
|
||||
virtual void InputChanged();
|
||||
|
||||
///
|
||||
gnomeBC & bc();
|
||||
|
||||
/// are we updating ?
|
||||
bool updating_;
|
||||
private:
|
||||
/// Loads the glade file to memory.
|
||||
void loadXML();
|
||||
|
||||
/// The glade file name
|
||||
const string file_;
|
||||
/// The widget name
|
||||
const string widget_name_;
|
||||
/// The XML representation of the dialogs.
|
||||
Glib::RefPtr<Gnome::Glade::Xml> xml_;
|
||||
|
||||
/** The dialog we work with, since it is managed by libglade, we do not
|
||||
* need to delete it or destroy it, it will be destroyed with the rest
|
||||
* of the libglade GladeXML structure.
|
||||
*/
|
||||
Gtk::Dialog * dialog_;
|
||||
|
||||
/// dialog title, displayed by WM.
|
||||
string title_;
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
T* GView::getWidget(const string & name) const
|
||||
{
|
||||
return dynamic_cast<T*>(xml_->get_widget(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* This class is used to provide a simple automatic casting of the controller.
|
||||
* We chose not to make GView a template since it has some size and we
|
||||
* have no reason to duplicate it by making it a template.
|
||||
*
|
||||
* Basically the GControlledView<Controller> template instantiates GView and
|
||||
* passes the parameters to it and it also adds the controller() method to
|
||||
* give us a reference to the controller of the correct type (the type is
|
||||
* set by the template parameter).
|
||||
*/
|
||||
template <class Controller>
|
||||
class GControlledView : public GView {
|
||||
public:
|
||||
GControlledView(string const & name);
|
||||
protected:
|
||||
Controller & controller();
|
||||
};
|
||||
|
||||
template <class Controller>
|
||||
GControlledView<Controller>::GControlledView(string const & name)
|
||||
: GView(name)
|
||||
{}
|
||||
|
||||
template <class Controller>
|
||||
Controller &
|
||||
GControlledView<Controller>::controller()
|
||||
{
|
||||
return static_cast<Controller &>(getController());
|
||||
}
|
||||
|
||||
#endif
|
@ -23,6 +23,7 @@ xforms_objects = \
|
||||
../xforms/FontInfo.lo \
|
||||
../xforms/FormAboutlyx.lo \
|
||||
../xforms/FormBase.lo \
|
||||
../xforms/FormDialogView.lo \
|
||||
../xforms/FormBibitem.lo \
|
||||
../xforms/FormBibtex.lo \
|
||||
../xforms/FormBrowser.lo \
|
||||
@ -149,6 +150,8 @@ libgnome_la_SOURCES = \
|
||||
gnome_helpers.h \
|
||||
GnomeBase.C \
|
||||
GnomeBase.h \
|
||||
GView.C \
|
||||
GView.h \
|
||||
gnomeBC.C \
|
||||
gnomeBC.h \
|
||||
lyx_gui.C \
|
||||
|
@ -11,30 +11,22 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "guiapi.h"
|
||||
#include "Dialogs.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
void gui_show_dialog(Dialogs * d, char const * name, char const * data)
|
||||
{
|
||||
d->show(name, data, 0);
|
||||
}
|
||||
|
||||
void gui_ShowAboutlyx(Dialogs & d)
|
||||
{
|
||||
d.showAboutlyx();
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowBibitem(InsetCommand * ic, Dialogs & d)
|
||||
{
|
||||
d.showBibitem(ic);
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowBibtex(InsetCommand * ic, Dialogs & d)
|
||||
{
|
||||
d.showBibtex(ic);
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowCharacter(Dialogs & d)
|
||||
{
|
||||
d.showCharacter();
|
||||
@ -47,42 +39,12 @@ void gui_SetUserFreeFont(Dialogs & d)
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowCitation(InsetCommand * ic, Dialogs & d)
|
||||
{
|
||||
d.showCitation(ic);
|
||||
}
|
||||
|
||||
|
||||
void gui_CreateCitation(string const & s, Dialogs & d)
|
||||
{
|
||||
d.createCitation(s);
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowDocument(Dialogs & d)
|
||||
{
|
||||
d.showDocument();
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowError(InsetError * ie, Dialogs & d)
|
||||
{
|
||||
d.showError(ie);
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowERT(InsetERT * ie, Dialogs & d)
|
||||
{
|
||||
d.showERT(ie);
|
||||
}
|
||||
|
||||
|
||||
void gui_UpdateERT(InsetERT * ie, Dialogs & d)
|
||||
{
|
||||
d.updateERT(ie);
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowExternal(InsetExternal * ie, Dialogs & d)
|
||||
{
|
||||
d.showExternal(ie);
|
||||
@ -100,6 +62,7 @@ void gui_ShowFloat(InsetFloat * ifl, Dialogs & d)
|
||||
d.showFloat(ifl);
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowWrap(InsetWrap * iw, Dialogs & d)
|
||||
{
|
||||
d.showWrap(iw);
|
||||
@ -123,18 +86,6 @@ void gui_ShowInclude(InsetInclude * ii, Dialogs & d)
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowIndex(InsetCommand * ic, Dialogs & d)
|
||||
{
|
||||
d.showIndex(ic);
|
||||
}
|
||||
|
||||
|
||||
void gui_CreateIndex(Dialogs & d)
|
||||
{
|
||||
d.createIndex();
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowLogFile(Dialogs & d)
|
||||
{
|
||||
d.showLogFile();
|
||||
@ -189,18 +140,6 @@ void gui_ShowPrint(Dialogs & d)
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowRef(InsetCommand * ic, Dialogs & d)
|
||||
{
|
||||
d.showRef(ic);
|
||||
}
|
||||
|
||||
|
||||
void gui_CreateRef(string const & s, Dialogs & d)
|
||||
{
|
||||
d.createRef(s);
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowSearch(Dialogs & d)
|
||||
{
|
||||
d.showSearch();
|
||||
@ -249,30 +188,6 @@ void gui_ShowThesaurus(string const & s, Dialogs & d)
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowTOC(InsetCommand * ic, Dialogs & d)
|
||||
{
|
||||
d.showTOC(ic);
|
||||
}
|
||||
|
||||
|
||||
void gui_CreateTOC(string const & s, Dialogs & d)
|
||||
{
|
||||
d.createTOC(s);
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowUrl(InsetCommand * ic, Dialogs & d)
|
||||
{
|
||||
d.showUrl(ic);
|
||||
}
|
||||
|
||||
|
||||
void gui_CreateUrl(string const & s, Dialogs & d)
|
||||
{
|
||||
d.createUrl(s);
|
||||
}
|
||||
|
||||
|
||||
void gui_ShowVCLogFile(Dialogs & d)
|
||||
{
|
||||
d.showVCLogFile();
|
||||
|
@ -16,9 +16,6 @@
|
||||
#include "LString.h"
|
||||
|
||||
class Dialogs;
|
||||
class InsetCommand;
|
||||
class InsetError;
|
||||
class InsetERT;
|
||||
class InsetExternal;
|
||||
class InsetFloat;
|
||||
class InsetWrap;
|
||||
@ -29,26 +26,18 @@ class InsetTabular;
|
||||
|
||||
extern "C" {
|
||||
|
||||
void gui_show_dialog(Dialogs *, char const * name, char const * data);
|
||||
|
||||
void gui_ShowAboutlyx(Dialogs &);
|
||||
void gui_ShowBibitem(InsetCommand *, Dialogs &);
|
||||
void gui_ShowBibtex(InsetCommand *, Dialogs &);
|
||||
void gui_ShowCharacter(Dialogs &);
|
||||
void gui_SetUserFreeFont(Dialogs &);
|
||||
void gui_ShowCitation(InsetCommand *, Dialogs &);
|
||||
void gui_CreateCitation(string const &, Dialogs &);
|
||||
void gui_ShowDocument(Dialogs &);
|
||||
void gui_ShowError(InsetError *, Dialogs &);
|
||||
void gui_ShowERT(InsetERT *, Dialogs &);
|
||||
void gui_UpdateERT(InsetERT *, Dialogs &);
|
||||
void gui_ShowExternal(InsetExternal *, Dialogs &);
|
||||
void gui_ShowFile(string const &, Dialogs &);
|
||||
void gui_ShowFloat(InsetFloat *, Dialogs &);
|
||||
void gui_ShowWrap(InsetWrap *, Dialogs &);
|
||||
void gui_ShowForks(Dialogs &);
|
||||
void gui_ShowGraphics(InsetGraphics *, Dialogs &);
|
||||
void gui_ShowInclude(InsetInclude *, Dialogs &);
|
||||
void gui_ShowIndex(InsetCommand *, Dialogs &);
|
||||
void gui_CreateIndex(Dialogs &);
|
||||
void gui_ShowLogFile(Dialogs &);
|
||||
void gui_ShowMathPanel(Dialogs &);
|
||||
void gui_ShowMinipage(InsetMinipage *, Dialogs &);
|
||||
@ -58,8 +47,6 @@ void gui_UpdateParagraph(Dialogs &);
|
||||
void gui_ShowPreamble(Dialogs &);
|
||||
void gui_ShowPreferences(Dialogs &);
|
||||
void gui_ShowPrint(Dialogs &);
|
||||
void gui_ShowRef(InsetCommand *, Dialogs &);
|
||||
void gui_CreateRef(string const &, Dialogs &);
|
||||
void gui_ShowSearch(Dialogs &);
|
||||
void gui_ShowSendto(Dialogs &);
|
||||
void gui_ShowSpellchecker(Dialogs &);
|
||||
@ -68,11 +55,8 @@ void gui_UpdateTabular(InsetTabular *, Dialogs &);
|
||||
void gui_ShowTabularCreate(Dialogs &);
|
||||
void gui_ShowTexinfo(Dialogs &);
|
||||
void gui_ShowThesaurus(string const &, Dialogs &);
|
||||
void gui_ShowTOC(InsetCommand *, Dialogs &);
|
||||
void gui_CreateTOC(string const &, Dialogs &);
|
||||
void gui_ShowUrl(InsetCommand *, Dialogs &);
|
||||
void gui_CreateUrl(string const &, Dialogs &);
|
||||
void gui_ShowVCLogFile(Dialogs &);
|
||||
void gui_ShowWrap(InsetWrap *, Dialogs &);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
/**
|
||||
* \file qt2/Dialogs.C
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Allan Rae
|
||||
* \author Angus Leeming
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
@ -12,56 +10,36 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "Dialogs_impl.h"
|
||||
|
||||
|
||||
Dialogs::Dialogs(LyXView & lv)
|
||||
: pimpl_(new Impl(lv, *this))
|
||||
void Dialogs::init_pimpl()
|
||||
{
|
||||
// reduce the number of connections needed in
|
||||
// dialogs by a simple connection here.
|
||||
hideAll.connect(hideBufferDependent);
|
||||
pimpl_ = new Impl(lyxview_, *this);
|
||||
}
|
||||
|
||||
|
||||
Dialogs::~Dialogs()
|
||||
{}
|
||||
|
||||
|
||||
void Dialogs::toggleTooltips()
|
||||
{}
|
||||
|
||||
|
||||
/// Are the tooltips on or off?
|
||||
bool Dialogs::tooltipsEnabled()
|
||||
{
|
||||
return false;
|
||||
delete pimpl_;
|
||||
}
|
||||
|
||||
|
||||
Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
: aboutlyx(lv, d),
|
||||
bibitem(lv, d),
|
||||
bibtex(lv, d),
|
||||
changes(lv, d),
|
||||
character(lv, d),
|
||||
citation(lv, d),
|
||||
document(lv, d),
|
||||
error(lv, d),
|
||||
ert(lv, d),
|
||||
external(lv, d),
|
||||
file(lv, d),
|
||||
floats(lv, d),
|
||||
graphics(lv, d),
|
||||
include(lv, d),
|
||||
index(lv, d),
|
||||
logfile(lv, d),
|
||||
minipage(lv, d),
|
||||
paragraph(lv, d),
|
||||
prefs(lv, d),
|
||||
print(lv, d),
|
||||
ref(lv, d),
|
||||
search(lv, d),
|
||||
sendto(lv, d),
|
||||
spellchecker(lv, d),
|
||||
@ -73,8 +51,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
thesaurus(lv, d),
|
||||
#endif
|
||||
|
||||
toc(lv, d),
|
||||
url(lv, d),
|
||||
vclogfile(lv, d),
|
||||
wrap(lv, d)
|
||||
{}
|
||||
|
@ -22,18 +22,6 @@ void Dialogs::showAboutlyx()
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showBibitem(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->bibitem.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showBibtex(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->bibtex.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showMergeChanges()
|
||||
{
|
||||
pimpl_->changes.controller().show();
|
||||
@ -52,42 +40,12 @@ void Dialogs::setUserFreeFont()
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showCitation(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->citation.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createCitation(string const & s)
|
||||
{
|
||||
pimpl_->citation.controller().createInset(s);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showDocument()
|
||||
{
|
||||
pimpl_->document.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showError(InsetError * ie)
|
||||
{
|
||||
pimpl_->error.controller().showInset(ie);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showERT(InsetERT * ie)
|
||||
{
|
||||
pimpl_->ert.controller().showInset(ie);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::updateERT(InsetERT * ie)
|
||||
{
|
||||
pimpl_->ert.controller().showInset(ie);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showExternal(InsetExternal * ie)
|
||||
{
|
||||
pimpl_->external.controller().showInset(ie);
|
||||
@ -122,18 +80,6 @@ void Dialogs::showInclude(InsetInclude * ii)
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showIndex(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->index.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createIndex()
|
||||
{
|
||||
pimpl_->index.controller().createInset("index");
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showLogFile()
|
||||
{
|
||||
pimpl_->logfile.controller().show();
|
||||
@ -191,18 +137,6 @@ void Dialogs::showPrint()
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showRef(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->ref.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createRef(string const & s)
|
||||
{
|
||||
pimpl_->ref.controller().createInset(s);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showSearch()
|
||||
{
|
||||
pimpl_->search.controller().show();
|
||||
@ -260,30 +194,6 @@ void Dialogs::showThesaurus(string const &)
|
||||
#endif
|
||||
|
||||
|
||||
void Dialogs::showTOC(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->toc.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createTOC(string const & s)
|
||||
{
|
||||
pimpl_->toc.controller().createInset(s);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showUrl(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->url.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createUrl(string const & s)
|
||||
{
|
||||
pimpl_->url.controller().createInset(s);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showVCLogFile()
|
||||
{
|
||||
pimpl_->vclogfile.controller().show();
|
||||
|
149
src/frontends/qt2/Dialogs3.C
Normal file
149
src/frontends/qt2/Dialogs3.C
Normal file
@ -0,0 +1,149 @@
|
||||
/**
|
||||
* \file qt2/Dialogs3.C
|
||||
* 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 "Dialog.h"
|
||||
|
||||
#include "ControlBibitem.h"
|
||||
#include "ControlBibtex.h"
|
||||
#include "ControlCitation.h"
|
||||
#include "ControlError.h"
|
||||
#include "ControlERT.h"
|
||||
#include "ControlIndex.h"
|
||||
#include "ControlRef.h"
|
||||
#include "ControlToc.h"
|
||||
#include "ControlUrl.h"
|
||||
|
||||
#include "QBibitem.h"
|
||||
#include "QBibitemDialog.h"
|
||||
#include "QBibtex.h"
|
||||
#include "QBibtexDialog.h"
|
||||
#include "QCitation.h"
|
||||
#include "QCitationDialog.h"
|
||||
#include "QError.h"
|
||||
#include "QErrorDialog.h"
|
||||
#include "QERT.h"
|
||||
#include "QERTDialog.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 "QIndex.h"
|
||||
#include "QIndexDialog.h"
|
||||
#include "QRef.h"
|
||||
#include "QRefDialog.h"
|
||||
#include "QToc.h"
|
||||
#include "QTocDialog.h"
|
||||
#include "QURL.h"
|
||||
#include "QURLDialog.h"
|
||||
|
||||
#include "Qt2BC.h"
|
||||
#include "ButtonController.h"
|
||||
|
||||
|
||||
typedef ButtonController<OkCancelPolicy, Qt2BC>
|
||||
OkCancelBC;
|
||||
|
||||
typedef ButtonController<OkCancelReadOnlyPolicy, Qt2BC>
|
||||
OkCancelReadOnlyBC;
|
||||
|
||||
typedef ButtonController<NoRepeatedApplyReadOnlyPolicy, Qt2BC>
|
||||
NoRepeatedApplyReadOnlyBC;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
char const * const dialognames[] = { "bibitem", "bibtex", "citation",
|
||||
"error", "ert", "index", "ref",
|
||||
"toc", "url" };
|
||||
|
||||
char const * const * const end_dialognames =
|
||||
dialognames + (sizeof(dialognames) / sizeof(char *));
|
||||
|
||||
struct cmpCStr {
|
||||
cmpCStr(char const * name) : name_(name) {}
|
||||
bool operator()(char const * other) {
|
||||
return strcmp(other, name_) == 0;
|
||||
}
|
||||
private:
|
||||
char const * name_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
bool Dialogs::isValidName(string const & name) const
|
||||
{
|
||||
return std::find_if(dialognames, end_dialognames,
|
||||
cmpCStr(name.c_str())) != end_dialognames;
|
||||
}
|
||||
|
||||
|
||||
Dialog * Dialogs::build(string const & name)
|
||||
{
|
||||
if (!isValidName(name))
|
||||
return 0;
|
||||
|
||||
Dialog * dialog = new Dialog(lyxview_, name);
|
||||
|
||||
if (name == "bibitem") {
|
||||
dialog->setController(new ControlBibitem(*dialog));
|
||||
dialog->setView(new QBibitem(*dialog));
|
||||
dialog->setButtonController(new OkCancelReadOnlyBC);
|
||||
} else if (name == "bibtex") {
|
||||
dialog->setController(new ControlBibtex(*dialog));
|
||||
dialog->setView(new QBibtex(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "citation") {
|
||||
dialog->setController(new ControlCitation(*dialog));
|
||||
dialog->setView(new QCitation(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "error") {
|
||||
dialog->setController(new ControlError(*dialog));
|
||||
dialog->setView(new QError(*dialog));
|
||||
dialog->setButtonController(new OkCancelBC);
|
||||
} else if (name == "ert") {
|
||||
dialog->setController(new ControlERT(*dialog));
|
||||
dialog->setView(new QERT(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "index") {
|
||||
dialog->setController(new ControlIndex(*dialog));
|
||||
dialog->setView(new QIndex(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "ref") {
|
||||
dialog->setController(new ControlRef(*dialog));
|
||||
dialog->setView(new QRef(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "toc") {
|
||||
dialog->setController(new ControlToc(*dialog));
|
||||
dialog->setView(new QToc(*dialog));
|
||||
dialog->setButtonController(new OkCancelBC);
|
||||
} else if (name == "url") {
|
||||
dialog->setController(new ControlUrl(*dialog));
|
||||
dialog->setView(new QURL(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
}
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::toggleTooltips()
|
||||
{}
|
||||
|
||||
|
||||
/// Are the tooltips on or off?
|
||||
bool Dialogs::tooltipsEnabled()
|
||||
{
|
||||
return false;
|
||||
}
|
@ -16,27 +16,20 @@
|
||||
#include "controllers/GUI.h"
|
||||
|
||||
#include "ControlAboutlyx.h"
|
||||
#include "ControlBibitem.h"
|
||||
#include "ControlBibtex.h"
|
||||
#include "ControlChanges.h"
|
||||
#include "ControlCharacter.h"
|
||||
#include "ControlCitation.h"
|
||||
#include "ControlDocument.h"
|
||||
#include "ControlError.h"
|
||||
#include "ControlERT.h"
|
||||
#include "ControlExternal.h"
|
||||
#include "ControlFloat.h"
|
||||
#include "ControlForks.h"
|
||||
#include "ControlGraphics.h"
|
||||
#include "insets/insetgraphicsParams.h"
|
||||
#include "ControlInclude.h"
|
||||
#include "ControlIndex.h"
|
||||
#include "ControlLog.h"
|
||||
#include "ControlMinipage.h"
|
||||
#include "ControlParagraph.h"
|
||||
#include "ControlPrefs.h"
|
||||
#include "ControlPrint.h"
|
||||
#include "ControlRef.h"
|
||||
#include "ControlSearch.h"
|
||||
#include "ControlSendto.h"
|
||||
#include "ControlShowFile.h"
|
||||
@ -44,29 +37,17 @@
|
||||
#include "ControlTabularCreate.h"
|
||||
#include "ControlTabular.h"
|
||||
#include "ControlTexinfo.h"
|
||||
#include "ControlToc.h"
|
||||
#include "ControlUrl.h"
|
||||
#include "ControlVCLog.h"
|
||||
#include "ControlWrap.h"
|
||||
|
||||
#include "QAbout.h"
|
||||
#include "QAboutDialog.h"
|
||||
#include "QBibitem.h"
|
||||
#include "QBibitemDialog.h"
|
||||
#include "QBibtex.h"
|
||||
#include "QBibtexDialog.h"
|
||||
#include "QChanges.h"
|
||||
#include "QChangesDialog.h"
|
||||
#include "QCharacter.h"
|
||||
#include "QCharacterDialog.h"
|
||||
#include "QCitation.h"
|
||||
#include "QCitationDialog.h"
|
||||
#include "QDocument.h"
|
||||
#include "QDocumentDialog.h"
|
||||
#include "QError.h"
|
||||
#include "QErrorDialog.h"
|
||||
#include "QERT.h"
|
||||
#include "QERTDialog.h"
|
||||
#include "QExternal.h"
|
||||
#include "QExternalDialog.h"
|
||||
#include "QFloat.h"
|
||||
@ -80,8 +61,6 @@
|
||||
#include "QGraphicsDialog.h"
|
||||
#include "QInclude.h"
|
||||
#include "QIncludeDialog.h"
|
||||
#include "QIndex.h"
|
||||
#include "QIndexDialog.h"
|
||||
#include "QLog.h"
|
||||
#include "QLogDialog.h"
|
||||
#include "QMinipage.h"
|
||||
@ -92,8 +71,6 @@
|
||||
#include "QPrefsDialog.h"
|
||||
#include "QPrint.h"
|
||||
#include "QLPrintDialog.h"
|
||||
#include "QRef.h"
|
||||
#include "QRefDialog.h"
|
||||
#include "QSearch.h"
|
||||
#include "QSearchDialog.h"
|
||||
#include "QSendto.h"
|
||||
@ -115,10 +92,6 @@
|
||||
#include "QThesaurusDialog.h"
|
||||
#endif
|
||||
|
||||
#include "QToc.h"
|
||||
#include "QTocDialog.h"
|
||||
#include "QURL.h"
|
||||
#include "QURLDialog.h"
|
||||
#include "QVCLog.h"
|
||||
#include "QVCLogDialog.h"
|
||||
#include "QWrap.h"
|
||||
@ -131,30 +104,15 @@
|
||||
typedef GUI<ControlAboutlyx, QAbout, OkCancelPolicy, Qt2BC>
|
||||
AboutlyxDialog;
|
||||
|
||||
typedef GUI<ControlBibitem, QBibitem, OkCancelReadOnlyPolicy, Qt2BC>
|
||||
BibitemDialog;
|
||||
|
||||
typedef GUI<ControlBibtex, QBibtex, OkCancelReadOnlyPolicy, Qt2BC>
|
||||
BibtexDialog;
|
||||
|
||||
typedef GUI<ControlChanges, QChanges, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
|
||||
ChangesDialog;
|
||||
|
||||
typedef GUI<ControlCharacter, QCharacter, OkApplyCancelReadOnlyPolicy, Qt2BC>
|
||||
CharacterDialog;
|
||||
|
||||
typedef GUI<ControlCitation, QCitation, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
|
||||
CitationDialog;
|
||||
|
||||
typedef GUI<ControlDocument, QDocument, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
|
||||
DocumentDialog;
|
||||
|
||||
typedef GUI<ControlError, QError, OkCancelPolicy, Qt2BC>
|
||||
ErrorDialog;
|
||||
|
||||
typedef GUI<ControlERT, QERT, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
|
||||
ERTDialog;
|
||||
|
||||
typedef GUI<ControlExternal, QExternal, OkApplyCancelReadOnlyPolicy, Qt2BC>
|
||||
ExternalDialog;
|
||||
|
||||
@ -170,9 +128,6 @@ GraphicsDialog;
|
||||
typedef GUI<ControlInclude, QInclude, OkCancelReadOnlyPolicy, Qt2BC>
|
||||
IncludeDialog;
|
||||
|
||||
typedef GUI<ControlIndex, QIndex, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
|
||||
IndexDialog;
|
||||
|
||||
typedef GUI<ControlLog, QLog, OkCancelPolicy, Qt2BC>
|
||||
LogFileDialog;
|
||||
|
||||
@ -188,9 +143,6 @@ PrefsDialog;
|
||||
typedef GUI<ControlPrint, QPrint, OkApplyCancelPolicy, Qt2BC>
|
||||
PrintDialog;
|
||||
|
||||
typedef GUI<ControlRef, QRef, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
|
||||
RefDialog;
|
||||
|
||||
typedef GUI<ControlSearch, QSearch, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
|
||||
SearchDialog;
|
||||
|
||||
@ -214,12 +166,6 @@ typedef GUI<ControlThesaurus, QThesaurus, OkApplyCancelReadOnlyPolicy, Qt2BC>
|
||||
ThesaurusDialog;
|
||||
#endif
|
||||
|
||||
typedef GUI<ControlToc, QToc, OkCancelPolicy, Qt2BC>
|
||||
TocDialog;
|
||||
|
||||
typedef GUI<ControlUrl, QURL, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
|
||||
UrlDialog;
|
||||
|
||||
typedef GUI<ControlVCLog, QVCLog, OkCancelPolicy, Qt2BC>
|
||||
VCLogFileDialog;
|
||||
|
||||
@ -231,26 +177,19 @@ struct Dialogs::Impl {
|
||||
Impl(LyXView & lv, Dialogs & d);
|
||||
|
||||
AboutlyxDialog aboutlyx;
|
||||
BibitemDialog bibitem;
|
||||
BibtexDialog bibtex;
|
||||
ChangesDialog changes;
|
||||
CharacterDialog character;
|
||||
CitationDialog citation;
|
||||
DocumentDialog document;
|
||||
ErrorDialog error;
|
||||
ERTDialog ert;
|
||||
ExternalDialog external;
|
||||
FileDialog file;
|
||||
FloatDialog floats;
|
||||
GraphicsDialog graphics;
|
||||
IncludeDialog include;
|
||||
IndexDialog index;
|
||||
LogFileDialog logfile;
|
||||
MinipageDialog minipage;
|
||||
ParagraphDialog paragraph;
|
||||
PrefsDialog prefs;
|
||||
PrintDialog print;
|
||||
RefDialog ref;
|
||||
SearchDialog search;
|
||||
SendtoDialog sendto;
|
||||
SpellcheckerDialog spellchecker;
|
||||
@ -262,8 +201,6 @@ struct Dialogs::Impl {
|
||||
ThesaurusDialog thesaurus;
|
||||
#endif
|
||||
|
||||
TocDialog toc;
|
||||
UrlDialog url;
|
||||
VCLogFileDialog vclogfile;
|
||||
WrapDialog wrap;
|
||||
};
|
||||
|
@ -14,11 +14,15 @@ INCLUDES = -I$(top_srcdir)/src/ -I$(top_srcdir)/src/frontends/ \
|
||||
|
||||
AM_CXXFLAGS = -DQT_CLEAN_NAMESPACE -DQT_GENUINE_STR -DQT_NO_TRANSLATION
|
||||
|
||||
|
||||
libqt2_la_SOURCES = \
|
||||
QDialogView.C \
|
||||
QDialogView.h \
|
||||
Alert_pimpl.C \
|
||||
bulletstrings.C bulletstrings.h \
|
||||
Dialogs.C \
|
||||
Dialogs2.C \
|
||||
Dialogs3.C \
|
||||
Dialogs_impl.h \
|
||||
FileDialog.C \
|
||||
LyXKeySymFactory.C \
|
||||
|
@ -104,6 +104,7 @@ MOCFILES = \
|
||||
QShowFileDialog.C QShowFileDialog.h \
|
||||
QSpellcheckerDialog.C QSpellcheckerDialog.h \
|
||||
Qt2Base.C Qt2Base.h \
|
||||
QDialogView.C QDialogView.h \
|
||||
QTabularCreateDialog.C QTabularCreateDialog.h \
|
||||
QTabularDialog.C QTabularDialog.h \
|
||||
QTexinfoDialog.C QTexinfoDialog.h \
|
||||
|
@ -24,11 +24,11 @@
|
||||
#include "QBibitem.h"
|
||||
#include "Qt2BC.h"
|
||||
|
||||
typedef Qt2CB<ControlBibitem, Qt2DB<QBibitemDialog> > base_class;
|
||||
typedef QController<ControlBibitem, QView<QBibitemDialog> > base_class;
|
||||
|
||||
|
||||
QBibitem::QBibitem()
|
||||
: base_class(qt_("LyX: Insert Bibliography Item"))
|
||||
QBibitem::QBibitem(Dialog & parent)
|
||||
: base_class(parent, qt_("LyX: Insert Bibliography Item"))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -13,18 +13,18 @@
|
||||
#define QBIBITEM_H
|
||||
|
||||
|
||||
#include "Qt2Base.h"
|
||||
#include "QDialogView.h"
|
||||
|
||||
class ControlBibitem;
|
||||
class QBibitemDialog;
|
||||
|
||||
class QBibitem
|
||||
: public Qt2CB<ControlBibitem, Qt2DB<QBibitemDialog> >
|
||||
: public QController<ControlBibitem, QView<QBibitemDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QBibitemDialog;
|
||||
|
||||
QBibitem();
|
||||
QBibitem(Dialog &);
|
||||
protected:
|
||||
virtual bool isValid();
|
||||
private:
|
||||
|
@ -33,11 +33,11 @@
|
||||
|
||||
using std::vector;
|
||||
|
||||
typedef Qt2CB<ControlBibtex, Qt2DB<QBibtexDialog> > base_class;
|
||||
typedef QController<ControlBibtex, QView<QBibtexDialog> > base_class;
|
||||
|
||||
|
||||
QBibtex::QBibtex()
|
||||
: base_class(qt_("BibTeX"))
|
||||
QBibtex::QBibtex(Dialog & parent)
|
||||
: base_class(parent, qt_("BibTeX"))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -13,18 +13,18 @@
|
||||
#define QBIBTEX_H
|
||||
|
||||
|
||||
#include "Qt2Base.h"
|
||||
#include "QDialogView.h"
|
||||
|
||||
class ControlBibtex;
|
||||
class QBibtexDialog;
|
||||
|
||||
class QBibtex
|
||||
: public Qt2CB<ControlBibtex, Qt2DB<QBibtexDialog> >
|
||||
: public QController<ControlBibtex, QView<QBibtexDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QBibtexDialog;
|
||||
|
||||
QBibtex();
|
||||
QBibtex(Dialog &);
|
||||
protected:
|
||||
virtual bool isValid();
|
||||
private:
|
||||
|
@ -38,11 +38,11 @@ using std::pair;
|
||||
using std::sort;
|
||||
using std::vector;
|
||||
|
||||
typedef Qt2CB<ControlCitation, Qt2DB<QCitationDialog> > base_class;
|
||||
typedef QController<ControlCitation, QView<QCitationDialog> > base_class;
|
||||
|
||||
|
||||
QCitation::QCitation()
|
||||
: base_class(qt_("LyX: Insert Citation"))
|
||||
QCitation::QCitation(Dialog & parent)
|
||||
: base_class(parent, qt_("LyX: Insert Citation"))
|
||||
{}
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ void QCitation::hide()
|
||||
citekeys.clear();
|
||||
bibkeys.clear();
|
||||
|
||||
Qt2Base::hide();
|
||||
QDialogView::hide();
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,20 +14,20 @@
|
||||
#define QCITATION_H
|
||||
|
||||
|
||||
#include "Qt2Base.h"
|
||||
#include "QDialogView.h"
|
||||
|
||||
|
||||
class QListBox;
|
||||
class ControlCitation;
|
||||
class QCitationDialog;
|
||||
|
||||
|
||||
class QCitation
|
||||
: public Qt2CB<ControlCitation, Qt2DB<QCitationDialog> >
|
||||
class QCitation : public QController<ControlCitation, QView<QCitationDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QCitationDialog;
|
||||
///
|
||||
QCitation();
|
||||
QCitation(Dialog &);
|
||||
private:
|
||||
///
|
||||
enum State {
|
||||
|
119
src/frontends/qt2/QDialogView.C
Normal file
119
src/frontends/qt2/QDialogView.C
Normal file
@ -0,0 +1,119 @@
|
||||
/**
|
||||
* \file QDialogView.C
|
||||
* 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 <qdialog.h>
|
||||
#include <qapplication.h>
|
||||
|
||||
#include "debug.h"
|
||||
#include "QtLyXView.h"
|
||||
#include "Dialogs.h"
|
||||
#include "QDialogView.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "support/LAssert.h"
|
||||
|
||||
|
||||
QDialogView::QDialogView(Dialog & parent, QString const & t)
|
||||
: Dialog::View(parent), updating_(false), title_(t)
|
||||
{}
|
||||
|
||||
|
||||
Qt2BC & QDialogView::bc()
|
||||
{
|
||||
return static_cast<Qt2BC &>(dialog().bc());
|
||||
}
|
||||
|
||||
|
||||
bool QDialogView::isVisible() const
|
||||
{
|
||||
return form() && form()->isVisible();
|
||||
}
|
||||
|
||||
|
||||
bool QDialogView::readOnly() const
|
||||
{
|
||||
return kernel().isBufferReadonly();
|
||||
}
|
||||
|
||||
|
||||
void QDialogView::show()
|
||||
{
|
||||
if (!form()) {
|
||||
build();
|
||||
}
|
||||
|
||||
form()->setMinimumSize(form()->sizeHint());
|
||||
|
||||
update(); // make sure its up-to-date
|
||||
|
||||
if (form()->isVisible()) {
|
||||
form()->raise();
|
||||
} else {
|
||||
form()->setCaption(title_);
|
||||
form()->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QDialogView::hide()
|
||||
{
|
||||
if (form() && form()->isVisible())
|
||||
form()->hide();
|
||||
}
|
||||
|
||||
|
||||
bool QDialogView::isValid()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void QDialogView::changed()
|
||||
{
|
||||
if (updating_)
|
||||
return;
|
||||
|
||||
if (isValid())
|
||||
bc().valid();
|
||||
else
|
||||
bc().invalid();
|
||||
}
|
||||
|
||||
|
||||
void QDialogView::slotWMHide()
|
||||
{
|
||||
dialog().CancelButton();
|
||||
}
|
||||
|
||||
|
||||
void QDialogView::slotApply()
|
||||
{
|
||||
dialog().ApplyButton();
|
||||
}
|
||||
|
||||
|
||||
void QDialogView::slotOK()
|
||||
{
|
||||
dialog().OKButton();
|
||||
}
|
||||
|
||||
|
||||
void QDialogView::slotClose()
|
||||
{
|
||||
dialog().CancelButton();
|
||||
}
|
||||
|
||||
|
||||
void QDialogView::slotRestore()
|
||||
{
|
||||
dialog().RestoreButton();
|
||||
}
|
185
src/frontends/qt2/QDialogView.h
Normal file
185
src/frontends/qt2/QDialogView.h
Normal file
@ -0,0 +1,185 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QDialogView.h
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef QDIALOGVIEW_H
|
||||
#define QDIALOGVIEW_H
|
||||
|
||||
|
||||
#include "Dialog.h"
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <qfont.h>
|
||||
#include <qdialog.h>
|
||||
#include <qobject.h>
|
||||
#include <qapplication.h>
|
||||
|
||||
class Qt2BC;
|
||||
|
||||
/** This class is an Qt2 GUI base class.
|
||||
*/
|
||||
class QDialogView : public QObject, public Dialog::View {
|
||||
Q_OBJECT
|
||||
public:
|
||||
///
|
||||
QDialogView(Dialog &, QString const &);
|
||||
///
|
||||
virtual ~QDialogView() {}
|
||||
///
|
||||
bool readOnly() const;
|
||||
|
||||
protected:
|
||||
/// build the actual dialog
|
||||
virtual void build_dialog() = 0;
|
||||
///
|
||||
virtual void build() = 0;
|
||||
/// Hide the dialog.
|
||||
virtual void hide();
|
||||
/// Create the dialog if necessary, update it and display it.
|
||||
virtual void show();
|
||||
/// update the dialog's contents
|
||||
virtual void update_contents() = 0;
|
||||
///
|
||||
virtual bool isVisible() const;
|
||||
|
||||
/// the dialog has changed contents
|
||||
virtual void changed();
|
||||
|
||||
/// is the dialog currently valid ?
|
||||
virtual bool isValid();
|
||||
|
||||
///
|
||||
Qt2BC & bc();
|
||||
|
||||
/// are we updating ?
|
||||
bool updating_;
|
||||
protected slots:
|
||||
// dialog closed from WM
|
||||
void slotWMHide();
|
||||
|
||||
// Restore button clicked
|
||||
void slotRestore();
|
||||
|
||||
// OK button clicked
|
||||
void slotOK();
|
||||
|
||||
// Apply button clicked
|
||||
void slotApply();
|
||||
|
||||
// Close button clicked
|
||||
void slotClose();
|
||||
private:
|
||||
/// Pointer to the actual instantiation of the Qt dialog
|
||||
virtual QDialog * form() const = 0;
|
||||
|
||||
private:
|
||||
/// dialog title, displayed by WM.
|
||||
QString title_;
|
||||
};
|
||||
|
||||
|
||||
template <class GUIDialog>
|
||||
class QView: public QDialogView {
|
||||
protected:
|
||||
QView(Dialog &, QString const &);
|
||||
|
||||
/// update the dialog
|
||||
virtual void update();
|
||||
|
||||
/// Build the dialog
|
||||
virtual void build();
|
||||
|
||||
/// Pointer to the actual instantiation of the Qt dialog
|
||||
virtual QDialog * form() const;
|
||||
|
||||
/// Real GUI implementation.
|
||||
boost::scoped_ptr<GUIDialog> dialog_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
template <class GUIDialog>
|
||||
QView<GUIDialog>::QView(Dialog & p, QString const & t)
|
||||
: QDialogView(p, t)
|
||||
{}
|
||||
|
||||
|
||||
template <class GUIDialog>
|
||||
QDialog * QView<GUIDialog>::form() const
|
||||
{
|
||||
return dialog_.get();
|
||||
}
|
||||
|
||||
|
||||
template <class GUIDialog>
|
||||
void QView<GUIDialog>::update()
|
||||
{
|
||||
form()->setUpdatesEnabled(false);
|
||||
|
||||
// protect the BC from unwarranted state transitions
|
||||
|
||||
qApp->processEvents();
|
||||
updating_ = true;
|
||||
update_contents();
|
||||
qApp->processEvents();
|
||||
updating_ = false;
|
||||
|
||||
form()->setUpdatesEnabled(true);
|
||||
form()->update();
|
||||
}
|
||||
|
||||
|
||||
template <class GUIDialog>
|
||||
void QView<GUIDialog>::build()
|
||||
{
|
||||
// protect the BC from unwarranted state transitions
|
||||
|
||||
qApp->processEvents();
|
||||
updating_ = true;
|
||||
build_dialog();
|
||||
qApp->processEvents();
|
||||
updating_ = false;
|
||||
}
|
||||
|
||||
|
||||
template <class Controller, class Base>
|
||||
class QController: public Base
|
||||
{
|
||||
protected:
|
||||
///
|
||||
QController(Dialog &, QString const &);
|
||||
/// The parent controller
|
||||
Controller & controller();
|
||||
/// The parent controller
|
||||
Controller const & controller() const;
|
||||
};
|
||||
|
||||
|
||||
template <class Controller, class Base>
|
||||
QController<Controller, Base>::QController(Dialog & p, QString const & t)
|
||||
: Base(p, t)
|
||||
{}
|
||||
|
||||
|
||||
template <class Controller, class Base>
|
||||
Controller & QController<Controller, Base>::controller()
|
||||
{
|
||||
return static_cast<Controller &>(getController());
|
||||
}
|
||||
|
||||
|
||||
template <class Controller, class Base>
|
||||
Controller const & QController<Controller, Base>::controller() const
|
||||
{
|
||||
return static_cast<Controller const &>(getController());
|
||||
}
|
||||
|
||||
|
||||
#endif // QDIALOGVIEW_H
|
@ -21,11 +21,11 @@
|
||||
#include "QERT.h"
|
||||
#include "Qt2BC.h"
|
||||
|
||||
typedef Qt2CB<ControlERT, Qt2DB<QERTDialog> > base_class;
|
||||
typedef QController<ControlERT, QView<QERTDialog> > base_class;
|
||||
|
||||
|
||||
QERT::QERT()
|
||||
: base_class(qt_("LyX: LaTeX Code Settings"))
|
||||
QERT::QERT(Dialog & parent)
|
||||
: base_class(parent, qt_("LyX: LaTeX Code Settings"))
|
||||
{
|
||||
}
|
||||
|
||||
@ -41,14 +41,12 @@ void QERT::build_dialog()
|
||||
|
||||
void QERT::apply()
|
||||
{
|
||||
ERTParams & params = controller().params();
|
||||
|
||||
if (dialog_->openRB->isChecked())
|
||||
params.status = InsetERT::Open;
|
||||
controller().setStatus(InsetERT::Open);
|
||||
else if (dialog_->inlineRB->isChecked())
|
||||
params.status = InsetERT::Inlined;
|
||||
controller().setStatus(InsetERT::Inlined);
|
||||
else
|
||||
params.status = InsetERT::Collapsed;
|
||||
controller().setStatus(InsetERT::Collapsed);
|
||||
}
|
||||
|
||||
|
||||
@ -56,7 +54,7 @@ void QERT::update_contents()
|
||||
{
|
||||
QRadioButton * rb = 0;
|
||||
|
||||
switch (controller().params().status) {
|
||||
switch (controller().status()) {
|
||||
case InsetERT::Open: rb = dialog_->openRB; break;
|
||||
case InsetERT::Inlined: rb = dialog_->inlineRB; break;
|
||||
case InsetERT::Collapsed: rb = dialog_->collapsedRB; break;
|
||||
|
@ -13,18 +13,19 @@
|
||||
#define QERT_H
|
||||
|
||||
|
||||
#include "Qt2Base.h"
|
||||
#include "QDialogView.h"
|
||||
|
||||
|
||||
class ControlERT;
|
||||
class QERTDialog;
|
||||
|
||||
class QERT
|
||||
: public Qt2CB<ControlERT, Qt2DB<QERTDialog> >
|
||||
|
||||
class QERT : public QController<ControlERT, QView<QERTDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QERTDialog;
|
||||
|
||||
QERT();
|
||||
QERT(Dialog &);
|
||||
private:
|
||||
/// Apply changes
|
||||
virtual void apply();
|
||||
|
@ -21,11 +21,11 @@
|
||||
#include "QError.h"
|
||||
#include "Qt2BC.h"
|
||||
|
||||
typedef Qt2CB<ControlError, Qt2DB<QErrorDialog> > base_class;
|
||||
typedef QController<ControlError, QView<QErrorDialog> > base_class;
|
||||
|
||||
|
||||
QError::QError()
|
||||
: base_class(qt_("LyX: LaTeX Error"))
|
||||
QError::QError(Dialog & parent)
|
||||
: base_class(parent, qt_("LyX: LaTeX Error"))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -13,19 +13,19 @@
|
||||
#define QERROR_H
|
||||
|
||||
|
||||
#include "Qt2Base.h"
|
||||
#include "QDialogView.h"
|
||||
|
||||
class ControlError;
|
||||
class QErrorDialog;
|
||||
|
||||
|
||||
class QError
|
||||
: public Qt2CB<ControlError, Qt2DB<QErrorDialog> >
|
||||
: public QController<ControlError, QView<QErrorDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QErrorDialog;
|
||||
|
||||
QError();
|
||||
QError(Dialog &);
|
||||
private:
|
||||
/// Apply changes
|
||||
virtual void apply() {}
|
||||
|
@ -20,11 +20,11 @@
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
typedef Qt2CB<ControlIndex, Qt2DB<QIndexDialog> > base_class;
|
||||
typedef QController<ControlIndex, QView<QIndexDialog> > base_class;
|
||||
|
||||
|
||||
QIndex::QIndex()
|
||||
: base_class(qt_("LyX: Insert Index Entry"))
|
||||
QIndex::QIndex(Dialog & parent)
|
||||
: base_class(parent, qt_("LyX: Insert Index Entry"))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -14,19 +14,19 @@
|
||||
#define QINDEX_H
|
||||
|
||||
|
||||
#include "Qt2Base.h"
|
||||
#include "QDialogView.h"
|
||||
|
||||
class ControlIndex;
|
||||
class QIndexDialog;
|
||||
|
||||
|
||||
class QIndex :
|
||||
public Qt2CB<ControlIndex, Qt2DB<QIndexDialog> >
|
||||
public QController<ControlIndex, QView<QIndexDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QIndexDialog;
|
||||
|
||||
QIndex();
|
||||
QIndex(Dialog &);
|
||||
protected:
|
||||
virtual bool isValid();
|
||||
private:
|
||||
|
@ -35,11 +35,11 @@ using std::vector;
|
||||
using std::endl;
|
||||
|
||||
|
||||
typedef Qt2CB<ControlRef, Qt2DB<QRefDialog> > base_class;
|
||||
typedef QController<ControlRef, QView<QRefDialog> > base_class;
|
||||
|
||||
|
||||
QRef::QRef()
|
||||
: base_class(qt_("LyX: Insert Cross-reference")),
|
||||
QRef::QRef(Dialog & parent)
|
||||
: base_class(parent, qt_("LyX: Insert Cross-reference")),
|
||||
sort_(false), at_ref_(false)
|
||||
{
|
||||
}
|
||||
@ -102,15 +102,17 @@ void QRef::apply()
|
||||
|
||||
bool QRef::nameAllowed()
|
||||
{
|
||||
return controller().docType() != ControlRef::LATEX &&
|
||||
controller().docType() != ControlRef::LITERATE;
|
||||
Kernel::DocTypes doc_type = kernel().docType();
|
||||
return doc_type != Kernel::LATEX &&
|
||||
doc_type != Kernel::LITERATE;
|
||||
}
|
||||
|
||||
|
||||
bool QRef::typeAllowed()
|
||||
{
|
||||
return controller().docType() != ControlRef::LINUXDOC &&
|
||||
controller().docType() != ControlRef::DOCBOOK;
|
||||
Kernel::DocTypes doc_type = kernel().docType();
|
||||
return doc_type != Kernel::LINUXDOC &&
|
||||
doc_type != Kernel::DOCBOOK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#define QREF_H
|
||||
|
||||
|
||||
#include "Qt2Base.h"
|
||||
#include "QDialogView.h"
|
||||
#include <vector>
|
||||
#include "LString.h"
|
||||
|
||||
@ -22,12 +22,12 @@ class QRefDialog;
|
||||
|
||||
|
||||
class QRef
|
||||
: public Qt2CB<ControlRef, Qt2DB<QRefDialog> >
|
||||
: public QController<ControlRef, QView<QRefDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QRefDialog;
|
||||
|
||||
QRef();
|
||||
QRef(Dialog &);
|
||||
private:
|
||||
/// apply changes
|
||||
virtual void apply();
|
||||
|
@ -33,10 +33,10 @@ using std::pair;
|
||||
using std::stack;
|
||||
using std::vector;
|
||||
|
||||
typedef Qt2CB<ControlToc, Qt2DB<QTocDialog> > base_class;
|
||||
typedef QController<ControlToc, QView<QTocDialog> > base_class;
|
||||
|
||||
QToc::QToc()
|
||||
: base_class(qt_("LyX: Table of Contents")), depth_(1)
|
||||
QToc::QToc(Dialog & parent)
|
||||
: base_class(parent, qt_("LyX: Table of Contents")), depth_(1)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -14,19 +14,19 @@
|
||||
#define QTOC_H
|
||||
|
||||
|
||||
#include "Qt2Base.h"
|
||||
#include "QDialogView.h"
|
||||
#include "toc.h"
|
||||
|
||||
class ControlToc;
|
||||
class QTocDialog;
|
||||
|
||||
class QToc :
|
||||
public Qt2CB<ControlToc, Qt2DB<QTocDialog> >
|
||||
public QController<ControlToc, QView<QTocDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QTocDialog;
|
||||
|
||||
QToc();
|
||||
QToc(Dialog &);
|
||||
private:
|
||||
/// update the listview
|
||||
void updateToc(int newdepth);
|
||||
|
@ -23,11 +23,11 @@
|
||||
#include <qpushbutton.h>
|
||||
#include <qlineedit.h>
|
||||
|
||||
typedef Qt2CB<ControlUrl, Qt2DB<QURLDialog> > base_class;
|
||||
typedef QController<ControlUrl, QView<QURLDialog> > base_class;
|
||||
|
||||
|
||||
QURL::QURL()
|
||||
: base_class(qt_("LyX: Insert URL"))
|
||||
QURL::QURL(Dialog & parent)
|
||||
: base_class(parent, qt_("LyX: Insert URL"))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -13,18 +13,18 @@
|
||||
#define QURL_H
|
||||
|
||||
|
||||
#include "Qt2Base.h"
|
||||
#include "QDialogView.h"
|
||||
|
||||
class ControlUrl;
|
||||
class QURLDialog;
|
||||
|
||||
|
||||
class QURL :
|
||||
public Qt2CB<ControlUrl, Qt2DB<QURLDialog> >
|
||||
public QController<ControlUrl, QView<QURLDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QURLDialog;
|
||||
QURL();
|
||||
QURL(Dialog &);
|
||||
protected:
|
||||
virtual bool isValid();
|
||||
private:
|
||||
|
@ -1,3 +1,38 @@
|
||||
2003-02-21 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FormDialogView.[Ch]: new base class for the xforms dialogs,
|
||||
deriving from Dialog::View. Otherwise identical to the existing
|
||||
FormBase that derives from ViewBase.
|
||||
|
||||
* Dialogs_impl.h:
|
||||
* Dialogs.C:
|
||||
* Dilaogs2.C: strip out those dialogs that now use the new
|
||||
Dialog class as the platform for an MCV split.
|
||||
|
||||
* Dialogs3.C: new file. Lazy instantiation of those dialogs that
|
||||
now use the new Dialog class.
|
||||
|
||||
* FormBibitem.[Ch]:
|
||||
* FormBibtex.[Ch]:
|
||||
* FormCitation.[Ch]:
|
||||
* FormError.[Ch]:
|
||||
* FormERT.[Ch]:
|
||||
* FormIndex.[Ch]:
|
||||
* FormRef.[Ch]:
|
||||
* FormToc.[Ch]:
|
||||
* FormUrl.[Ch]:
|
||||
* forms/form_bibitem.fd:
|
||||
* forms/form_bibtex.fd:
|
||||
* forms/form_citation.fd:
|
||||
* forms/form_error.fd:
|
||||
* forms/form_ert.fd:
|
||||
* forms/form_index.fd:
|
||||
* forms/form_ref.fd:
|
||||
* forms/form_toc.fd:
|
||||
* forms/form_url.fd: minor changes to reflect the new heirarchy.
|
||||
|
||||
* Makefile.am: add new files.
|
||||
|
||||
2003-02-22 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* lyx_gui.C (parse_init): added a call to LoaderQueue::setPriority
|
||||
|
@ -1,10 +1,8 @@
|
||||
/**
|
||||
* \file xforms/Dialogs.C
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Allan Rae
|
||||
* \author Angus Leeming
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
@ -12,52 +10,32 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "Dialogs_impl.h"
|
||||
|
||||
Dialogs::Dialogs(LyXView & lv)
|
||||
: pimpl_(new Impl(lv, *this))
|
||||
|
||||
void Dialogs::init_pimpl()
|
||||
{
|
||||
// reduce the number of connections needed in
|
||||
// dialogs by a simple connection here.
|
||||
hideAll.connect(hideBufferDependent);
|
||||
pimpl_ = new Impl(lyxview_, *this);
|
||||
}
|
||||
|
||||
|
||||
Dialogs::~Dialogs()
|
||||
{}
|
||||
|
||||
|
||||
void Dialogs::toggleTooltips()
|
||||
{
|
||||
Tooltips::toggleEnabled();
|
||||
}
|
||||
|
||||
|
||||
/// Are the tooltips on or off?
|
||||
bool Dialogs::tooltipsEnabled()
|
||||
{
|
||||
return Tooltips::enabled();
|
||||
delete pimpl_;
|
||||
}
|
||||
|
||||
|
||||
Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
: aboutlyx(lv, d),
|
||||
bibitem(lv, d),
|
||||
bibtex(lv, d),
|
||||
changes(lv, d),
|
||||
character(lv, d),
|
||||
citation(lv, d),
|
||||
document(lv, d),
|
||||
error(lv, d),
|
||||
ert(lv, d),
|
||||
external(lv, d),
|
||||
file(lv, d),
|
||||
floats(lv, d),
|
||||
forks(lv, d),
|
||||
graphics(lv, d),
|
||||
include(lv, d),
|
||||
index(lv, d),
|
||||
logfile(lv, d),
|
||||
mathpanel(lv, d),
|
||||
minipage(lv, d),
|
||||
@ -65,7 +43,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
preamble(lv, d),
|
||||
preferences(lv, d),
|
||||
print(lv, d),
|
||||
ref(lv, d),
|
||||
search(lv, d),
|
||||
sendto(lv, d),
|
||||
spellchecker(lv, d),
|
||||
@ -77,8 +54,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
|
||||
thesaurus(lv, d),
|
||||
#endif
|
||||
|
||||
toc(lv, d),
|
||||
url(lv, d),
|
||||
vclogfile(lv, d),
|
||||
wrap(lv, d)
|
||||
{}
|
||||
|
@ -22,18 +22,6 @@ void Dialogs::showAboutlyx()
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showBibitem(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->bibitem.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showBibtex(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->bibtex.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showMergeChanges()
|
||||
{
|
||||
pimpl_->changes.controller().show();
|
||||
@ -52,42 +40,12 @@ void Dialogs::setUserFreeFont()
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showCitation(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->citation.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createCitation(string const & s)
|
||||
{
|
||||
pimpl_->citation.controller().createInset(s);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showDocument()
|
||||
{
|
||||
pimpl_->document.controller().show();
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showError(InsetError * ie)
|
||||
{
|
||||
pimpl_->error.controller().showInset(ie);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showERT(InsetERT * ie)
|
||||
{
|
||||
pimpl_->ert.controller().showInset(ie);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::updateERT(InsetERT * ie)
|
||||
{
|
||||
pimpl_->ert.controller().showInset(ie);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showExternal(InsetExternal * ie)
|
||||
{
|
||||
pimpl_->external.controller().showInset(ie);
|
||||
@ -124,18 +82,6 @@ void Dialogs::showInclude(InsetInclude * ii)
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showIndex(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->index.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createIndex()
|
||||
{
|
||||
pimpl_->index.controller().createInset("index");
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showLogFile()
|
||||
{
|
||||
pimpl_->logfile.controller().show();
|
||||
@ -190,18 +136,6 @@ void Dialogs::showPrint()
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showRef(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->ref.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createRef(string const & s)
|
||||
{
|
||||
pimpl_->ref.controller().createInset(s);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showSearch()
|
||||
{
|
||||
pimpl_->search.controller().show();
|
||||
@ -259,30 +193,6 @@ void Dialogs::showThesaurus(string const &)
|
||||
#endif
|
||||
|
||||
|
||||
void Dialogs::showTOC(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->toc.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createTOC(string const & s)
|
||||
{
|
||||
pimpl_->toc.controller().createInset(s);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showUrl(InsetCommand * ic)
|
||||
{
|
||||
pimpl_->url.controller().showInset(ic);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::createUrl(string const & s)
|
||||
{
|
||||
pimpl_->url.controller().createInset(s);
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::showVCLogFile()
|
||||
{
|
||||
pimpl_->vclogfile.controller().show();
|
||||
|
161
src/frontends/xforms/Dialogs3.C
Normal file
161
src/frontends/xforms/Dialogs3.C
Normal file
@ -0,0 +1,161 @@
|
||||
/**
|
||||
* \file xforms/Dialogs3.C
|
||||
* 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 "Dialog.h"
|
||||
|
||||
#include "Tooltips.h"
|
||||
|
||||
#include "ControlBibitem.h"
|
||||
#include "FormBibitem.h"
|
||||
#include "forms/form_bibitem.h"
|
||||
|
||||
#include "ControlBibtex.h"
|
||||
#include "FormBibtex.h"
|
||||
#include "forms/form_bibtex.h"
|
||||
|
||||
#include "ControlCitation.h"
|
||||
#include "FormCitation.h"
|
||||
#include "forms/form_citation.h"
|
||||
|
||||
#include "ControlError.h"
|
||||
#include "FormError.h"
|
||||
#include "forms/form_error.h"
|
||||
|
||||
#include "ControlERT.h"
|
||||
#include "FormERT.h"
|
||||
#include "forms/form_ert.h"
|
||||
|
||||
#include "ControlIndex.h"
|
||||
#include "FormIndex.h"
|
||||
#include "forms/form_index.h"
|
||||
|
||||
#include "ControlRef.h"
|
||||
#include "FormRef.h"
|
||||
#include "forms/form_ref.h"
|
||||
|
||||
#include "ControlToc.h"
|
||||
#include "FormToc.h"
|
||||
#include "forms/form_toc.h"
|
||||
|
||||
#include "ControlUrl.h"
|
||||
#include "FormUrl.h"
|
||||
#include "forms/form_url.h"
|
||||
|
||||
#include "xformsBC.h"
|
||||
#include "ButtonController.h"
|
||||
|
||||
|
||||
typedef ButtonController<OkCancelPolicy, xformsBC>
|
||||
OkCancelBC;
|
||||
|
||||
typedef ButtonController<OkCancelReadOnlyPolicy, xformsBC>
|
||||
OkCancelReadOnlyBC;
|
||||
|
||||
typedef ButtonController<NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
NoRepeatedApplyReadOnlyBC;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
// char const * const dialognames[] = { "bibitem", "bibtex", "citation",
|
||||
// "error", "ert", "external", "float",
|
||||
// "graphics", "include", "index",
|
||||
// "minipage", "ref", "tabular", "toc",
|
||||
// "url", "wrap" };
|
||||
char const * const dialognames[] = { "bibitem", "bibtex", "citation",
|
||||
"error", "ert", "index", "ref",
|
||||
"toc", "url" };
|
||||
|
||||
char const * const * const end_dialognames =
|
||||
dialognames + (sizeof(dialognames) / sizeof(char *));
|
||||
|
||||
struct cmpCStr {
|
||||
cmpCStr(char const * name) : name_(name) {}
|
||||
bool operator()(char const * other) {
|
||||
return strcmp(other, name_) == 0;
|
||||
}
|
||||
private:
|
||||
char const * name_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
bool Dialogs::isValidName(string const & name) const
|
||||
{
|
||||
return std::find_if(dialognames, end_dialognames,
|
||||
cmpCStr(name.c_str())) != end_dialognames;
|
||||
}
|
||||
|
||||
|
||||
Dialog * Dialogs::build(string const & name)
|
||||
{
|
||||
if (!isValidName(name))
|
||||
return 0;
|
||||
|
||||
Dialog * dialog = new Dialog(lyxview_, name);
|
||||
|
||||
if (name == "bibitem") {
|
||||
dialog->setController(new ControlBibitem(*dialog));
|
||||
dialog->setView(new FormBibitem(*dialog));
|
||||
dialog->setButtonController(new OkCancelReadOnlyBC);
|
||||
} else if (name == "bibtex") {
|
||||
dialog->setController(new ControlBibtex(*dialog));
|
||||
dialog->setView(new FormBibtex(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "citation") {
|
||||
dialog->setController(new ControlCitation(*dialog));
|
||||
dialog->setView(new FormCitation(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "error") {
|
||||
dialog->setController(new ControlError(*dialog));
|
||||
dialog->setView(new FormError(*dialog));
|
||||
dialog->setButtonController(new OkCancelBC);
|
||||
} else if (name == "ert") {
|
||||
dialog->setController(new ControlERT(*dialog));
|
||||
dialog->setView(new FormERT(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "index") {
|
||||
dialog->setController(new ControlIndex(*dialog));
|
||||
dialog->setView(new FormIndex(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "ref") {
|
||||
dialog->setController(new ControlRef(*dialog));
|
||||
dialog->setView(new FormRef(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
} else if (name == "toc") {
|
||||
dialog->setController(new ControlToc(*dialog));
|
||||
dialog->setView(new FormToc(*dialog));
|
||||
dialog->setButtonController(new OkCancelBC);
|
||||
} else if (name == "url") {
|
||||
dialog->setController(new ControlUrl(*dialog));
|
||||
dialog->setView(new FormUrl(*dialog));
|
||||
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC);
|
||||
}
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::toggleTooltips()
|
||||
{
|
||||
Tooltips::toggleEnabled();
|
||||
}
|
||||
|
||||
|
||||
/// Are the tooltips on or off?
|
||||
bool Dialogs::tooltipsEnabled()
|
||||
{
|
||||
return Tooltips::enabled();
|
||||
}
|
@ -23,14 +23,6 @@
|
||||
#include "FormAboutlyx.h"
|
||||
#include "forms/form_aboutlyx.h"
|
||||
|
||||
#include "ControlBibitem.h"
|
||||
#include "FormBibitem.h"
|
||||
#include "forms/form_bibitem.h"
|
||||
|
||||
#include "ControlBibtex.h"
|
||||
#include "FormBibtex.h"
|
||||
#include "forms/form_bibtex.h"
|
||||
|
||||
#include "FormBrowser.h"
|
||||
#include "forms/form_browser.h"
|
||||
|
||||
@ -42,22 +34,10 @@
|
||||
#include "FormCharacter.h"
|
||||
#include "forms/form_character.h"
|
||||
|
||||
#include "ControlCitation.h"
|
||||
#include "FormCitation.h"
|
||||
#include "forms/form_citation.h"
|
||||
|
||||
#include "ControlDocument.h"
|
||||
#include "FormDocument.h"
|
||||
#include "forms/form_document.h"
|
||||
|
||||
#include "ControlError.h"
|
||||
#include "FormError.h"
|
||||
#include "forms/form_error.h"
|
||||
|
||||
#include "ControlERT.h"
|
||||
#include "FormERT.h"
|
||||
#include "forms/form_ert.h"
|
||||
|
||||
#include "ControlExternal.h"
|
||||
#include "FormExternal.h"
|
||||
#include "forms/form_external.h"
|
||||
@ -78,10 +58,6 @@
|
||||
#include "FormInclude.h"
|
||||
#include "forms/form_include.h"
|
||||
|
||||
#include "ControlIndex.h"
|
||||
#include "FormIndex.h"
|
||||
#include "forms/form_index.h"
|
||||
|
||||
#include "ControlLog.h"
|
||||
#include "FormLog.h"
|
||||
|
||||
@ -112,10 +88,6 @@
|
||||
#include "FormPrint.h"
|
||||
#include "forms/form_print.h"
|
||||
|
||||
#include "ControlRef.h"
|
||||
#include "FormRef.h"
|
||||
#include "forms/form_ref.h"
|
||||
|
||||
#include "ControlSearch.h"
|
||||
#include "FormSearch.h"
|
||||
#include "forms/form_search.h"
|
||||
@ -146,14 +118,6 @@
|
||||
#include "forms/form_thesaurus.h"
|
||||
#endif
|
||||
|
||||
#include "ControlToc.h"
|
||||
#include "FormToc.h"
|
||||
#include "forms/form_toc.h"
|
||||
|
||||
#include "ControlUrl.h"
|
||||
#include "FormUrl.h"
|
||||
#include "forms/form_url.h"
|
||||
|
||||
#include "ControlVCLog.h"
|
||||
#include "FormVCLog.h"
|
||||
|
||||
@ -165,30 +129,15 @@
|
||||
typedef GUI<ControlAboutlyx, FormAboutlyx, OkCancelPolicy, xformsBC>
|
||||
AboutlyxDialog;
|
||||
|
||||
typedef GUI<ControlBibitem, FormBibitem, OkCancelReadOnlyPolicy, xformsBC>
|
||||
BibitemDialog;
|
||||
|
||||
typedef GUI<ControlBibtex, FormBibtex, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
BibtexDialog;
|
||||
|
||||
typedef GUI<ControlChanges, FormChanges, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
ChangesDialog;
|
||||
|
||||
typedef GUI<ControlCharacter, FormCharacter, OkApplyCancelReadOnlyPolicy, xformsBC>
|
||||
CharacterDialog;
|
||||
|
||||
typedef GUI<ControlCitation, FormCitation, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
CitationDialog;
|
||||
|
||||
typedef GUI<ControlDocument, FormDocument, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
DocumentDialog;
|
||||
|
||||
typedef GUI<ControlError, FormError, OkCancelPolicy, xformsBC>
|
||||
ErrorDialog;
|
||||
|
||||
typedef GUI<ControlERT, FormERT, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
ERTDialog;
|
||||
|
||||
typedef GUI<ControlExternal, FormExternal, OkApplyCancelReadOnlyPolicy, xformsBC>
|
||||
ExternalDialog;
|
||||
|
||||
@ -207,9 +156,6 @@ GraphicsDialog;
|
||||
typedef GUI<ControlInclude, FormInclude, OkCancelReadOnlyPolicy, xformsBC>
|
||||
IncludeDialog;
|
||||
|
||||
typedef GUI<ControlIndex, FormIndex, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
IndexDialog;
|
||||
|
||||
typedef GUI<ControlLog, FormLog, OkCancelPolicy, xformsBC>
|
||||
LogFileDialog;
|
||||
|
||||
@ -231,9 +177,6 @@ PreferencesDialog;
|
||||
typedef GUI<ControlPrint, FormPrint, OkApplyCancelPolicy, xformsBC>
|
||||
PrintDialog;
|
||||
|
||||
typedef GUI<ControlRef, FormRef, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
RefDialog;
|
||||
|
||||
typedef GUI<ControlSearch, FormSearch, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
SearchDialog;
|
||||
|
||||
@ -257,12 +200,6 @@ typedef GUI<ControlThesaurus, FormThesaurus, OkApplyCancelReadOnlyPolicy, xforms
|
||||
ThesaurusDialog;
|
||||
#endif
|
||||
|
||||
typedef GUI<ControlToc, FormToc, OkCancelPolicy, xformsBC>
|
||||
TocDialog;
|
||||
|
||||
typedef GUI<ControlUrl, FormUrl, NoRepeatedApplyReadOnlyPolicy, xformsBC>
|
||||
UrlDialog;
|
||||
|
||||
typedef GUI<ControlVCLog, FormVCLog, OkCancelPolicy, xformsBC>
|
||||
VCLogFileDialog;
|
||||
|
||||
@ -273,21 +210,15 @@ struct Dialogs::Impl {
|
||||
Impl(LyXView & lv, Dialogs & d);
|
||||
|
||||
AboutlyxDialog aboutlyx;
|
||||
BibitemDialog bibitem;
|
||||
BibtexDialog bibtex;
|
||||
ChangesDialog changes;
|
||||
CharacterDialog character;
|
||||
CitationDialog citation;
|
||||
DocumentDialog document;
|
||||
ErrorDialog error;
|
||||
ERTDialog ert;
|
||||
ExternalDialog external;
|
||||
FileDialog file;
|
||||
FloatDialog floats;
|
||||
ForksDialog forks;
|
||||
GraphicsDialog graphics;
|
||||
IncludeDialog include;
|
||||
IndexDialog index;
|
||||
LogFileDialog logfile;
|
||||
MathPanelDialog mathpanel;
|
||||
MinipageDialog minipage;
|
||||
@ -295,7 +226,6 @@ struct Dialogs::Impl {
|
||||
PreambleDialog preamble;
|
||||
PreferencesDialog preferences;
|
||||
PrintDialog print;
|
||||
RefDialog ref;
|
||||
SearchDialog search;
|
||||
SendtoDialog sendto;
|
||||
SpellcheckerDialog spellchecker;
|
||||
@ -307,8 +237,6 @@ struct Dialogs::Impl {
|
||||
ThesaurusDialog thesaurus;
|
||||
#endif
|
||||
|
||||
TocDialog toc;
|
||||
UrlDialog url;
|
||||
VCLogFileDialog vclogfile;
|
||||
WrapDialog wrap;
|
||||
};
|
||||
|
@ -20,10 +20,10 @@
|
||||
#include "gettext.h"
|
||||
#include "support/lstrings.h" // compare
|
||||
|
||||
typedef FormCB<ControlBibitem, FormDB<FD_bibitem> > base_class;
|
||||
typedef FormController<ControlBibitem, FormView<FD_bibitem> > base_class;
|
||||
|
||||
FormBibitem::FormBibitem()
|
||||
: base_class(_("Bibliography Entry"))
|
||||
FormBibitem::FormBibitem(Dialog & parent)
|
||||
: base_class(parent, _("Bibliography Entry"))
|
||||
{}
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#define FORMBIBITEM_H
|
||||
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "FormDialogView.h"
|
||||
|
||||
class ControlBibitem;
|
||||
struct FD_bibitem;
|
||||
@ -22,10 +22,10 @@ struct FD_bibitem;
|
||||
/**
|
||||
* For bibliography entry editing
|
||||
*/
|
||||
class FormBibitem : public FormCB<ControlBibitem, FormDB<FD_bibitem> > {
|
||||
class FormBibitem : public FormController<ControlBibitem, FormView<FD_bibitem> > {
|
||||
public:
|
||||
///
|
||||
FormBibitem();
|
||||
FormBibitem(Dialog &);
|
||||
private:
|
||||
/// Set the Params variable for the Controller.
|
||||
virtual void apply();
|
||||
|
@ -32,10 +32,10 @@ using std::vector;
|
||||
using std::sort;
|
||||
|
||||
|
||||
typedef FormCB<ControlBibtex, FormDB<FD_bibtex> > base_class;
|
||||
typedef FormController<ControlBibtex, FormView<FD_bibtex> > base_class;
|
||||
|
||||
FormBibtex::FormBibtex()
|
||||
: base_class(_("BibTeX Database"))
|
||||
FormBibtex::FormBibtex(Dialog & parent)
|
||||
: base_class(parent, _("BibTeX Database"))
|
||||
{}
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ void FormBibtex::build()
|
||||
|
||||
// callback for double click in browser
|
||||
fl_set_browser_dblclick_callback(dialog_->browser_styles,
|
||||
C_FormBaseInputCB, 2);
|
||||
C_FormDialogView_InputCB, 2);
|
||||
|
||||
// set up the tooltips
|
||||
string str = _("The database you want to cite from. Insert it "
|
||||
|
@ -14,7 +14,7 @@
|
||||
#define FORMBIBTEX_H
|
||||
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "FormDialogView.h"
|
||||
|
||||
class ControlBibtex;
|
||||
struct FD_bibtex;
|
||||
@ -22,10 +22,10 @@ struct FD_bibtex;
|
||||
/**
|
||||
* For bibtex database setting
|
||||
*/
|
||||
class FormBibtex : public FormCB<ControlBibtex, FormDB<FD_bibtex> > {
|
||||
class FormBibtex : public FormController<ControlBibtex, FormView<FD_bibtex> > {
|
||||
public:
|
||||
///
|
||||
FormBibtex();
|
||||
FormBibtex(Dialog &);
|
||||
private:
|
||||
/// Set the Params variable for the Controller.
|
||||
virtual void apply();
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "ControlCitation.h"
|
||||
#include "FormCitation.h"
|
||||
#include "forms/form_citation.h"
|
||||
#include "Kernel.h"
|
||||
#include "Tooltips.h"
|
||||
#include "helper_funcs.h"
|
||||
#include "xforms_helpers.h"
|
||||
@ -86,11 +87,11 @@ void updateStyle(FD_citation * dialog, string command)
|
||||
} // namespace anon
|
||||
|
||||
|
||||
typedef FormCB<ControlCitation, FormDB<FD_citation> > base_class;
|
||||
typedef FormController<ControlCitation, FormView<FD_citation> > base_class;
|
||||
|
||||
|
||||
FormCitation::FormCitation()
|
||||
: base_class(_("Citation"))
|
||||
FormCitation::FormCitation(Dialog & parent)
|
||||
: base_class(parent, _("Citation"))
|
||||
{}
|
||||
|
||||
|
||||
@ -124,7 +125,7 @@ void FormCitation::hide()
|
||||
citekeys.clear();
|
||||
bibkeys.clear();
|
||||
|
||||
FormBase::hide();
|
||||
FormDialogView::hide();
|
||||
}
|
||||
|
||||
|
||||
@ -286,7 +287,7 @@ ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long)
|
||||
fl_set_browser_topline(dialog_->browser_cite, n + 1);
|
||||
}
|
||||
|
||||
if (!controller().bufferIsReadonly()) {
|
||||
if (!kernel().isBufferReadonly()) {
|
||||
if (cit != citekeys.end()) {
|
||||
setBibButtons(OFF);
|
||||
setCiteButtons(ON);
|
||||
@ -301,7 +302,7 @@ ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long)
|
||||
if (sel < 1 || sel > citekeys.size())
|
||||
return ButtonPolicy::SMI_NOOP;
|
||||
|
||||
if (!controller().bufferIsReadonly()) {
|
||||
if (!kernel().isBufferReadonly()) {
|
||||
setBibButtons(OFF);
|
||||
setCiteButtons(ON);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
#define FORMCITATION_H
|
||||
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "FormDialogView.h"
|
||||
#include "biblio.h"
|
||||
|
||||
/** This class provides an XForms implementation of the Citation Dialog.
|
||||
@ -21,10 +21,10 @@
|
||||
class ControlCitation;
|
||||
struct FD_citation;
|
||||
|
||||
class FormCitation : public FormCB<ControlCitation, FormDB<FD_citation> > {
|
||||
class FormCitation : public FormController<ControlCitation, FormView<FD_citation> > {
|
||||
public:
|
||||
///
|
||||
FormCitation();
|
||||
FormCitation(Dialog &);
|
||||
private:
|
||||
///
|
||||
enum State {
|
||||
|
443
src/frontends/xforms/FormDialogView.C
Normal file
443
src/frontends/xforms/FormDialogView.C
Normal file
@ -0,0 +1,443 @@
|
||||
/**
|
||||
* \file FormDialogView.C
|
||||
* 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 "FormDialogView.h"
|
||||
|
||||
#include "Dialog.h"
|
||||
#include "xformsBC.h"
|
||||
#include "xforms_resize.h"
|
||||
#include "Tooltips.h"
|
||||
#include "xforms_helpers.h" // formatted
|
||||
|
||||
#include "gettext.h" // _()
|
||||
#include "lyxrc.h"
|
||||
#include "BoostFormat.h"
|
||||
|
||||
#include "support/LAssert.h"
|
||||
#include "support/filetools.h" // LibFileSearch
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
extern "C" {
|
||||
|
||||
// These should be in forms.h but aren't
|
||||
void fl_show_tooltip(const char *, int, int);
|
||||
|
||||
void fl_hide_tooltip();
|
||||
|
||||
// Callback function invoked by xforms when the dialog is closed by the
|
||||
// window manager.
|
||||
static int C_WMHideCB(FL_FORM * form, void *);
|
||||
|
||||
// Callback function invoked by the xforms pre-handler routine.
|
||||
static int C_PrehandlerCB(FL_OBJECT *, int, FL_Coord, FL_Coord, int, void *);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
||||
FormDialogView::FormDialogView(Dialog & parent,
|
||||
string const & t, bool allowResize)
|
||||
: Dialog::View(parent),
|
||||
warning_posted_(false), message_widget_(0),
|
||||
minw_(0), minh_(0), allow_resize_(allowResize),
|
||||
title_(t), icon_pixmap_(0), icon_mask_(0),
|
||||
tooltips_(new Tooltips())
|
||||
{}
|
||||
|
||||
|
||||
FormDialogView::~FormDialogView()
|
||||
{
|
||||
if (icon_pixmap_)
|
||||
XFreePixmap(fl_get_display(), icon_pixmap_);
|
||||
|
||||
delete tooltips_;
|
||||
}
|
||||
|
||||
|
||||
bool FormDialogView::isVisible() const
|
||||
{
|
||||
return form() && form()->visible;
|
||||
}
|
||||
|
||||
|
||||
Tooltips & FormDialogView::tooltips()
|
||||
{
|
||||
return *tooltips_;
|
||||
}
|
||||
|
||||
|
||||
void FormDialogView::redraw()
|
||||
{
|
||||
if (form() && form()->visible)
|
||||
fl_redraw_form(form());
|
||||
}
|
||||
|
||||
|
||||
xformsBC & FormDialogView::bc()
|
||||
{
|
||||
return static_cast<xformsBC &>(dialog().bc());
|
||||
}
|
||||
|
||||
|
||||
void FormDialogView::prepare_to_show()
|
||||
{
|
||||
double const scale = get_scale_to_fit(form());
|
||||
if (scale > 1.001)
|
||||
scale_form_horizontally(form(), scale);
|
||||
|
||||
// work around dumb xforms sizing bug
|
||||
minw_ = form()->w;
|
||||
minh_ = form()->h;
|
||||
|
||||
fl_set_form_atclose(form(), C_WMHideCB, 0);
|
||||
|
||||
// set the title for the minimized form
|
||||
if (!lyxrc.dialogs_iconify_with_main)
|
||||
fl_winicontitle(form()->window, title_.c_str());
|
||||
|
||||
// assign an icon to the form
|
||||
string const iconname = LibFileSearch("images", "lyx", "xpm");
|
||||
if (!iconname.empty()) {
|
||||
unsigned int w, h;
|
||||
icon_pixmap_ = fl_read_pixmapfile(fl_root,
|
||||
iconname.c_str(),
|
||||
&w,
|
||||
&h,
|
||||
&icon_mask_,
|
||||
0, 0, 0);
|
||||
fl_set_form_icon(form(), icon_pixmap_, icon_mask_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormDialogView::show()
|
||||
{
|
||||
if (!form()) {
|
||||
build();
|
||||
}
|
||||
|
||||
// we use minw_ to flag whether the dialog has ever been shown.
|
||||
// In turn, prepare_to_show() initialises various bits 'n' pieces
|
||||
// (including minw_).
|
||||
if (minw_ == 0) {
|
||||
prepare_to_show();
|
||||
}
|
||||
|
||||
// make sure the form is up to date.
|
||||
fl_freeze_form(form());
|
||||
update();
|
||||
fl_unfreeze_form(form());
|
||||
|
||||
if (form()->visible) {
|
||||
fl_raise_form(form());
|
||||
/* This XMapWindow() will hopefully ensure that
|
||||
* iconified dialogs are de-iconified. Mad props
|
||||
* out to those crazy Xlib guys for forgetting a
|
||||
* XDeiconifyWindow(). At least WindowMaker, when
|
||||
* being notified of the redirected MapRequest will
|
||||
* specifically de-iconify. From source, fvwm2 seems
|
||||
* to do the same.
|
||||
*/
|
||||
XMapWindow(fl_get_display(), form()->window);
|
||||
} else {
|
||||
// calls to fl_set_form_minsize/maxsize apply only to the next
|
||||
// fl_show_form(), so this comes first.
|
||||
fl_set_form_minsize(form(), minw_, minh_);
|
||||
if (!allow_resize_)
|
||||
fl_set_form_maxsize(form(), minw_, minh_);
|
||||
|
||||
string const maximize_title = "LyX: " + title_;
|
||||
int const iconify_policy = lyxrc.dialogs_iconify_with_main ?
|
||||
FL_TRANSIENT : 0;
|
||||
|
||||
fl_show_form(form(),
|
||||
FL_PLACE_MOUSE | FL_FREE_SIZE,
|
||||
iconify_policy,
|
||||
maximize_title.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormDialogView::hide()
|
||||
{
|
||||
#if FL_VERSION < 1
|
||||
// Does no harm if none is visible and ensures that the tooltip form
|
||||
// is hidden should the dialog be closed from the keyboard.
|
||||
fl_hide_tooltip();
|
||||
#endif
|
||||
|
||||
// xforms sometimes tries to process a hint-type MotionNotify, and
|
||||
// use XQueryPointer, without verifying if the window still exists.
|
||||
// So we try to clear out motion events in the queue before the
|
||||
// DestroyNotify
|
||||
XSync(fl_get_display(), false);
|
||||
|
||||
if (form() && form()->visible)
|
||||
fl_hide_form(form());
|
||||
}
|
||||
|
||||
|
||||
void FormDialogView::setPrehandler(FL_OBJECT * ob)
|
||||
{
|
||||
lyx::Assert(ob);
|
||||
fl_set_object_prehandler(ob, C_PrehandlerCB);
|
||||
}
|
||||
|
||||
|
||||
void FormDialogView::setMessageWidget(FL_OBJECT * ob)
|
||||
{
|
||||
lyx::Assert(ob && ob->objclass == FL_TEXT);
|
||||
message_widget_ = ob;
|
||||
fl_set_object_lsize(message_widget_, FL_NORMAL_SIZE);
|
||||
}
|
||||
|
||||
|
||||
void FormDialogView::InputCB(FL_OBJECT * ob, long data)
|
||||
{
|
||||
// It is possible to set the choice to 0 when using the
|
||||
// keyboard shortcuts. This work-around deals with the problem.
|
||||
if (ob && ob->objclass == FL_CHOICE && fl_get_choice(ob) < 1) {
|
||||
fl_set_choice(ob, 1);
|
||||
}
|
||||
|
||||
bc().input(input(ob, data));
|
||||
}
|
||||
|
||||
|
||||
ButtonPolicy::SMInput FormDialogView::input(FL_OBJECT *, long)
|
||||
{
|
||||
return ButtonPolicy::SMI_VALID;
|
||||
}
|
||||
|
||||
|
||||
// preemptive handler for feedback messages
|
||||
void FormDialogView::MessageCB(FL_OBJECT * ob, int event)
|
||||
{
|
||||
lyx::Assert(ob);
|
||||
|
||||
switch (event) {
|
||||
case FL_ENTER:
|
||||
{
|
||||
string const feedback = getFeedback(ob);
|
||||
if (feedback.empty() && warning_posted_)
|
||||
break;
|
||||
|
||||
warning_posted_ = false;
|
||||
postMessage(getFeedback(ob));
|
||||
break;
|
||||
}
|
||||
|
||||
case FL_LEAVE:
|
||||
if (!warning_posted_)
|
||||
clearMessage();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormDialogView::PrehandlerCB(FL_OBJECT * ob, int event, int key)
|
||||
{
|
||||
lyx::Assert(ob);
|
||||
|
||||
if (ob->objclass == FL_INPUT && event == FL_PUSH && key == 2) {
|
||||
// Trigger an input event when pasting in an xforms input
|
||||
// object using the middle mouse button.
|
||||
InputCB(ob, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event) {
|
||||
case FL_ENTER:
|
||||
case FL_LEAVE:
|
||||
if (message_widget_) {
|
||||
// Post feedback as the mouse enters the object,
|
||||
// remove it as the mouse leaves.
|
||||
MessageCB(ob, event);
|
||||
}
|
||||
|
||||
#if FL_VERSION < 1
|
||||
if (ob->objclass == FL_TABFOLDER) {
|
||||
// This prehandler is used to work-around an xforms
|
||||
// bug and ensures that the form->x, form->y coords of
|
||||
// the active tabfolder are up to date.
|
||||
|
||||
// The tabfolder itself can be very narrow, being just
|
||||
// the visible border to the tabs.
|
||||
// We thus use both FL_ENTER and FL_LEAVE as flags,
|
||||
// in case the FL_ENTER event is not caught.
|
||||
|
||||
FL_FORM * const folder = fl_get_active_folder(ob);
|
||||
if (folder && folder->window) {
|
||||
fl_get_winorigin(folder->window,
|
||||
&(folder->x), &(folder->y));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
// Tooltips are not displayed on browser widgets due to an xforms' bug.
|
||||
// I have a fix, but it's not yet in the xforms sources.
|
||||
// This is a work-around:
|
||||
switch (event) {
|
||||
case FL_ENTER:
|
||||
if (ob->objclass == FL_BROWSER &&
|
||||
ob->tooltip && *(ob->tooltip)) {
|
||||
int const x = ob->form->x + ob->x;
|
||||
int const y = ob->form->y + ob->y + ob->h + 1;
|
||||
fl_show_tooltip(ob->tooltip, x, y);
|
||||
}
|
||||
break;
|
||||
case FL_LEAVE:
|
||||
case FL_PUSH:
|
||||
case FL_KEYPRESS:
|
||||
if (ob->objclass == FL_BROWSER)
|
||||
fl_hide_tooltip();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormDialogView::postWarning(string const & warning)
|
||||
{
|
||||
warning_posted_ = true;
|
||||
postMessage(warning);
|
||||
}
|
||||
|
||||
|
||||
void FormDialogView::clearMessage()
|
||||
{
|
||||
lyx::Assert(message_widget_);
|
||||
|
||||
warning_posted_ = false;
|
||||
|
||||
string const existing = message_widget_->label
|
||||
? message_widget_->label : string();
|
||||
if (existing.empty())
|
||||
return;
|
||||
|
||||
// This trick is needed to get xforms to clear the label...
|
||||
fl_set_object_label(message_widget_, "");
|
||||
fl_hide_object(message_widget_);
|
||||
}
|
||||
|
||||
|
||||
void FormDialogView::postMessage(string const & message)
|
||||
{
|
||||
lyx::Assert(message_widget_);
|
||||
|
||||
int const width = message_widget_->w - 10;
|
||||
#if USE_BOOST_FORMAT
|
||||
boost::format fmter = warning_posted_ ?
|
||||
boost::format(_("WARNING! %1$s")) :
|
||||
boost::format("%1$s");
|
||||
|
||||
string const str = formatted(boost::io::str(fmter % message),
|
||||
width, FL_NORMAL_SIZE);
|
||||
#else
|
||||
string const tmp = warning_posted_ ?
|
||||
_("WARNING!") + string(" ") + message :
|
||||
message;
|
||||
|
||||
string const str = formatted(tmp, width, FL_NORMAL_SIZE);
|
||||
#endif
|
||||
|
||||
fl_set_object_label(message_widget_, str.c_str());
|
||||
FL_COLOR const label_color = warning_posted_ ? FL_RED : FL_LCOL;
|
||||
fl_set_object_lcol(message_widget_, label_color);
|
||||
|
||||
if (!message_widget_->visible)
|
||||
fl_show_object(message_widget_);
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
FormDialogView * GetForm(FL_OBJECT * ob)
|
||||
{
|
||||
lyx::Assert(ob && ob->form && ob->form->u_vdata);
|
||||
FormDialogView * ptr =
|
||||
static_cast<FormDialogView *>(ob->form->u_vdata);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
void C_FormDialogView_ApplyCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
GetForm(ob)->dialog().ApplyButton();
|
||||
}
|
||||
|
||||
|
||||
void C_FormDialogView_OKCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
GetForm(ob)->dialog().OKButton();
|
||||
}
|
||||
|
||||
|
||||
void C_FormDialogView_CancelCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
FormDialogView * form = GetForm(ob);
|
||||
form->dialog().CancelButton();
|
||||
}
|
||||
|
||||
|
||||
void C_FormDialogView_RestoreCB(FL_OBJECT * ob, long)
|
||||
{
|
||||
GetForm(ob)->dialog().RestoreButton();
|
||||
}
|
||||
|
||||
|
||||
void C_FormDialogView_InputCB(FL_OBJECT * ob, long d)
|
||||
{
|
||||
GetForm(ob)->InputCB(ob, d);
|
||||
}
|
||||
|
||||
|
||||
static int C_WMHideCB(FL_FORM * form, void *)
|
||||
{
|
||||
// Close the dialog cleanly, even if the WM is used to do so.
|
||||
lyx::Assert(form && form->u_vdata);
|
||||
FormDialogView * ptr = static_cast<FormDialogView *>(form->u_vdata);
|
||||
ptr->dialog().CancelButton();
|
||||
return FL_CANCEL;
|
||||
}
|
||||
|
||||
static int C_PrehandlerCB(FL_OBJECT * ob, int event,
|
||||
FL_Coord, FL_Coord, int key, void *)
|
||||
{
|
||||
// Note that the return value is important in the pre-emptive handler.
|
||||
// Don't return anything other than 0.
|
||||
lyx::Assert(ob);
|
||||
|
||||
// Don't Assert this one, as it can happen quite naturally when things
|
||||
// are being deleted in the d-tor.
|
||||
//Assert(ob->form);
|
||||
if (!ob->form) return 0;
|
||||
|
||||
FormDialogView * ptr =
|
||||
static_cast<FormDialogView *>(ob->form->u_vdata);
|
||||
|
||||
if (ptr)
|
||||
ptr->PrehandlerCB(ob, event, key);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // extern "C"
|
198
src/frontends/xforms/FormDialogView.h
Normal file
198
src/frontends/xforms/FormDialogView.h
Normal file
@ -0,0 +1,198 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file FormDialogView.h
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* A base class for the MCV-ed xforms dialogs.
|
||||
*/
|
||||
|
||||
#ifndef FORMDIALOGVIEW_H
|
||||
#define FORMDIALOGVIEW_H
|
||||
|
||||
|
||||
#include "Dialog.h"
|
||||
#include "ButtonPolicies.h"
|
||||
#include "forms_fwd.h"
|
||||
|
||||
#include "LString.h"
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <X11/Xlib.h> // for Pixmap
|
||||
|
||||
class xformsBC;
|
||||
class Tooltips;
|
||||
|
||||
|
||||
/** This class is an XForms GUI base class.
|
||||
*/
|
||||
class FormDialogView : public Dialog::View {
|
||||
public:
|
||||
///
|
||||
FormDialogView(Dialog &, string const &, bool allowResize);
|
||||
///
|
||||
virtual ~FormDialogView();
|
||||
|
||||
/** Input callback function.
|
||||
* Invoked only by the xforms callback interface
|
||||
*/
|
||||
void InputCB(FL_OBJECT *, long);
|
||||
|
||||
/** Message callback function.
|
||||
* Invoked only by the xforms callback interface
|
||||
*/
|
||||
void MessageCB(FL_OBJECT *, int event);
|
||||
|
||||
/** Prehandler callback function.
|
||||
* Invoked only by the xforms callback interface
|
||||
*/
|
||||
void PrehandlerCB(FL_OBJECT * ob, int event, int key);
|
||||
|
||||
///
|
||||
Tooltips & tooltips();
|
||||
|
||||
protected:
|
||||
/// Build the dialog
|
||||
virtual void build() = 0;
|
||||
/// Hide the dialog.
|
||||
virtual void hide();
|
||||
/// Create the dialog if necessary, update it and display it.
|
||||
virtual void show();
|
||||
///
|
||||
virtual bool isVisible() const;
|
||||
|
||||
/** Prepare the way to:
|
||||
* 1. display feedback as the mouse moves over ob. This feedback will
|
||||
* typically be rather more verbose than just a tooltip.
|
||||
* 2. activate the button controller after a paste with the middle
|
||||
* mouse button.
|
||||
*/
|
||||
static void setPrehandler(FL_OBJECT * ob);
|
||||
|
||||
/** Pass the class a pointer to the message_widget so that it can
|
||||
post the message */
|
||||
void setMessageWidget(FL_OBJECT * message_widget);
|
||||
|
||||
/** Send the warning message from the daughter class to the
|
||||
message_widget direct. The message will persist till the mouse
|
||||
movesto a new object. */
|
||||
void postWarning(string const & warning);
|
||||
/// Reset the message_widget_
|
||||
void clearMessage();
|
||||
|
||||
///
|
||||
xformsBC & bc();
|
||||
|
||||
private:
|
||||
/// Pointer to the actual instantiation of xform's form
|
||||
virtual FL_FORM * form() const = 0;
|
||||
/// Filter the inputs on callback from xforms
|
||||
virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
|
||||
|
||||
/** Redraw the form (on receipt of a Signal indicating, for example,
|
||||
* that the xform colors have been re-mapped).
|
||||
*/
|
||||
virtual void redraw();
|
||||
|
||||
/** Called on the first show() request, initialising various bits and
|
||||
* pieces.
|
||||
*/
|
||||
void prepare_to_show();
|
||||
|
||||
/** Get the feedback message for ob.
|
||||
Called if warning_posted_ == false. */
|
||||
virtual string const getFeedback(FL_OBJECT * /* ob */)
|
||||
{ return string(); }
|
||||
|
||||
/// Post the feedback message for ob to message_widget_
|
||||
void postMessage(string const & message);
|
||||
|
||||
/** Variable used to decide whether to remove the existing feedback
|
||||
message or not (if it is in fact a warning) */
|
||||
bool warning_posted_;
|
||||
/// The widget to display the feedback
|
||||
FL_OBJECT * message_widget_;
|
||||
|
||||
/// The dialog's minimum allowable dimensions.
|
||||
int minw_;
|
||||
///
|
||||
int minh_;
|
||||
/// Can the dialog be resized after it has been created?
|
||||
bool allow_resize_;
|
||||
/// dialog title, displayed by the window manager.
|
||||
string title_;
|
||||
/// Passed to the window manager to give a pretty little symbol ;-)
|
||||
Pixmap icon_pixmap_;
|
||||
///
|
||||
Pixmap icon_mask_;
|
||||
///
|
||||
Tooltips * tooltips_;
|
||||
};
|
||||
|
||||
|
||||
template <class FL_dialog>
|
||||
class FormView: public FormDialogView {
|
||||
protected:
|
||||
///
|
||||
FormView(Dialog &, string const &, bool allowResize=true);
|
||||
/// Pointer to the actual instantiation of xform's form
|
||||
virtual FL_FORM * form() const;
|
||||
/// Real GUI implementation.
|
||||
boost::scoped_ptr<FL_dialog> dialog_;
|
||||
};
|
||||
|
||||
|
||||
template <class FL_dialog>
|
||||
FormView<FL_dialog>::FormView(Dialog & parent, string const & t,
|
||||
bool allowResize)
|
||||
: FormDialogView(parent, t, allowResize)
|
||||
{}
|
||||
|
||||
|
||||
template <class FL_dialog>
|
||||
FL_FORM * FormView<FL_dialog>::form() const
|
||||
{
|
||||
return dialog_.get() ? dialog_->form : 0;
|
||||
}
|
||||
|
||||
|
||||
template <class Controller, class Base>
|
||||
class FormController: public Base {
|
||||
public:
|
||||
/// The parent controller
|
||||
Controller & controller();
|
||||
///
|
||||
Controller const & controller() const;
|
||||
|
||||
protected:
|
||||
///
|
||||
FormController(Dialog &, string const &, bool allowResize = true);
|
||||
};
|
||||
|
||||
|
||||
template <class Controller, class Base>
|
||||
FormController<Controller, Base>::FormController(Dialog & p,
|
||||
string const & t, bool resize)
|
||||
: Base(p, t, resize)
|
||||
{}
|
||||
|
||||
|
||||
template <class Controller, class Base>
|
||||
Controller & FormController<Controller, Base>::controller()
|
||||
{
|
||||
return static_cast<Controller &>(getController());
|
||||
}
|
||||
|
||||
|
||||
template <class Controller, class Base>
|
||||
Controller const & FormController<Controller, Base>::controller() const
|
||||
{
|
||||
return static_cast<Controller const &>(getController());
|
||||
}
|
||||
|
||||
|
||||
#endif // FORMDIALOGVIEW_H
|
@ -20,10 +20,10 @@
|
||||
#include "debug.h"
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
typedef FormCB<ControlERT, FormDB<FD_ert> > base_class;
|
||||
typedef FormController<ControlERT, FormView<FD_ert> > base_class;
|
||||
|
||||
FormERT::FormERT()
|
||||
: base_class(_("ERT Options"))
|
||||
FormERT::FormERT(Dialog & parent)
|
||||
: base_class(parent, _("ERT Options"))
|
||||
{}
|
||||
|
||||
|
||||
@ -45,17 +45,17 @@ void FormERT::build()
|
||||
void FormERT::apply()
|
||||
{
|
||||
if (fl_get_button(dialog_->radio_open))
|
||||
controller().params().status = InsetERT::Open;
|
||||
controller().setStatus(InsetERT::Open);
|
||||
else if (fl_get_button(dialog_->radio_collapsed))
|
||||
controller().params().status = InsetERT::Collapsed;
|
||||
controller().setStatus(InsetERT::Collapsed);
|
||||
else
|
||||
controller().params().status = InsetERT::Inlined;
|
||||
controller().setStatus(InsetERT::Inlined);
|
||||
}
|
||||
|
||||
|
||||
void FormERT::update()
|
||||
{
|
||||
switch (controller().params().status) {
|
||||
switch (controller().status()) {
|
||||
case InsetERT::Open:
|
||||
fl_set_button(dialog_->radio_open, 1);
|
||||
break;
|
||||
|
@ -13,7 +13,8 @@
|
||||
#define FORMERT_H
|
||||
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "FormDialogView.h"
|
||||
|
||||
|
||||
class ControlERT;
|
||||
struct FD_ert;
|
||||
@ -21,11 +22,10 @@ struct FD_ert;
|
||||
/** This class provides an XForms implementation of the ERT
|
||||
Dialog.
|
||||
*/
|
||||
class FormERT
|
||||
: public FormCB<ControlERT, FormDB<FD_ert> > {
|
||||
class FormERT : public FormController<ControlERT, FormView<FD_ert> > {
|
||||
public:
|
||||
///
|
||||
FormERT();
|
||||
FormERT(Dialog &);
|
||||
private:
|
||||
/// Set the Params variable for the Controller.
|
||||
virtual void apply();
|
||||
|
@ -18,10 +18,10 @@
|
||||
#include "xforms_helpers.h" // formatted
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
typedef FormCB<ControlError, FormDB<FD_error> > base_class;
|
||||
typedef FormController<ControlError, FormView<FD_error> > base_class;
|
||||
|
||||
FormError::FormError()
|
||||
: base_class(_("LaTeX Error"))
|
||||
FormError::FormError(Dialog & parent)
|
||||
: base_class(parent, _("LaTeX Error"))
|
||||
{}
|
||||
|
||||
|
||||
|
@ -13,17 +13,18 @@
|
||||
#define FORMERROR_H
|
||||
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "FormDialogView.h"
|
||||
|
||||
|
||||
class ControlError;
|
||||
struct FD_error;
|
||||
|
||||
/** This class provides an XForms implementation of the Error Dialog.
|
||||
*/
|
||||
class FormError : public FormCB<ControlError, FormDB<FD_error> > {
|
||||
class FormError : public FormController<ControlError, FormView<FD_error> > {
|
||||
public:
|
||||
/// Constructor
|
||||
FormError();
|
||||
FormError(Dialog &);
|
||||
private:
|
||||
/// not needed.
|
||||
virtual void apply() {}
|
||||
|
@ -20,10 +20,10 @@
|
||||
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
typedef FormCB<ControlIndex, FormDB<FD_index> > base_class;
|
||||
typedef FormController<ControlIndex, FormView<FD_index> > base_class;
|
||||
|
||||
FormIndex::FormIndex()
|
||||
: base_class(_("Index"))
|
||||
FormIndex::FormIndex(Dialog & parent)
|
||||
: base_class(parent, _("Index"))
|
||||
{}
|
||||
|
||||
|
||||
|
@ -13,17 +13,17 @@
|
||||
#define FORMINDEX_H
|
||||
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "FormDialogView.h"
|
||||
|
||||
class ControlIndex;
|
||||
struct FD_index;
|
||||
|
||||
/** This class provides an XForms implementation of the Index Dialog.
|
||||
*/
|
||||
class FormIndex : public FormCB<ControlIndex, FormDB<FD_index> > {
|
||||
class FormIndex : public FormController<ControlIndex, FormView<FD_index> > {
|
||||
public:
|
||||
///
|
||||
FormIndex();
|
||||
FormIndex(Dialog &);
|
||||
private:
|
||||
/// Set the Params variable for the Controller.
|
||||
virtual void apply();
|
||||
|
@ -28,10 +28,10 @@ using std::max;
|
||||
using std::sort;
|
||||
using std::vector;
|
||||
|
||||
typedef FormCB<ControlRef, FormDB<FD_ref> > base_class;
|
||||
typedef FormController<ControlRef, FormView<FD_ref> > base_class;
|
||||
|
||||
FormRef::FormRef()
|
||||
: base_class(_("Reference")),
|
||||
FormRef::FormRef(Dialog & parent)
|
||||
: base_class(parent, _("Reference")),
|
||||
at_ref_(false)
|
||||
{}
|
||||
|
||||
@ -90,16 +90,15 @@ void FormRef::update()
|
||||
switch_go_button();
|
||||
|
||||
// Name is irrelevant to LaTeX/Literate documents
|
||||
if (controller().docType() == ControlRef::LATEX ||
|
||||
controller().docType() == ControlRef::LITERATE) {
|
||||
Kernel::DocTypes doctype = kernel().docType();
|
||||
if (doctype == Kernel::LATEX || doctype == Kernel::LITERATE) {
|
||||
setEnabled(dialog_->input_name, false);
|
||||
} else {
|
||||
setEnabled(dialog_->input_name, true);
|
||||
}
|
||||
|
||||
// type is irrelevant to LinuxDoc/DocBook.
|
||||
if (controller().docType() == ControlRef::LINUXDOC ||
|
||||
controller().docType() == ControlRef::DOCBOOK) {
|
||||
if (doctype == Kernel::LINUXDOC || doctype == Kernel::DOCBOOK) {
|
||||
fl_set_choice(dialog_->choice_format, 1);
|
||||
setEnabled(dialog_->choice_format, false);
|
||||
} else {
|
||||
@ -226,7 +225,7 @@ ButtonPolicy::SMInput FormRef::input(FL_OBJECT * ob, long)
|
||||
if (sel < 1 || sel > refs_.size())
|
||||
return ButtonPolicy::SMI_NOOP;
|
||||
|
||||
if (!controller().bufferIsReadonly()) {
|
||||
if (!kernel().isBufferReadonly()) {
|
||||
string s = fl_get_browser_line(dialog_->browser_refs, sel);
|
||||
fl_set_input(dialog_->input_ref, s.c_str());
|
||||
}
|
||||
|
@ -13,17 +13,17 @@
|
||||
#define FORMREF_H
|
||||
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "FormDialogView.h"
|
||||
|
||||
class ControlRef;
|
||||
struct FD_ref;
|
||||
|
||||
/** This class provides an XForms implementation of the FormRef Dialog.
|
||||
*/
|
||||
class FormRef : public FormCB<ControlRef, FormDB<FD_ref> > {
|
||||
class FormRef : public FormController<ControlRef, FormView<FD_ref> > {
|
||||
public:
|
||||
///
|
||||
FormRef();
|
||||
FormRef(Dialog &);
|
||||
private:
|
||||
/// Set the Params variable for the Controller.
|
||||
virtual void apply();
|
||||
|
@ -27,10 +27,10 @@ using std::vector;
|
||||
using std::endl;
|
||||
|
||||
|
||||
typedef FormCB<ControlToc, FormDB<FD_toc> > base_class;
|
||||
typedef FormController<ControlToc, FormView<FD_toc> > base_class;
|
||||
|
||||
FormToc::FormToc()
|
||||
: base_class(_("Table of Contents"))
|
||||
FormToc::FormToc(Dialog & parent)
|
||||
: base_class(parent, _("Table of Contents"))
|
||||
{}
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#define FORMTOC_H
|
||||
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "FormDialogView.h"
|
||||
#include "toc.h"
|
||||
|
||||
class ControlToc;
|
||||
@ -21,10 +21,10 @@ struct FD_toc;
|
||||
|
||||
/** This class provides an XForms implementation of the FormToc Dialog.
|
||||
*/
|
||||
class FormToc : public FormCB<ControlToc, FormDB<FD_toc> > {
|
||||
class FormToc : public FormController<ControlToc, FormView<FD_toc> > {
|
||||
public:
|
||||
///
|
||||
FormToc();
|
||||
FormToc(Dialog &);
|
||||
private:
|
||||
/// not needed
|
||||
virtual void apply() {}
|
||||
|
@ -18,10 +18,10 @@
|
||||
#include "forms/form_url.h"
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
typedef FormCB<ControlUrl, FormDB<FD_url> > base_class;
|
||||
typedef FormController<ControlUrl, FormView<FD_url> > base_class;
|
||||
|
||||
FormUrl::FormUrl()
|
||||
: base_class(_("Url"))
|
||||
FormUrl::FormUrl(Dialog & parent)
|
||||
: base_class(parent, _("Url"))
|
||||
{}
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user