]> git.lyx.org Git - lyx.git/commitdiff
Hold on to your hats.
authorAngus Leeming <leeming@lyx.org>
Tue, 25 Feb 2003 14:51:38 +0000 (14:51 +0000)
committerAngus Leeming <leeming@lyx.org>
Tue, 25 Feb 2003 14:51:38 +0000 (14:51 +0000)
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

147 files changed:
lib/ChangeLog
lib/ui/default.ui
src/BufferView_pimpl.C
src/ChangeLog
src/LyXAction.C
src/commandtags.h
src/factory.C
src/frontends/ChangeLog
src/frontends/Dialogs.C
src/frontends/Dialogs.h
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlBibitem.C
src/frontends/controllers/ControlBibitem.h
src/frontends/controllers/ControlBibtex.C
src/frontends/controllers/ControlBibtex.h
src/frontends/controllers/ControlCitation.C
src/frontends/controllers/ControlCitation.h
src/frontends/controllers/ControlCommand.C
src/frontends/controllers/ControlCommand.h
src/frontends/controllers/ControlConnections.C
src/frontends/controllers/ControlERT.C
src/frontends/controllers/ControlERT.h
src/frontends/controllers/ControlError.C
src/frontends/controllers/ControlError.h
src/frontends/controllers/ControlIndex.C
src/frontends/controllers/ControlIndex.h
src/frontends/controllers/ControlRef.C
src/frontends/controllers/ControlRef.h
src/frontends/controllers/ControlToc.C
src/frontends/controllers/ControlToc.h
src/frontends/controllers/ControlUrl.C
src/frontends/controllers/ControlUrl.h
src/frontends/controllers/Dialog.C [new file with mode: 0644]
src/frontends/controllers/Dialog.h [new file with mode: 0644]
src/frontends/controllers/Kernel.C [new file with mode: 0644]
src/frontends/controllers/Kernel.h [new file with mode: 0644]
src/frontends/controllers/Makefile.am
src/frontends/gnome/Dialogs.C
src/frontends/gnome/Dialogs2.C
src/frontends/gnome/Dialogs3.C [new file with mode: 0644]
src/frontends/gnome/Dialogs_impl.h
src/frontends/gnome/GError.C
src/frontends/gnome/GError.h
src/frontends/gnome/GUrl.C
src/frontends/gnome/GUrl.h
src/frontends/gnome/GView.C [new file with mode: 0644]
src/frontends/gnome/GView.h [new file with mode: 0644]
src/frontends/gnome/Makefile.am
src/frontends/guiapi.C
src/frontends/guiapi.h
src/frontends/qt2/Dialogs.C
src/frontends/qt2/Dialogs2.C
src/frontends/qt2/Dialogs3.C [new file with mode: 0644]
src/frontends/qt2/Dialogs_impl.h
src/frontends/qt2/Makefile.am
src/frontends/qt2/Makefile.dialogs
src/frontends/qt2/QBibitem.C
src/frontends/qt2/QBibitem.h
src/frontends/qt2/QBibtex.C
src/frontends/qt2/QBibtex.h
src/frontends/qt2/QCitation.C
src/frontends/qt2/QCitation.h
src/frontends/qt2/QDialogView.C [new file with mode: 0644]
src/frontends/qt2/QDialogView.h [new file with mode: 0644]
src/frontends/qt2/QERT.C
src/frontends/qt2/QERT.h
src/frontends/qt2/QError.C
src/frontends/qt2/QError.h
src/frontends/qt2/QIndex.C
src/frontends/qt2/QIndex.h
src/frontends/qt2/QRef.C
src/frontends/qt2/QRef.h
src/frontends/qt2/QToc.C
src/frontends/qt2/QToc.h
src/frontends/qt2/QURL.C
src/frontends/qt2/QURL.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/Dialogs.C
src/frontends/xforms/Dialogs2.C
src/frontends/xforms/Dialogs3.C [new file with mode: 0644]
src/frontends/xforms/Dialogs_impl.h
src/frontends/xforms/FormBibitem.C
src/frontends/xforms/FormBibitem.h
src/frontends/xforms/FormBibtex.C
src/frontends/xforms/FormBibtex.h
src/frontends/xforms/FormCitation.C
src/frontends/xforms/FormCitation.h
src/frontends/xforms/FormDialogView.C [new file with mode: 0644]
src/frontends/xforms/FormDialogView.h [new file with mode: 0644]
src/frontends/xforms/FormERT.C
src/frontends/xforms/FormERT.h
src/frontends/xforms/FormError.C
src/frontends/xforms/FormError.h
src/frontends/xforms/FormIndex.C
src/frontends/xforms/FormIndex.h
src/frontends/xforms/FormRef.C
src/frontends/xforms/FormRef.h
src/frontends/xforms/FormToc.C
src/frontends/xforms/FormToc.h
src/frontends/xforms/FormUrl.C
src/frontends/xforms/FormUrl.h
src/frontends/xforms/Makefile.am
src/frontends/xforms/XWorkArea.C
src/frontends/xforms/forms/form_bibitem.fd
src/frontends/xforms/forms/form_bibtex.fd
src/frontends/xforms/forms/form_citation.fd
src/frontends/xforms/forms/form_error.fd
src/frontends/xforms/forms/form_ert.fd
src/frontends/xforms/forms/form_index.fd
src/frontends/xforms/forms/form_ref.fd
src/frontends/xforms/forms/form_toc.fd
src/frontends/xforms/forms/form_url.fd
src/insets/ChangeLog
src/insets/Makefile.am
src/insets/insetbibitem.C
src/insets/insetbibitem.h
src/insets/insetbibtex.C
src/insets/insetbibtex.h
src/insets/insetbutton.C
src/insets/insetbutton.h
src/insets/insetcite.C
src/insets/insetcite.h
src/insets/insetcollapsable.C
src/insets/insetcollapsable.h
src/insets/insetcommand.C
src/insets/insetcommand.h
src/insets/inseterror.C
src/insets/inseterror.h
src/insets/insetert.C
src/insets/insetert.h
src/insets/insetfloatlist.C
src/insets/insetfloatlist.h
src/insets/insetindex.C
src/insets/insetindex.h
src/insets/insetref.C
src/insets/insetref.h
src/insets/insettoc.C
src/insets/insettoc.h
src/insets/inseturl.C
src/insets/inseturl.h
src/insets/mailinset.C [new file with mode: 0644]
src/insets/mailinset.h [new file with mode: 0644]
src/lyxfunc.C
src/mathed/ChangeLog
src/mathed/formulabase.C
src/mathed/ref_inset.C
src/text3.C

index a6e89e98d007b9cbb83157e415494d52023bfcba..2dcd2e167e97e0c12a148651cfec81183248ce6a 100644 (file)
@@ -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):
 2003-02-25  Angus Leeming  <leeming@lyx.org>
 
        * reLyX/BasicLyX.pm (regularizeLatexLength, getAsLyXLength):
index aa2a3639529471de5f69919d9f942de8c4114d15..979eb0ef0b82d5288429a1040148cb99627642cf 100644 (file)
@@ -195,8 +195,8 @@ Menuset
         Submenu "Math|h" "insert_math"
        Separator
        Submenu "Special Character|S" "insert_special"
         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"
        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 "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"
     End
 
     Menu "insert_file"
index 734dcebeb6708d60851a1360ae6746e83d13c503..dd0074921b1e150800e18256e0807b1e76c80f02 100644 (file)
 #include "iterators.h"
 #include "lyxfind.h"
 
 #include "iterators.h"
 #include "lyxfind.h"
 
+#include "insets/insetbibitem.h"
 #include "insets/insetbibtex.h"
 #include "insets/insetcite.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"
 #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/insetref.h"
 #include "insets/insettext.h"
 #include "insets/insettoc.h"
+#include "insets/inseturl.h"
 
 #include "mathed/formulabase.h"
 
 
 #include "mathed/formulabase.h"
 
@@ -1095,22 +1098,6 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
                MenuInsertLabel(bv_, ev.argument);
                break;
 
                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;
        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;
 
                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;
 
        }
        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";
-
-               InsetCommandParams p("BibTeX", db, bibstyle);
-               InsetBibtex * inset = new InsetBibtex(p);
-
-               if (insertInset(inset)) {
-                       if (ev.argument.empty())
-                               inset->edit(bv_);
-               } else
-                       delete inset;
+       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;
 
        }
        break;
 
-       // BibTeX data bases
-       case LFUN_BIBDB_ADD:
-       {
-               InsetBibtex * inset =
-                       static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
-               if (inset) {
-                       inset->addDatabase(ev.argument);
+       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;
 
        }
        break;
 
-       case LFUN_BIBDB_DEL:
-       {
-               InsetBibtex * inset =
-                       static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
-               if (inset)
-                       inset->delDatabase(ev.argument);
+       case LFUN_INDEX_APPLY: {
+               InsetCommandParams params;
+               InsetCommandMailer::string2params(ev.argument, params);
+
+               InsetBase * base = owner_->getDialogs().getOpenInset("index");
+               InsetIndex * inset = 0;
+               if (base) {
+                       inset = dynamic_cast<InsetIndex *>(base);
+                       if (!inset)
+                               break;
+
+                       inset->setParams(params);
+               } else {
+                       InsetIndex * inset = new InsetIndex(params);
+                       if (!insertInset(inset)) {
+                               delete inset;
+                               break;
+                       }
+               }
+               updateInset(inset, true);
        }
        break;
 
        }
        break;
 
-       case LFUN_BIBTEX_STYLE:
-       {
-               InsetBibtex * inset =
-                       static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
-               if (inset)
-                       inset->setOptions(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_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;
 
        }
        break;
 
index 977f127d754f50e02a850ce514c3f2cfc99fd15c..b572a865f5598729692e614ff0c8804d1081eb3d 100644 (file)
@@ -4,6 +4,21 @@
        * toc.C: make TocItem store an id not a Paragraph *
          (bug #913)
 
        * 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):
 2003-02-21  Angus Leeming  <leeming@lyx.org>
 
        * BufferView_pimpl.C (MenuInsertLyXFile):
index a1dca28948bb7e6c64bc12d0fa2c25a22782293f..15dc26fb4c1438eddabf23f0c1889b958c5c4867 100644 (file)
@@ -100,11 +100,6 @@ void LyXAction::init()
                  NoBuffer|ReadOnly },
                { LFUN_LEFTSEL, "backward-select",
                  N_("Select previous char"), ReadOnly },
                  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 },
                { 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 },
                  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 },
                { 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 },
                  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 },
                { 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_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 }
        };
 
                { LFUN_NOACTION, "", "", Noop }
        };
 
index 1216e494d342b210bc88b4c2d0eaf830176e8208..571537bd1607c3e988d024aabefe13d2f823762b 100644 (file)
@@ -1,4 +1,4 @@
-// -*- C++ -*-
+// -*- C++ --*
 /* ======================================================================= *\
    Docu   : To add a new function:
    - add a new enum constant immediately before LFUN_LASTACTION
 /* ======================================================================= *\
    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_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
        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_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
        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_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
        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_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 */
 };
 
        LFUN_LASTACTION  /* this marks the end of the table */
 };
 
index 8e032cf51f052b7223ab652af041000967d51b9b..c0a8cfab93c481e5504ca73a46316c4596a29817 100644 (file)
@@ -97,17 +97,22 @@ Inset * createInset(FuncRequest const & cmd)
                        return 0;
 
                case LFUN_INDEX_INSERT: {
                        return 0;
 
                case LFUN_INDEX_INSERT: {
-                       string const entry = cmd.argument.empty() ?
-                               "index" : cmd.argument;
-                       InsetCommandParams icp;
-                       icp.setFromString(entry);
-
-                       if (icp.getContents().empty())
-                               icp.setContents(bv->getLyXText()->getStringToIndex(bv));
-                       if (!icp.getContents().empty())
-                               return new InsetIndex(icp);
-                       
-                       bv->owner()->getDialogs().createIndex();
+                       // 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);
+
+                       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;
                }
 
                        return 0;
                }
 
index 05aed79c94aff40e903acb13fb7efd1fdad2899c..8a08a03876aee4477d80101f78d51b89a64c4c28 100644 (file)
@@ -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
 2003-02-21  Angus Leeming  <leeming@lyx.org>
 
        * Timeout.[Ch]: define a Timeout::Impl abstract base class from
index 57b13fe0ec07d9be6242d3e2f5503d3f7790edf5..9d12d28e1c1ac8ac1122ec408506955e3262c290 100644 (file)
 
 #include <config.h>
 
 
 #include <config.h>
 
-
 #include "Dialogs.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.
 
 // 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();
 }
        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();
+       }
+}
index dbb20e76451cbde8357df8c8d37dfd000751df40..2e31183cc311f8bf7566e68df4119703ccd89b3a 100644 (file)
 #include <boost/signals/signal0.hpp>
 #include <boost/signals/signal1.hpp>
 
 #include <boost/signals/signal0.hpp>
 #include <boost/signals/signal1.hpp>
 
+class Dialog;
+class InsetBase;
 class LyXView;
 class LyXView;
+
 class InsetCommand;
 class InsetError;
 class InsetCommand;
 class InsetError;
-class InsetERT;
 class InsetExternal;
 class InsetFloat;
 class InsetWrap;
 class InsetExternal;
 class InsetFloat;
 class InsetWrap;
@@ -59,46 +61,34 @@ public:
        /// Are the tooltips on or off?
        static bool tooltipsEnabled();
 
        /// Are the tooltips on or off?
        static bool tooltipsEnabled();
 
-       /**@name Global Hide and Update Signals */
+       /// Signals slated to go
        //@{
        //@{
-       /// Hide all visible dialogs
-       boost::signal0<void> hideAll;
+       boost::signal0<void> hideAllSignal;
+       boost::signal0<void> hideBufferDependentSignal;
+       boost::signal1<void, bool> updateBufferDependentSignal;
+       //@}
 
 
+       /// Hide all visible dialogs
+       void hideAll() const;
        /// Hide any dialogs that require a buffer for them to operate
        /// 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.
         */
        /** 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();
 
        /**@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 showCharacter();
        /// connected to the character dialog also
        void setUserFreeFont();
        ///
-       void showCitation(InsetCommand *);
-       ///
-       void createCitation(string const &);
-       ///
        void showDocument();
        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.
        /// 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 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
        /// show the LaTeX log or build file
        void showLogFile();
        /// display the top-level maths panel
@@ -138,10 +124,6 @@ public:
        ///
        void showPrint();
        ///
        ///
        void showPrint();
        ///
-       void showRef(InsetCommand *);
-       ///
-       void createRef(string const &);
-       ///
        void showSearch();
        ///
        void showSendto();
        void showSearch();
        ///
        void showSendto();
@@ -157,23 +139,54 @@ public:
        void showTexinfo();
        /// show the thesaurus dialog
        void showThesaurus(string const &);
        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();
        //@}
 
        /// 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:
 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;
        class Impl;
-       /// The pointer never changes although *pimpl_'s contents may.
-       boost::scoped_ptr<Impl> const pimpl_;
+       ///
+       Impl * pimpl_;
 };
 
 #endif
 };
 
 #endif
index 3e6ee386ce894096750374784dc8526b7ae1ebf6..cf63d8c108f781bd3449d989681f1835e66e4c32 100644 (file)
@@ -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):
 2003-02-21  Angus Leeming  <leeming@lyx.org>
 
        * ControlBibtex.C (Browse):
index 896a673db1501ed0828e14eb6f0ce0e73ff844b5..42bb262102f400dc3ecc8c5611d9a47bbc796491 100644 (file)
 
 #include <config.h>
 
 
 #include <config.h>
 
-
 #include "ControlBibitem.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();
-}
index fa3559d483599163cd65ee49dd1936b01769d6a4..226466a27fa1b46b747225edd828d087941f0b28 100644 (file)
 class ControlBibitem : public ControlCommand {
 public:
        ///
 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
 };
 
 #endif // CONTROLBIBITEM_H
index e29ff0bc2019c6d0f55e90cf8a970acfee4287fa..7747a78ce6f80dfdf3001dd1e07db53639cd7134 100644 (file)
 
 #include <config.h>
 
 
 #include <config.h>
 
-
 #include "ControlBibtex.h"
 #include "ControlBibtex.h"
+#include "Kernel.h"
+
 #include "buffer.h"
 #include "buffer.h"
-#include "BufferView.h"
 #include "lyxrc.h"
 #include "helper_funcs.h"
 #include "tex_helpers.h"
 #include "gettext.h"
 #include "lyxrc.h"
 #include "helper_funcs.h"
 #include "tex_helpers.h"
 #include "gettext.h"
-#include "support/lstrings.h"
-
 
 using std::pair;
 
 
 
 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));
 {
        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);
 }
 
                             title, pattern, false, dir1);
 }
 
index aee1e5b25116a1f3dc1cee7dad0740d6d6eebcaa..c1449f91150e9e15dc5dcb0c2abafc4fba0c40d8 100644 (file)
 
 #include "ControlCommand.h"
 
 
 #include "ControlCommand.h"
 
+
 /** A controller for Bibtex dialogs.
  */
 class ControlBibtex : public ControlCommand {
 public:
        ///
 /** 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
        /// 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;
        /// 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
 #endif // CONTROLBIBTEX_H
index 4d0f1c42bd128c821022ac24787995d456da38c8..844375bd048327199b906afb818987c76ae2626e 100644 (file)
@@ -10,8 +10,9 @@
 
 #include <config.h>
 
 
 #include <config.h>
 
-
 #include "ControlCitation.h"
 #include "ControlCitation.h"
+#include "Kernel.h"
+
 #include "buffer.h"
 
 using std::vector;
 #include "buffer.h"
 
 using std::vector;
@@ -21,21 +22,17 @@ using std::pair;
 vector<biblio::CiteStyle> ControlCitation::citeStyles_;
 
 
 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;
        vector<pair<string,string> > blist;
-       buffer()->fillWithBibKeys(blist);
+       kernel().buffer()->fillWithBibKeys(blist);
 
        typedef std::map<string, string>::value_type InfoMapValue;
 
 
        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_;
 biblio::InfoMap const & ControlCitation::bibkeysInfo() const
 {
        return bibkeysInfo_;
@@ -63,7 +68,7 @@ biblio::InfoMap const & ControlCitation::bibkeysInfo() const
 
 bool ControlCitation::usingNatbib() 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());
 
        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);
                styles = biblio::getNumericalStrings(key, bibkeysInfo_, cs);
        else
                styles = biblio::getAuthorYearStrings(key, bibkeysInfo_, cs);
index 451b01e57bd9bf0a84428de5e4bf11419e8316c5..ac51a7fbe447836ce0da159ab8bbc81df90fc50d 100644 (file)
 class ControlCitation : public ControlCommand {
 public:
        ///
 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;
 
        /// Returns a reference to the map of stored keys
        biblio::InfoMap const & bibkeysInfo() const;
@@ -36,15 +46,6 @@ public:
                return citeStyles_;
        }
 private:
                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_;
 
        /// The info associated with each key
        biblio::InfoMap bibkeysInfo_;
 
index 054faec3eb1484315daecbe1fea56687748296a6..5c632825c230719b6ed5281a0cd807133ef99943 100644 (file)
 
 #include <config.h>
 
 
 #include <config.h>
 
-
 #include "ControlCommand.h"
 #include "ControlCommand.h"
+#include "Kernel.h"
 
 
-#include "BufferView.h"
 #include "funcrequest.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)
 {}
 
 
          action_(ac)
 {}
 
 
-InsetCommandParams const ControlCommand::getParams(string const & arg)
-{
-       InsetCommandParams params;
-       params.setFromString(arg);
-       return params;
-}
-
-
-InsetCommandParams const ControlCommand::getParams(InsetCommand const & inset)
+void ControlCommand::initialiseParams(string const & data)
 {
 {
-       return inset.params();
+       InsetCommandMailer::string2params(data, params_);
 }
 
 
 }
 
 
-void ControlCommand::applyParamsToInset()
+void ControlCommand::clearParams()
 {
 {
-       inset()->setParams(params());
-       bufferview()->updateInset(inset(), true);
+       params_.setCmdName(string());
+       params_.setOptions(string());
+       params_.setContents(string());
 }
 
 
 }
 
 
-void ControlCommand::applyParamsNoInset()
+void ControlCommand::dispatchParams()
 {
        if (action_ == LFUN_NOACTION)
                return;
 {
        if (action_ == LFUN_NOACTION)
                return;
-       lyxfunc().dispatch(FuncRequest(action_, params().getAsString()));
+
+       FuncRequest fr(action_, InsetCommandMailer::params2string(params_));
+       kernel().dispatch(fr);
 }
 }
index 9603419cc48d7f8597caae8d5d9ea61a1630f226..4e9bde7162a6bb5154097ac01d55fda17cbe77a9 100644 (file)
  *
  * ControlCommand is a controller class for dialogs that create or modify
  * an inset derived from InsetCommand.
  *
  * 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
 
 
  */
 
 #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
 
 #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:
        ///
 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_;
 };
 
        kb_action const action_;
 };
 
index c19c4b31f4f43171790b6549766e905b771e4965..83c42e701a8ab623c22369077c798035957b3154 100644 (file)
@@ -125,7 +125,7 @@ ControlConnectBI::ControlConnectBI(LyXView & lv, Dialogs & d)
 
 void ControlConnectBI::connect()
 {
 
 void ControlConnectBI::connect()
 {
-       h_ = d_.hideAll.connect(boost::bind(&ControlConnectBI::hide, this));
+       h_ = d_.hideAllSignal.connect(boost::bind(&ControlConnectBI::hide, this));
        ControlConnectBase::connect();
 }
 
        ControlConnectBase::connect();
 }
 
@@ -136,9 +136,9 @@ ControlConnectBD::ControlConnectBD(LyXView & lv, Dialogs & d)
 
 void ControlConnectBD::connect()
 {
 
 void ControlConnectBD::connect()
 {
-       u_ = d_.updateBufferDependent.
+       u_ = d_.updateBufferDependentSignal.
                connect(boost::bind(&ControlConnectBD::updateSlot, this, _1));
                connect(boost::bind(&ControlConnectBD::updateSlot, this, _1));
-       h_ = d_.hideBufferDependent.
+       h_ = d_.hideBufferDependentSignal.
                connect(boost::bind(&ControlConnectBD::hide, this));
        ControlConnectBase::connect();
 }
                connect(boost::bind(&ControlConnectBD::hide, this));
        ControlConnectBase::connect();
 }
index b0090fa97cca686c927b3d781793afd1651060dd..3e641906949d78bc5b46f79ae3cb6bb5dbb24ad7 100644 (file)
 
 #include <config.h>
 
 
 #include <config.h>
 
-
 #include "ControlERT.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()
-{
-       inset()->status(bufferview(), params().status);
-}
-
-
-void ControlERT::applyParamsNoInset()
-{
-}
-
-
-ERTParams const ControlERT::getParams(InsetERT const & inset)
+void ControlERT::initialiseParams(string const & data)
 {
 {
-       return ERTParams(inset);
+       InsetERTMailer::string2params(data, status_);
 }
 
 
 }
 
 
-ERTParams::ERTParams()
-       : status(InsetERT::Collapsed)
-{}
-
-
-ERTParams::ERTParams(InsetERT const & inset)
-       : status(inset.status())
-{}
-
-
-bool operator==(ERTParams const & p1, ERTParams const & p2)
+void ControlERT::clearParams()
 {
 {
-       return (p1.status == p2.status);
+       status_ = InsetERT::Collapsed;
 }
 
 
 }
 
 
-bool operator!=(ERTParams const & p1, ERTParams const & p2)
+void ControlERT::dispatchParams()
 {
 {
-       return !(p1 == p2);
+       FuncRequest fr(LFUN_ERT_APPLY, InsetERTMailer::params2string(status_));
+       kernel().dispatch(fr);
 }
 }
index eb6569c1f560f83124b4521c8518bcecf3960182..575db4ef38d1eb86aa531c9b7f4f7802b96d4b9a 100644 (file)
 #ifndef CONTROLERT_H
 #define CONTROLERT_H
 
 #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 {
+class ControlERT : public Dialog::Controller {
+public:
        ///
        ///
-       ERTParams();
+       ControlERT(Dialog &);
        ///
        ///
-       ERTParams(InsetERT const &);
+       InsetERT::ERTStatus status() const { return status_; }
        ///
        ///
-       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>  {
-public:
+       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();
        ///
        ///
-       ControlERT(LyXView &, Dialogs &);
+       virtual bool isBufferDependent() const { return true; }
 private:
 private:
-       /// Dispatch the changed parameters to the kernel.
-       virtual void applyParamsToInset();
        ///
        ///
-       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_;
 };
 
 #endif
 };
 
 #endif
index 960bd7d05682e9c3d73f7e464100c990d9f712cf..fdc0e0f28ad466ddc99f5ef7197077057199775c 100644 (file)
 
 #include <config.h>
 
 
 #include <config.h>
 
-
 #include "ControlError.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)
+{
+       params_ = data;
+}
+
+
+void ControlError::clearParams()
 {
 {
-       return inset.getContents();
+       params_.clear();
 }
 }
+
index 6c9e2f048a9946221870a52e3b40e211af9140de..3c9435685f87f94bd78ccf24ce42b56a844a8bdb 100644 (file)
 #define CONTROLERROR_H
 
 
 #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:
        ///
 public:
        ///
-       ControlError(LyXView &, Dialogs &);
+       ControlError(Dialog &);
+       ///
+       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:
 private:
-       /// not needed.
-       virtual void applyParamsToInset() {}
-       ///
-       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 &);
+       string params_;
 };
 
 #endif // CONTROLERROR_H
 };
 
 #endif // CONTROLERROR_H
index 93871b743a64d2c4c12329242265e4cb8aa79c0f..a80a3b3cced06b2779f224b53c68d8694c31e3f5 100644 (file)
@@ -14,6 +14,6 @@
 #include "ControlIndex.h"
 
 
 #include "ControlIndex.h"
 
 
-ControlIndex::ControlIndex(LyXView & lv, Dialogs & d)
-       : ControlCommand(lv, d, LFUN_INDEX_INSERT)
+ControlIndex::ControlIndex(Dialog & d)
+       : ControlCommand(d, LFUN_INDEX_APPLY)
 {}
 {}
index 95185e21bf6df4007b64396348aeba5f8d4a2374..48cc37a7801f0df6ed53dce9036f46a7417b6abf 100644 (file)
@@ -20,7 +20,7 @@
 class ControlIndex : public ControlCommand {
 public:
        ///
 class ControlIndex : public ControlCommand {
 public:
        ///
-       ControlIndex(LyXView &, Dialogs &);
+       ControlIndex(Dialog &);
 };
 
 #endif // CONTROLINDEX_H
 };
 
 #endif // CONTROLINDEX_H
index 8e3f7ac16c9efd0833c0908e7e7254d57e2ea4f8..a681d7ec64ae39c75539bba5d41fd412de18abd9 100644 (file)
@@ -24,8 +24,8 @@ using std::vector;
 extern BufferList bufferlist;
 
 
 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)
 {
        Buffer const * buf = bufferlist.getBuffer(MakeAbsPath(name));
        if (!buf)
-               buf = buffer();
+               buf = kernel().buffer();
        return buf->getLabelList();
 }
 
 
 void ControlRef::gotoRef(string const & ref)
 {
        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()
 {
 }
 
 
 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();
 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())
        vector<string>::const_iterator cit =
                find(buffers.begin(), buffers.end(), name);
        if (cit == buffers.end())
index 385c9bff000628446e700f662f75a4bce6f06cff..df13045ec51d6eea00be4952ded138936278da2d 100644 (file)
 
 
 #include "ControlCommand.h"
 
 
 #include "ControlCommand.h"
+#include <vector>
+
 
 /** A controller for the Ref Dialog.
  */
 class ControlRef : public ControlCommand {
 public:
        ///
 
 /** A controller for the Ref Dialog.
  */
 class ControlRef : public ControlCommand {
 public:
        ///
-       ControlRef(LyXView &, Dialogs &);
+       ControlRef(Dialog &);
        ///
        std::vector<string> const getLabelList(string const &) const;
        ///
        ///
        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. */
 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
 };
 
 #endif // CONTROLREF_H
index 07d9b05ca4ea14afb90b216774c6fbe9e35e746d..17bf7caf79e94835f5d85ce9137c6663b8bbc5d3 100644 (file)
 
 #include <config.h>
 
 
 #include <config.h>
 
-
 #include "ControlToc.h"
 #include "ControlToc.h"
-#include "toc.h"
-
 #include "support/lstrings.h" // tostr
 
 using std::vector;
 #include "support/lstrings.h" // tostr
 
 using std::vector;
@@ -21,20 +18,20 @@ using std::vector;
 class Buffer;
 
 
 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
 {
 }
 
 
 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...
        toc::Toc empty_list;
 
        // This shouldn't be possible...
-       if (!bufferIsAvailable()) {
+       if (!kernel().isBufferAvailable()) {
                return empty_list;
        }
 
                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;
        toc::TocList::iterator it = tmp.find(type);
        if (it == tmp.end()) {
                return empty_list;
index 9615232209e841f3057613b94772e2386e0ab446..8a236ad25e11e387692e7806eea2fc909ad5b79f 100644 (file)
 #define CONTROLTOC_H
 
 
 #define CONTROLTOC_H
 
 
-#include <vector>
 #include "ControlCommand.h"
 #include "toc.h"
 #include "ControlCommand.h"
 #include "toc.h"
+#include <vector>
 
 /** A controller for TOC dialogs.
  */
 class ControlToc : public ControlCommand {
 public:
        ///
 
 /** A controller for TOC dialogs.
  */
 class ControlToc : public ControlCommand {
 public:
        ///
-       ControlToc(LyXView &, Dialogs &);
+       ControlToc(Dialog &);
 
        /// Goto this paragraph id
 
        /// 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;
 
        /// Return the list of types available
        std::vector<string> const getTypes() const;
index 935d4e4e07be2ed4762e74bd1c77dc591541c72c..c755bc80bf9fe198cf7d03a651f3eb0beef355fb 100644 (file)
@@ -14,6 +14,6 @@
 #include "ControlUrl.h"
 
 
 #include "ControlUrl.h"
 
 
-ControlUrl::ControlUrl(LyXView & lv, Dialogs & d)
-       : ControlCommand(lv, d, LFUN_INSERT_URL)
+ControlUrl::ControlUrl(Dialog & d)
+       : ControlCommand(d, LFUN_URL_APPLY)
 {}
 {}
index 3e79b862c719d0f264651868e5341aa3b4d02d2a..923860f2cfffd8522d3f06fa757751e289685d93 100644 (file)
@@ -21,7 +21,7 @@ class ControlUrl : public ControlCommand
 {
 public:
        ///
 {
 public:
        ///
-       ControlUrl(LyXView &, Dialogs &);
+       ControlUrl(Dialog &);
 };
 
 #endif // CONTROLURL_H
 };
 
 #endif // CONTROLURL_H
diff --git a/src/frontends/controllers/Dialog.C b/src/frontends/controllers/Dialog.C
new file mode 100644 (file)
index 0000000..f75686a
--- /dev/null
@@ -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);
+}
diff --git a/src/frontends/controllers/Dialog.h b/src/frontends/controllers/Dialog.h
new file mode 100644 (file)
index 0000000..b61ef45
--- /dev/null
@@ -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
diff --git a/src/frontends/controllers/Kernel.C b/src/frontends/controllers/Kernel.C
new file mode 100644 (file)
index 0000000..99a1b81
--- /dev/null
@@ -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();
+}
diff --git a/src/frontends/controllers/Kernel.h b/src/frontends/controllers/Kernel.h
new file mode 100644 (file)
index 0000000..1d7d143
--- /dev/null
@@ -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
index 437b524a756f402a02d87ec4f698d2f18abe5373..de72b274989a9fc42ad8c3cd026447717e1f5b5f 100644 (file)
@@ -8,6 +8,10 @@ INCLUDES = -I$(top_srcdir)/src \
 EXTRA_DIST = ButtonController.tmpl ControlDialog.tmpl ControlInset.tmpl
 
 libcontrollers_la_SOURCES= \
 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 \
        biblio.C \
        biblio.h \
        character.C \
index 06c44f0520e92e037a4824d067133ab1d4e73107..acb9a8048de54e9567c30f3930dc951455627c9a 100644 (file)
 
 #include <config.h>
 
 
 #include <config.h>
 
-
 #include "Dialogs_impl.h"
 
 #include "Dialogs_impl.h"
 
-Dialogs::Dialogs(LyXView & lv)
-       : pimpl_(new Impl(lv, *this))
-{
-       // reduce the number of connections needed in
-       // dialogs by a simple connection here.
-       hideAll.connect(hideBufferDependent);
-}
 
 
-
-Dialogs::~Dialogs()
-{}
-
-
-void Dialogs::toggleTooltips()
+void Dialogs::init_pimpl()
 {
 {
-       Tooltips::toggleEnabled();
+       pimpl_ = new Impl(lyxview_, *this);
 }
 
 
 }
 
 
-/// Are the tooltips on or off?
-bool Dialogs::tooltipsEnabled()
+Dialogs::~Dialogs()
 {
 {
-       return Tooltips::enabled();
+       delete pimpl_;
 }
 
 
 Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
        : aboutlyx(lv, d),
 }
 
 
 Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
        : aboutlyx(lv, d),
-         bibitem(lv, d),
-         bibtex(lv, d),
          character(lv, d),
          changes(lv, d),
          character(lv, d),
          changes(lv, d),
-         citation(lv, d),
          document(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),
          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),
          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),
          preamble(lv, d),
          preferences(lv, d),
          print(lv, d),
-         ref(lv, d),
          search(lv, d),
          sendto(lv, d),
          spellchecker(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
 
          thesaurus(lv, d),
 #endif
 
-         toc(lv, d),
-         url(lv, d),
          vclogfile(lv, d),
          wrap(lv, d)
 {}
          vclogfile(lv, d),
          wrap(lv, d)
 {}
index b9b7605b3156459b95bb1c77f55c147f8f0a1b9c..858db6dea401a27e0b8cc9ac0c514564e0fbd17e 100644 (file)
@@ -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();
 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::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);
 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();
 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();
 void Dialogs::showSearch()
 {
        pimpl_->search.controller().show();
@@ -256,30 +190,6 @@ void Dialogs::showThesaurus(string const &)
 #endif
 
 
 #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();
 void Dialogs::showVCLogFile()
 {
        pimpl_->vclogfile.controller().show();
diff --git a/src/frontends/gnome/Dialogs3.C b/src/frontends/gnome/Dialogs3.C
new file mode 100644 (file)
index 0000000..44d8a0f
--- /dev/null
@@ -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();
+}
index 6583aa71d47af711d4719600ef44be11d3dcc862..09e0783dd1fd464bba2ba0f83dc5ad71b2ab9ea1 100644 (file)
 #include "ControlAboutlyx.h"
 #include "GAbout.h"
 
 #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"
 
 #include "FormBrowser.h"
 #include "forms/form_browser.h"
 
 #include "FormCharacter.h"
 #include "forms/form_character.h"
 
 #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"
 
 #include "ControlChanges.h"
 #include "GChanges.h"
 
 typedef GUI<ControlAboutlyx, GAbout, OkCancelPolicy, gnomeBC>
 AboutlyxDialog;
 
 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<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<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>
 ExternalDialog;
 
 typedef GUI<ControlShowFile, FormShowFile, OkCancelPolicy, xformsBC>
@@ -199,9 +172,6 @@ GraphicsDialog;
 typedef GUI<ControlInclude, FormInclude, OkCancelReadOnlyPolicy, xformsBC>
 IncludeDialog;
 
 typedef GUI<ControlInclude, FormInclude, OkCancelReadOnlyPolicy, xformsBC>
 IncludeDialog;
 
-typedef GUI<ControlIndex, FormIndex, NoRepeatedApplyReadOnlyPolicy, xformsBC>
-IndexDialog;
-
 typedef GUI<ControlLog, GLog, OkCancelPolicy, gnomeBC>
 LogFileDialog;
 
 typedef GUI<ControlLog, GLog, OkCancelPolicy, gnomeBC>
 LogFileDialog;
 
@@ -223,9 +193,6 @@ PreferencesDialog;
 typedef GUI<ControlPrint, FormPrint, OkApplyCancelPolicy, xformsBC>
 PrintDialog;
 
 typedef GUI<ControlPrint, FormPrint, OkApplyCancelPolicy, xformsBC>
 PrintDialog;
 
-typedef GUI<ControlRef, FormRef, NoRepeatedApplyReadOnlyPolicy, xformsBC>
-RefDialog;
-
 typedef GUI<ControlSearch, FormSearch, NoRepeatedApplyReadOnlyPolicy, xformsBC>
 SearchDialog;
 
 typedef GUI<ControlSearch, FormSearch, NoRepeatedApplyReadOnlyPolicy, xformsBC>
 SearchDialog;
 
@@ -249,12 +216,6 @@ typedef GUI<ControlThesaurus, FormThesaurus, OkApplyCancelReadOnlyPolicy, xforms
 ThesaurusDialog;
 #endif
 
 ThesaurusDialog;
 #endif
 
-typedef GUI<ControlToc, FormToc, OkCancelPolicy, xformsBC>
-TocDialog;
-
-typedef GUI<ControlUrl, GUrl, NoRepeatedApplyReadOnlyPolicy, gnomeBC>
-UrlDialog;
-
 typedef GUI<ControlVCLog, FormVCLog, OkCancelPolicy, xformsBC>
 VCLogFileDialog;
 
 typedef GUI<ControlVCLog, FormVCLog, OkCancelPolicy, xformsBC>
 VCLogFileDialog;
 
@@ -265,21 +226,15 @@ struct Dialogs::Impl {
        Impl(LyXView & lv, Dialogs & d);
 
        AboutlyxDialog      aboutlyx;
        Impl(LyXView & lv, Dialogs & d);
 
        AboutlyxDialog      aboutlyx;
-       BibitemDialog       bibitem;
-       BibtexDialog        bibtex;
        CharacterDialog     character;
        ChangesDialog       changes;
        CharacterDialog     character;
        ChangesDialog       changes;
-       CitationDialog      citation;
        DocumentDialog      document;
        DocumentDialog      document;
-       ErrorDialog         error;
-       ERTDialog           ert;
        ExternalDialog      external;
        FileDialog          file;
        FloatDialog         floats;
        ForksDialog         forks;
        GraphicsDialog      graphics;
        IncludeDialog       include;
        ExternalDialog      external;
        FileDialog          file;
        FloatDialog         floats;
        ForksDialog         forks;
        GraphicsDialog      graphics;
        IncludeDialog       include;
-       IndexDialog         index;
        LogFileDialog       logfile;
        MathPanelDialog     mathpanel;
        MinipageDialog      minipage;
        LogFileDialog       logfile;
        MathPanelDialog     mathpanel;
        MinipageDialog      minipage;
@@ -287,7 +242,6 @@ struct Dialogs::Impl {
        PreambleDialog      preamble;
        PreferencesDialog   preferences;
        PrintDialog         print;
        PreambleDialog      preamble;
        PreferencesDialog   preferences;
        PrintDialog         print;
-       RefDialog           ref;
        SearchDialog        search;
        SendtoDialog        sendto;
        SpellcheckerDialog  spellchecker;
        SearchDialog        search;
        SendtoDialog        sendto;
        SpellcheckerDialog  spellchecker;
@@ -299,8 +253,6 @@ struct Dialogs::Impl {
        ThesaurusDialog     thesaurus;
 #endif
 
        ThesaurusDialog     thesaurus;
 #endif
 
-       TocDialog           toc;
-       UrlDialog           url;
        VCLogFileDialog     vclogfile;
        WrapDialog          wrap;
 };
        VCLogFileDialog     vclogfile;
        WrapDialog          wrap;
 };
index 1284f59d26eff35fa9e13a28d7292d489ffb1086..291a48341f836e237da81b6ac9edb9223eb5612a 100644 (file)
@@ -19,7 +19,7 @@
 #include <gtkmm/textview.h>
 
 GErrorDialog::GErrorDialog()
 #include <gtkmm/textview.h>
 
 GErrorDialog::GErrorDialog()
-       : GnomeCB<ControlError>("GError")
+       : GControlledView<ControlError>("GError")
 {}
 
 
 {}
 
 
index 2668f73f50c4e94bb46842f8830dc2b6b237f263..387622312525e26382b5e8b31137b767171f6157 100644 (file)
@@ -15,7 +15,7 @@
 
 
 #include "ControlError.h"
 
 
 #include "ControlError.h"
-#include "GnomeBase.h"
+#include "GView.h"
 
 namespace Gtk {
 
 
 namespace Gtk {
 
@@ -27,7 +27,7 @@ class TextView;
 /**
  * This class implements the dialog to show error messages.
  */
 /**
  * This class implements the dialog to show error messages.
  */
-class GErrorDialog : public GnomeCB<ControlError> {
+class GErrorDialog : public GControlledView<ControlError> {
 public:
        ///
        GErrorDialog();
 public:
        ///
        GErrorDialog();
index 487ce7a26ff90e3a3898a0c4e29462acdc3a3f42..ecadf760aa9afbc0e6b99ce86dcf0085dbe851e1 100644 (file)
@@ -20,7 +20,7 @@
 #include <gtkmm/button.h>
 
 GUrl::GUrl()
 #include <gtkmm/button.h>
 
 GUrl::GUrl()
-       : GnomeCB<ControlUrl>("GUrl")
+       : GControlledView<ControlUrl>("GUrl")
 {}
 
 
 {}
 
 
index da046aa232c0f3bf90e940ff45510cd0d6714662..35fa696ccc6695f2fe25f8eaab585bead55984ab 100644 (file)
@@ -15,7 +15,7 @@
 
 
 #include "ControlUrl.h"
 
 
 #include "ControlUrl.h"
-#include "GnomeBase.h"
+#include "GView.h"
 
 namespace Gtk {
 class Button;
 
 namespace Gtk {
 class Button;
@@ -26,7 +26,7 @@ class Entry;
 /**
  * This class implements the dialog to insert/modify urls.
  */
 /**
  * This class implements the dialog to insert/modify urls.
  */
-class GUrl : public GnomeCB<ControlUrl> {
+class GUrl : public GControlledView<ControlUrl> {
 public:
        ///
        GUrl();
 public:
        ///
        GUrl();
diff --git a/src/frontends/gnome/GView.C b/src/frontends/gnome/GView.C
new file mode 100644 (file)
index 0000000..57f72d7
--- /dev/null
@@ -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();
+}
diff --git a/src/frontends/gnome/GView.h b/src/frontends/gnome/GView.h
new file mode 100644 (file)
index 0000000..50459b8
--- /dev/null
@@ -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
index aacdb81fbc1de1814d226b8a519f055d10360710..02531bfc54ac91cecae61cce4444b4d3f8ee6e91 100644 (file)
@@ -23,6 +23,7 @@ xforms_objects = \
        ../xforms/FontInfo.lo \
        ../xforms/FormAboutlyx.lo \
        ../xforms/FormBase.lo \
        ../xforms/FontInfo.lo \
        ../xforms/FormAboutlyx.lo \
        ../xforms/FormBase.lo \
+       ../xforms/FormDialogView.lo \
        ../xforms/FormBibitem.lo \
        ../xforms/FormBibtex.lo \
        ../xforms/FormBrowser.lo \
        ../xforms/FormBibitem.lo \
        ../xforms/FormBibtex.lo \
        ../xforms/FormBrowser.lo \
@@ -149,6 +150,8 @@ libgnome_la_SOURCES = \
        gnome_helpers.h \
        GnomeBase.C \
        GnomeBase.h \
        gnome_helpers.h \
        GnomeBase.C \
        GnomeBase.h \
+       GView.C \
+       GView.h \
        gnomeBC.C \
        gnomeBC.h \
        lyx_gui.C \
        gnomeBC.C \
        gnomeBC.h \
        lyx_gui.C \
index 2528efed49a4f37155364362abde782231004527..876e53230898a68f74db30b812e011c3da5ee50e 100644 (file)
 
 #include <config.h>
 
 
 #include <config.h>
 
-
 #include "guiapi.h"
 #include "Dialogs.h"
 
 extern "C" {
 
 #include "guiapi.h"
 #include "Dialogs.h"
 
 extern "C" {
 
-void gui_ShowAboutlyx(Dialogs & d)
-{
-       d.showAboutlyx();
-}
-
-
-void gui_ShowBibitem(InsetCommand * ic, Dialogs & d)
+void gui_show_dialog(Dialogs * d, char const * name, char const * data)
 {
 {
-       d.showBibitem(ic);
+       d->show(name, data, 0);
 }
 }
-
-
-void gui_ShowBibtex(InsetCommand * ic, Dialogs & d)
+               
+void gui_ShowAboutlyx(Dialogs & d)
 {
 {
-       d.showBibtex(ic);
+       d.showAboutlyx();
 }
 
 
 }
 
 
@@ -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_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);
 void gui_ShowExternal(InsetExternal * ie, Dialogs & d)
 {
        d.showExternal(ie);
@@ -100,6 +62,7 @@ void gui_ShowFloat(InsetFloat * ifl, Dialogs & d)
        d.showFloat(ifl);
 }
 
        d.showFloat(ifl);
 }
 
+
 void gui_ShowWrap(InsetWrap * iw, Dialogs & d)
 {
        d.showWrap(iw);
 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();
 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();
 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();
 void gui_ShowVCLogFile(Dialogs & d)
 {
        d.showVCLogFile();
index 7e779dacd32e8531bec6edccea2be04773afc011..7763e6a7265790a44cfa2ee16422d821336255ce 100644 (file)
@@ -16,9 +16,6 @@
 #include "LString.h"
 
 class Dialogs;
 #include "LString.h"
 
 class Dialogs;
-class InsetCommand;
-class InsetError;
-class InsetERT;
 class InsetExternal;
 class InsetFloat;
 class InsetWrap;
 class InsetExternal;
 class InsetFloat;
 class InsetWrap;
@@ -29,26 +26,18 @@ class InsetTabular;
 
 extern "C" {
 
 
 extern "C" {
 
+void gui_show_dialog(Dialogs *, char const * name, char const * data);
+
 void gui_ShowAboutlyx(Dialogs &);
 void gui_ShowAboutlyx(Dialogs &);
-void gui_ShowBibitem(InsetCommand *, Dialogs &);
-void gui_ShowBibtex(InsetCommand *, Dialogs &);
 void gui_ShowCharacter(Dialogs &);
 void gui_SetUserFreeFont(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_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_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_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 &);
 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_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 &);
 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_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_ShowVCLogFile(Dialogs &);
+void gui_ShowWrap(InsetWrap *, Dialogs &);
 
 } // extern "C"
 
 
 } // extern "C"
 
index 56d05e6e04fb2b7f0a4944817a8da664b65f3e45..68d0669bd9a93d715d54d393a4c123e189aaabe3 100644 (file)
@@ -1,10 +1,8 @@
 /**
  * \file qt2/Dialogs.C
 /**
  * \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.
  *
  * 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
  * \author Angus Leeming
  *
  * Full author contact details are available in file CREDITS
 
 #include <config.h>
 
 
 #include <config.h>
 
-
 #include "Dialogs_impl.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()
 }
 
 
 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),
 }
 
 
 Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
        : aboutlyx(lv, d),
-         bibitem(lv, d),
-         bibtex(lv, d),
          changes(lv, d),
          character(lv, d),
          changes(lv, d),
          character(lv, d),
-         citation(lv, d),
          document(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),
          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),
          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),
          search(lv, d),
          sendto(lv, d),
          spellchecker(lv, d),
@@ -73,8 +51,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
          thesaurus(lv, d),
 #endif
 
          thesaurus(lv, d),
 #endif
 
-         toc(lv, d),
-         url(lv, d),
          vclogfile(lv, d),
          wrap(lv, d)
 {}
          vclogfile(lv, d),
          wrap(lv, d)
 {}
index 2f9b55270255cb1675e76ec152caf0201228867d..abff4722487135058081c34e44b4b992357e38d9 100644 (file)
@@ -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();
 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::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);
 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();
 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();
 void Dialogs::showSearch()
 {
        pimpl_->search.controller().show();
@@ -260,30 +194,6 @@ void Dialogs::showThesaurus(string const &)
 #endif
 
 
 #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();
 void Dialogs::showVCLogFile()
 {
        pimpl_->vclogfile.controller().show();
diff --git a/src/frontends/qt2/Dialogs3.C b/src/frontends/qt2/Dialogs3.C
new file mode 100644 (file)
index 0000000..9bf1824
--- /dev/null
@@ -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;
+}
index 187394ca6095637ce10118645e43732cf681b08f..98e4e412293eb762e3972cbc020bf5903850da2f 100644 (file)
 #include "controllers/GUI.h"
 
 #include "ControlAboutlyx.h"
 #include "controllers/GUI.h"
 
 #include "ControlAboutlyx.h"
-#include "ControlBibitem.h"
-#include "ControlBibtex.h"
 #include "ControlChanges.h"
 #include "ControlCharacter.h"
 #include "ControlChanges.h"
 #include "ControlCharacter.h"
-#include "ControlCitation.h"
 #include "ControlDocument.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 "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 "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"
 #include "ControlSearch.h"
 #include "ControlSendto.h"
 #include "ControlShowFile.h"
 #include "ControlTabularCreate.h"
 #include "ControlTabular.h"
 #include "ControlTexinfo.h"
 #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 "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 "QChanges.h"
 #include "QChangesDialog.h"
 #include "QCharacter.h"
 #include "QCharacterDialog.h"
-#include "QCitation.h"
-#include "QCitationDialog.h"
 #include "QDocument.h"
 #include "QDocumentDialog.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"
 #include "QExternal.h"
 #include "QExternalDialog.h"
 #include "QFloat.h"
@@ -80,8 +61,6 @@
 #include "QGraphicsDialog.h"
 #include "QInclude.h"
 #include "QIncludeDialog.h"
 #include "QGraphicsDialog.h"
 #include "QInclude.h"
 #include "QIncludeDialog.h"
-#include "QIndex.h"
-#include "QIndexDialog.h"
 #include "QLog.h"
 #include "QLogDialog.h"
 #include "QMinipage.h"
 #include "QLog.h"
 #include "QLogDialog.h"
 #include "QMinipage.h"
@@ -92,8 +71,6 @@
 #include "QPrefsDialog.h"
 #include "QPrint.h"
 #include "QLPrintDialog.h"
 #include "QPrefsDialog.h"
 #include "QPrint.h"
 #include "QLPrintDialog.h"
-#include "QRef.h"
-#include "QRefDialog.h"
 #include "QSearch.h"
 #include "QSearchDialog.h"
 #include "QSendto.h"
 #include "QSearch.h"
 #include "QSearchDialog.h"
 #include "QSendto.h"
 #include "QThesaurusDialog.h"
 #endif
 
 #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"
 #include "QVCLog.h"
 #include "QVCLogDialog.h"
 #include "QWrap.h"
 typedef GUI<ControlAboutlyx, QAbout, OkCancelPolicy, Qt2BC>
 AboutlyxDialog;
 
 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<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<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;
 
 typedef GUI<ControlExternal, QExternal, OkApplyCancelReadOnlyPolicy, Qt2BC>
 ExternalDialog;
 
@@ -170,9 +128,6 @@ GraphicsDialog;
 typedef GUI<ControlInclude, QInclude, OkCancelReadOnlyPolicy, Qt2BC>
 IncludeDialog;
 
 typedef GUI<ControlInclude, QInclude, OkCancelReadOnlyPolicy, Qt2BC>
 IncludeDialog;
 
-typedef GUI<ControlIndex, QIndex, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
-IndexDialog;
-
 typedef GUI<ControlLog, QLog, OkCancelPolicy, Qt2BC>
 LogFileDialog;
 
 typedef GUI<ControlLog, QLog, OkCancelPolicy, Qt2BC>
 LogFileDialog;
 
@@ -188,9 +143,6 @@ PrefsDialog;
 typedef GUI<ControlPrint, QPrint, OkApplyCancelPolicy, Qt2BC>
 PrintDialog;
 
 typedef GUI<ControlPrint, QPrint, OkApplyCancelPolicy, Qt2BC>
 PrintDialog;
 
-typedef GUI<ControlRef, QRef, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
-RefDialog;
-
 typedef GUI<ControlSearch, QSearch, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
 SearchDialog;
 
 typedef GUI<ControlSearch, QSearch, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
 SearchDialog;
 
@@ -214,12 +166,6 @@ typedef GUI<ControlThesaurus, QThesaurus, OkApplyCancelReadOnlyPolicy, Qt2BC>
 ThesaurusDialog;
 #endif
 
 ThesaurusDialog;
 #endif
 
-typedef GUI<ControlToc, QToc, OkCancelPolicy, Qt2BC>
-TocDialog;
-
-typedef GUI<ControlUrl, QURL, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
-UrlDialog;
-
 typedef GUI<ControlVCLog, QVCLog, OkCancelPolicy, Qt2BC>
 VCLogFileDialog;
 
 typedef GUI<ControlVCLog, QVCLog, OkCancelPolicy, Qt2BC>
 VCLogFileDialog;
 
@@ -231,26 +177,19 @@ struct Dialogs::Impl {
        Impl(LyXView & lv, Dialogs & d);
 
        AboutlyxDialog      aboutlyx;
        Impl(LyXView & lv, Dialogs & d);
 
        AboutlyxDialog      aboutlyx;
-       BibitemDialog       bibitem;
-       BibtexDialog        bibtex;
        ChangesDialog       changes;
        CharacterDialog     character;
        ChangesDialog       changes;
        CharacterDialog     character;
-       CitationDialog      citation;
        DocumentDialog      document;
        DocumentDialog      document;
-       ErrorDialog         error;
-       ERTDialog           ert;
        ExternalDialog      external;
        FileDialog          file;
        FloatDialog         floats;
        GraphicsDialog      graphics;
        IncludeDialog       include;
        ExternalDialog      external;
        FileDialog          file;
        FloatDialog         floats;
        GraphicsDialog      graphics;
        IncludeDialog       include;
-       IndexDialog         index;
        LogFileDialog       logfile;
        MinipageDialog      minipage;
        ParagraphDialog     paragraph;
        PrefsDialog         prefs;
        PrintDialog         print;
        LogFileDialog       logfile;
        MinipageDialog      minipage;
        ParagraphDialog     paragraph;
        PrefsDialog         prefs;
        PrintDialog         print;
-       RefDialog           ref;
        SearchDialog        search;
        SendtoDialog        sendto;
        SpellcheckerDialog  spellchecker;
        SearchDialog        search;
        SendtoDialog        sendto;
        SpellcheckerDialog  spellchecker;
@@ -262,8 +201,6 @@ struct Dialogs::Impl {
        ThesaurusDialog     thesaurus;
 #endif
 
        ThesaurusDialog     thesaurus;
 #endif
 
-       TocDialog           toc;
-       UrlDialog           url;
        VCLogFileDialog     vclogfile;
        WrapDialog          wrap;
 };
        VCLogFileDialog     vclogfile;
        WrapDialog          wrap;
 };
index 5b4155514c4e0bae6bee0e53b3f97eab1c348cfe..83ab731c92396724984a4cb001cd0dc0d94f8e74 100644 (file)
@@ -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
 
 
 AM_CXXFLAGS = -DQT_CLEAN_NAMESPACE -DQT_GENUINE_STR -DQT_NO_TRANSLATION
 
+
 libqt2_la_SOURCES = \
 libqt2_la_SOURCES = \
+       QDialogView.C \
+       QDialogView.h \
        Alert_pimpl.C \
        bulletstrings.C bulletstrings.h \
        Dialogs.C \
        Dialogs2.C \
        Alert_pimpl.C \
        bulletstrings.C bulletstrings.h \
        Dialogs.C \
        Dialogs2.C \
+       Dialogs3.C \
        Dialogs_impl.h \
        FileDialog.C \
        LyXKeySymFactory.C \
        Dialogs_impl.h \
        FileDialog.C \
        LyXKeySymFactory.C \
index 7f9f3d5fde1f57eafc539fb490d6266083f80f0a..a5621676a777dfd8ef91ee24aad37e6c96347e9e 100644 (file)
@@ -104,6 +104,7 @@ MOCFILES = \
        QShowFileDialog.C QShowFileDialog.h \
        QSpellcheckerDialog.C QSpellcheckerDialog.h \
        Qt2Base.C Qt2Base.h \
        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 \
        QTabularCreateDialog.C QTabularCreateDialog.h \
        QTabularDialog.C QTabularDialog.h \
        QTexinfoDialog.C QTexinfoDialog.h \
index 12267a8a9bd1826ce1bab8255e8d0f6244cbe216..2a86aa04a036506a0f3f535d7b67a85a40fe6658 100644 (file)
 #include "QBibitem.h"
 #include "Qt2BC.h"
 
 #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"))
 {
 }
 
 {
 }
 
index 8fa2291b8939c7daa5f5b710557fd209545e8879..12dd72bfc493a4e2a278bf6c5323c3786b5a5fd7 100644 (file)
 #define QBIBITEM_H
 
 
 #define QBIBITEM_H
 
 
-#include "Qt2Base.h"
+#include "QDialogView.h"
 
 class ControlBibitem;
 class QBibitemDialog;
 
 class QBibitem
 
 class ControlBibitem;
 class QBibitemDialog;
 
 class QBibitem
-       : public Qt2CB<ControlBibitem, Qt2DB<QBibitemDialog> >
+       : public QController<ControlBibitem, QView<QBibitemDialog> >
 {
 public:
        friend class QBibitemDialog;
 
 {
 public:
        friend class QBibitemDialog;
 
-       QBibitem();
+       QBibitem(Dialog &);
 protected:
        virtual bool isValid();
 private:
 protected:
        virtual bool isValid();
 private:
index 4eca11fdb905d083dc629287799a79e01d9aa87f..3beb7eba3358360c2fd0368eb0d2960ff0ed997b 100644 (file)
 
 using std::vector;
 
 
 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"))
 {
 }
 
 {
 }
 
index 65e27b6bde5c578b23034f1944fcb2dd8aa40dcd..eee2d259607bf71ee97de82e6c16f575807ed449 100644 (file)
 #define QBIBTEX_H
 
 
 #define QBIBTEX_H
 
 
-#include "Qt2Base.h"
+#include "QDialogView.h"
 
 class ControlBibtex;
 class QBibtexDialog;
 
 class QBibtex
 
 class ControlBibtex;
 class QBibtexDialog;
 
 class QBibtex
-       : public Qt2CB<ControlBibtex, Qt2DB<QBibtexDialog> >
+       : public QController<ControlBibtex, QView<QBibtexDialog> >
 {
 public:
        friend class QBibtexDialog;
 
 {
 public:
        friend class QBibtexDialog;
 
-       QBibtex();
+       QBibtex(Dialog &);
 protected:
        virtual bool isValid();
 private:
 protected:
        virtual bool isValid();
 private:
index 64ecb9166d96393b913b2d8c4cf7bb1edb872f5f..293b9d88ebbd417f21b6069a6e84764667ff55de 100644 (file)
@@ -38,11 +38,11 @@ using std::pair;
 using std::sort;
 using std::vector;
 
 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();
 
        citekeys.clear();
        bibkeys.clear();
 
-       Qt2Base::hide();
+       QDialogView::hide();
 }
 
 
 }
 
 
index 89a7203e0a44326ed5a7c1a7b1c5166f156e6d29..6f9da4dad376b0aa0835dcf0efbad747cb550a8e 100644 (file)
 #define QCITATION_H
 
 
 #define QCITATION_H
 
 
-#include "Qt2Base.h"
+#include "QDialogView.h"
+
 
 class QListBox;
 class ControlCitation;
 class QCitationDialog;
 
 
 
 class QListBox;
 class ControlCitation;
 class QCitationDialog;
 
 
-class QCitation
-       : public Qt2CB<ControlCitation, Qt2DB<QCitationDialog> >
+class QCitation : public QController<ControlCitation, QView<QCitationDialog> >
 {
 public:
        friend class QCitationDialog;
        ///
 {
 public:
        friend class QCitationDialog;
        ///
-       QCitation();
+       QCitation(Dialog &);
 private:
        ///
        enum State {
 private:
        ///
        enum State {
diff --git a/src/frontends/qt2/QDialogView.C b/src/frontends/qt2/QDialogView.C
new file mode 100644 (file)
index 0000000..d683273
--- /dev/null
@@ -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();
+}
diff --git a/src/frontends/qt2/QDialogView.h b/src/frontends/qt2/QDialogView.h
new file mode 100644 (file)
index 0000000..4fe4a81
--- /dev/null
@@ -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
index fcfb480cd72b06242312a5ae3b6765f33a6a95dc..12ea8be4ddecb7f611c956e79bd8dd814614f32a 100644 (file)
 #include "QERT.h"
 #include "Qt2BC.h"
 
 #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()
 {
 
 void QERT::apply()
 {
-       ERTParams & params = controller().params();
-
        if (dialog_->openRB->isChecked())
        if (dialog_->openRB->isChecked())
-               params.status = InsetERT::Open;
+               controller().setStatus(InsetERT::Open);
        else if (dialog_->inlineRB->isChecked())
        else if (dialog_->inlineRB->isChecked())
-               params.status = InsetERT::Inlined;
+               controller().setStatus(InsetERT::Inlined);
        else
        else
-               params.status = InsetERT::Collapsed;
+               controller().setStatus(InsetERT::Collapsed);
 }
 
 
 }
 
 
@@ -56,7 +54,7 @@ void QERT::update_contents()
 {
        QRadioButton * rb = 0;
 
 {
        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;
                case InsetERT::Open: rb = dialog_->openRB; break;
                case InsetERT::Inlined: rb = dialog_->inlineRB; break;
                case InsetERT::Collapsed: rb = dialog_->collapsedRB; break;
index 6f98398ce767294b2247d7e73e4c8d8a8b1f529f..3be76ddfbcb62dd1b523160f04681672b899789a 100644 (file)
 #define QERT_H
 
 
 #define QERT_H
 
 
-#include "Qt2Base.h"
+#include "QDialogView.h"
+
 
 class ControlERT;
 class QERTDialog;
 
 
 class ControlERT;
 class QERTDialog;
 
-class QERT
-       : public Qt2CB<ControlERT, Qt2DB<QERTDialog> >
+
+class QERT : public QController<ControlERT, QView<QERTDialog> >
 {
 public:
        friend class QERTDialog;
 
 {
 public:
        friend class QERTDialog;
 
-       QERT();
+       QERT(Dialog &);
 private:
        /// Apply changes
        virtual void apply();
 private:
        /// Apply changes
        virtual void apply();
index b82b1b5b20e3182847a1b6b92fb536ec64e5b101..46748760cb4ab5a49ac197e19f0f796f999ab71f 100644 (file)
 #include "QError.h"
 #include "Qt2BC.h"
 
 #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"))
 {
 }
 
 {
 }
 
index a697a8a4c14552097069fb03a62c614671ac2033..84de64a00ad8ea7978d12f66d4680908c71eee43 100644 (file)
 #define QERROR_H
 
 
 #define QERROR_H
 
 
-#include "Qt2Base.h"
+#include "QDialogView.h"
 
 class ControlError;
 class QErrorDialog;
 
 
 class QError
 
 class ControlError;
 class QErrorDialog;
 
 
 class QError
-       : public Qt2CB<ControlError, Qt2DB<QErrorDialog> >
+       : public QController<ControlError, QView<QErrorDialog> >
 {
 public:
        friend class QErrorDialog;
 
 {
 public:
        friend class QErrorDialog;
 
-       QError();
+       QError(Dialog &);
 private:
        /// Apply changes
        virtual void apply() {}
 private:
        /// Apply changes
        virtual void apply() {}
index 7558b3f724280be14689491a66a10b005c240386..1f025efb4c64aed1a0792acacf949df0a01cead8 100644 (file)
 #include <qlineedit.h>
 #include <qpushbutton.h>
 
 #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"))
 {
 }
 
 {
 }
 
index cee1e99f65d4ded7e40fdb34c7acb9896d1bf35c..18fafd4ba8db934cd9aa591b8c764869c00c7279 100644 (file)
 #define QINDEX_H
 
 
 #define QINDEX_H
 
 
-#include "Qt2Base.h"
+#include "QDialogView.h"
 
 class ControlIndex;
 class QIndexDialog;
 
 
 class QIndex :
 
 class ControlIndex;
 class QIndexDialog;
 
 
 class QIndex :
-       public Qt2CB<ControlIndex, Qt2DB<QIndexDialog> >
+       public QController<ControlIndex, QView<QIndexDialog> >
 {
 public:
        friend class QIndexDialog;
 
 {
 public:
        friend class QIndexDialog;
 
-       QIndex();
+       QIndex(Dialog &);
 protected:
        virtual bool isValid();
 private:
 protected:
        virtual bool isValid();
 private:
index 583b55bdbdb86ade80ced30cff884882529ab709..797bfd089aad6efe94c771103b2bcf60f09595cb 100644 (file)
@@ -35,11 +35,11 @@ using std::vector;
 using std::endl;
 
 
 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)
 {
 }
        sort_(false), at_ref_(false)
 {
 }
@@ -102,15 +102,17 @@ void QRef::apply()
 
 bool QRef::nameAllowed()
 {
 
 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()
 {
 }
 
 
 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;
 }
 
 
 }
 
 
index 1afca59eee5f56ac550b0592a767cb41d4632e66..ba721a9bf47017319df182ae29f1b8af004e0630 100644 (file)
@@ -13,7 +13,7 @@
 #define QREF_H
 
 
 #define QREF_H
 
 
-#include "Qt2Base.h"
+#include "QDialogView.h"
 #include <vector>
 #include "LString.h"
 
 #include <vector>
 #include "LString.h"
 
@@ -22,12 +22,12 @@ class QRefDialog;
 
 
 class QRef
 
 
 class QRef
-       : public Qt2CB<ControlRef, Qt2DB<QRefDialog> >
+       : public QController<ControlRef, QView<QRefDialog> >
 {
 public:
        friend class QRefDialog;
 
 {
 public:
        friend class QRefDialog;
 
-       QRef();
+       QRef(Dialog &);
 private:
        /// apply changes
        virtual void apply();
 private:
        /// apply changes
        virtual void apply();
index a5a9ada7e12dc5e929f4749af31782905e08805e..867b4a941954f5dc62d8f274b194c3d2f2934894 100644 (file)
@@ -33,10 +33,10 @@ using std::pair;
 using std::stack;
 using std::vector;
 
 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)
 {}
 
 
 {}
 
 
index 10294dc9cb017f16a11923805624af5e155143b1..94a04308c5d8b90258ee6984a6d1ea1a24af72d1 100644 (file)
 #define QTOC_H
 
 
 #define QTOC_H
 
 
-#include "Qt2Base.h"
+#include "QDialogView.h"
 #include "toc.h"
 
 class ControlToc;
 class QTocDialog;
 
 class QToc :
 #include "toc.h"
 
 class ControlToc;
 class QTocDialog;
 
 class QToc :
-       public Qt2CB<ControlToc, Qt2DB<QTocDialog> >
+       public QController<ControlToc, QView<QTocDialog> >
 {
 public:
        friend class QTocDialog;
 
 {
 public:
        friend class QTocDialog;
 
-       QToc();
+       QToc(Dialog &);
 private:
        /// update the listview
        void updateToc(int newdepth);
 private:
        /// update the listview
        void updateToc(int newdepth);
index 14b522adfc148986c394a300dc9aa6fb746ba697..1c4b77fb9176b204318d7469a2dc63b85bf039d5 100644 (file)
 #include <qpushbutton.h>
 #include <qlineedit.h>
 
 #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"))
 {
 }
 
 {
 }
 
index e9f40b7cc44de69dfda0ff1d6fbc1e8b893835ff..4a61ce9ca76d8e07c57cfc484b6cb689cdb154d4 100644 (file)
 #define QURL_H
 
 
 #define QURL_H
 
 
-#include "Qt2Base.h"
+#include "QDialogView.h"
 
 class ControlUrl;
 class QURLDialog;
 
 
 class QURL :
 
 class ControlUrl;
 class QURLDialog;
 
 
 class QURL :
-       public Qt2CB<ControlUrl, Qt2DB<QURLDialog> >
+       public QController<ControlUrl, QView<QURLDialog> >
 {
 public:
        friend class QURLDialog;
 {
 public:
        friend class QURLDialog;
-       QURL();
+       QURL(Dialog &);
 protected:
        virtual bool isValid();
 private:
 protected:
        virtual bool isValid();
 private:
index d3e96357fc9592d461257f1d32384b8017a30462..b5d6a97233ac8cc877c25854d5e46a2bdc7b4874 100644 (file)
@@ -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
 2003-02-22  Alfredo Braunstein <abraunst@libero.it>
 
        * lyx_gui.C (parse_init): added a call to LoaderQueue::setPriority
index 9eb84bcabfcade3f8a302079639c852ca86b40e6..231f3aa2e96aa79f86a3120545520a1ae1648ca5 100644 (file)
@@ -1,10 +1,8 @@
 /**
  * \file xforms/Dialogs.C
 /**
  * \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.
  *
  * 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
  * \author Angus Leeming
  *
  * Full author contact details are available in file CREDITS
 
 #include <config.h>
 
 
 #include <config.h>
 
-
 #include "Dialogs_impl.h"
 
 #include "Dialogs_impl.h"
 
-Dialogs::Dialogs(LyXView & lv)
-       : pimpl_(new Impl(lv, *this))
-{
-       // reduce the number of connections needed in
-       // dialogs by a simple connection here.
-       hideAll.connect(hideBufferDependent);
-}
 
 
-
-Dialogs::~Dialogs()
-{}
-
-
-void Dialogs::toggleTooltips()
+void Dialogs::init_pimpl()
 {
 {
-       Tooltips::toggleEnabled();
+       pimpl_ = new Impl(lyxview_, *this);
 }
 
 
 }
 
 
-/// Are the tooltips on or off?
-bool Dialogs::tooltipsEnabled()
+Dialogs::~Dialogs()
 {
 {
-       return Tooltips::enabled();
+       delete pimpl_;
 }
 
 
 Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
        : aboutlyx(lv, d),
 }
 
 
 Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
        : aboutlyx(lv, d),
-         bibitem(lv, d),
-         bibtex(lv, d),
          changes(lv, d),
          character(lv, d),
          changes(lv, d),
          character(lv, d),
-         citation(lv, d),
          document(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),
          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),
          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),
          preamble(lv, d),
          preferences(lv, d),
          print(lv, d),
-         ref(lv, d),
          search(lv, d),
          sendto(lv, d),
          spellchecker(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
 
          thesaurus(lv, d),
 #endif
 
-         toc(lv, d),
-         url(lv, d),
          vclogfile(lv, d),
          wrap(lv, d)
 {}
          vclogfile(lv, d),
          wrap(lv, d)
 {}
index 8e77fb19894d8d5c9626ed16f25c8c5886c41618..39cfbeba6aa77084da55e47fa4c7f189fbf7e194 100644 (file)
@@ -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();
 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::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);
 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();
 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();
 void Dialogs::showSearch()
 {
        pimpl_->search.controller().show();
@@ -259,30 +193,6 @@ void Dialogs::showThesaurus(string const &)
 #endif
 
 
 #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();
 void Dialogs::showVCLogFile()
 {
        pimpl_->vclogfile.controller().show();
diff --git a/src/frontends/xforms/Dialogs3.C b/src/frontends/xforms/Dialogs3.C
new file mode 100644 (file)
index 0000000..0e826a1
--- /dev/null
@@ -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();
+}
index 5ffc0f7b6feda5679c996a232d3cc79a19bb7733..5233665b2bed79f1c3f4098691badb4494d42b81 100644 (file)
 #include "FormAboutlyx.h"
 #include "forms/form_aboutlyx.h"
 
 #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"
 
 #include "FormBrowser.h"
 #include "forms/form_browser.h"
 
 #include "FormCharacter.h"
 #include "forms/form_character.h"
 
 #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 "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"
 #include "ControlExternal.h"
 #include "FormExternal.h"
 #include "forms/form_external.h"
 #include "FormInclude.h"
 #include "forms/form_include.h"
 
 #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"
 
 #include "ControlLog.h"
 #include "FormLog.h"
 
 #include "FormPrint.h"
 #include "forms/form_print.h"
 
 #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"
 #include "ControlSearch.h"
 #include "FormSearch.h"
 #include "forms/form_search.h"
 #include "forms/form_thesaurus.h"
 #endif
 
 #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"
 
 #include "ControlVCLog.h"
 #include "FormVCLog.h"
 
 typedef GUI<ControlAboutlyx, FormAboutlyx, OkCancelPolicy, xformsBC>
 AboutlyxDialog;
 
 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<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<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;
 
 typedef GUI<ControlExternal, FormExternal, OkApplyCancelReadOnlyPolicy, xformsBC>
 ExternalDialog;
 
@@ -207,9 +156,6 @@ GraphicsDialog;
 typedef GUI<ControlInclude, FormInclude, OkCancelReadOnlyPolicy, xformsBC>
 IncludeDialog;
 
 typedef GUI<ControlInclude, FormInclude, OkCancelReadOnlyPolicy, xformsBC>
 IncludeDialog;
 
-typedef GUI<ControlIndex, FormIndex, NoRepeatedApplyReadOnlyPolicy, xformsBC>
-IndexDialog;
-
 typedef GUI<ControlLog, FormLog, OkCancelPolicy, xformsBC>
 LogFileDialog;
 
 typedef GUI<ControlLog, FormLog, OkCancelPolicy, xformsBC>
 LogFileDialog;
 
@@ -231,9 +177,6 @@ PreferencesDialog;
 typedef GUI<ControlPrint, FormPrint, OkApplyCancelPolicy, xformsBC>
 PrintDialog;
 
 typedef GUI<ControlPrint, FormPrint, OkApplyCancelPolicy, xformsBC>
 PrintDialog;
 
-typedef GUI<ControlRef, FormRef, NoRepeatedApplyReadOnlyPolicy, xformsBC>
-RefDialog;
-
 typedef GUI<ControlSearch, FormSearch, NoRepeatedApplyReadOnlyPolicy, xformsBC>
 SearchDialog;
 
 typedef GUI<ControlSearch, FormSearch, NoRepeatedApplyReadOnlyPolicy, xformsBC>
 SearchDialog;
 
@@ -257,12 +200,6 @@ typedef GUI<ControlThesaurus, FormThesaurus, OkApplyCancelReadOnlyPolicy, xforms
 ThesaurusDialog;
 #endif
 
 ThesaurusDialog;
 #endif
 
-typedef GUI<ControlToc, FormToc, OkCancelPolicy, xformsBC>
-TocDialog;
-
-typedef GUI<ControlUrl, FormUrl, NoRepeatedApplyReadOnlyPolicy, xformsBC>
-UrlDialog;
-
 typedef GUI<ControlVCLog, FormVCLog, OkCancelPolicy, xformsBC>
 VCLogFileDialog;
 
 typedef GUI<ControlVCLog, FormVCLog, OkCancelPolicy, xformsBC>
 VCLogFileDialog;
 
@@ -273,21 +210,15 @@ struct Dialogs::Impl {
        Impl(LyXView & lv, Dialogs & d);
 
        AboutlyxDialog      aboutlyx;
        Impl(LyXView & lv, Dialogs & d);
 
        AboutlyxDialog      aboutlyx;
-       BibitemDialog       bibitem;
-        BibtexDialog        bibtex;
        ChangesDialog       changes;
         CharacterDialog     character;
        ChangesDialog       changes;
         CharacterDialog     character;
-       CitationDialog      citation;
        DocumentDialog      document;
        DocumentDialog      document;
-       ErrorDialog         error;
-       ERTDialog           ert;
        ExternalDialog      external;
        FileDialog          file;
        FloatDialog         floats;
        ForksDialog         forks;
        GraphicsDialog      graphics;
        IncludeDialog       include;
        ExternalDialog      external;
        FileDialog          file;
        FloatDialog         floats;
        ForksDialog         forks;
        GraphicsDialog      graphics;
        IncludeDialog       include;
-       IndexDialog         index;
        LogFileDialog       logfile;
        MathPanelDialog     mathpanel;
        MinipageDialog      minipage;
        LogFileDialog       logfile;
        MathPanelDialog     mathpanel;
        MinipageDialog      minipage;
@@ -295,7 +226,6 @@ struct Dialogs::Impl {
        PreambleDialog      preamble;
        PreferencesDialog   preferences;
        PrintDialog         print;
        PreambleDialog      preamble;
        PreferencesDialog   preferences;
        PrintDialog         print;
-       RefDialog           ref;
        SearchDialog        search;
        SendtoDialog        sendto;
        SpellcheckerDialog  spellchecker;
        SearchDialog        search;
        SendtoDialog        sendto;
        SpellcheckerDialog  spellchecker;
@@ -307,8 +237,6 @@ struct Dialogs::Impl {
        ThesaurusDialog     thesaurus;
 #endif
 
        ThesaurusDialog     thesaurus;
 #endif
 
-       TocDialog           toc;
-       UrlDialog           url;
        VCLogFileDialog     vclogfile;
        WrapDialog          wrap;
 };
        VCLogFileDialog     vclogfile;
        WrapDialog          wrap;
 };
index e7747adca1066d893d862dfbdea9c362151e9197..791687a0c33030a43ce6bbd0b0e9af1d0c8d9efb 100644 (file)
 #include "gettext.h"
 #include "support/lstrings.h" // compare
 
 #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"))
 {}
 
 
 {}
 
 
index de978d714e2cd60ed66e60b9611b5b16a55d1d6c..9206642d9060bd757841addda3f87d203c0eb02f 100644 (file)
@@ -14,7 +14,7 @@
 #define FORMBIBITEM_H
 
 
 #define FORMBIBITEM_H
 
 
-#include "FormBase.h"
+#include "FormDialogView.h"
 
 class ControlBibitem;
 struct FD_bibitem;
 
 class ControlBibitem;
 struct FD_bibitem;
@@ -22,10 +22,10 @@ struct FD_bibitem;
 /**
  * For bibliography entry editing
  */
 /**
  * For bibliography entry editing
  */
-class FormBibitem : public FormCB<ControlBibitem, FormDB<FD_bibitem> > {
+class FormBibitem : public FormController<ControlBibitem, FormView<FD_bibitem> > {
 public:
        ///
 public:
        ///
-       FormBibitem();
+       FormBibitem(Dialog &);
 private:
        /// Set the Params variable for the Controller.
        virtual void apply();
 private:
        /// Set the Params variable for the Controller.
        virtual void apply();
index 973d70b0f8b1504d6cbb42a40f0d5c26ddd78ea6..b69409217b11b457240cca7dc29826d949f93c69 100644 (file)
@@ -32,10 +32,10 @@ using std::vector;
 using std::sort;
 
 
 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,
 
        // 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 "
 
        // set up the tooltips
        string str = _("The database you want to cite from. Insert it "
index 913b68aba2d82175e9da3916dbcc049dc0b6677f..11435b850fca52c8f6250225ea5cd35188f0bc60 100644 (file)
@@ -14,7 +14,7 @@
 #define FORMBIBTEX_H
 
 
 #define FORMBIBTEX_H
 
 
-#include "FormBase.h"
+#include "FormDialogView.h"
 
 class ControlBibtex;
 struct FD_bibtex;
 
 class ControlBibtex;
 struct FD_bibtex;
@@ -22,10 +22,10 @@ struct FD_bibtex;
 /**
  * For bibtex database setting
  */
 /**
  * For bibtex database setting
  */
-class FormBibtex : public FormCB<ControlBibtex, FormDB<FD_bibtex> > {
+class FormBibtex : public FormController<ControlBibtex, FormView<FD_bibtex> > {
 public:
        ///
 public:
        ///
-       FormBibtex();
+       FormBibtex(Dialog &);
 private:
        /// Set the Params variable for the Controller.
        virtual void apply();
 private:
        /// Set the Params variable for the Controller.
        virtual void apply();
index a1b9014b58ab2e394c663b58a2775a40711f8dde..11a493e22723d6b5724df34e8675b4b4aa895b34 100644 (file)
@@ -17,6 +17,7 @@
 #include "ControlCitation.h"
 #include "FormCitation.h"
 #include "forms/form_citation.h"
 #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"
 #include "Tooltips.h"
 #include "helper_funcs.h"
 #include "xforms_helpers.h"
@@ -86,11 +87,11 @@ void updateStyle(FD_citation * dialog, string command)
 } // namespace anon
 
 
 } // 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();
 
        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);
                }
 
                        fl_set_browser_topline(dialog_->browser_cite, n + 1);
                }
 
-               if (!controller().bufferIsReadonly()) {
+               if (!kernel().isBufferReadonly()) {
                        if (cit != citekeys.end()) {
                                setBibButtons(OFF);
                                setCiteButtons(ON);
                        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 (sel < 1 || sel > citekeys.size())
                        return ButtonPolicy::SMI_NOOP;
 
-               if (!controller().bufferIsReadonly()) {
+               if (!kernel().isBufferReadonly()) {
                        setBibButtons(OFF);
                        setCiteButtons(ON);
                }
                        setBibButtons(OFF);
                        setCiteButtons(ON);
                }
index 8c03035160e45c1093f082f4f289f1eb6765cd1d..09ca816b041407b8513d5729e19ad9f18ec60ee1 100644 (file)
@@ -13,7 +13,7 @@
 #define FORMCITATION_H
 
 
 #define FORMCITATION_H
 
 
-#include "FormBase.h"
+#include "FormDialogView.h"
 #include "biblio.h"
 
 /** This class provides an XForms implementation of the Citation Dialog.
 #include "biblio.h"
 
 /** This class provides an XForms implementation of the Citation Dialog.
 class ControlCitation;
 struct FD_citation;
 
 class ControlCitation;
 struct FD_citation;
 
-class FormCitation : public FormCB<ControlCitation, FormDB<FD_citation> > {
+class FormCitation : public FormController<ControlCitation, FormView<FD_citation> > {
 public:
        ///
 public:
        ///
-       FormCitation();
+       FormCitation(Dialog &);
 private:
        ///
        enum State {
 private:
        ///
        enum State {
diff --git a/src/frontends/xforms/FormDialogView.C b/src/frontends/xforms/FormDialogView.C
new file mode 100644 (file)
index 0000000..7996633
--- /dev/null
@@ -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"
diff --git a/src/frontends/xforms/FormDialogView.h b/src/frontends/xforms/FormDialogView.h
new file mode 100644 (file)
index 0000000..c76eed0
--- /dev/null
@@ -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
index ad707be361ebb2e1b87d4cfdc9f59e971cdf031b..e5760ccb2806ea7f18c185013686ccd447a29d75 100644 (file)
 #include "debug.h"
 #include FORMS_H_LOCATION
 
 #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))
 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))
        else if (fl_get_button(dialog_->radio_collapsed))
-               controller().params().status = InsetERT::Collapsed;
+               controller().setStatus(InsetERT::Collapsed);
        else
        else
-               controller().params().status = InsetERT::Inlined;
+               controller().setStatus(InsetERT::Inlined);
 }
 
 
 void FormERT::update()
 {
 }
 
 
 void FormERT::update()
 {
-       switch (controller().params().status) {
+       switch (controller().status()) {
        case InsetERT::Open:
                fl_set_button(dialog_->radio_open, 1);
                break;
        case InsetERT::Open:
                fl_set_button(dialog_->radio_open, 1);
                break;
index 4074b4de20364e5691848f77258ee42ada9433de..edfe7771aecb17067a0427496d95c2b1867fec43 100644 (file)
@@ -13,7 +13,8 @@
 #define FORMERT_H
 
 
 #define FORMERT_H
 
 
-#include "FormBase.h"
+#include "FormDialogView.h"
+
 
 class ControlERT;
 struct FD_ert;
 
 class ControlERT;
 struct FD_ert;
@@ -21,11 +22,10 @@ struct FD_ert;
 /** This class provides an XForms implementation of the ERT
     Dialog.
  */
 /** 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:
        ///
 public:
        ///
-       FormERT();
+       FormERT(Dialog &);
 private:
        /// Set the Params variable for the Controller.
        virtual void apply();
 private:
        /// Set the Params variable for the Controller.
        virtual void apply();
index efa06d7d160144a0f09e95c84f627c0c2d254365..300f285a8cf4be2d6380b45f40a20d02ca6d274d 100644 (file)
 #include "xforms_helpers.h" // formatted
 #include FORMS_H_LOCATION
 
 #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"))
 {}
 
 
 {}
 
 
index fd817c29e7e72a8922d2ed67e39a77bc9fc5976d..d613e57d70523833e57e38c548c2a1dcecc19e49 100644 (file)
 #define FORMERROR_H
 
 
 #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 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
 public:
        /// Constructor
-       FormError();
+       FormError(Dialog &);
 private:
        /// not needed.
        virtual void apply() {}
 private:
        /// not needed.
        virtual void apply() {}
index e5be7a92efc807eb260aea1ed36771cc14d1766b..99ef7d6036baf70cf04af1800e8aa0d81659a39a 100644 (file)
 
 #include FORMS_H_LOCATION
 
 
 #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"))
 {}
 
 
 {}
 
 
index 3cb4bc8b8ed51328908d63f3240c5dbd29f929be..c1b2d2908130fcea259aab8e9d0ffadb4d8bcb5e 100644 (file)
 #define FORMINDEX_H
 
 
 #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 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:
        ///
 public:
        ///
-       FormIndex();
+       FormIndex(Dialog &);
 private:
        /// Set the Params variable for the Controller.
        virtual void apply();
 private:
        /// Set the Params variable for the Controller.
        virtual void apply();
index 5e23ecaed9e19f50ba6b964274219f89bee1a2e1..9e65a8eb5b631577f651bbb68824793cf84dca15 100644 (file)
@@ -28,10 +28,10 @@ using std::max;
 using std::sort;
 using std::vector;
 
 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)
 {}
 
          at_ref_(false)
 {}
 
@@ -90,16 +90,15 @@ void FormRef::update()
        switch_go_button();
 
        // Name is irrelevant to LaTeX/Literate documents
        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.
                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 {
                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 (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());
                }
                        string s = fl_get_browser_line(dialog_->browser_refs, sel);
                        fl_set_input(dialog_->input_ref, s.c_str());
                }
index c1e1d867aacb32f229268dfd557d80536bff0e52..51b5f2893c35b6de98d7d7926dbbae9e91d0b294 100644 (file)
 #define FORMREF_H
 
 
 #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 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:
        ///
 public:
        ///
-       FormRef();
+       FormRef(Dialog &);
 private:
        /// Set the Params variable for the Controller.
        virtual void apply();
 private:
        /// Set the Params variable for the Controller.
        virtual void apply();
index 8d1cd430384ee8da24fb5de687a60c7eb474b657..c62488ac2917507676daa0fa10eb454d228a82b6 100644 (file)
@@ -27,10 +27,10 @@ using std::vector;
 using std::endl;
 
 
 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"))
 {}
 
 
 {}
 
 
index 0276e3d09f39c4a6fce1c2eb8ad98fe252a9a4e7..d3a3c6f6511eb06ceedee1a570c971594cebed5b 100644 (file)
@@ -13,7 +13,7 @@
 #define FORMTOC_H
 
 
 #define FORMTOC_H
 
 
-#include "FormBase.h"
+#include "FormDialogView.h"
 #include "toc.h"
 
 class ControlToc;
 #include "toc.h"
 
 class ControlToc;
@@ -21,10 +21,10 @@ struct FD_toc;
 
 /** This class provides an XForms implementation of the FormToc Dialog.
  */
 
 /** 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:
        ///
 public:
        ///
-       FormToc();
+       FormToc(Dialog &);
 private:
        /// not needed
        virtual void apply() {}
 private:
        /// not needed
        virtual void apply() {}
index 6ce4b266a031d6637b94c8e2cadfbff2b8807266..1ab86a837a8b42a42e34acce1134a8fd86e42ab6 100644 (file)
 #include "forms/form_url.h"
 #include FORMS_H_LOCATION
 
 #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"))
 {}
 
 
 {}
 
 
index 067a93f3860dcb54b134482a74b46127c812830c..7e7b3a17662d067b0a873f70d29cba87a92f0737 100644 (file)
 #define FORMURL_H
 
 
 #define FORMURL_H
 
 
-#include "FormBase.h"
+#include "FormDialogView.h"
 
 class ControlUrl;
 struct FD_url;
 
 /** This class provides an XForms implementation of the Url Dialog.
  */
 
 class ControlUrl;
 struct FD_url;
 
 /** This class provides an XForms implementation of the Url Dialog.
  */
-class FormUrl : public FormCB<ControlUrl, FormDB<FD_url> > {
+class FormUrl : public FormController<ControlUrl, FormView<FD_url> > {
 public:
        ///
 public:
        ///
-       FormUrl();
+       FormUrl(Dialog &);
 private:
        /// Apply from dialog (modify or create inset)
        virtual void apply();
 private:
        /// Apply from dialog (modify or create inset)
        virtual void apply();
index a67ac6279a6d4cb66a2d12d1f91b17db9bacad85..3ac9282f94420162eded02603870083c04048884 100644 (file)
@@ -48,6 +48,7 @@ libxforms_la_SOURCES = \
        ColorHandler.h \
        Dialogs.C \
        Dialogs2.C \
        ColorHandler.h \
        Dialogs.C \
        Dialogs2.C \
+       Dialogs3.C \
        Dialogs_impl.h \
        DropDown.h \
        DropDown.C \
        Dialogs_impl.h \
        DropDown.h \
        DropDown.C \
@@ -60,6 +61,8 @@ libxforms_la_SOURCES = \
        FormAboutlyx.h \
        FormBase.C \
        FormBase.h \
        FormAboutlyx.h \
        FormBase.C \
        FormBase.h \
+       FormDialogView.C \
+       FormDialogView.h \
        FormBibitem.C \
        FormBibitem.h \
        FormBibtex.C \
        FormBibitem.C \
        FormBibitem.h \
        FormBibtex.C \
@@ -163,17 +166,3 @@ libxforms_la_SOURCES = \
        XWorkArea.C
 
 libxforms.la: $(libxforms_la_OBJECTS) $(libxforms_la_DEPENDENCIES)
        XWorkArea.C
 
 libxforms.la: $(libxforms_la_OBJECTS) $(libxforms_la_DEPENDENCIES)
-
-# just copied from old lyx repository
-#dist-hook:
-#      for subdir in $(LYXDATADIRS) ; do \
-#      test -d $(distdir)/$$subdir \
-#      || mkdir $(distdir)/$$subdir \
-#      || exit 1; \
-#      chmod 777 $(distdir)/$$subdir; \
-#      list=`(cd $(srcdir)/$$subdir && ls -1 | grep -v CVS)`; \
-#      echo $$list ; \
-#      for fil in $$list ; do \
-#      cp -p $(srcdir)/$$subdir/$$fil $(distdir)/$$subdir ; \
-#      done ; \
-#      done
index 561d90b5b56456ebc0ca3714179128319e747e9b..3bf532b96031f38568914f5c5d6e7f80ac072c00 100644 (file)
@@ -368,55 +368,20 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
        case FL_KEYPRESS:
        {
                lyxerr[Debug::WORKAREA] << "Workarea event: KEYPRESS" << endl;
        case FL_KEYPRESS:
        {
                lyxerr[Debug::WORKAREA] << "Workarea event: KEYPRESS" << endl;
-
-               KeySym keysym = 0;
-               char dummy[1];
                XKeyEvent * xke = reinterpret_cast<XKeyEvent *>(ev);
                XKeyEvent * xke = reinterpret_cast<XKeyEvent *>(ev);
-               XLookupString(xke, dummy, 1, &keysym, 0);
 
                if (lyxerr.debugging(Debug::KEY)) {
                        char const * const tmp  = XKeysymToString(key);
 
                if (lyxerr.debugging(Debug::KEY)) {
                        char const * const tmp  = XKeysymToString(key);
-                       char const * const tmp2 = XKeysymToString(keysym);
-                       string const stm  = (tmp ? tmp : string());
-                       string const stm2 = (tmp2 ? tmp2 : string());
-
-                       lyxerr << "XWorkArea: Key is `" << stm
-                              << "' [" << key << "]\n"
-                              << "XWorkArea: Keysym is `" << stm2
-                              << "' [" << keysym << ']' << endl;
+                       lyxerr << "XWorkArea: Key is `" << tmp
+                              << "' [" << key << "]" << endl;
                }
 
                }
 
-               // Note that we need this handling because of a bug
-               // in XForms 0.89, if this bug is resolved in the way I hope
-               // we can just use the keysym directly without looking
-               // at key at all. (Lgb)
-               KeySym ret_key = 0;
                if (!key) {
                if (!key) {
-                       // We might have to add more keysyms here also,
-                       // we will do that as the issues arise. (Lgb)
-                       if (keysym == XK_space) {
-                               ret_key = keysym;
-                               lyxerr[Debug::KEY] << "Using keysym [A]"
-                                                  << endl;
-                       } else
-                               break;
-               } else {
-                       // It seems that this was a bit optimistic...
-                       // With this hacking things seems to be better (Lgb)
-                       //if (!iscntrl(key)) {
-                       //      ret_key = key;
-                       //      lyxerr[Debug::KEY]
-                       //              << "Using key [B]\n"
-                       //              << "Uchar["
-                       //              << static_cast<unsigned char>(key)
-                       //              << endl;
-                       //} else {
-                       ret_key = (keysym ? keysym : key);
-                       lyxerr[Debug::KEY] << "Using keysym [B]"
-                                          << endl;
-                               //}
+                       lyxerr << "Probably composing" << endl;
+                       break;
                }
 
                }
 
+               KeySym ret_key = key;
                unsigned int const ret_state = xke->state;
 
                // If you have a better way to handle "wild-output" of
                unsigned int const ret_state = xke->state;
 
                // If you have a better way to handle "wild-output" of
index b509d17d79e399a2879ea21927cc9d0be90fd02d..ac9724b7c4dd019915c62e284731ad2a75f1f396 100644 (file)
@@ -46,7 +46,7 @@ shortcut:
 resize: FL_RESIZE_X
 gravity: FL_West FL_East
 name: input_key
 resize: FL_RESIZE_X
 gravity: FL_West FL_East
 name: input_key
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -64,7 +64,7 @@ shortcut: ^M
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_ok
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_ok
-callback: C_FormBaseOKCB
+callback: C_FormDialogView_OKCB
 argument: 3
 
 --------------------
 argument: 3
 
 --------------------
@@ -82,7 +82,7 @@ shortcut:
 resize: FL_RESIZE_X
 gravity: FL_West FL_East
 name: input_label
 resize: FL_RESIZE_X
 gravity: FL_West FL_East
 name: input_label
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -100,7 +100,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_close
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_close
-callback: C_FormBaseCancelCB
+callback: C_FormDialogView_CancelCB
 argument: 2
 
 ==============================
 argument: 2
 
 ==============================
index 2c8636ef2b2002cb6d3a0947e6eca5264035eeac..7065b4a9f195c8534a04f51d93a31986e6ddb56f 100644 (file)
@@ -46,7 +46,7 @@ shortcut:
 resize: FL_RESIZE_X
 gravity: FL_North FL_North
 name: button_rescan
 resize: FL_RESIZE_X
 gravity: FL_North FL_North
 name: button_rescan
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -64,7 +64,7 @@ shortcut:
 resize: FL_RESIZE_X
 gravity: FL_North FL_North
 name: input_database
 resize: FL_RESIZE_X
 gravity: FL_North FL_North
 name: input_database
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -82,7 +82,7 @@ shortcut: ^M
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_ok
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_ok
-callback: C_FormBaseOKCB
+callback: C_FormDialogView_OKCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -100,7 +100,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_close
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_close
-callback: C_FormBaseCancelCB
+callback: C_FormDialogView_CancelCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -118,7 +118,7 @@ shortcut:
 resize: FL_RESIZE_X
 gravity: FL_North FL_North
 name: input_style
 resize: FL_RESIZE_X
 gravity: FL_North FL_North
 name: input_style
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -136,7 +136,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_North FL_North
 name: button_database_browse
 resize: FL_RESIZE_NONE
 gravity: FL_North FL_North
 name: button_database_browse
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -154,7 +154,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_West FL_West
 name: check_bibtotoc
 resize: FL_RESIZE_NONE
 gravity: FL_West FL_West
 name: check_bibtotoc
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -172,7 +172,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_North FL_South
 name: browser_styles
 resize: FL_RESIZE_ALL
 gravity: FL_North FL_South
 name: browser_styles
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -190,7 +190,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_North FL_North
 name: button_style_browse
 resize: FL_RESIZE_NONE
 gravity: FL_North FL_North
 name: button_style_browse
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -208,7 +208,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_apply
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_apply
-callback: C_FormBaseApplyCB
+callback: C_FormDialogView_ApplyCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -226,7 +226,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthWest FL_SouthWest
 name: button_restore
 resize: FL_RESIZE_NONE
 gravity: FL_SouthWest FL_SouthWest
 name: button_restore
-callback: C_FormBaseRestoreCB
+callback: C_FormDialogView_RestoreCB
 argument: 0
 
 ==============================
 argument: 0
 
 ==============================
index 6e3e6904f755898fb9cd5d57cb299fbb64e6bd9c..cf82e82f62d041e693b4de2339a7620379164567 100644 (file)
@@ -46,7 +46,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NorthWest FL_South
 name: browser_cite
 resize: FL_RESIZE_ALL
 gravity: FL_NorthWest FL_South
 name: browser_cite
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -64,7 +64,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_North FL_SouthEast
 name: browser_bib
 resize: FL_RESIZE_ALL
 gravity: FL_North FL_SouthEast
 name: browser_bib
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -100,7 +100,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthWest FL_SouthWest
 name: button_restore
 resize: FL_RESIZE_NONE
 gravity: FL_SouthWest FL_SouthWest
 name: button_restore
-callback: C_FormBaseRestoreCB
+callback: C_FormDialogView_RestoreCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -118,7 +118,7 @@ shortcut: #&D
 resize: FL_RESIZE_NONE
 gravity: FL_North FL_North
 name: button_add
 resize: FL_RESIZE_NONE
 gravity: FL_North FL_North
 name: button_add
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -136,7 +136,7 @@ shortcut: #X
 resize: FL_RESIZE_NONE
 gravity: FL_North FL_North
 name: button_del
 resize: FL_RESIZE_NONE
 gravity: FL_North FL_North
 name: button_del
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -154,7 +154,7 @@ shortcut: #&A
 resize: FL_RESIZE_NONE
 gravity: FL_North FL_North
 name: button_up
 resize: FL_RESIZE_NONE
 gravity: FL_North FL_North
 name: button_up
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -172,7 +172,7 @@ shortcut: #&B
 resize: FL_RESIZE_NONE
 gravity: FL_North FL_North
 name: button_down
 resize: FL_RESIZE_NONE
 gravity: FL_North FL_North
 name: button_down
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -262,7 +262,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: button_previous
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: button_previous
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -280,7 +280,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: button_next
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: button_next
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -298,7 +298,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: choice_style
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: choice_style
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -316,7 +316,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: check_full_author_list
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: check_full_author_list
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -334,7 +334,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: check_force_uppercase
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: check_force_uppercase
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -352,7 +352,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: input_before
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: input_before
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -370,7 +370,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: input_after
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: input_after
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -388,7 +388,7 @@ shortcut: ^M
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_ok
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_ok
-callback: C_FormBaseOKCB
+callback: C_FormDialogView_OKCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -406,7 +406,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_close
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_close
-callback: C_FormBaseCancelCB
+callback: C_FormDialogView_CancelCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -424,7 +424,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_apply
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_apply
-callback: C_FormBaseApplyCB
+callback: C_FormDialogView_ApplyCB
 argument: 0
 
 ==============================
 argument: 0
 
 ==============================
index 34df4757360481d7e446886aa7162299bf8067d1..ae80b8d46908e16f6f200b5ebe29ce34734c51a8 100644 (file)
@@ -63,7 +63,7 @@ shortcut: ^M
 resize: FL_RESIZE_NONE
 gravity: FL_South FL_South
 name: button_close
 resize: FL_RESIZE_NONE
 gravity: FL_South FL_South
 name: button_close
-callback: C_FormBaseCancelCB
+callback: C_FormDialogView_CancelCB
 argument: 0
 
 ==============================
 argument: 0
 
 ==============================
index 9aed80c36f2d000994a61061e77933810b775b52..d94e18086b00be8cef9dbc7319d603cb65cd4cad 100644 (file)
@@ -81,7 +81,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_open
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_open
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -99,7 +99,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_collapsed
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_collapsed
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -117,7 +117,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_inlined
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: radio_inlined
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -153,7 +153,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: button_close
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: button_close
-callback: C_FormBaseCancelCB
+callback: C_FormDialogView_CancelCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -171,7 +171,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: button_apply
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: button_apply
-callback: C_FormBaseApplyCB
+callback: C_FormDialogView_ApplyCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -189,7 +189,7 @@ shortcut: ^M
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: button_ok
 resize: FL_RESIZE_ALL
 gravity: FL_NoGravity FL_NoGravity
 name: button_ok
-callback: C_FormBaseOKCB
+callback: C_FormDialogView_OKCB
 argument: 0
 
 ==============================
 argument: 0
 
 ==============================
index efad37bfe16257290abcdd98c4c0b1e6f248e0df..72d4c058834e64fc913c6fcfb65c621fe3d84093 100644 (file)
@@ -45,7 +45,7 @@ shortcut:
 resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: input_key
 resize: FL_RESIZE_X
 gravity: FL_NoGravity FL_NoGravity
 name: input_key
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -63,7 +63,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthWest FL_SouthWest
 name: button_restore
 resize: FL_RESIZE_NONE
 gravity: FL_SouthWest FL_SouthWest
 name: button_restore
-callback: C_FormBaseRestoreCB
+callback: C_FormDialogView_RestoreCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -81,7 +81,7 @@ shortcut: ^M
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_ok
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_ok
-callback: C_FormBaseOKCB
+callback: C_FormDialogView_OKCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -99,7 +99,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_apply
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_apply
-callback: C_FormBaseApplyCB
+callback: C_FormDialogView_ApplyCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -117,7 +117,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_close
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_close
-callback: C_FormBaseCancelCB
+callback: C_FormDialogView_CancelCB
 argument: 0
 
 ==============================
 argument: 0
 
 ==============================
index e3e8efec9c6c688286aa14c4208ed76e8981a5b2..ede6b7cf1c8fa08d783008bbf1cf07952c8edcd0 100644 (file)
@@ -46,7 +46,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NorthWest FL_SouthEast
 name: browser_refs
 resize: FL_RESIZE_ALL
 gravity: FL_NorthWest FL_SouthEast
 name: browser_refs
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -64,7 +64,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: button_update
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: button_update
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -82,7 +82,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: check_sort
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: check_sort
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -100,7 +100,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthWest FL_SouthWest
 name: button_restore
 resize: FL_RESIZE_NONE
 gravity: FL_SouthWest FL_SouthWest
 name: button_restore
-callback: C_FormBaseRestoreCB
+callback: C_FormDialogView_RestoreCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -118,7 +118,7 @@ shortcut: ^M
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_ok
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_ok
-callback: C_FormBaseOKCB
+callback: C_FormDialogView_OKCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -136,7 +136,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_close
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_close
-callback: C_FormBaseCancelCB
+callback: C_FormDialogView_CancelCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -154,7 +154,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_apply
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_apply
-callback: C_FormBaseApplyCB
+callback: C_FormDialogView_ApplyCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -172,7 +172,7 @@ shortcut:
 resize: FL_RESIZE_X
 gravity: FL_NorthWest FL_NorthEast
 name: choice_document
 resize: FL_RESIZE_X
 gravity: FL_NorthWest FL_NorthEast
 name: choice_document
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
   align: FL_ALIGN_LEFT
 
 argument: 0
   align: FL_ALIGN_LEFT
 
@@ -209,7 +209,7 @@ shortcut:
 resize: FL_RESIZE_X
 gravity: FL_South FL_South
 name: input_ref
 resize: FL_RESIZE_X
 gravity: FL_South FL_South
 name: input_ref
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -227,7 +227,7 @@ shortcut:
 resize: FL_RESIZE_X
 gravity: FL_South FL_South
 name: choice_format
 resize: FL_RESIZE_X
 gravity: FL_South FL_South
 name: choice_format
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -245,7 +245,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: button_go
 resize: FL_RESIZE_NONE
 gravity: FL_East FL_East
 name: button_go
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 ==============================
 argument: 0
 
 ==============================
index a6ea906ed617bad204307a6057f0bb0c42eccc79..a08212c93206bbb2ffaa06f279e12f0ec1f7423d 100644 (file)
@@ -46,7 +46,7 @@ shortcut:
 resize: FL_RESIZE_ALL
 gravity: FL_NorthWest FL_SouthEast
 name: browser_toc
 resize: FL_RESIZE_ALL
 gravity: FL_NorthWest FL_SouthEast
 name: browser_toc
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -64,7 +64,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthWest FL_SouthWest
 name: button_update
 resize: FL_RESIZE_NONE
 gravity: FL_SouthWest FL_SouthWest
 name: button_update
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -82,7 +82,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthWest FL_SouthWest
 name: choice_toc_type
 resize: FL_RESIZE_NONE
 gravity: FL_SouthWest FL_SouthWest
 name: choice_toc_type
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -100,7 +100,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_close
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_close
-callback: C_FormBaseCancelCB
+callback: C_FormDialogView_CancelCB
 argument: 0
 
 ==============================
 argument: 0
 
 ==============================
index 86b3e274319745a07ac533be08efecab52391e51..a2bcd43ca200964298331c0a006cabd6dd7d797d 100644 (file)
@@ -46,7 +46,7 @@ shortcut:
 resize: FL_RESIZE_X
 gravity: FL_West FL_East
 name: input_url
 resize: FL_RESIZE_X
 gravity: FL_West FL_East
 name: input_url
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -64,7 +64,7 @@ shortcut:
 resize: FL_RESIZE_X
 gravity: FL_West FL_East
 name: input_name
 resize: FL_RESIZE_X
 gravity: FL_West FL_East
 name: input_name
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -82,7 +82,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_West FL_West
 name: check_html
 resize: FL_RESIZE_NONE
 gravity: FL_West FL_West
 name: check_html
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -100,7 +100,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_close
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_close
-callback: C_FormBaseCancelCB
+callback: C_FormDialogView_CancelCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -118,7 +118,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_ok
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_ok
-callback: C_FormBaseOKCB
+callback: C_FormDialogView_OKCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -136,7 +136,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_apply
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_apply
-callback: C_FormBaseApplyCB
+callback: C_FormDialogView_ApplyCB
 argument: 0
 
 --------------------
 argument: 0
 
 --------------------
@@ -154,7 +154,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthWest FL_SouthWest
 name: button_restore
 resize: FL_RESIZE_NONE
 gravity: FL_SouthWest FL_SouthWest
 name: button_restore
-callback: C_FormBaseRestoreCB
+callback: C_FormDialogView_RestoreCB
 argument: 0
 
 ==============================
 argument: 0
 
 ==============================
index 6ac5408a2229c3872946212f3ca0bdbb48f988a9..7217ea5f1063be65132aa602c7bc6a76c152c79e 100644 (file)
@@ -9,6 +9,32 @@
        * insetfloat.C:
        * insetwrap.C: TocItem changed API (bug 913)
 
        * insetfloat.C:
        * insetwrap.C: TocItem changed API (bug 913)
 
+2003-02-21  Angus Leeming  <leeming@lyx.org>
+
+       * insetcollapsable.[Ch] (cache, edit):
+       * insetbutton.[Ch] (cache, edit): new methods to cache the
+       BufferView in the draw method.
+
+       * insetcommand.[Ch]: implement a new class, InsetCommandMailer, to
+       simplify comunication between InsetCommand-derived classes and
+       the Dialogs.
+
+       * insetbibitem.[Ch]:
+       * insetbibtex.[Ch]:
+       * insetcite.[Ch]:
+       * inseterror.[Ch]:
+       * insetfloatlist.[Ch]:
+       * insetindex.[Ch]:
+       * insetref.[Ch]:
+       * insettoc.[Ch]:
+       * inseturl.[Ch]: small changes to reflect the new interface to the
+       Dialogs code.
+
+       * mailinset.[Ch]: new files. Base class to InsetCommandMailer and
+       other, similar classes.
+
+       * Makefile.am: add new files.
+
 2003-02-21  Angus Leeming  <leeming@lyx.org>
        
        * updatableinset.h (setView, view): remove.
 2003-02-21  Angus Leeming  <leeming@lyx.org>
        
        * updatableinset.h (setView, view): remove.
index 98871f3f6b3be7fdbb681096abc07867fa84d103..9476738deef2b3b0622e872849b9593a131e34b4 100644 (file)
@@ -13,6 +13,8 @@ EXTRA_DIST = \
        insettheorem.h
 
 libinsets_la_SOURCES = \
        insettheorem.h
 
 libinsets_la_SOURCES = \
+       mailinset.C \
+       mailinset.h \
        ExternalTemplate.C \
        ExternalTemplate.h \
        inset.C \
        ExternalTemplate.C \
        ExternalTemplate.h \
        inset.C \
index 2e569cd0485ef8573eede8d8de08f8ec95b52d8d..513a4efd74ea39e3c13a6f2a8f681711360b645e 100644 (file)
@@ -15,8 +15,6 @@
 #include "lyxlex.h"
 
 #include "frontends/font_metrics.h"
 #include "lyxlex.h"
 
 #include "frontends/font_metrics.h"
-#include "frontends/LyXView.h"
-#include "frontends/Dialogs.h"
 
 #include "support/lstrings.h"
 
 
 #include "support/lstrings.h"
 
@@ -35,6 +33,13 @@ InsetBibitem::InsetBibitem(InsetCommandParams const & p)
 }
 
 
 }
 
 
+InsetBibitem::~InsetBibitem()
+{
+       InsetCommandMailer mailer("bibitem", *this);
+       mailer.hideDialog();
+}
+
+
 Inset * InsetBibitem::clone(Buffer const &, bool) const
 {
        InsetBibitem * b = new InsetBibitem(params());
 Inset * InsetBibitem::clone(Buffer const &, bool) const
 {
        InsetBibitem * b = new InsetBibitem(params());
@@ -91,9 +96,10 @@ string const InsetBibitem::getScreenLabel(Buffer const *) const
 }
 
 
 }
 
 
-void InsetBibitem::edit(BufferView * bv, int, int, mouse_button::state)
+void InsetBibitem::edit(BufferView *, int, int, mouse_button::state)
 {
 {
-       bv->owner()->getDialogs().showBibitem(this);
+       InsetCommandMailer mailer("bibitem", *this);
+       mailer.showDialog();
 }
 
 
 }
 
 
index 62408b63b460c46e18ac33bca9a1b7ae91c429b7..105f23ed466f10766da7e6ff5cc885e7ca44dae8 100644 (file)
@@ -27,6 +27,8 @@ public:
        ///
        InsetBibitem(InsetCommandParams const &);
        ///
        ///
        InsetBibitem(InsetCommandParams const &);
        ///
+       ~InsetBibitem();
+       ///
        Inset * clone(Buffer const &, bool same_id = false) const;
        /** Currently \bibitem is used as a LyX2.x command,
            so we need this method.
        Inset * clone(Buffer const &, bool same_id = false) const;
        /** Currently \bibitem is used as a LyX2.x command,
            so we need this method.
index da263a49698795cd9bf4247ea6e3043f0026e00a..95c97a52503169fb370fb91f4b679729b1dd9b68 100644 (file)
 
 #include "insetbibtex.h"
 #include "buffer.h"
 
 #include "insetbibtex.h"
 #include "buffer.h"
-#include "BufferView.h"
 #include "debug.h"
 #include "gettext.h"
 
 #include "debug.h"
 #include "gettext.h"
 
-#include "frontends/LyXView.h"
-#include "frontends/Dialogs.h"
-
 #include "support/filetools.h"
 #include "support/path.h"
 #include "support/os.h"
 #include "support/filetools.h"
 #include "support/path.h"
 #include "support/os.h"
@@ -41,6 +37,13 @@ InsetBibtex::InsetBibtex(InsetCommandParams const & p, bool)
 {}
 
 
 {}
 
 
+InsetBibtex::~InsetBibtex()
+{
+       InsetCommandMailer mailer("bibtex", *this);
+       mailer.hideDialog();
+}
+
+
 string const InsetBibtex::getScreenLabel(Buffer const *) const
 {
        return _("BibTeX Generated References");
 string const InsetBibtex::getScreenLabel(Buffer const *) const
 {
        return _("BibTeX Generated References");
@@ -185,9 +188,10 @@ void InsetBibtex::fillWithBibKeys
 }
 
 
 }
 
 
-void InsetBibtex::edit(BufferView * bv, int, int, mouse_button::state)
+void InsetBibtex::edit(BufferView *, int, int, mouse_button::state)
 {
 {
-       bv->owner()->getDialogs().showBibtex(this);
+       InsetCommandMailer mailer("bibtex", *this);
+       mailer.showDialog();
 }
 
 
 }
 
 
index 0efae323f9f696d8b791cbe108b673b978ceb1e0..7c7b2676ef12c8c0dc863ea818721b58f45e315d 100644 (file)
@@ -25,6 +25,8 @@ public:
        ///
        InsetBibtex(InsetCommandParams const &, bool same_id = false);
        ///
        ///
        InsetBibtex(InsetCommandParams const &, bool same_id = false);
        ///
+       ~InsetBibtex();
+       ///
        Inset * clone(Buffer const &, bool same_id = false) const {
                return new InsetBibtex(params(), same_id);
        }
        Inset * clone(Buffer const &, bool same_id = false) const {
                return new InsetBibtex(params(), same_id);
        }
index 832dae795c77828b0a4e27a6ecbde3fa9774e4c3..13c399043f05a74adf2fee33dd81e65a34556b51 100644 (file)
@@ -16,6 +16,7 @@
 #include "insetbutton.h"
 #include "debug.h"
 #include "BufferView.h"
 #include "insetbutton.h"
 #include "debug.h"
 #include "BufferView.h"
+#include "frontends/LyXView.h"
 #include "frontends/Painter.h"
 #include "support/LAssert.h"
 #include "lyxfont.h"
 #include "frontends/Painter.h"
 #include "support/LAssert.h"
 #include "lyxfont.h"
@@ -95,6 +96,7 @@ void InsetButton::draw(BufferView * bv, LyXFont const &,
                        int baseline, float & x, bool) const
 {
        lyx::Assert(bv);
                        int baseline, float & x, bool) const
 {
        lyx::Assert(bv);
+       cache(bv);
 
        Painter & pain = bv->painter();
        // Draw it as a box with the LaTeX text
 
        Painter & pain = bv->painter();
        // Draw it as a box with the LaTeX text
@@ -112,3 +114,15 @@ void InsetButton::draw(BufferView * bv, LyXFont const &,
 
        x += width(bv, font);
 }
 
        x += width(bv, font);
 }
+
+
+void InsetButton::cache(BufferView * bv) const
+{
+       view_ = bv->owner()->view();
+}
+
+
+BufferView * InsetButton::view() const
+{
+       return view_.get();
+}
index 1b90a3b255fd53b4c1b9fe2712cfd0a0ffe5b117..6d5b872e393ae23dad6a1e98330827d54f439878 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "inset.h"
 #include "LString.h"
 
 #include "inset.h"
 #include "LString.h"
+#include <boost/weak_ptr.hpp>
 
 /** Used to provide an inset that looks like a button.
  */
 
 /** Used to provide an inset that looks like a button.
  */
@@ -32,8 +33,14 @@ public:
        void draw(BufferView *, LyXFont const &, int, float &, bool) const;
 
 protected:
        void draw(BufferView *, LyXFont const &, int, float &, bool) const;
 
 protected:
+       ///
+       virtual void cache(BufferView *) const;
+       ///
+       virtual BufferView * view() const;
        /// This should provide the text for the button
        virtual string const getScreenLabel(Buffer const *) const = 0;
        /// This should provide the text for the button
        virtual string const getScreenLabel(Buffer const *) const = 0;
+private:
+       mutable boost::weak_ptr<BufferView> view_;
 };
 
 #endif
 };
 
 #endif
index 9df8737b020c5697e407d27c532d3f7767da7013..9d9db5b0df2634157de765fb6f71a749d039e3ee 100644 (file)
 
 #include <config.h>
 
 
 #include <config.h>
 
-
 #include "insetcite.h"
 #include "buffer.h"
 #include "BufferView.h"
 #include "LaTeXFeatures.h"
 #include "insetcite.h"
 #include "buffer.h"
 #include "BufferView.h"
 #include "LaTeXFeatures.h"
-#include "frontends/LyXView.h"
-#include "debug.h"
-#include "gettext.h"
 
 #include "frontends/controllers/biblio.h"
 
 #include "frontends/controllers/biblio.h"
-#include "frontends/Dialogs.h"
 
 
-#include "support/filetools.h"
-#include "support/lstrings.h"
-#include "support/path.h"
-#include "support/os.h"
 #include "support/lstrings.h"
 #include "support/lstrings.h"
-#include "support/LAssert.h"
 
 #include <map>
 
 
 #include <map>
 
@@ -235,6 +225,13 @@ InsetCitation::InsetCitation(InsetCommandParams const & p, bool)
 {}
 
 
 {}
 
 
+InsetCitation::~InsetCitation()
+{
+       InsetCommandMailer mailer("citation", *this);
+       mailer.hideDialog();
+}
+
+
 string const InsetCitation::generateLabel(Buffer const * buffer) const
 {
        string const before = string();
 string const InsetCitation::generateLabel(Buffer const * buffer) const
 {
        string const before = string();
@@ -326,7 +323,8 @@ void InsetCitation::edit(BufferView * bv, int, int, mouse_button::state)
        // buffer but doing some real work.
        setLoadingBuffer(bv->buffer(), false);
 
        // buffer but doing some real work.
        setLoadingBuffer(bv->buffer(), false);
 
-       bv->owner()->getDialogs().showCitation(this);
+       InsetCommandMailer mailer("citation", *this);
+       mailer.showDialog();
 }
 
 
 }
 
 
index 409464ffd8447dc51ae16dd4e7aa967db3408662..3cec12c54d1fd1c920786aa7fcf2c1ca7e97fb1b 100644 (file)
@@ -23,6 +23,8 @@ public:
        ///
        InsetCitation(InsetCommandParams const &, bool same_id = false);
        ///
        ///
        InsetCitation(InsetCommandParams const &, bool same_id = false);
        ///
+       ~InsetCitation();
+       ///
        Inset * clone(Buffer const &, bool same_id = false) const {
                return new InsetCitation(params(), same_id);
        }
        Inset * clone(Buffer const &, bool same_id = false) const {
                return new InsetCitation(params(), same_id);
        }
index 5ae85084a0f9eaef034ddda1a81eabf522a7580a..b01fd7082b941329551845748d137a866209ba0c 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "frontends/font_metrics.h"
 #include "frontends/Painter.h"
 
 #include "frontends/font_metrics.h"
 #include "frontends/Painter.h"
+#include "frontends/LyXView.h"
 
 #include "support/LOstream.h"
 #include "support/lstrings.h"
 
 #include "support/LOstream.h"
 #include "support/lstrings.h"
@@ -716,3 +717,17 @@ void InsetCollapsable::addPreview(grfx::PreviewLoader & loader) const
 {
        inset.addPreview(loader);
 }
 {
        inset.addPreview(loader);
 }
+
+
+void InsetCollapsable::cache(BufferView * bv) const
+{
+       view_ = bv->owner()->view();
+}
+
+
+BufferView * InsetCollapsable::view() const
+{
+       return view_.get();
+}
+
+
index f29428a3f752992426d1644b6a84868be1120a98..00bc07abff1bb1044da30eddf8af47d3f4c2e70a 100644 (file)
@@ -20,6 +20,8 @@
 #include "lyxfont.h"
 #include "LColor.h"
 
 #include "lyxfont.h"
 #include "LColor.h"
 
+#include <boost/weak_ptr.hpp>
+
 class Painter;
 class LyXText;
 class Paragraph;
 class Painter;
 class LyXText;
 class Paragraph;
@@ -191,6 +193,11 @@ public:
        void addPreview(grfx::PreviewLoader &) const;
 
 protected:
        void addPreview(grfx::PreviewLoader &) const;
 
 protected:
+       ///
+       virtual void cache(BufferView *) const;
+       ///
+       virtual BufferView * view() const;
+
        ///
        int ascent_collapsed() const;
        ///
        ///
        int ascent_collapsed() const;
        ///
@@ -243,6 +250,8 @@ private:
        bool in_update;
        ///
        mutable bool first_after_edit;
        bool in_update;
        ///
        mutable bool first_after_edit;
+       ///
+       mutable boost::weak_ptr<BufferView> view_;
 };
 
 #endif
 };
 
 #endif
index 27324e97e4f3ef30c10f035033d80a3b8e98fffa..3b2874b036471cd57b8983feb1d9ea4dbb0ca057 100644 (file)
@@ -15,6 +15,8 @@
 #include "insetcommand.h"
 #include "debug.h"
 #include "frontends/Painter.h"
 #include "insetcommand.h"
 #include "debug.h"
 #include "frontends/Painter.h"
+#include "Lsstream.h"
+#include "lyxlex.h"
 
 using std::ostream;
 using std::endl;
 
 using std::ostream;
 using std::endl;
@@ -57,3 +59,44 @@ int InsetCommand::docbook(Buffer const *, ostream &, bool) const
 {
        return 0;
 }
 {
        return 0;
 }
+
+
+InsetCommandMailer::InsetCommandMailer(string const & name,
+                                      InsetCommand & inset)
+       : name_(name), inset_(inset)
+{}
+
+
+string const InsetCommandMailer::inset2string() const
+{
+       return params2string(inset_.params());
+}
+
+
+void InsetCommandMailer::string2params(string const & in,
+                                      InsetCommandParams & params)
+{
+       params.setCmdName(string());
+       params.setContents(string());
+       params.setOptions(string());
+
+       if (in.empty())
+               return;
+
+       istringstream data(in);
+       LyXLex lex(0,0);
+       lex.setStream(data);
+
+       params.read(lex);
+}
+
+
+string const
+InsetCommandMailer::params2string(InsetCommandParams const & params)
+{
+       ostringstream data;
+       params.write(data);
+       data << "\\end_inset\n";
+
+       return data.str();
+}
index 8ddee55aa22edc025e9620c8eb9c9970990f18d9..387363a7d211d5cf39f9358782f1d44c10eb4d89 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "insetbutton.h"
 #include "insetcommandparams.h"
 
 #include "insetbutton.h"
 #include "insetcommandparams.h"
-#include <boost/signals/signal0.hpp>
+#include "mailinset.h"
 #include <boost/utility.hpp>
 
 // Created by Alejandro 970222
 #include <boost/utility.hpp>
 
 // Created by Alejandro 970222
@@ -33,8 +33,6 @@ public:
        explicit
        InsetCommand(InsetCommandParams const &, bool same_id = false);
        ///
        explicit
        InsetCommand(InsetCommandParams const &, bool same_id = false);
        ///
-       virtual ~InsetCommand() { hideDialog(); }
-       ///
        void write(Buffer const *, std::ostream & os) const
                { p_.write(os); }
        ///
        void write(Buffer const *, std::ostream & os) const
                { p_.write(os); }
        ///
@@ -72,12 +70,33 @@ public:
        InsetCommandParams const & params() const { return p_; }
        ///
        void setParams(InsetCommandParams const &);
        InsetCommandParams const & params() const { return p_; }
        ///
        void setParams(InsetCommandParams const &);
-       ///
-       boost::signal0<void> hideDialog;
 
 private:
        ///
        InsetCommandParams p_;
 };
 
 
 private:
        ///
        InsetCommandParams p_;
 };
 
+
+class InsetCommandMailer : public MailInset {
+public:
+       ///
+       InsetCommandMailer(string const & name, InsetCommand & inset);
+       ///
+       virtual Inset & inset() const { return inset_; }
+       ///
+       virtual string const & name() const { return name_; }
+       ///
+       virtual string const inset2string() const;
+       ///
+       static void string2params(string const &, InsetCommandParams &);
+       ///
+       static string const params2string(InsetCommandParams const &);
+private:
+       ///
+       string const name_;
+       ///
+       InsetCommand & inset_;
+};
+
+
 #endif
 #endif
index b887c52e3ec3b94416f7dbedaa3273f39218bb56..08b9b4179e768e8940360fe781d9c37d8aeb4802 100644 (file)
@@ -19,6 +19,7 @@
 #include "frontends/LyXView.h"
 #include "frontends/Painter.h"
 #include "frontends/Dialogs.h"
 #include "frontends/LyXView.h"
 #include "frontends/Painter.h"
 #include "frontends/Dialogs.h"
+#include "support/LAssert.h"
 
 using std::ostream;
 
 
 using std::ostream;
 
@@ -29,6 +30,13 @@ InsetError::InsetError(string const & str, bool)
 {}
 
 
 {}
 
 
+InsetError::~InsetError()
+{
+       if (view())
+               view()->owner()->getDialogs().hide("error");
+}
+
+
 int InsetError::ascent(BufferView *, LyXFont const & font) const
 {
        LyXFont efont;
 int InsetError::ascent(BufferView *, LyXFont const & font) const
 {
        LyXFont efont;
@@ -56,6 +64,9 @@ int InsetError::width(BufferView *, LyXFont const & font) const
 void InsetError::draw(BufferView * bv, LyXFont const & font,
                      int baseline, float & x, bool) const
 {
 void InsetError::draw(BufferView * bv, LyXFont const & font,
                      int baseline, float & x, bool) const
 {
+       lyx::Assert(bv);
+       cache(bv);
+
        Painter & pain = bv->painter();
        LyXFont efont;
        efont.setSize(font.size()).decSize();
        Painter & pain = bv->painter();
        LyXFont efont;
        efont.setSize(font.size()).decSize();
@@ -85,7 +96,7 @@ string const InsetError::editMessage() const
 
 void InsetError::edit(BufferView * bv, int, int, mouse_button::state)
 {
 
 void InsetError::edit(BufferView * bv, int, int, mouse_button::state)
 {
-       bv->owner()->getDialogs().showError(this);
+       bv->owner()->getDialogs().show("error", getContents(), this);
 }
 
 
 }
 
 
index 4d40f04e4f8c638c325be669d8d28eee2b8c8c92..e24aa22bd2b8eb5d383b979b960d56a69e256659 100644 (file)
@@ -16,8 +16,6 @@
 #include "inset.h"
 #include "LString.h"
 
 #include "inset.h"
 #include "LString.h"
 
-#include <boost/signals/signal0.hpp>
-
 /** Used for error messages from LaTeX runs.
 
   The edit-operation opens a
 /** Used for error messages from LaTeX runs.
 
   The edit-operation opens a
@@ -29,7 +27,7 @@ public:
        explicit
        InsetError(string const &, bool same_id = false);
        ///
        explicit
        InsetError(string const &, bool same_id = false);
        ///
-       ~InsetError() { hideDialog(); }
+       ~InsetError();
        ///
        int ascent(BufferView *, LyXFont const &) const;
        ///
        ///
        int ascent(BufferView *, LyXFont const &) const;
        ///
@@ -70,8 +68,6 @@ public:
        bool directWrite() const { return true; };
        ///
        string const & getContents() const { return contents; }
        bool directWrite() const { return true; };
        ///
        string const & getContents() const { return contents; }
-       ///
-       boost::signal0<void> hideDialog;
 private:
        ///
        string contents;
 private:
        ///
        string contents;
index eece0b9846d5161bf7e3c80d069931a5b2542f2f..7f0c4a2bf6b2e5e38f1d62d8b5c9e5de068e0418 100644 (file)
@@ -10,7 +10,6 @@
  */
 #include <config.h>
 
  */
 #include <config.h>
 
-
 #include "insetert.h"
 #include "insettext.h"
 
 #include "insetert.h"
 #include "insettext.h"
 
@@ -31,6 +30,8 @@
 #include "frontends/LyXView.h"
 
 #include "support/LOstream.h"
 #include "frontends/LyXView.h"
 
 #include "support/LOstream.h"
+#include "support/LAssert.h"
+#include "support/lstrings.h"
 
 
 using std::ostream;
 
 
 using std::ostream;
@@ -104,7 +105,8 @@ InsetERT::InsetERT(BufferParams const & bp,
 
 InsetERT::~InsetERT()
 {
 
 InsetERT::~InsetERT()
 {
-       hideDialog();
+       InsetERTMailer mailer(*this);
+       mailer.hideDialog();
 }
 
 
 }
 
 
@@ -493,8 +495,8 @@ string const InsetERT::get_new_label() const
        pos_type const max_length = 15;
        pos_type const p_siz = inset.paragraph()->size();
        pos_type const n = min(max_length, p_siz);
        pos_type const max_length = 15;
        pos_type const p_siz = inset.paragraph()->size();
        pos_type const n = min(max_length, p_siz);
-       int i = 0;
-       int j = 0;
+       pos_type i = 0;
+       pos_type j = 0;
        for(; i < n && j < p_siz; ++j) {
                if (inset.paragraph()->isInset(j))
                        continue;
        for(; i < n && j < p_siz; ++j) {
                if (inset.paragraph()->isInset(j))
                        continue;
@@ -563,6 +565,9 @@ int InsetERT::width(BufferView * bv, LyXFont const & font) const
 void InsetERT::draw(BufferView * bv, LyXFont const & f,
                    int baseline, float & x, bool cleared) const
 {
 void InsetERT::draw(BufferView * bv, LyXFont const & f,
                    int baseline, float & x, bool cleared) const
 {
+       lyx::Assert(bv);
+       cache(bv);
+
        Painter & pain = bv->painter();
 
        button_length = width_collapsed();
        Painter & pain = bv->painter();
 
        button_length = width_collapsed();
@@ -651,9 +656,10 @@ void InsetERT::status(BufferView * bv, ERTStatus const st) const
 }
 
 
 }
 
 
-bool InsetERT::showInsetDialog(BufferView * bv) const
+bool InsetERT::showInsetDialog(BufferView *) const
 {
 {
-       bv->owner()->getDialogs().showERT(const_cast<InsetERT *>(this));
+       InsetERTMailer mailer(const_cast<InsetERT &>(*this));
+       mailer.showDialog();
        return true;
 }
 
        return true;
 }
 
@@ -718,3 +724,32 @@ void InsetERT::update(BufferView * bv, LyXFont const & font,
        }
        InsetCollapsable::update(bv, font, reinit);
 }
        }
        InsetCollapsable::update(bv, font, reinit);
 }
+
+
+InsetERTMailer::InsetERTMailer(InsetERT & inset)
+       : name_("ert"), inset_(inset)
+{}
+
+
+string const InsetERTMailer::inset2string() const
+{
+       return params2string(inset_.status());
+}
+
+
+void InsetERTMailer::string2params(string const & in,
+                                  InsetERT::ERTStatus & status)
+{
+       status = InsetERT::Collapsed;
+       if (in.empty())
+               return;
+
+       status = static_cast<InsetERT::ERTStatus>(strToInt(in));
+}
+
+
+string const
+InsetERTMailer::params2string(InsetERT::ERTStatus status)
+{
+       return tostr(status);
+}
index a03d9877b93da56cf5afdb06922360409974cbb1..9919ae12496aced93bff3d2e1fb291eb6cb17633 100644 (file)
@@ -16,8 +16,6 @@
 
 #include "insetcollapsable.h"
 
 
 #include "insetcollapsable.h"
 
-#include <boost/signals/signal0.hpp>
-
 /** A collapsable text inset for LaTeX insertions.
 
   To write full ert (including styles and other insets) in a given
 /** A collapsable text inset for LaTeX insertions.
 
   To write full ert (including styles and other insets) in a given
@@ -70,8 +68,6 @@ public:
        ///
        EDITABLE editable() const;
        ///
        ///
        EDITABLE editable() const;
        ///
-       boost::signal0<void> hideDialog;
-       ///
        int latex(Buffer const *, std::ostream &, bool fragile,
                  bool free_spc) const;
        ///
        int latex(Buffer const *, std::ostream &, bool fragile,
                  bool free_spc) const;
        ///
@@ -155,4 +151,29 @@ private:
        mutable ERTStatus status_;
 };
 
        mutable ERTStatus status_;
 };
 
+
+#include "mailinset.h"
+
+class InsetERTMailer : public MailInset {
+public:
+       ///
+       InsetERTMailer(InsetERT & inset);
+       ///
+       virtual Inset & inset() const { return inset_; }
+       ///
+       virtual string const & name() const { return name_; }
+       ///
+       virtual string const inset2string() const;
+       ///
+       static void string2params(string const &, InsetERT::ERTStatus &);
+       ///
+       static string const params2string(InsetERT::ERTStatus);
+private:
+       ///
+       string const name_;
+       ///
+       InsetERT & inset_;
+};
+
+
 #endif
 #endif
index ad85096c8d84e065e5d838fd6e62a2342958819b..f6b49cef57c8e98ce37dda7373b8b380378d1a08 100644 (file)
@@ -41,6 +41,13 @@ InsetFloatList::InsetFloatList(string const & type)
 }
 
 
 }
 
 
+InsetFloatList::~InsetFloatList()
+{
+       InsetCommandMailer mailer("toc", *this);
+       mailer.hideDialog();
+}
+
+
 string const InsetFloatList::getScreenLabel(Buffer const * buf) const
 {
        FloatList const & floats = buf->params.getLyXTextClass().floats();
 string const InsetFloatList::getScreenLabel(Buffer const * buf) const
 {
        FloatList const & floats = buf->params.getLyXTextClass().floats();
@@ -89,9 +96,10 @@ void InsetFloatList::read(Buffer const * buf, LyXLex & lex)
 }
 
 
 }
 
 
-void InsetFloatList::edit(BufferView * bv, int, int, mouse_button::state)
+void InsetFloatList::edit(BufferView *, int, int, mouse_button::state)
 {
 {
-       bv->owner()->getDialogs().showTOC(this);
+       InsetCommandMailer mailer("toc", *this);
+       mailer.showDialog();
 }
 
 
 }
 
 
index f8751333776edacb139a7f3d3cfb295bf6486f73..a5b7f68442d2d2af92ffe85fafcb70104deedbd7 100644 (file)
@@ -24,6 +24,8 @@ public:
        ///
        InsetFloatList(string const & type);
        ///
        ///
        InsetFloatList(string const & type);
        ///
+       ~InsetFloatList();
+       ///
        Inset * clone(Buffer const &, bool = false) const {
                return new InsetFloatList(getCmdName());
        }
        Inset * clone(Buffer const &, bool = false) const {
                return new InsetFloatList(getCmdName());
        }
index d86396019417f6a685004d967b64925d61478180..29d2aa4b80da2073afde0609909a099ea8051fcc 100644 (file)
@@ -25,15 +25,23 @@ InsetIndex::InsetIndex(InsetCommandParams const & p, bool)
 {}
 
 
 {}
 
 
+InsetIndex::~InsetIndex()
+{
+       InsetCommandMailer mailer("index", *this);
+       mailer.hideDialog();
+}
+
+
 string const InsetIndex::getScreenLabel(Buffer const *) const
 {
        return _("Idx");
 }
 
 
 string const InsetIndex::getScreenLabel(Buffer const *) const
 {
        return _("Idx");
 }
 
 
-void InsetIndex::edit(BufferView * bv, int, int, mouse_button::state)
+void InsetIndex::edit(BufferView *, int, int, mouse_button::state)
 {
 {
-       bv->owner()->getDialogs().showIndex(this);
+       InsetCommandMailer mailer("index", *this);
+       mailer.showDialog();
 }
 
 
 }
 
 
index db4a138713603f1ffacec7523ab60e371e2f3e11..3f13751563d3fe840ce94b58a4aa006e6ce1d22a 100644 (file)
@@ -24,6 +24,8 @@ public:
        ///
        InsetIndex(InsetCommandParams const &, bool same_id = false);
        ///
        ///
        InsetIndex(InsetCommandParams const &, bool same_id = false);
        ///
+       ~InsetIndex();
+       ///
        virtual Inset * clone(Buffer const &, bool same_id = false) const {
                return new InsetIndex(params(), same_id);
        }
        virtual Inset * clone(Buffer const &, bool same_id = false) const {
                return new InsetIndex(params(), same_id);
        }
index 4da8535664d4c948d91eaf07981b5336ac5f8cb0..7f0e3f1b8f1b765b245dbccf425c3ae03193bc58 100644 (file)
@@ -28,13 +28,22 @@ InsetRef::InsetRef(InsetCommandParams const & p, Buffer const & buf, bool)
 {}
 
 
 {}
 
 
+InsetRef::~InsetRef()
+{
+       InsetCommandMailer mailer("ref", *this);
+       mailer.hideDialog();
+}
+
+
 void InsetRef::edit(BufferView * bv, int, int, mouse_button::state button)
 {
        // FuncRequestually trigger dialog with button 3 not 1
        if (button == mouse_button::button3)
                bv->owner()->dispatch(FuncRequest(LFUN_REF_GOTO, getContents()));
 void InsetRef::edit(BufferView * bv, int, int, mouse_button::state button)
 {
        // FuncRequestually trigger dialog with button 3 not 1
        if (button == mouse_button::button3)
                bv->owner()->dispatch(FuncRequest(LFUN_REF_GOTO, getContents()));
-       else if (button == mouse_button::button1)
-               bv->owner()->getDialogs().showRef(this);
+       else if (button == mouse_button::button1) {
+               InsetCommandMailer mailer("ref", *this);
+               mailer.showDialog();
+       }
 }
 
 
 }
 
 
index 87b8716593598b652127d53474163cfc2f1d7edb..9a5dac30df17acf2a083e76ac327b823517b8b18 100644 (file)
@@ -38,6 +38,8 @@ public:
        ///
        InsetRef(InsetCommandParams const &, Buffer const &, bool same_id = false);
        ///
        ///
        InsetRef(InsetCommandParams const &, Buffer const &, bool same_id = false);
        ///
+       ~InsetRef();
+       ///
        virtual Inset * clone(Buffer const & buffer, bool same_id = false) const {
                return new InsetRef(params(), buffer, same_id);
        }
        virtual Inset * clone(Buffer const & buffer, bool same_id = false) const {
                return new InsetRef(params(), buffer, same_id);
        }
index 277212db00dbbc2996fe1540c490530b2e2a3010..0c64eb5013d091bd6a9e1241c35edec5648f1ac4 100644 (file)
@@ -22,6 +22,18 @@ using std::vector;
 using std::ostream;
 
 
 using std::ostream;
 
 
+InsetTOC::InsetTOC(InsetCommandParams const & p, bool same_id)
+       : InsetCommand(p, same_id)
+{}
+
+
+InsetTOC::~InsetTOC()
+{
+       InsetCommandMailer mailer("toc", *this);
+       mailer.hideDialog();
+}
+
+
 string const InsetTOC::getScreenLabel(Buffer const *) const
 {
        string const cmdname(getCmdName());
 string const InsetTOC::getScreenLabel(Buffer const *) const
 {
        string const cmdname(getCmdName());
@@ -41,9 +53,10 @@ Inset::Code InsetTOC::lyxCode() const
 }
 
 
 }
 
 
-void InsetTOC::edit(BufferView * bv, int, int, mouse_button::state)
+void InsetTOC::edit(BufferView *, int, int, mouse_button::state)
 {
 {
-       bv->owner()->getDialogs().showTOC(this);
+       InsetCommandMailer mailer("toc", *this);
+       mailer.showDialog();
 }
 
 
 }
 
 
index 50d0f7c1d300c8d6d4328c3dde3c710d64a2104f..142c8de333980a9e093d5e33382ad266ece9c496 100644 (file)
@@ -20,8 +20,9 @@
 class InsetTOC : public InsetCommand {
 public:
        ///
 class InsetTOC : public InsetCommand {
 public:
        ///
-       InsetTOC(InsetCommandParams const & p, bool same_id = false)
-                       : InsetCommand(p, same_id) {}
+       InsetTOC(InsetCommandParams const &, bool same_id = false);
+       ///
+       ~InsetTOC();
        ///
        virtual Inset * clone(Buffer const &, bool same_id = false) const {
                return new InsetTOC(params(), same_id);
        ///
        virtual Inset * clone(Buffer const &, bool same_id = false) const {
                return new InsetTOC(params(), same_id);
index 0ad00a3c678d3464363a4ec194924598f46ab1d6..60c2ab2a12e7610801a38cdb5c7692834a6d1d40 100644 (file)
@@ -27,9 +27,17 @@ InsetUrl::InsetUrl(InsetCommandParams const & p, bool)
 {}
 
 
 {}
 
 
-void InsetUrl::edit(BufferView * bv, int, int, mouse_button::state)
+InsetUrl::~InsetUrl()
 {
 {
-       bv->owner()->getDialogs().showUrl(this);
+       InsetCommandMailer mailer("url", *this);
+       mailer.hideDialog();
+}
+
+
+void InsetUrl::edit(BufferView *, int, int, mouse_button::state)
+{
+       InsetCommandMailer mailer("url", *this);
+       mailer.showDialog();
 }
 
 
 }
 
 
index 3e8f712188e91ab724f8a8bed43df4abfa3a8068..4f5d2693a4cfef6d2edcc20a963c3a3fd517f16d 100644 (file)
@@ -25,6 +25,8 @@ public:
        explicit
        InsetUrl(InsetCommandParams const &, bool same_id = false);
        ///
        explicit
        InsetUrl(InsetCommandParams const &, bool same_id = false);
        ///
+       ~InsetUrl();
+       ///
        virtual Inset * clone(Buffer const &, bool same_id = false) const {
                return new InsetUrl(params(), same_id);
        }
        virtual Inset * clone(Buffer const &, bool same_id = false) const {
                return new InsetUrl(params(), same_id);
        }
diff --git a/src/insets/mailinset.C b/src/insets/mailinset.C
new file mode 100644 (file)
index 0000000..725ca45
--- /dev/null
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+/**
+ * \file mailinset.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 "mailinset.h"
+#include "inset.h"
+#include "BufferView.h"
+#include "frontends/LyXView.h"
+#include "frontends/Dialogs.h"
+#include "Lsstream.h"
+
+
+void MailInset::showDialog() const
+{
+       BufferView * bv = inset().view();
+       if (!bv)
+               return;
+
+       bv->owner()->getDialogs().show(name(), inset2string(), &inset());
+}
+
+
+void MailInset::updateDialog() const
+{
+       BufferView * bv = inset().view();
+       if (!bv)
+               return;
+
+       bv->owner()->getDialogs().update(name(), inset2string());
+}
+
+
+void MailInset::hideDialog() const
+{
+       BufferView * bv = inset().view();
+       if (!bv)
+               return;
+
+       bv->owner()->getDialogs().hide(name());
+}
diff --git a/src/insets/mailinset.h b/src/insets/mailinset.h
new file mode 100644 (file)
index 0000000..965895d
--- /dev/null
@@ -0,0 +1,43 @@
+// -*- C++ -*-
+/**
+ * \file mailinset.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 MAILINSET_H
+#define MAILINSET_H
+
+
+#include "LString.h"
+
+
+class Inset;
+
+
+class MailInset {
+public:
+       ///
+       virtual ~MailInset() {};
+       ///
+       void showDialog() const;
+       ///
+       void updateDialog() const;
+       ///
+       void hideDialog() const;
+       ///
+       virtual string const inset2string() const = 0;
+
+protected:
+       ///
+       virtual Inset & inset() const = 0;
+       ///
+       virtual string const & name() const = 0;
+};
+
+
+#endif // MAILINSET_H
index 2b0a43513ad719c84fc1109c83a6b888a45c3ca0..904070eb038c87907eb9669cc56aa6eab0bf718a 100644 (file)
@@ -43,6 +43,8 @@
 #include "ParagraphParameters.h"
 
 #include "insets/insetcommand.h"
 #include "ParagraphParameters.h"
 
 #include "insets/insetcommand.h"
+#include "insets/inseterror.h"
+#include "insets/insetert.h"
 #include "insets/insettabular.h"
 
 #include "mathed/formulamacro.h"
 #include "insets/insettabular.h"
 
 #include "mathed/formulamacro.h"
@@ -559,13 +561,12 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
        case LFUN_REF_INSERT:
                code = Inset::REF_CODE;
                break;
        case LFUN_REF_INSERT:
                code = Inset::REF_CODE;
                break;
-       case LFUN_CITATION_CREATE:
-       case LFUN_CITATION_INSERT:
-               code = Inset::CITE_CODE;
-               break;
-       case LFUN_INSERT_BIBTEX:
+       case LFUN_BIBTEX_APPLY:
                code = Inset::BIBTEX_CODE;
                break;
                code = Inset::BIBTEX_CODE;
                break;
+       case LFUN_CITATION_APPLY:
+               code = Inset::CITE_CODE;
+               break;
        case LFUN_INDEX_INSERT:
                code = Inset::INDEX_CODE;
                break;
        case LFUN_INDEX_INSERT:
                code = Inset::INDEX_CODE;
                break;
@@ -1047,27 +1048,10 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
                break;
 
        case LFUN_TOCVIEW:
                break;
 
        case LFUN_TOCVIEW:
-#if 0
-       case LFUN_LOFVIEW:
-       case LFUN_LOTVIEW:
-       case LFUN_LOAVIEW:
-#endif
        {
        {
-               InsetCommandParams p;
-
-#if 0
-               if (action == LFUN_TOCVIEW)
-#endif
-                       p.setCmdName("tableofcontents");
-#if 0
-               else if (action == LFUN_LOAVIEW)
-                       p.setCmdName("listof{algorithm}{List of Algorithms}");
-               else if (action == LFUN_LOFVIEW)
-                       p.setCmdName("listoffigures");
-               else
-                       p.setCmdName("listoftables");
-#endif
-               owner->getDialogs().createTOC(p.getAsString());
+               InsetCommandParams p("tableofcontents");
+               string const data = InsetCommandMailer::params2string(p);
+               owner->getDialogs().show("toc", data, 0);
                break;
        }
 
                break;
        }
 
@@ -1374,27 +1358,79 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
                owner->getDialogs().showMathPanel();
                break;
 
                owner->getDialogs().showMathPanel();
                break;
 
-       case LFUN_CITATION_CREATE:
-       {
-               InsetCommandParams p("cite");
+       case LFUN_DIALOG_SHOW_NEW_INSET: {
+               string const & name = argument;
+               string data;
+               if (name == "bibitem" ||
+                   name == "bibtex" ||
+                   name == "index" ||
+                   name == "ref" ||
+                   name == "toc" ||
+                   name == "url") {
+                       InsetCommandParams p(name);
+                       data = InsetCommandMailer::params2string(p);
+               } else if (name == "citation") {
+                       InsetCommandParams p("cite");
+                       data = InsetCommandMailer::params2string(p);
+//             } else if (name == "error" || name == "ert") {
+//                     // need do nothing special
+               }
+                owner->getDialogs().show(name, data, 0);
+       }
+       break;
 
 
-               if (!argument.empty()) {
-                       // This should be set at source, ie when typing
-                       // "citation-insert foo" in the minibuffer.
-                       // Question: would pybibliographer also need to be
-                       // changed. Suspect so. Leave as-is therefore.
-                       if (contains(argument, "|")) {
-                               p.setContents(token(argument, '|', 0));
-                               p.setOptions(token(argument, '|', 1));
-                       } else {
-                               p.setContents(argument);
-                       }
-                       dispatch(FuncRequest(view(), LFUN_CITATION_INSERT, p.getAsString()));
-               } else
-                       owner->getDialogs().createCitation(p.getAsString());
+       case LFUN_DIALOG_SHOW_NEXT_INSET: {
        }
        break;
 
        }
        break;
 
+       case LFUN_DIALOG_UPDATE: {
+               string const & name = argument;
+               // Can only update a dialog connected to an existing inset
+               InsetBase * i = owner->getDialogs().getOpenInset(name);
+               if (!i)
+                       break;
+
+               if (name == "bibitem" ||
+                   name == "bibtex" ||
+                   name == "citation" ||
+                   name == "index" ||
+                   name == "ref" ||
+                   name == "toc" ||
+                   name == "url") {
+                       InsetCommand * inset = dynamic_cast<InsetCommand *>(i);
+                       if (!inset)
+                               break;
+
+                       InsetCommandMailer mailer(name, *inset);
+                       mailer.updateDialog();
+
+               } else if (name == "error") {
+                       InsetError * inset = dynamic_cast<InsetError *>(i);
+                       if (!inset)
+                               break;
+
+                       owner->getDialogs().update("error",
+                                                  inset->getContents());
+
+               } else if (name == "ert") {
+                       InsetERT * inset = dynamic_cast<InsetERT *>(i);
+                       if (!inset)
+                               break;
+
+                       InsetERTMailer mailer(*inset);
+                       mailer.updateDialog();
+               }
+       }
+       break;
+
+       case LFUN_DIALOG_HIDE:
+               owner ->getDialogs().hide(argument);
+               break;
+
+       case LFUN_DIALOG_DISCONNECT_INSET:
+                owner->getDialogs().disconnect(argument);
+               break;
+
        case LFUN_CHILDOPEN:
        {
                string const filename =
        case LFUN_CHILDOPEN:
        {
                string const filename =
index 768593d1283081f993b412a163bc88a4faa2939a..c049d028af59b9bca42f236ef519de679f57f51a 100644 (file)
@@ -1,3 +1,12 @@
+2003-02-21  Angus Leeming  <leeming@lyx.org>
+
+       * formulabase.C (localDispatch): retire LFUN_REF_INSERT. Add
+       LFUN_DIALOG_SHOW_NEW_INSET "ref" and LFUN_REF_APPLY. The latter
+       is not yet safe. Posted some ideas to the list for further discussion.
+
+       * ref_inset.C (dispatch): a first stab at activating the code
+       to display the reference dialog from within mathed. Not yet working.
+
 2003-02-14  Dekel Tsur  <dekelts@tau.ac.il>
 
        * math_parser.C (parse1): Do not remove braces for {<expr>}^
 2003-02-14  Dekel Tsur  <dekelts@tau.ac.il>
 
        * math_parser.C (parse1): Do not remove braces for {<expr>}^
index 27a2df6176b107fa154ed37feb42b2706b907c41..f1b50471c0d15802d5cd021e4301bde53b831428 100644 (file)
@@ -51,7 +51,7 @@
 #include "textpainter.h"
 #include "frontends/Dialogs.h"
 #include "intl.h"
 #include "textpainter.h"
 #include "frontends/Dialogs.h"
 #include "intl.h"
-#include "insets/insetcommandparams.h"
+#include "insets/insetcommand.h"
 #include "ref_inset.h"
 
 using std::endl;
 #include "ref_inset.h"
 
 using std::endl;
@@ -795,31 +795,42 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
                updateLocal(bv, true);
                break;
 
                updateLocal(bv, true);
                break;
 
-       case LFUN_REF_INSERT:
-               //if (argument.empty()) {
-               //      InsetCommandParams p("ref");
-               //      owner_->getDialogs().createRef(p.getAsString());
-               //} else {
-               //      InsetCommandParams p;
-               //      p.setFromString(argument);
-
-               //      InsetRef * inset = new InsetRef(p, *buffer_);
-               //      if (!insertInset(inset))
-               //              delete inset;
-               //      else
-               //              updateInset(inset, true);
-               //}
-               //
-               if (cmd.argument.empty()) {
-                       InsetCommandParams p("ref");
-                       bv->owner()->getDialogs().createRef(p.getAsString());
+       case LFUN_DIALOG_SHOW_NEW_INSET: {
+               string const & name = argument;
+               if (name == "ref") {
+                       InsetCommandParams p(name);
+                       string data = InsetCommandMailer::params2string(p);
+                       bv->owner()->getDialogs().show(name, data, 0);
+               } else
+                       result = UNDISPATCHED;
+       }
+       break;
+
+       case LFUN_REF_APPLY: {
+               InsetCommandParams params;
+               InsetCommandMailer::string2params(argument, params);
+
+               // It would be nice if RefInset could handle an
+               // InsetCommandParams arg, but for now we convert it to
+               // 'foo|++|bar|++|nonsense'.
+               string const tmp = params.getAsString();
+
+               InsetBase * base =
+                       bv->owner()->getDialogs().getOpenInset("ref");
+               if (base) {
+                       RefInset * inset = dynamic_cast<RefInset *>(base);
+                       if (!inset) {
+                               result = UNDISPATCHED;
+                               break;
+                       }
+
+                       *inset = RefInset(tmp);
                } else {
                } else {
-                       //mathcursor->handleNest(new InsetRef2);
-                       //mathcursor->insert(arg);
-                       mathcursor->insert(MathAtom(new RefInset(cmd.argument)));
+                       mathcursor->insert(MathAtom(new RefInset(tmp)));
                }
                updateLocal(bv, true);
                }
                updateLocal(bv, true);
-               break;
+       }
+       break;
 
        default:
                result = UNDISPATCHED;
 
        default:
                result = UNDISPATCHED;
index 9e3b5a8e30e6d7da991d9d8c76016f29d4e3c8ba..98de8ee7222755d69c3170e656b51106438234d1 100644 (file)
@@ -12,6 +12,8 @@
 #include "gettext.h"
 #include "LaTeXFeatures.h"
 #include "debug.h"
 #include "gettext.h"
 #include "LaTeXFeatures.h"
 #include "debug.h"
+#include "math_mathmlstream.h"
+#include "Lsstream.h"
 
 
 RefInset::RefInset()
 
 
 RefInset::RefInset()
@@ -39,8 +41,9 @@ void RefInset::infoize(std::ostream & os) const
 dispatch_result
 RefInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
 {
 dispatch_result
 RefInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
 {
+       lyxerr << "RefInset::dispatch" << std::endl;
+       lyxerr << "dispatching " << cmd.argument << "\n";
        switch (cmd.action) {
        switch (cmd.action) {
-               lyxerr << "dispatching " << cmd.argument << "\n";
                case LFUN_MOUSE_RELEASE:
                        if (cmd.button() == mouse_button::button3) {
                                lyxerr << "trying to goto ref" << cell(0) << "\n";
                case LFUN_MOUSE_RELEASE:
                        if (cmd.button() == mouse_button::button3) {
                                lyxerr << "trying to goto ref" << cell(0) << "\n";
@@ -49,8 +52,19 @@ RefInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
                        }
                        if (cmd.button() == mouse_button::button1) {
                                lyxerr << "trying to open ref" << cell(0) << "\n";
                        }
                        if (cmd.button() == mouse_button::button1) {
                                lyxerr << "trying to open ref" << cell(0) << "\n";
-                               // Eventually trigger dialog with button 3 not 1
-               //      cmd.view()->owner()->getDialogs()->showRef(this);
+                               // Eventually trigger dialog with button 3
+                               // not 1
+                               ostringstream data;
+                               WriteStream wsdata(data);
+                               write(wsdata);
+
+                               lyxerr << "ref_inset dispatch.\n"
+                                      << "this " << this << "\n"
+                                      << "The data is "<< data.str()
+                                      << std::endl;
+
+                               cmd.view()->owner()->getDialogs().
+                                       show("ref", data.str(), this);
                                return DISPATCHED;
                        }
                        break;
                                return DISPATCHED;
                        }
                        break;
index 9de9251e6fb0d7e80dc726001a777c7eeefb98ae..e37f2bf1dc3cd54142267b62a0686a21b2025344 100644 (file)
@@ -1592,13 +1592,15 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
 
        case LFUN_HTMLURL: {
                InsetCommandParams p("htmlurl");
 
        case LFUN_HTMLURL: {
                InsetCommandParams p("htmlurl");
-               bv->owner()->getDialogs().createUrl(p.getAsString());
+               string const data = InsetCommandMailer::params2string(p);
+               bv->owner()->getDialogs().show("url", data, 0);
                break;
        }
 
        case LFUN_URL: {
                InsetCommandParams p("url");
                break;
        }
 
        case LFUN_URL: {
                InsetCommandParams p("url");
-               bv->owner()->getDialogs().createUrl(p.getAsString());
+               string const data = InsetCommandMailer::params2string(p);
+               bv->owner()->getDialogs().show("url", data, 0);
                break;
        }
 
                break;
        }