]> git.lyx.org Git - features.git/commitdiff
shuffle some frontend stuff around. merge controller(base) and "Kernel". Make fronten...
authorAndré Pönitz <poenitz@gmx.net>
Mon, 10 Sep 2007 22:32:59 +0000 (22:32 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Mon, 10 Sep 2007 22:32:59 +0000 (22:32 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20202 a592a061-630c-0410-9148-cb99ea01b6c8

80 files changed:
src/frontends/Dialogs.cpp
src/frontends/controllers/ControlBibtex.cpp
src/frontends/controllers/ControlBox.cpp
src/frontends/controllers/ControlBranch.cpp
src/frontends/controllers/ControlChanges.cpp
src/frontends/controllers/ControlCharacter.cpp
src/frontends/controllers/ControlCitation.cpp
src/frontends/controllers/ControlCommand.cpp
src/frontends/controllers/ControlDocument.cpp
src/frontends/controllers/ControlERT.cpp
src/frontends/controllers/ControlEmbeddedFiles.cpp
src/frontends/controllers/ControlErrorList.cpp
src/frontends/controllers/ControlExternal.cpp
src/frontends/controllers/ControlFloat.cpp
src/frontends/controllers/ControlGraphics.cpp
src/frontends/controllers/ControlInclude.cpp
src/frontends/controllers/ControlListings.cpp
src/frontends/controllers/ControlMath.cpp
src/frontends/controllers/ControlNote.cpp
src/frontends/controllers/ControlParagraph.cpp
src/frontends/controllers/ControlPrefs.cpp
src/frontends/controllers/ControlPrint.cpp
src/frontends/controllers/ControlRef.cpp
src/frontends/controllers/ControlSearch.cpp
src/frontends/controllers/ControlSendto.cpp
src/frontends/controllers/ControlSpellchecker.cpp
src/frontends/controllers/ControlTabular.cpp
src/frontends/controllers/ControlTabularCreate.cpp
src/frontends/controllers/ControlTexinfo.cpp
src/frontends/controllers/ControlThesaurus.cpp
src/frontends/controllers/ControlToc.cpp
src/frontends/controllers/ControlVSpace.cpp
src/frontends/controllers/ControlViewSource.cpp
src/frontends/controllers/ControlWrap.cpp
src/frontends/controllers/Dialog.cpp
src/frontends/controllers/Dialog.h
src/frontends/controllers/Kernel.cpp [deleted file]
src/frontends/controllers/Kernel.h [deleted file]
src/frontends/controllers/Makefile.am
src/frontends/qt4/DockView.h
src/frontends/qt4/GuiBibitem.cpp
src/frontends/qt4/GuiBibtex.cpp
src/frontends/qt4/GuiBox.cpp
src/frontends/qt4/GuiBranch.cpp
src/frontends/qt4/GuiChanges.cpp
src/frontends/qt4/GuiCharacter.cpp
src/frontends/qt4/GuiCitation.cpp
src/frontends/qt4/GuiDialog.cpp
src/frontends/qt4/GuiDialog.h
src/frontends/qt4/GuiDocument.cpp
src/frontends/qt4/GuiERT.cpp
src/frontends/qt4/GuiEmbeddedFiles.h
src/frontends/qt4/GuiErrorList.cpp
src/frontends/qt4/GuiExternal.cpp
src/frontends/qt4/GuiFloat.cpp
src/frontends/qt4/GuiGraphics.cpp
src/frontends/qt4/GuiInclude.cpp
src/frontends/qt4/GuiIndex.cpp
src/frontends/qt4/GuiListings.cpp
src/frontends/qt4/GuiLog.cpp
src/frontends/qt4/GuiMathMatrix.cpp
src/frontends/qt4/GuiNomencl.cpp
src/frontends/qt4/GuiNote.cpp
src/frontends/qt4/GuiParagraph.cpp
src/frontends/qt4/GuiPrefs.cpp
src/frontends/qt4/GuiPrint.cpp
src/frontends/qt4/GuiRef.cpp
src/frontends/qt4/GuiSearch.cpp
src/frontends/qt4/GuiSendto.cpp
src/frontends/qt4/GuiShowFile.cpp
src/frontends/qt4/GuiSpellchecker.cpp
src/frontends/qt4/GuiTabular.cpp
src/frontends/qt4/GuiTabularCreate.cpp
src/frontends/qt4/GuiTexinfo.cpp
src/frontends/qt4/GuiThesaurus.cpp
src/frontends/qt4/GuiURL.cpp
src/frontends/qt4/GuiVSpace.cpp
src/frontends/qt4/GuiWrap.cpp
src/frontends/qt4/Validator.cpp
src/frontends/qt4/Validator.h

index cb6bc88f250b050c6b232cffe6d2e4758a024b5c..5fb70c4587c1cc5605f10646b2766cefaee38da9 100644 (file)
@@ -29,8 +29,7 @@ namespace frontend {
 
 Dialogs::Dialogs(LyXView & lyxview)
        : lyxview_(lyxview), in_show_(false)
-{
-}
+{}
 
 
 Dialog * Dialogs::find_or_build(string const & name)
@@ -51,29 +50,27 @@ Dialog * Dialogs::find_or_build(string const & name)
 
 void Dialogs::show(string const & name, string const & data)
 {
-       if (in_show_) {
+       if (in_show_)
                return;
-       }
+
        in_show_ = true;
        Dialog * dialog = find_or_build(name);
-       if (dialog) {
-               // FIXME! Should check that the dialog is NOT an inset dialog.
-               dialog->show(data);
-       }
+       if (dialog)
+               dialog->showData(data);
+
        in_show_ = false;
 }
 
 
 void Dialogs::show(string const & name, string const & data, Inset * inset)
 {
-       if (in_show_) {
+       if (in_show_)
                return;
-       }
+
        in_show_ = true;
        Dialog * dialog = find_or_build(name);
        if (dialog) {
-               // FIXME! Should check that the dialog IS an inset dialog.
-               dialog->show(data);
+               dialog->showData(data);
                open_insets_[name] = inset;
        }
        in_show_ = false;
@@ -86,7 +83,7 @@ bool Dialogs::visible(string const & name) const
                dialogs_.find(name);
        if (it == dialogs_.end())
                return false;
-       return it->second.get()->isVisible();
+       return it->second.get()->isVisibleView();
 }
 
 
@@ -98,8 +95,8 @@ void Dialogs::update(string const & name, string const & data)
                return;
 
        Dialog * const dialog = it->second.get();
-       if (dialog->isVisible())
-               dialog->update(data);
+       if (dialog->isVisibleView())
+               dialog->updateData(data);
 }
 
 
@@ -121,7 +118,7 @@ void Dialogs::hide(string const & name, Inset* inset)
                return;
 
        Dialog * const dialog = it->second.get();
-       if (dialog->isVisible())
+       if (dialog->isVisibleView())
                dialog->hide();
        open_insets_[name] = 0;
 }
@@ -153,9 +150,8 @@ 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) {
+       for(; it != end; ++it)
                it->second->hide();
-       }
 }
 
 
@@ -165,7 +161,7 @@ void Dialogs::hideBufferDependent() const
        std::map<string, DialogPtr>::const_iterator end = dialogs_.end();
 
        for(; it != end; ++it) {
-               Dialog * dialog =  it->second.get();
+               Dialog * dialog = it->second.get();
                if (dialog->controller().isBufferDependent())
                        dialog->hide();
        }
@@ -178,9 +174,9 @@ void Dialogs::updateBufferDependent(bool switched) const
        std::map<string, DialogPtr>::const_iterator end = dialogs_.end();
 
        for(; it != end; ++it) {
-               Dialog * dialog =  it->second.get();
+               Dialog * dialog = it->second.get();
                if (switched && dialog->controller().isBufferDependent()) {
-                       if (dialog->isVisible() && dialog->controller().initialiseParams(""))
+                       if (dialog->isVisibleView() && dialog->controller().initialiseParams(""))
                                dialog->updateView();
                        else
                                dialog->hide();
@@ -199,9 +195,8 @@ 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) {
+       for(; it != end; ++it)
                it->second->redraw();
-       }
 }
 
 
@@ -212,7 +207,7 @@ void Dialogs::checkStatus()
 
        for(; it != end; ++it) {
                Dialog * const dialog = it->second.get();
-               if (dialog->isVisible())
+               if (dialog->isVisibleView())
                        dialog->checkStatus();
        }
 }
index fb2d0c407cf63660fddd7ac93b0a97ec788d58bc..4e7f226f5826c5710fd4881baacff3785df5cad3 100644 (file)
@@ -50,9 +50,9 @@ docstring const ControlBibtex::browseBib(docstring const & in_name) const
 {
        // FIXME UNICODE
        pair<docstring, docstring> dir1(_("Documents|#o#O"),
-                                 lyx::from_utf8(lyxrc.document_path));
+                                 from_utf8(lyxrc.document_path));
        FileFilterList const filter(_("BibTeX Databases (*.bib)"));
-       return browseRelFile(in_name, lyx::from_utf8(kernel().bufferFilepath()),
+       return browseRelFile(in_name, from_utf8(bufferFilepath()),
                             _("Select a BibTeX database to add"),
                             filter, false, dir1);
 }
@@ -62,9 +62,9 @@ docstring const ControlBibtex::browseBst(docstring const & in_name) const
 {
        // FIXME UNICODE
        pair<docstring, docstring> dir1(_("Documents|#o#O"),
-                                 lyx::from_utf8(lyxrc.document_path));
+                                 from_utf8(lyxrc.document_path));
        FileFilterList const filter(_("BibTeX Styles (*.bst)"));
-       return browseRelFile(in_name, lyx::from_utf8(kernel().bufferFilepath()),
+       return browseRelFile(in_name, from_utf8(bufferFilepath()),
                             _("Select a BibTeX style"), filter, false, dir1);
 }
 
@@ -117,13 +117,13 @@ void ControlBibtex::rescanBibStyles() const
 
 bool ControlBibtex::usingBibtopic() const
 {
-       return kernel().buffer().params().use_bibtopic;
+       return buffer().params().use_bibtopic;
 }
 
 
 bool ControlBibtex::bibtotoc() const
 {
-       return prefixIs(lyx::to_utf8(params()["options"]), "bibtotoc");
+       return prefixIs(to_utf8(params()["options"]), "bibtotoc");
 }
 
 
@@ -131,21 +131,20 @@ string const ControlBibtex::getStylefile() const
 {
        // the different bibtex packages have (and need) their
        // own "plain" stylefiles
-       biblio::CiteEngine const engine =
-               kernel().buffer().params().getEngine();
+       biblio::CiteEngine const engine = buffer().params().getEngine();
        docstring defaultstyle;
        switch (engine) {
        case biblio::ENGINE_BASIC:
-               defaultstyle = lyx::from_ascii("plain");
+               defaultstyle = from_ascii("plain");
                break;
        case biblio::ENGINE_NATBIB_AUTHORYEAR:
-               defaultstyle = lyx::from_ascii("plainnat");
+               defaultstyle = from_ascii("plainnat");
                break;
        case biblio::ENGINE_NATBIB_NUMERICAL:
-               defaultstyle = lyx::from_ascii("plainnat");
+               defaultstyle = from_ascii("plainnat");
                break;
        case biblio::ENGINE_JURABIB:
-               defaultstyle = lyx::from_ascii("jurabib");
+               defaultstyle = from_ascii("jurabib");
                break;
        }
 
@@ -153,7 +152,7 @@ string const ControlBibtex::getStylefile() const
        if (bibtotoc()){
                // bibstyle exists?
                if (contains(bst, ',')) {
-                       docstring bibtotoc = lyx::from_ascii("bibtotoc");
+                       docstring bibtotoc = from_ascii("bibtotoc");
                        bst = split(bst, bibtotoc, ',');
                } else
                        bst.erase();
@@ -166,7 +165,7 @@ string const ControlBibtex::getStylefile() const
                bst = defaultstyle;
 
        // FIXME UNICODE
-       return lyx::to_utf8(bst);
+       return to_utf8(bst);
 }
 
 } // namespace frontend
index a468cca5c2f27ed8347f0e8cbe490b3db4e9a5ec..309958fc369163c7c42be466dccda18f80a0142b 100644 (file)
@@ -47,7 +47,7 @@ void ControlBox::clearParams()
 void ControlBox::dispatchParams()
 {
        string const lfun = InsetBoxMailer::params2string(params());
-       kernel().dispatch(FuncRequest(getLfun(), lfun));
+       dispatch(FuncRequest(getLfun(), lfun));
 }
 
 
index a08b72ea8b2764acc87e9d611fc9a2f43b48615a..20aa483f665db7a550ce6a7b979e3c761be4a221 100644 (file)
@@ -49,13 +49,13 @@ void ControlBranch::clearParams()
 void ControlBranch::dispatchParams()
 {
        string const lfun = InsetBranchMailer::params2string(params());
-       kernel().dispatch(FuncRequest(getLfun(), lfun));
+       dispatch(FuncRequest(getLfun(), lfun));
 }
 
 
 BranchList const & ControlBranch::branchlist() const
 {
-       return kernel().buffer().params().branchlist();
+       return buffer().params().branchlist();
 }
 
 } // namespace frontend
index 60141765405e533122888ada35aa7f0617d1db54..1746c51186d0fe90dd666824f7a7a6f0317feb84 100644 (file)
@@ -37,13 +37,13 @@ ControlChanges::ControlChanges(Dialog & parent)
 
 void ControlChanges::next()
 {
-       kernel().dispatch(FuncRequest(LFUN_CHANGE_NEXT));
+       dispatch(FuncRequest(LFUN_CHANGE_NEXT));
 }
 
 
 docstring const ControlChanges::getChangeDate()
 {
-       Change const & c = kernel().bufferview()->getCurrentChange();
+       Change const & c = bufferview()->getCurrentChange();
        if (c.type == Change::UNCHANGED)
                return docstring();
 
@@ -54,17 +54,16 @@ docstring const ControlChanges::getChangeDate()
 
 docstring const ControlChanges::getChangeAuthor()
 {
-       Change const & c = kernel().bufferview()->getCurrentChange();
+       Change const & c = bufferview()->getCurrentChange();
        if (c.type == Change::UNCHANGED)
                return docstring();
 
-       Author const & a = kernel().buffer().params().authors().get(c.author);
+       Author const & a = buffer().params().authors().get(c.author);
 
-       docstring author(a.name());
+       docstring author = a.name();
 
-       if (!a.email().empty()) {
+       if (!a.email().empty())
                author += " (" + a.email() + ")";
-       }
 
        return author;
 }
@@ -72,14 +71,14 @@ docstring const ControlChanges::getChangeAuthor()
 
 void ControlChanges::accept()
 {
-       kernel().dispatch(FuncRequest(LFUN_CHANGE_ACCEPT));
+       dispatch(FuncRequest(LFUN_CHANGE_ACCEPT));
        next();
 }
 
 
 void ControlChanges::reject()
 {
-       kernel().dispatch(FuncRequest(LFUN_CHANGE_REJECT));
+       dispatch(FuncRequest(LFUN_CHANGE_REJECT));
        next();
 }
 
index d6e1f8f96653f2d27e42004fa74d08d7b4a764e9..9154bc0f93bc13ddad8aaf4b8b9eb4cbc285559d 100644 (file)
@@ -63,7 +63,7 @@ void ControlCharacter::dispatchParams()
 
        string data;
        if (font2string(*font_.get(), toggleall_, data)) {
-               kernel().dispatch(FuncRequest(getLfun(), data));
+               dispatch(FuncRequest(getLfun(), data));
        }
 }
 
@@ -225,9 +225,10 @@ void ControlCharacter::setLanguage(string const & val)
        else if (val == "reset") {
                reset_lang_ = true;
                // Ignored in getLanguage, but needed for dispatchParams
-               font_->setLanguage(kernel().buffer().params().language);
-       } else
+               font_->setLanguage(buffer().params().language);
+       } else {
                font_->setLanguage(languages.getLanguage(val));
+       }
 }
 
 
index 5a7244dacd29d339e7bf158bc679c491d16d9f5b..b96d01387b5fffd3bcbd85bab39ef78a17e9bfc2 100644 (file)
@@ -43,12 +43,11 @@ bool ControlCitation::initialiseParams(string const & data)
        if (!ControlCommand::initialiseParams(data))
                return false;
 
-       biblio::CiteEngine const engine =
-               kernel().buffer().params().getEngine();
+       biblio::CiteEngine const engine = buffer().params().getEngine();
 
        bool use_styles = engine != biblio::ENGINE_BASIC;
 
-       bibkeysInfo_.fillWithBibKeys(&(kernel().buffer()));
+       bibkeysInfo_.fillWithBibKeys(&buffer());
        
        if (citeStyles_.empty())
                citeStyles_ = biblio::getCiteStyles(engine);
@@ -112,7 +111,7 @@ void ControlCitation::filterByEntryType(
 
 biblio::CiteEngine const ControlCitation::getEngine() const
 {
-       return kernel().buffer().params().getEngine();
+       return buffer().params().getEngine();
 }
 
 
@@ -203,7 +202,7 @@ vector<docstring> ControlCitation::searchKeys(
 
 vector<docstring> const ControlCitation::getCiteStrings(docstring const & key) const
 {
-       return bibkeysInfo_.getCiteStrings(key, kernel().buffer());
+       return bibkeysInfo_.getCiteStrings(key, buffer());
 }
 
 } // namespace frontend
index 5fe84f81613d3f477729cbdee3c3c6d424e0e929..02913155bb501432239c12986efe5ef6cc9c360b 100644 (file)
@@ -50,7 +50,7 @@ void ControlCommand::dispatchParams()
 
        string const lfun = InsetCommandMailer::params2string(lfun_name_,
                                                              params_);
-       kernel().dispatch(FuncRequest(getLfun(), lfun));
+       dispatch(FuncRequest(getLfun(), lfun));
 }
 
 } // namespace frontend
index 77f502efaea1e52d3e0c6ac890e25c162aa34628..10d2117884af3bc09c6fb2bcd1f0060fa01fa5e3 100644 (file)
@@ -11,7 +11,6 @@
 #include <config.h>
 
 #include "ControlDocument.h"
-#include "Kernel.h"
 
 #include "BranchList.h"
 #include "Buffer.h"
@@ -61,7 +60,7 @@ ControlDocument::~ControlDocument()
 bool ControlDocument::initialiseParams(std::string const &)
 {
        bp_.reset(new BufferParams);
-       *bp_ = kernel().buffer().params();
+       *bp_ = buffer().params();
        return true;
 }
 
@@ -81,7 +80,7 @@ BufferParams & ControlDocument::params() const
 
 BufferId ControlDocument::id() const
 {
-       return &kernel().buffer();
+       return &buffer();
 }
 
 
@@ -91,20 +90,16 @@ TextClass const & ControlDocument::textClass() const
 }
 
 
-namespace {
-
-void dispatch_bufferparams(Kernel const & kernel, BufferParams const & bp,
-                          kb_action lfun)
+static void dispatch_bufferparams(Controller const & controller,
+       BufferParams const & bp, kb_action lfun)
 {
        ostringstream ss;
        ss << "\\begin_header\n";
        bp.writeFile(ss);
        ss << "\\end_header\n";
-       kernel.dispatch(FuncRequest(lfun, ss.str()));
+       controller.dispatch(FuncRequest(lfun, ss.str()));
 }
 
-} // namespace anon
-
 
 void ControlDocument::dispatchParams()
 {
@@ -115,7 +110,7 @@ void ControlDocument::dispatchParams()
        // and then update the buffer's layout.
        //FIXME Could this be done last? Then, I think, we'd get the automatic
        //update mentioned in the next FIXME...
-       dispatch_bufferparams(kernel(), params(), LFUN_BUFFER_PARAMS_APPLY);
+       dispatch_bufferparams(*this, params(), LFUN_BUFFER_PARAMS_APPLY);
 
        // Generate the colours requested by each new branch.
        BranchList & branchlist = params().branchlist();
@@ -129,33 +124,33 @@ void ControlDocument::dispatchParams()
                                        lyx::X11hexname(branch->getColor());
                        // display the new color
                        docstring const str = current_branch + ' ' + from_ascii(x11hexname);
-                       kernel().dispatch(FuncRequest(LFUN_SET_COLOR, str));
+                       dispatch(FuncRequest(LFUN_SET_COLOR, str));
                }
 
                // Open insets of selected branches, close deselected ones
-               kernel().dispatch(FuncRequest(LFUN_ALL_INSETS_TOGGLE,
+               dispatch(FuncRequest(LFUN_ALL_INSETS_TOGGLE,
                        "assign branch"));
        }
        // FIXME: If we used an LFUN, we would not need those two lines:
-       kernel().bufferview()->update();
-       kernel().lyxview().currentWorkArea()->redraw();
+       bufferview()->update();
+       lyxview().currentWorkArea()->redraw();
 }
 
 
 void ControlDocument::setLanguage() const
 {
        Language const * const newL = bp_->language;
-       if (kernel().buffer().params().language == newL)
+       if (buffer().params().language == newL)
                return;
 
        string const lang_name = newL->lang();
-       kernel().dispatch(FuncRequest(LFUN_BUFFER_LANGUAGE, lang_name));
+       dispatch(FuncRequest(LFUN_BUFFER_LANGUAGE, lang_name));
 }
 
 
 void ControlDocument::saveAsDefault() const
 {
-       dispatch_bufferparams(kernel(), params(), LFUN_BUFFER_SAVE_AS_DEFAULT);
+       dispatch_bufferparams(*this, params(), LFUN_BUFFER_SAVE_AS_DEFAULT);
 }
 
 
index 601a68af9ebe92432b2970c8bf2ddb00a145f6d2..4f80a0fc5d6134452380341b747e7624f03d25bd 100644 (file)
@@ -41,7 +41,7 @@ void ControlERT::clearParams()
 void ControlERT::dispatchParams()
 {
        string const lfun = InsetERTMailer::params2string(status_);
-       kernel().dispatch(FuncRequest(getLfun(), lfun));
+       dispatch(FuncRequest(getLfun(), lfun));
 }
 
 } // namespace frontend
index 9f8c948bfb25ba048d54225ce1f524fa9a47e0a6..d1a718d16be973ab8ce3b646d983d7eba95ed96b 100644 (file)
@@ -41,7 +41,7 @@ ControlEmbeddedFiles::ControlEmbeddedFiles(Dialog & parent)
 
 EmbeddedFiles & ControlEmbeddedFiles::embeddedFiles()
 {
-       return kernel().buffer().embeddedFiles();
+       return buffer().embeddedFiles();
 }
 
 
@@ -54,8 +54,8 @@ bool ControlEmbeddedFiles::initialiseParams(string const &)
 void ControlEmbeddedFiles::updateEmbeddedFiles()
 {
        // copy buffer embeddedFiles to a local copy
-       kernel().buffer().embeddedFiles().update();
-       kernel().buffer().embeddingChanged();
+       buffer().embeddedFiles().update();
+       buffer().embeddingChanged();
 }
 
 
@@ -63,21 +63,21 @@ void ControlEmbeddedFiles::dispatchMessage(string const & msg)
 {
        // FIXME: the right thing to do? QT guys?
        // lyx view will only be updated if we do something to the main window. :-)
-       kernel().dispatch(FuncRequest(LFUN_MESSAGE, msg));
+       dispatch(FuncRequest(LFUN_MESSAGE, msg));
 }
 
 
 void ControlEmbeddedFiles::goTo(EmbeddedFile const & item, int idx)
 {
        BOOST_ASSERT(idx < item.refCount());
-       item.saveBookmark(&kernel().buffer(), idx);
-       kernel().lyxview().dispatch(FuncRequest(LFUN_BOOKMARK_GOTO, "0"));
+       item.saveBookmark(&buffer(), idx);
+       lyxview().dispatch(FuncRequest(LFUN_BOOKMARK_GOTO, "0"));
 }
 
 
 void ControlEmbeddedFiles::view(EmbeddedFile const & item)
 {
-       formats.view(kernel().buffer(), item, formats.getFormatFromFile(item));
+       formats.view(buffer(), item, formats.getFormatFromFile(item));
 }
 
 
@@ -85,9 +85,9 @@ void ControlEmbeddedFiles::setEmbed(EmbeddedFile & item, bool embed)
 {
        // FIXME: updateFromExternalFile() or extract() may fail...
        if (embed)
-               item.updateFromExternalFile(&kernel().buffer());
+               item.updateFromExternalFile(&buffer());
        else
-               item.extract(&kernel().buffer());
+               item.extract(&buffer());
        item.setEmbed(embed);
 }
 
@@ -95,9 +95,9 @@ void ControlEmbeddedFiles::setEmbed(EmbeddedFile & item, bool embed)
 docstring const ControlEmbeddedFiles::browseFile()
 {
        std::pair<docstring, docstring> dir1(_("Documents|#o#O"),
-                                 lyx::from_utf8(lyxrc.document_path));
+                                 from_utf8(lyxrc.document_path));
        FileFilterList const filter(_("All file (*.*)"));
-       return browseRelFile(docstring(), lyx::from_utf8(kernel().bufferFilepath()),
+       return browseRelFile(docstring(), from_utf8(bufferFilepath()),
                             _("Select a file to embed"),
                             filter, false, dir1);
 }
@@ -106,7 +106,7 @@ docstring const ControlEmbeddedFiles::browseFile()
 bool ControlEmbeddedFiles::extract(EmbeddedFile const & item)
 {
        if (item.embedded())
-               return item.extract(&kernel().buffer());
+               return item.extract(&buffer());
        else
                return false;
 }
@@ -115,7 +115,7 @@ bool ControlEmbeddedFiles::extract(EmbeddedFile const & item)
 bool ControlEmbeddedFiles::update(EmbeddedFile const & item)
 {
        if (item.embedded())
-               return item.updateFromExternalFile(&kernel().buffer());
+               return item.updateFromExternalFile(&buffer());
        else
                return false;
 }
index 431cd6dbb233a1ece3ad246d090dab81f921e844..63c3d4291e0ef795650d2295ec15766b5be63c8a 100644 (file)
@@ -44,14 +44,14 @@ void ControlErrorList::clearParams()
 
 ErrorList const & ControlErrorList::errorList() const
 {
-       return kernel().bufferview()->buffer().errorList(error_type_);
+       return bufferview()->buffer().errorList(error_type_);
 }
 
 
 bool ControlErrorList::initialiseParams(string const & error_type)
 {
        error_type_ = error_type;
-       Buffer const & buf = kernel().bufferview()->buffer();
+       Buffer const & buf = bufferview()->buffer();
        // FIXME UNICODE
        docstring const title = bformat(_("%1$s Errors (%2$s)"),
                                     _(error_type),
@@ -74,7 +74,7 @@ void ControlErrorList::goTo(int item)
        if (err.par_id == -1)
                return;
 
-       Buffer & buf = kernel().buffer();
+       Buffer & buf = buffer();
        ParIterator pit = buf.getParFromID(err.par_id);
 
        if (pit == buf.par_iterator_end()) {
@@ -90,10 +90,10 @@ void ControlErrorList::goTo(int item)
        pos_type const start = std::min(err.pos_start, end);
        pos_type const range = end - start;
        DocIterator const dit = makeDocIterator(pit, start);
-       kernel().bufferview()->putSelectionAt(dit, range, false);
+       bufferview()->putSelectionAt(dit, range, false);
        // FIXME: If we used an LFUN, we would not need those two lines:
-       kernel().bufferview()->update();
-       kernel().lyxview().currentWorkArea()->redraw();
+       bufferview()->update();
+       lyxview().currentWorkArea()->redraw();
 }
 
 } // namespace frontend
index 06874eb2ee6e885904f0672dbab1d26d512a577e..6cb7f685e36004b6aa1f38c955a33b9605c79c97 100644 (file)
@@ -54,7 +54,7 @@ ControlExternal::ControlExternal(Dialog & parent)
 bool ControlExternal::initialiseParams(string const & data)
 {
        params_.reset(new InsetExternalParams);
-       InsetExternalMailer::string2params(data, kernel().buffer(), *params_);
+       InsetExternalMailer::string2params(data, buffer(), *params_);
        return true;
 }
 
@@ -68,9 +68,9 @@ void ControlExternal::clearParams()
 void ControlExternal::dispatchParams()
 {
        string const lfun = InsetExternalMailer::params2string(params(),
-                                                              kernel().buffer());
+                                                              buffer());
 
-       kernel().dispatch(FuncRequest(getLfun(), lfun));
+       dispatch(FuncRequest(getLfun(), lfun));
 }
 
 
@@ -94,8 +94,8 @@ void ControlExternal::editExternal()
 
        dialog().applyView();
        string const lfun =
-               InsetExternalMailer::params2string(params(), kernel().buffer());
-       kernel().dispatch(FuncRequest(LFUN_EXTERNAL_EDIT, lfun));
+               InsetExternalMailer::params2string(params(), buffer());
+       dispatch(FuncRequest(LFUN_EXTERNAL_EDIT, lfun));
 }
 
 
@@ -162,7 +162,7 @@ docstring const ControlExternal::browse(docstring const & input,
 {
        docstring const title =  _("Select external file");
 
-       docstring const bufpath = lyx::from_utf8(kernel().bufferFilepath());
+       docstring const bufpath = lyx::from_utf8(bufferFilepath());
        FileFilterList const filter =
                FileFilterList(lyx::from_utf8(getTemplateFilters(lyx::to_utf8(template_name))));
 
@@ -175,7 +175,7 @@ docstring const ControlExternal::browse(docstring const & input,
 
 string const ControlExternal::readBB(string const & file)
 {
-       FileName const abs_file(makeAbsPath(file, kernel().bufferFilepath()));
+       FileName const abs_file(makeAbsPath(file, bufferFilepath()));
 
        // try to get it from the file, if possible. Zipped files are
        // unzipped in the readBB_from_PSFile-Function
index a6799147a655a65ec0f066e597b0e9290c2641d9..1f355af028b4eac639603d522de567906b3174dc 100644 (file)
@@ -43,7 +43,7 @@ void ControlFloat::clearParams()
 void ControlFloat::dispatchParams()
 {
        string const lfun = InsetFloatMailer::params2string(params());
-       kernel().dispatch(FuncRequest(getLfun(), lfun));
+       dispatch(FuncRequest(getLfun(), lfun));
 }
 
 } // namespace frontend
index 8f86c54db6caf5bc18142ecf9e7d5486aa7b7144..f59fdc3ef8c1946474579380667ee300b801115f 100644 (file)
@@ -61,7 +61,7 @@ ControlGraphics::ControlGraphics(Dialog & parent)
 bool ControlGraphics::initialiseParams(string const & data)
 {
        InsetGraphicsParams params;
-       InsetGraphicsMailer::string2params(data, kernel().buffer(), params);
+       InsetGraphicsMailer::string2params(data, buffer(), params);
        params_.reset(new InsetGraphicsParams(params));
        return true;
 }
@@ -77,8 +77,8 @@ void ControlGraphics::dispatchParams()
 {
        InsetGraphicsParams tmp_params(params());
        string const lfun =
-               InsetGraphicsMailer::params2string(tmp_params, kernel().buffer());
-       kernel().dispatch(FuncRequest(getLfun(), lfun));
+               InsetGraphicsMailer::params2string(tmp_params, buffer());
+       dispatch(FuncRequest(getLfun(), lfun));
 }
 
 
@@ -95,7 +95,7 @@ docstring const ControlGraphics::browse(docstring const & in_name) const
        pair<docstring, docstring> dir1(_("Clipart|#C#c"), from_utf8(clipdir));
        pair<docstring, docstring> dir2(_("Documents|#o#O"), from_utf8(lyxrc.document_path));
        // Show the file browser dialog
-       return browseRelFile(in_name, from_utf8(kernel().bufferFilepath()),
+       return browseRelFile(in_name, from_utf8(bufferFilepath()),
                             title,
                             FileFilterList(),
                             false, dir1, dir2);
@@ -104,7 +104,7 @@ docstring const ControlGraphics::browse(docstring const & in_name) const
 
 string const ControlGraphics::readBB(string const & file)
 {
-       FileName const abs_file(makeAbsPath(file, kernel().bufferFilepath()));
+       FileName const abs_file(makeAbsPath(file, bufferFilepath()));
 
        // try to get it from the file, if possible. Zipped files are
        // unzipped in the readBB_from_PSFile-Function
@@ -133,7 +133,7 @@ string const ControlGraphics::readBB(string const & file)
 bool ControlGraphics::isFilenameValid(string const & fname) const
 {
        // It may be that the filename is relative.
-       FileName const name(makeAbsPath(fname, kernel().bufferFilepath()));
+       FileName const name(makeAbsPath(fname, bufferFilepath()));
        return isFileReadable(name);
 }
 
@@ -144,8 +144,8 @@ void ControlGraphics::editGraphics()
 
        dialog().applyView();
        string const lfun =
-               InsetGraphicsMailer::params2string(params(), kernel().buffer());
-       kernel().dispatch(FuncRequest(LFUN_GRAPHICS_EDIT, lfun));
+               InsetGraphicsMailer::params2string(params(), buffer());
+       dispatch(FuncRequest(LFUN_GRAPHICS_EDIT, lfun));
 }
 
 
index 1b927587435e2dbe42a92d18d9c67827fd8d4cf6..59ae0f8126c60fe517203807025a4c954d11e804 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "ControlInclude.h"
 #include "frontend_helpers.h"
-#include "Kernel.h"
 
 #include "Buffer.h"
 #include "Format.h"
@@ -63,7 +62,7 @@ void ControlInclude::clearParams()
 void ControlInclude::dispatchParams()
 {
        string const lfun = InsetIncludeMailer::params2string(params_);
-       kernel().dispatch(FuncRequest(getLfun(), lfun));
+       dispatch(FuncRequest(getLfun(), lfun));
 }
 
 
@@ -91,9 +90,9 @@ docstring const ControlInclude::browse(docstring const & in_name, Type in_type)
        }
 
        pair<docstring, docstring> dir1(_("Documents|#o#O"),
-               lyx::from_utf8(lyxrc.document_path));
+               from_utf8(lyxrc.document_path));
 
-       docstring const docpath = lyx::from_utf8(onlyPath(kernel().buffer().fileName()));
+       docstring const docpath = from_utf8(onlyPath(buffer().fileName()));
 
        return browseRelFile(in_name, docpath, title,
                             filters, false, dir1);
@@ -104,11 +103,11 @@ void ControlInclude::edit(string const & file)
 {
        string const ext = support::getExtension(file);
        if (ext == "lyx")
-               kernel().dispatch(FuncRequest(LFUN_BUFFER_CHILD_OPEN, file));
+               dispatch(FuncRequest(LFUN_BUFFER_CHILD_OPEN, file));
        else
                // tex file or other text file in verbatim mode
-               formats.edit(kernel().buffer(), 
-                       FileName(makeAbsPath(file, onlyPath(kernel().buffer().fileName()))),
+               formats.edit(buffer(), 
+                       FileName(makeAbsPath(file, onlyPath(buffer().fileName()))),
                        "text");
 }
 
@@ -116,7 +115,7 @@ void ControlInclude::edit(string const & file)
 bool ControlInclude::fileExists(string const & file)
 {
        FileName const fileWithAbsPath(
-               makeAbsPath(file, onlyPath(kernel().buffer().fileName())));
+               makeAbsPath(file, onlyPath(buffer().fileName())));
 
        if (isFileReadable(fileWithAbsPath))
                return true;
index 3bdc3a8760b8ce1c824a78d8545191f0a1767c3b..7f1d518d3fa7e5a2667f1ccdf4e4f5e60416d4eb 100644 (file)
@@ -42,7 +42,7 @@ void ControlListings::clearParams()
 void ControlListings::dispatchParams()
 {
        string const lfun = InsetListingsMailer::params2string(params());
-       kernel().dispatch(FuncRequest(getLfun(), lfun));
+       dispatch(FuncRequest(getLfun(), lfun));
 }
 
 
index 5beb07624f8734ab416323636bf3743da8876a0d..f1ddc161944bbc5ada70aa90e3f9f4b9a4f3de41 100644 (file)
@@ -73,7 +73,7 @@ ControlMath::ControlMath(Dialog & dialog)
 
 void ControlMath::dispatchFunc(kb_action action, string const & arg) const
 {
-       kernel().dispatch(FuncRequest(action, arg));
+       dispatch(FuncRequest(action, arg));
 }
 
 
index de25bf67df8dee7f5606a3656609f2b7145e98b3..5ab3c01136cb49211fc99fbae6b9e3d9f7e4fb10 100644 (file)
@@ -44,7 +44,7 @@ void ControlNote::clearParams()
 void ControlNote::dispatchParams()
 {
        string const lfun = InsetNoteMailer::params2string(params());
-       kernel().dispatch(FuncRequest(getLfun(), lfun));
+       dispatch(FuncRequest(getLfun(), lfun));
 }
 
 } // namespace frontend
index 1e56a707f97ea3020998188e18abae6082abcef8..ab11234e1db14d774fabb345a6b3f85d7398c160 100644 (file)
@@ -133,7 +133,7 @@ void ControlParagraph::dispatchParams()
        ostringstream data;
        params().write(data);
        FuncRequest const fr(LFUN_PARAGRAPH_PARAMS_APPLY, data.str());
-       kernel().dispatch(fr);
+       dispatch(fr);
 }
 
 
@@ -151,24 +151,26 @@ ParagraphParameters const & ControlParagraph::params() const
 }
 
 
-bool const ControlParagraph::haveMulitParSelection() {
-       Cursor cur = kernel().bufferview()->cursor();
-       if (!cur.selection())
-               return false;
-       return (cur.selBegin().pit() != cur.selEnd().pit());
+bool const ControlParagraph::haveMulitParSelection()
+{
+       Cursor cur = bufferview()->cursor();
+       return cur.selection() && cur.selBegin().pit() != cur.selEnd().pit();
 }
+
        
 bool ControlParagraph::inInset() const
 {
        return ininset_;
 }
 
+
 bool ControlParagraph::canIndent() const
 {
-       return kernel().buffer().params().paragraph_separation ==
+       return buffer().params().paragraph_separation ==
                BufferParams::PARSEP_INDENT;
 }
 
+
 LyXAlignment ControlParagraph::alignPossible() const
 {
        return alignpossible_;
index 59f236dd6130ee6799dffdf20fbb3ec8d6d57fb6..4cd5f3ceb8f15b6f83a733838663ae6be45a12d5 100644 (file)
@@ -13,7 +13,6 @@
 #include "ControlPrefs.h"
 
 #include "frontend_helpers.h"
-#include "Kernel.h"
 
 #include "BufferList.h"
 #include "gettext.h"
@@ -60,8 +59,7 @@ void ControlPrefs::dispatchParams()
 {
        ostringstream ss;
        rc_.write(ss, true);
-       kernel().dispatch(FuncRequest(LFUN_LYXRC_APPLY, ss.str()));
-
+       dispatch(FuncRequest(LFUN_LYXRC_APPLY, ss.str())); 
        // FIXME: these need lfuns
        // FIXME UNICODE
        theBufferList().setCurrentAuthor(from_utf8(rc_.user_name), from_utf8(rc_.user_email));
@@ -77,17 +75,17 @@ void ControlPrefs::dispatchParams()
        vector<string>::const_iterator it = colors_.begin();
        vector<string>::const_iterator const end = colors_.end();
        for (; it != end; ++it)
-               kernel().dispatch(FuncRequest(LFUN_SET_COLOR, *it));
+               dispatch(FuncRequest(LFUN_SET_COLOR, *it));
        colors_.clear();
 
        if (update_screen_font_) {
-               kernel().dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
+               dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
                update_screen_font_ = false;
        }
 
        // The Save button has been pressed
        if (dialog().isClosing()) {
-               kernel().dispatch(FuncRequest(LFUN_PREFERENCES_SAVE));
+               dispatch(FuncRequest(LFUN_PREFERENCES_SAVE));
        }
 }
 
index fc775a5758135c7cfd58bc51937a01a1e374481e..bd0271bea4df158866449dea29d3c85f2b6d21a4 100644 (file)
@@ -43,7 +43,7 @@ ControlPrint::ControlPrint(Dialog & parent)
 bool ControlPrint::initialiseParams(std::string const &)
 {
        /// get global printer parameters
-       string const name =  changeExtension(kernel().buffer().fileName(),
+       string const name =  changeExtension(buffer().fileName(),
                                        lyxrc.print_file_extension);
        params_.reset(new PrinterParams(PrinterParams::PRINTER,
                                        lyxrc.printer, name));
@@ -68,7 +68,7 @@ PrinterParams & ControlPrint::params() const
 
 docstring const ControlPrint::browse(docstring const & in_name) const
 {
-       return browseRelFile(in_name, lyx::from_utf8(kernel().buffer().filePath()),
+       return browseRelFile(in_name, lyx::from_utf8(buffer().filePath()),
                             _("Print to file"),
                             FileFilterList(_("PostScript files (*.ps)")),
                             true);
@@ -128,7 +128,7 @@ void ControlPrint::dispatchParams()
                command += lyxrc.print_extra_options + ' ';
        }
 
-       command += kernel().buffer().params().dvips_options();
+       command += buffer().params().dvips_options();
 
        string const target = (pp.target == PrinterParams::PRINTER) ?
                "printer" : "file";
@@ -138,7 +138,7 @@ void ControlPrint::dispatchParams()
                pp.file_name;
 
        string const data = target + " \"" + target_name + "\" \"" + command + '"';
-       kernel().dispatch(FuncRequest(getLfun(), data));
+       dispatch(FuncRequest(getLfun(), data));
 }
 
 } // namespace frontend
index dc7da17fc7c1d0ce6ce9ac6fa22ecccaf430c98f..87e76c1a2ae6133347ea42205a26fc120ce36e05 100644 (file)
@@ -47,14 +47,14 @@ vector<docstring> const ControlRef::getLabelList(string const & name) const
 
 void ControlRef::gotoRef(string const & ref)
 {
-       kernel().dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"));
-       kernel().dispatch(FuncRequest(LFUN_LABEL_GOTO, ref));
+       dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"));
+       dispatch(FuncRequest(LFUN_LABEL_GOTO, ref));
 }
 
 
 void ControlRef::gotoBookmark()
 {
-       kernel().dispatch(FuncRequest(LFUN_BOOKMARK_GOTO, "0"));
+       dispatch(FuncRequest(LFUN_BOOKMARK_GOTO, "0"));
 }
 
 
@@ -73,7 +73,7 @@ vector<string> const ControlRef::getBufferList() const
 int ControlRef::getBufferNum() const
 {
        vector<string> buffers = theBufferList().getFileNames();
-       string const name = kernel().buffer().fileName();
+       string const name = buffer().fileName();
        vector<string>::const_iterator cit =
                find(buffers.begin(), buffers.end(), name);
        if (cit == buffers.end())
index 19a56d9ae9a16dbc8091323cc0a506cb426bcb55..6a07501efb2999859d22eb4ecc7c7f03cac17ea5 100644 (file)
@@ -28,7 +28,7 @@ void ControlSearch::find(docstring const & search, bool casesensitive,
 {
        docstring const data = find2string(search, casesensitive,
                                              matchword, forward);
-       kernel().dispatch(FuncRequest(LFUN_WORD_FIND, data));
+       dispatch(FuncRequest(LFUN_WORD_FIND, data));
 }
 
 
@@ -39,7 +39,7 @@ void ControlSearch::replace(docstring const & search, docstring const & replace,
        docstring const data =
                replace2string(search, replace, casesensitive,
                                     matchword, all, forward);
-       kernel().dispatch(FuncRequest(LFUN_WORD_REPLACE, data));
+       dispatch(FuncRequest(LFUN_WORD_REPLACE, data));
 }
 
 } // namespace frontend
index d8bbbb714bfd85ed2b98f1e348406ad147f7fc4b..95b42ec63984482c63bd19972f2e276959e4be15 100644 (file)
@@ -50,7 +50,7 @@ void ControlSendto::dispatchParams()
                return;
 
        string const data = format_->name() + " " + command_;
-       kernel().dispatch(FuncRequest(getLfun(), data));
+       dispatch(FuncRequest(getLfun(), data));
 }
 
 
@@ -61,13 +61,11 @@ vector<Format const *> const ControlSendto::allFormats() const
        exports.push_back("lyx");
        exports.push_back("text");
 
-       Buffer const & buffer = kernel().buffer();
-
-       if (buffer.isLatex())
+       if (buffer().isLatex())
                exports.push_back("latex");
-       else if (buffer.isDocBook())
+       else if (buffer().isDocBook())
                exports.push_back("docbook");
-       else if (buffer.isLiterate())
+       else if (buffer().isLiterate())
                exports.push_back("literate");
 
        // Loop over these native formats and ascertain what formats we
index 4594a111ca75c88e2cc2a43354bb8dcdcfddca1c..1f059ac1057655eac14b7ee9f8d06f2023b9eaac 100644 (file)
@@ -102,7 +102,7 @@ bool ControlSpellchecker::initialiseParams(std::string const &)
 {
        LYXERR(Debug::GUI) << "Spellchecker::initialiseParams" << endl;
 
-       speller_.reset(getSpeller(kernel().buffer().params()));
+       speller_.reset(getSpeller(buffer().params()));
        if (!speller_.get())
                return false;
 
@@ -199,13 +199,13 @@ void ControlSpellchecker::check()
 
        SpellBase::Result res = SpellBase::OK;
 
-       Cursor cur = kernel().bufferview()->cursor();
+       Cursor cur = bufferview()->cursor();
        while (cur && cur.pos() && isLetter(cur)) {
                cur.backwardPos();
        }
 
        ptrdiff_t start = 0, total = 0;
-       DocIterator it = DocIterator(kernel().buffer().inset());
+       DocIterator it = DocIterator(buffer().inset());
        for (start = 0; it != cur; it.forwardPos())
                ++start;
 
@@ -251,12 +251,12 @@ void ControlSpellchecker::check()
 
        int const size = cur.selEnd().pos() - cur.selBegin().pos();
        cur.pos() -= size;
-       kernel().bufferview()->putSelectionAt(cur, size, false);
+       bufferview()->putSelectionAt(cur, size, false);
        // FIXME: if we used a lfun like in find/replace, dispatch would do
        // that for us
-       kernel().bufferview()->update();
+       bufferview()->update();
        // FIXME: this Controller is very badly designed...
-       kernel().lyxview().currentWorkArea()->redraw();
+       lyxview().currentWorkArea()->redraw();
 
        // set suggestions
        if (res != SpellBase::OK && res != SpellBase::IGNORED_WORD) {
@@ -307,11 +307,10 @@ void ControlSpellchecker::replace(docstring const & replacement)
 {
        LYXERR(Debug::GUI) << "ControlSpellchecker::replace("
                           << to_utf8(replacement) << ")" << std::endl;
-       BufferView & bufferview = *kernel().bufferview();
-       cap::replaceSelectionWithString(bufferview.cursor(), replacement, true);
-       kernel().buffer().markDirty();
+       cap::replaceSelectionWithString(bufferview()->cursor(), replacement, true);
+       buffer().markDirty();
        // If we used an LFUN, we would not need that
-       bufferview.update();
+       bufferview()->update();
        // fix up the count
        --count_;
        check();
index c8d81507f0b2b7c272933fd33cd95cd61e6f7004..1c284cd7ecd14b94405babc8f4a458f72d983340 100644 (file)
@@ -31,7 +31,7 @@ ControlTabular::ControlTabular(Dialog & parent)
 bool ControlTabular::initialiseParams(string const & data)
 {
        // try to get the current cell
-       BufferView const * const bv = kernel().bufferview();
+       BufferView const * const bv = bufferview();
        InsetTabular const * current_inset = 0;
        if (bv) {
                Cursor const & cur = bv->cursor();
@@ -50,7 +50,7 @@ bool ControlTabular::initialiseParams(string const & data)
                return true;
        }
 
-       InsetTabular tmp(kernel().buffer());
+       InsetTabular tmp(buffer());
        InsetTabularMailer::string2params(data, tmp);
        params_.reset(new Tabular(tmp.tabular));
        return true;
@@ -80,7 +80,7 @@ Tabular const & ControlTabular::tabular() const
 void ControlTabular::set(Tabular::Feature f, string const & arg)
 {
        string const data = featureAsString(f) + ' ' + arg;
-       kernel().dispatch(FuncRequest(getLfun(), data));
+       dispatch(FuncRequest(getLfun(), data));
 }
 
 
index 5e7320927e47a92c6a4e66e6f9bca600ae1ad7ea..2441a6fba036b8e0808f28fc4df664123f1051d3 100644 (file)
@@ -44,7 +44,7 @@ void ControlTabularCreate::clearParams()
 void ControlTabularCreate::dispatchParams()
 {
        string const data = convert<string>(params().first) + ' ' + convert<string>(params().second);
-       kernel().dispatch(FuncRequest(getLfun(), data));
+       dispatch(FuncRequest(getLfun(), data));
 }
 
 } // namespace frontend
index 44c5e82861cf12aa60e3b2cbdb9aef1831f0796b..96106b3b8b43056f9be1c5fc94b365069fdbd8f7 100644 (file)
@@ -69,7 +69,7 @@ ControlTexinfo::ControlTexinfo(Dialog & parent)
 void ControlTexinfo::viewFile(string const & filename) const
 {
        string const arg = "file " + filename;
-       kernel().dispatch(FuncRequest(LFUN_DIALOG_SHOW, arg));
+       dispatch(FuncRequest(LFUN_DIALOG_SHOW, arg));
 }
 
 
index 44bd0693abbe7088a43bc029b5dfdca5e57959b8..b9832253a0f33d14851e64a2b9b4c8750d428e48 100644 (file)
@@ -50,7 +50,7 @@ void ControlThesaurus::replace(docstring const & newstr)
                                     true,  // match word
                                     false, // all words
                                     true); // forward
-       kernel().dispatch(FuncRequest(LFUN_WORD_REPLACE, data));
+       dispatch(FuncRequest(LFUN_WORD_REPLACE, data));
 }
 
 
index c2db5ac5e7b08cadc5b3639afa0a5e9416056626..de6ca9bf690c83db0f0fb35efb6670a273957e05 100644 (file)
 using std::string;
 
 
-class Buffer;
-
 namespace lyx {
 namespace frontend {
 
-
 ControlToc::ControlToc(Dialog & d)
        : ControlCommand(d, "tableofcontents", "toc")
 {
@@ -42,7 +39,7 @@ ControlToc::ControlToc(Dialog & d)
 
 TocList const & ControlToc::tocs() const
 {
-       return kernel().buffer().getMasterBuffer()->tocBackend().tocs();
+       return buffer().getMasterBuffer()->tocBackend().tocs();
 }
 
 
@@ -53,7 +50,7 @@ bool ControlToc::initialiseParams(string const & data)
 
        types_.clear();
        type_names_.clear();
-       TocList const & tocs = kernel().buffer().getMasterBuffer()->
+       TocList const & tocs = buffer().getMasterBuffer()->
                tocBackend().tocs();
        TocList::const_iterator it = tocs.begin();
        TocList::const_iterator end = tocs.end();
@@ -78,10 +75,11 @@ bool ControlToc::initialiseParams(string const & data)
        return true;
 }
 
+
 void ControlToc::goTo(TocItem const & item)
 {
        string const tmp = convert<string>(item.id());
-       kernel().lyxview().dispatch(FuncRequest(LFUN_PARAGRAPH_GOTO, tmp));
+       lyxview().dispatch(FuncRequest(LFUN_PARAGRAPH_GOTO, tmp));
 }
 
 
@@ -93,40 +91,40 @@ bool ControlToc::canOutline(size_t type) const
 
 void ControlToc::outlineUp()
 {
-       kernel().dispatch(FuncRequest(LFUN_OUTLINE_UP));
+       dispatch(FuncRequest(LFUN_OUTLINE_UP));
 }
 
 
 void ControlToc::outlineDown()
 {
-       kernel().dispatch(FuncRequest(LFUN_OUTLINE_DOWN));
+       dispatch(FuncRequest(LFUN_OUTLINE_DOWN));
 }
 
 
 void ControlToc::outlineIn()
 {
-       kernel().dispatch(FuncRequest(LFUN_OUTLINE_IN));
+       dispatch(FuncRequest(LFUN_OUTLINE_IN));
 }
 
 
 void ControlToc::outlineOut()
 {
-       kernel().dispatch(FuncRequest(LFUN_OUTLINE_OUT));
+       dispatch(FuncRequest(LFUN_OUTLINE_OUT));
 }
 
 
 void ControlToc::updateBackend()
 {
-       kernel().buffer().getMasterBuffer()->tocBackend().update();
-       kernel().buffer().structureChanged();
+       buffer().getMasterBuffer()->tocBackend().update();
+       buffer().structureChanged();
 }
 
 
 TocIterator const ControlToc::getCurrentTocItem(size_t type) const
 {
-       BOOST_ASSERT(kernel().bufferview());
-       ParConstIterator it(kernel().bufferview()->cursor());
-       Buffer const * master = kernel().buffer().getMasterBuffer();
+       BOOST_ASSERT(bufferview());
+       ParConstIterator it(bufferview()->cursor());
+       Buffer const * master = buffer().getMasterBuffer();
        return master->tocBackend().item(types_[type], it);
 }
 
@@ -136,8 +134,7 @@ docstring const ControlToc::getGuiName(string const & type) const
        if (type == "tableofcontents")
                return _("Table of Contents");
 
-       FloatList const & floats =
-               kernel().buffer().params().getTextClass().floats();
+       FloatList const & floats = buffer().params().getTextClass().floats();
        if (floats.typeExist(type))
                return _(floats.getType(type).listName());
        else
index a487da11e69fddc69cbd0802ad2046abe24c48b1..627c7933cf8dffe7e24a43d233287d378ea88d11 100644 (file)
@@ -31,8 +31,6 @@ ControlVSpace::ControlVSpace(Dialog & parent)
 bool ControlVSpace::initialiseParams(string const & data)
 {
        InsetVSpaceMailer::string2params(data, params_);
-
-       // so that the user can press Ok
        dialog().setButtonsValid(true);
 
        return true;
@@ -48,7 +46,7 @@ void ControlVSpace::clearParams()
 void ControlVSpace::dispatchParams()
 {
        string const str = InsetVSpaceMailer::params2string(params_);
-       kernel().dispatch(FuncRequest(getLfun(), str));
+       dispatch(FuncRequest(getLfun(), str));
 }
 
 
index c09cb8579459a262ecc0129f4928eb743b9a80e2..f3419371b3c6aab0c128cdbd9fe1b698787e2892 100644 (file)
@@ -20,7 +20,7 @@
 #include "Buffer.h"
 #include "Cursor.h"
 #include "TexRow.h"
-#include <sstream>
+
 
 using std::string;
 
@@ -37,14 +37,15 @@ bool ControlViewSource::initialiseParams(string const & /*source*/)
        return true;
 }
 
+
 docstring const ControlViewSource::updateContent(bool fullSource)
 {
        // get the *top* level paragraphs that contain the cursor,
        // or the selected text
-       lyx::pit_type par_begin;
-       lyx::pit_type par_end;
+       pit_type par_begin;
+       pit_type par_end;
 
-       BufferView * view = kernel().bufferview();
+       BufferView * view = bufferview();
        if (!view->cursor().selection()) {
                par_begin = view->cursor().bottom().pit();
                par_end = par_begin;
@@ -54,7 +55,7 @@ docstring const ControlViewSource::updateContent(bool fullSource)
        }
        if (par_begin > par_end)
                std::swap(par_begin, par_end);
-       lyx::odocstringstream ostr;
+       odocstringstream ostr;
        view->buffer().getSourceCode(ostr, par_begin, par_end + 1, fullSource);
        return ostr.str();
 }
@@ -62,7 +63,7 @@ docstring const ControlViewSource::updateContent(bool fullSource)
 
 std::pair<int, int> ControlViewSource::getRows() const
 {
-       BufferView const * view = kernel().bufferview();
+       BufferView const * view = bufferview();
        CursorSlice beg = view->cursor().selectionBegin().bottom();
        CursorSlice end = view->cursor().selectionEnd().bottom();
 
@@ -83,22 +84,17 @@ void ControlViewSource::clearParams()
 
 docstring const ControlViewSource::title() const
 {
-       string source_type;
-
-       Kernel::DocType doctype = kernel().docType();
-       switch (doctype) {
-       case Kernel::LATEX:
-               source_type = "LaTeX";
-               break;
-       case Kernel::DOCBOOK:
-               source_type = "DocBook";
-               break;
-       case Kernel::LITERATE:
-               source_type = "Literate";
-       default:
-               BOOST_ASSERT(false);
+       switch (docType()) {
+               case LATEX:
+                       return _("LaTeX Source");
+               case DOCBOOK:
+                       return _("DocBook Source");
+               case LITERATE:
+                       return _("Literate Source");
+               default:
+                       BOOST_ASSERT(false);
+                       return docstring();
        }
-       return _(source_type + " Source");
 }
 
 } // namespace frontend
index ddc9e03fbeee7453669717ce0923a73436566f47..e56e80af8a335d112a6fbb1d78a5c3c41f28a51f 100644 (file)
@@ -43,7 +43,7 @@ void ControlWrap::clearParams()
 void ControlWrap::dispatchParams()
 {
        string const lfun = InsetWrapMailer::params2string(params());
-       kernel().dispatch(FuncRequest(getLfun(), lfun));
+       dispatch(FuncRequest(getLfun(), lfun));
 }
 
 } // namespace frontend
index ed236578bf4cea6af5191b74aadc57ac05549e91..03a279474bfe2803a9fcab82c7d738d7e2efd3d9 100644 (file)
 
 #include "Dialog.h"
 
-#include "frontends/LyXView.h"
-
-#include "debug.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
 #include "LyXFunc.h"
 
+#include "frontends/LyXView.h"
+#include "frontends/Dialogs.h" // FIXME
+
+#include "Buffer.h"
 
-using std::string;
 
 namespace lyx {
 namespace frontend {
 
-Dialog::Dialog(LyXView & lv, string const & name)
-       : is_closing_(false), kernel_(lv), name_(name), controller_(0)
+
+Dialog::~Dialog()
 {}
 
 
-Dialog::~Dialog()
+Controller::Controller(Dialog & parent)
+       : parent_(parent), lyxview_(0)
+{}
+
+
+Controller::~Controller()
+{}
+
+
+bool Controller::canApply() const
 {
-       delete controller_;
+       FuncRequest const fr(getLfun(), dialog().name());
+       FuncStatus const fs(getStatus(fr));
+       return fs.enabled();
 }
 
 
-void Dialog::show(string const & data)
+void Controller::dispatch(FuncRequest const & fr) const
 {
-       if (controller().isBufferDependent() && !kernel().isBufferAvailable())
-               return;
-
-       if (!controller().initialiseParams(data)) {
-               lyxerr << "Dialog \"" << name_
-                      << "\" failed to translate the data "
-                       "string passed to show()" << std::endl;
-               return;
-       }
-
-       preShow();
-       showView();
-       postShow();
+       lyxview_->dispatch(fr);
 }
 
 
-void Dialog::update(string const & data)
+void Controller::updateDialog(std::string const & name) const
 {
-       if (controller().isBufferDependent() && !kernel().isBufferAvailable())
-               return;
-
-       if (!controller().initialiseParams(data)) {
-               lyxerr << "Dialog \"" << name_
-                      << "\" could not be initialized" << std::endl;
-               return;
-       }
-
-       preUpdate();
-       updateView();
-       postUpdate();
+       dispatch(FuncRequest(LFUN_DIALOG_UPDATE, name));
 }
 
 
-void Dialog::checkStatus()
+void Controller::disconnect(std::string const & name) const
 {
+       lyxview_->getDialogs().disconnect(name);
 }
 
 
-void Dialog::hide()
+bool Controller::isBufferAvailable() const
 {
-       if (!isVisibleView())
-               return;
-
-       controller().clearParams();
-       hideView();
-       kernel().disconnect(name_);
+       return lyxview_->buffer() != 0;
 }
 
 
-void Dialog::apply()
+bool Controller::isBufferReadonly() const
 {
-       if (controller().isBufferDependent()) {
-               if (!kernel().isBufferAvailable() ||
-                   (kernel().isBufferReadonly() && !controller().canApplyToReadOnly()))
-                       return;
-       }
-
-       applyView();
-       controller().dispatchParams();
-
-       if (controller().disconnectOnApply() && !is_closing_) {
-               kernel().disconnect(name_);
-               controller().initialiseParams(string());
-               updateView();
-       }
+       if (!lyxview_->buffer())
+               return true;
+       return lyxview_->buffer()->isReadonly();
 }
 
 
-bool Dialog::isVisible() const
+std::string const Controller::bufferFilepath() const
 {
-       return isVisibleView();
+       return buffer().filePath();
 }
 
 
-void Dialog::redraw()
+KernelDocType Controller::docType() const
 {
-       redrawView();
+       if (buffer().isLatex())
+               return LATEX;
+       if (buffer().isLiterate())
+               return LITERATE;
+
+       return DOCBOOK;
 }
 
 
-void Dialog::setController(Controller * controller)
+BufferView * Controller::bufferview()
 {
-       BOOST_ASSERT(controller);
-       BOOST_ASSERT(!controller_);
-       controller_ = controller;
+       return lyxview_->view();
 }
 
-Controller & Dialog::controller() const
+
+BufferView const * Controller::bufferview() const
 {
-       BOOST_ASSERT(controller_);
-       return *controller_;
+       return lyxview_->view();
 }
 
 
-Controller::Controller(Dialog & parent)
-       : parent_(parent)
-{}
+Buffer & Controller::buffer()
+{
+       BOOST_ASSERT(lyxview_->buffer());
+       return *lyxview_->buffer();
+}
 
 
-bool Controller::canApply() const
+Buffer const & Controller::buffer() const
 {
-       FuncRequest const fr(getLfun(), dialog().name());
-       FuncStatus const fs(getStatus(fr));
-       return fs.enabled();
+       BOOST_ASSERT(lyxview_->buffer());
+       return *lyxview_->buffer();
 }
 
-
 } // namespace frontend
 } // namespace lyx
index c3a0fd2bae8c660098d6ade7c5e1ba8575dd1ff2..78f0de12f0fa1019b9bf07a9863fc832921aef52 100644 (file)
 #ifndef DIALOG_H
 #define DIALOG_H
 
-#include "Kernel.h"
 #include "lfuns.h"
 
 #include "support/docstring.h"
-#include <boost/scoped_ptr.hpp>
+#include <string>
 
 namespace lyx {
+
+class Buffer;
+class BufferView;
+class FuncRequest;
+
 namespace frontend {
 
 class LyXView;
 
+/** \enum KernelDocType used to flag the different kinds of buffer
+ *  without making the kernel header files available to the
+ *  dialog's Controller or View.
+ */
+enum KernelDocType
+{
+       LATEX,
+       LITERATE,
+       DOCBOOK
+};
+
+
 /** Different dialogs will have different Controllers and Views.
  *  deriving from these base classes.
  */
@@ -39,7 +55,7 @@ public:
        /// \param lv is the access point for the dialog to the LyX kernel.
        /// \param name is the identifier given to the dialog by its parent
        /// container.
-       Dialog(LyXView & lv, std::string const & name);
+       Dialog() {}
        virtual ~Dialog();
 
        /** \name Container Access
@@ -49,18 +65,12 @@ public:
        //@{
        /// \param data is a string encoding of the data to be displayed.
        /// It is passed to the Controller to be translated into a useable form.
-       void show(std::string const & data);
-       void update(std::string const & data);
+       virtual void showData(std::string const & /*data*/) {}
+       virtual void updateData(std::string const & /*data*/) {}
 
-       void hide();
-       bool isVisible() const;
+       virtual void hide() {}
 
        // Override in GuiDialog
-       virtual void preShow() {}
-       virtual void postShow() {}
-       virtual void preUpdate() {}
-       virtual void postUpdate() {}
-
        virtual void OkButton() {}
        virtual void ApplyButton() {}
        virtual void CancelButton() {}
@@ -69,41 +79,26 @@ public:
        /** This function is called, for example, if the GUI colours
         *  have been changed.
         */
-       void redraw();
+       virtual void redraw() {}
        //@}
 
        /** Check whether we may apply our data.
         *
         *  The buttons are disabled if not and (re-)enabled if yes.
         */
-       void checkStatus();
+       virtual void checkStatus() {}
 
        /** 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 wrapper class.
-        *  In an ideal world, it will shrink as more info is passed to the
-        *  show() and update() methods.
-        */
-       Kernel & kernel() { return kernel_; }
-       Kernel const & kernel() const { return kernel_; }
+       virtual bool isClosing() const { return false; }
 
        /** \name Dialog Specialization
         *  Methods to set the Controller and View and so specialise
         *  to a particular dialog.
         */
        //@{
-       /// \param ptr is stored and destroyed by \c Dialog.
-       void setController(Controller * ptr);
-       //@}
-
-       /** \name Dialog Components
-        *  Methods to access the various components making up a dialog.
-        */
-       //@{
-       virtual Controller & controller() const;
+       virtual Controller & controller() const = 0;
        //@}
 
        /** \c Button controller part
@@ -127,7 +122,7 @@ public:
        virtual void hideView() = 0;
 
        /// Redraw the dialog (e.g. if the colors have been remapped).
-       virtual void redrawView() {}
+       virtual void redrawView() = 0;
 
        /// Create the dialog if necessary, update it and display it.
        virtual void showView() = 0;
@@ -144,26 +139,18 @@ public:
         *  dialog therefore needs updating.
         *  \param id identifies what should be updated.
         */
-       virtual void partialUpdateView(int /*id*/) {}
+       virtual void partialUpdateView(int /*id*/) = 0;
 
        ///
-       std::string name() const { return name_; }
+       virtual std::string name() const = 0;
+
+protected:
+       virtual void apply() {}
 
 private:
        /// intentionally unimplemented, therefore uncopiable
        Dialog(Dialog const &);
        void operator=(Dialog const &);
-
-protected:
-       void apply();
-
-       bool is_closing_;
-       Kernel kernel_;
-       /** The Dialog's name is the means by which a dialog identifies
-        *  itself to the kernel.
-        */
-       std::string name_;
-       Controller * controller_;
 };
 
 
@@ -175,7 +162,8 @@ class Controller
 public:
        /// \param parent Dialog owning this Controller.
        Controller(Dialog & parent);
-       virtual ~Controller() {}
+       virtual ~Controller();
+       void setLyXView(LyXView & lv) { lyxview_ = &lv; }
 
        /** \name Generic Controller
         *  These few methods are all that a generic dialog needs of a
@@ -239,23 +227,70 @@ public:
        */
        virtual bool exitEarly() const { return false; }
        //@}
-
-       /// Main Window access.
-       /// This is unfortunately needed for the qt4 frontend and the \c
-       /// QDialogView framework. This permits to give a parent to the
-       /// constructed \c QDialog via a cast to \c GuiView.
-       LyXView * view() { return &parent_.kernel().lyxview(); }
-
-protected:
+public:
        /** \name Controller Access
         *  Enable the derived classes to access the other parts of the whole.
         */
        //@{
        Dialog & dialog() { return parent_; }
        Dialog const & dialog() const { return parent_; }
+       //@}
+
+       /** \c Kernel part: a wrapper making the LyX kernel available to the dialog.
+        * (Ie, it provides an interface to the Model part of the Model-Controller-
+        *  View split.
+        *  In an ideal world, it will shrink as more info is passed to the
+        *  Dialog::show() and Dialog::update() methods.
+        */
 
-       Kernel & kernel() { return parent_.kernel(); }
-       Kernel const & kernel() const { return parent_.kernel(); }
+
+       /** This method is the primary purpose of the class. It provides
+        *  the "gateway" by which the dialog can send a request (of a
+        *  change in the data, for more information) to the kernel.
+        *  \param fr is the encoding of the request.
+        */
+       void dispatch(FuncRequest const & fr) const;
+
+       /** The dialog has received a request from the user
+        *  (who pressed the "Restore" button) to update contents.
+        *  It must, therefore, ask the kernel to provide this information.
+        *  \param name is used to identify the dialog to the kernel.
+        */
+       void updateDialog(std::string const & name) const;
+
+       /** A request from the Controller that future changes to the data
+        *  stored by the dialog are not applied to the inset currently
+        *  connected to the dialog. Instead, they will be used to generate
+        *  a new inset at the cursor position.
+        *  \param name is used to identify the dialog to the kernel.
+        */
+       void disconnect(std::string const & name) const;
+
+       /** \name Kernel Wrappers
+        *  Simple wrapper functions to Buffer methods.
+        */
+       //@{
+       bool isBufferAvailable() const;
+       bool isBufferReadonly() const;
+       std::string const bufferFilepath() const;
+       //@}
+
+       /// The type of the current buffer.
+       KernelDocType docType() const;
+
+       /** \name Kernel Nasties
+        *  Unpleasantly public internals of the LyX kernel.
+        *  We should aim to reduce/remove these from the interface.
+        */
+       //@{
+       LyXView & lyxview() { return *lyxview_; }
+       LyXView const & lyxview() const { return *lyxview_; }
+
+       Buffer & buffer();
+       Buffer const & buffer() const;
+
+       BufferView * bufferview();
+       BufferView const * bufferview() const;
        //@}
 
 private:
@@ -265,10 +300,10 @@ private:
 
 private:
        Dialog & parent_;
+       LyXView * lyxview_;
 };
 
 
-
 } // namespace frontend
 } // namespace lyx
 
diff --git a/src/frontends/controllers/Kernel.cpp b/src/frontends/controllers/Kernel.cpp
deleted file mode 100644 (file)
index 8fef842..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * \file Kernel.cpp
- * 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 "Kernel.h"
-
-#include "Buffer.h"
-#include "BufferView.h"
-#include "FuncRequest.h"
-#include "LyXFunc.h"
-#include "frontends/Dialogs.h"
-#include "frontends/LyXView.h"
-
-
-using std::string;
-
-namespace lyx {
-namespace frontend {
-
-Kernel::Kernel(LyXView & lyxview)
-       : lyxview_(lyxview)
-{}
-
-
-void Kernel::dispatch(FuncRequest const & fr) const
-{
-       lyxview_.dispatch(fr);
-}
-
-
-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
-{
-       return lyxview_.buffer() != 0;
-}
-
-
-bool Kernel::isBufferReadonly() const
-{
-       if (!lyxview_.buffer())
-               return true;
-       return lyxview_.buffer()->isReadonly();
-}
-
-
-string const Kernel::bufferFilepath() const
-{
-       return buffer().filePath();
-}
-
-
-Kernel::DocType Kernel::docType() const
-{
-       if (buffer().isLatex())
-               return LATEX;
-       if (buffer().isLiterate())
-               return LITERATE;
-
-       return DOCBOOK;
-}
-
-
-BufferView * Kernel::bufferview()
-{
-       return lyxview_.view();
-}
-
-
-BufferView const * Kernel::bufferview() const
-{
-       return lyxview_.view();
-}
-
-
-Buffer & Kernel::buffer()
-{
-       BOOST_ASSERT(lyxview_.buffer());
-       return *lyxview_.buffer();
-}
-
-
-Buffer const & Kernel::buffer() const
-{
-       BOOST_ASSERT(lyxview_.buffer());
-       return *lyxview_.buffer();
-}
-
-} // namespace frontend
-} // namespace lyx
diff --git a/src/frontends/controllers/Kernel.h b/src/frontends/controllers/Kernel.h
deleted file mode 100644 (file)
index 6f4308c..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-// -*- C++ -*-
-/**
- * \file Kernel.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 KERNEL_H
-#define KERNEL_H
-
-#include <string>
-
-namespace lyx {
-
-class Buffer;
-class BufferView;
-class FuncRequest;
-
-namespace frontend {
-
-class LyXView;
-
-/** \c Kernel is a wrapper making the LyX kernel available to the dialog.
- * (Ie, it provides an interface to the Model part of the Model-Controller-
- *  View split.
- *  In an ideal world, it will shrink as more info is passed to the
- *  Dialog::show() and Dialog::update() methods.
- */
-class Kernel {
-public:
-       /// \param lv is the access point for the dialog to the LyX kernel.
-       Kernel(LyXView & lv);
-
-       /** This method is the primary purpose of the class. It provides
-        *  the "gateway" by which the dialog can send a request (of a
-        *  change in the data, for more information) to the kernel.
-        *  \param fr is the encoding of the request.
-        */
-       void dispatch(FuncRequest const & fr) const;
-
-       /** The dialog has received a request from the user
-        *  (who pressed the "Restore" button) to update contents.
-        *  It must, therefore, ask the kernel to provide this information.
-        *  \param name is used to identify the dialog to the kernel.
-        */
-       void updateDialog(std::string const & name) const;
-
-       /** A request from the Controller that future changes to the data
-        *  stored by the dialog are not applied to the inset currently
-        *  connected to the dialog. Instead, they will be used to generate
-        *  a new inset at the cursor position.
-        *  \param name is used to identify the dialog to the kernel.
-        */
-       void disconnect(std::string const & name) const;
-
-       /** \name Kernel Wrappers
-        *  Simple wrapper functions to Buffer methods.
-        */
-       //@{
-       bool isBufferAvailable() const;
-       bool isBufferReadonly() const;
-       std::string const bufferFilepath() const;
-       //@}
-
-       /** \enum DocType used to flag the different kinds of buffer
-        *  without making the kernel header files available to the
-        *  dialog's Controller or View.
-        */
-       enum DocType {
-               LATEX,
-               LITERATE,
-               DOCBOOK
-       };
-       /// The type of the current buffer.
-       DocType docType() const;
-
-       /** \name Kernel Nasties
-        *  Unpleasantly public internals of the LyX kernel.
-        *  We should aim to reduce/remove these from the interface.
-        */
-       //@{
-       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_;
-};
-
-
-/** \c KernelDocType is a wrapper for Kernel::DocType.
- *  It can be forward-declared and passed as a function argument without
- *  having to expose Kernel.h.
- */
-class KernelDocType {
-public:
-       KernelDocType(Kernel::DocType val) : val_(val) {}
-       operator Kernel::DocType() const { return val_; }
-private:
-       Kernel::DocType val_;
-};
-
-} // namespace frontend
-} // namespace lyx
-
-#endif // KERNEL_H
index f1e99b1f65b4d13c7e2abf034842538eb5581816..09f9ce6e3094268071b1cb2c31c3f0ce491878b7 100644 (file)
@@ -8,7 +8,6 @@ pkglib_LTLIBRARIES = liblyxcontrollers.la
 
 SOURCEFILES = \
        Dialog.cpp \
-       Kernel.cpp \
        ButtonPolicy.cpp \
        ControlBibtex.cpp \
        ControlBox.cpp \
@@ -49,7 +48,6 @@ SOURCEFILES = \
        frontend_helpers.cpp 
 
 HEADERFILES = \
-       Kernel.h \
        ButtonPolicy.h \
        ControlBibtex.h \
        ControlBox.h \
index c1c207468cdfd26c1106336fb84c2f9ca70989d8..e5c8773cefff5d5205afd7a12cbc2440865e22a3 100644 (file)
 
 #include <QDockWidget>
 
-#include <boost/scoped_ptr.hpp>
-
-#include <string>
-
 namespace lyx {
 namespace frontend {
 
@@ -38,19 +34,20 @@ public:
                std::string const & name, ///< dialog identifier.
                Qt::DockWidgetArea area = Qt::LeftDockWidgetArea, ///< Position of the dock (and also drawer)
                Qt::WindowFlags flags = 0
-               )
-               : QDockWidget(&parent, flags),
-               Dialog(parent, name)
+       )
+               : QDockWidget(&parent, flags), name_(name)
        {
                if (flags & Qt::Drawer)
                        setFeatures(QDockWidget::NoDockWidgetFeatures);
-               MyController * controller = new MyController(*this);
-               setController(controller);
-               widget_.reset(new MyWidget(*controller));
-               setWidget(widget_.get());
+               MyController * c = new MyController(*this);
+               controller_ = c;
+               controller_->setLyXView(parent);
+               widget_ = new MyWidget(*c);
+               setWidget(widget_);
                setWindowTitle(widget_->windowTitle());
                parent.addDockWidget(area, this);
        }
+       ~DockView() { delete widget_; delete controller_; }
 
        /// Dialog inherited methods
        //@{
@@ -58,16 +55,24 @@ public:
        void hideView() { QDockWidget::hide(); }
        void showView() { QDockWidget::show(); }
        bool isVisibleView() const { return QDockWidget::isVisible(); }
+       void checkStatus() {}
+       void redraw() { redrawView(); }
        void redrawView() {}
        void updateView()
        {
                widget_->updateView();
                QDockWidget::update();
        }
+       bool isClosing() const { return false; }
+       void partialUpdateView(int /*id*/) {}
+       Controller & controller() const { return *controller_; }
+       std::string name() const { return name_; }
        //@}
 private:
        /// The encapsulated widget.
-       boost::scoped_ptr<MyWidget> widget_;
+       MyWidget * widget_;
+       Controller * controller_;
+       std::string name_;
 };
 
 } // frontend
index 8adff5841522257e289511a0a5a6ede23c0a094e..746e647edbebae09db26750fe2c1667e585a6f98 100644 (file)
@@ -48,7 +48,7 @@ GuiBibitemDialog::GuiBibitemDialog(LyXView & lv)
 
 ControlCommand & GuiBibitemDialog::controller() const
 {
-       return static_cast<ControlCommand &>(Dialog::controller());
+       return static_cast<ControlCommand &>(GuiDialog::controller());
 }
 
 
index b5c29ba81f7ae6816746b0056001ad7dfa9226b7..a1dc48751d2b9dfc060341044735075f0c8a992e 100644 (file)
@@ -113,7 +113,7 @@ GuiBibtexDialog::GuiBibtexDialog(LyXView & lv)
 
 ControlBibtex & GuiBibtexDialog::controller() const
 {
-       return static_cast<ControlBibtex &>(Dialog::controller());
+       return static_cast<ControlBibtex &>(GuiDialog::controller());
 }
 
 
index 9514a7262b115cb316cd040924d3e4d2b13f6cb7..f3ad3787e0f1048ae663c1bc081deb56f563d828 100644 (file)
@@ -114,7 +114,7 @@ GuiBoxDialog::GuiBoxDialog(LyXView & lv)
 
 ControlBox & GuiBoxDialog::controller() const
 {
-       return static_cast<ControlBox &>(Dialog::controller());
+       return static_cast<ControlBox &>(GuiDialog::controller());
 }
 
 
index eac0eda6d93d06adc2266ed4c1dd34a53bc980b4..9a41c1cf3ab400249f87cb10a962e39db8ee9964 100644 (file)
@@ -45,7 +45,7 @@ GuiBranchDialog::GuiBranchDialog(LyXView & lv)
 
 ControlBranch & GuiBranchDialog::controller() const
 {
-       return static_cast<ControlBranch &>(Dialog::controller());
+       return static_cast<ControlBranch &>(GuiDialog::controller());
 }
 
 
index 467d47f3dd1a693141146d4cd4ff91e3256437db..99e4b4b6514cc36ece837ef99fbf9a2168ae0403 100644 (file)
@@ -48,7 +48,7 @@ GuiChangesDialog::GuiChangesDialog(LyXView & lv)
 
 ControlChanges & GuiChangesDialog::controller() const
 {
-       return static_cast<ControlChanges &>(Dialog::controller());
+       return static_cast<ControlChanges &>(GuiDialog::controller());
 }
 
 
index 35f0a7f1bf01df516b6b6df74de0c61c6119628f..22ff331027ef082b65d191ccfe07db8b9cc7ae45 100644 (file)
@@ -108,7 +108,7 @@ GuiCharacterDialog::GuiCharacterDialog(LyXView & lv)
 
 ControlCharacter & GuiCharacterDialog::controller() const
 {
-       return static_cast<ControlCharacter &>(Dialog::controller());
+       return static_cast<ControlCharacter &>(GuiDialog::controller());
 }
 
 
index 7b355ef9bb6dfc5bdcbdeca4ecc52cdd94fea784..4aaf7034cf428d144e2cfa53a70b0cce76ae418e 100644 (file)
@@ -104,7 +104,7 @@ GuiCitationDialog::GuiCitationDialog(LyXView & lv)
 
 ControlCitation & GuiCitationDialog::controller() const
 {
-       return static_cast<ControlCitation &>(Dialog::controller());
+       return static_cast<ControlCitation &>(GuiDialog::controller());
 }
 
 
index 0e2dbaaf5cab96ca9c68e9b75c8ecf7b7421d506..44c448de7e78d98021f1636ecd44aa5d32a1bc88 100644 (file)
 #include "GuiDialog.h"
 #include "debug.h"
 #include "qt_helpers.h"
+#include "frontends/LyXView.h"
+
+using std::string;
 
 namespace lyx {
 namespace frontend {
 
 GuiDialog::GuiDialog(LyXView & lv, std::string const & name)
-       : Dialog(lv, name)
-{}
+       : is_closing_(false), name_(name), controller_(0)
+{
+       lyxview_ = &lv;
+}
+
+
+GuiDialog::~GuiDialog()
+{
+       delete controller_;
+}
 
 
 void GuiDialog::setViewTitle(docstring const & title)
@@ -60,40 +71,13 @@ void GuiDialog::CancelButton()
 
 void GuiDialog::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
+       // Tell the controller that a request to refresh the dialog's contents
+       // has been received. It's up to the controller to supply the necessary
        // info by calling GuiDialog::updateView().
-       kernel().updateDialog(name_);
+       controller().updateDialog(name_);
        bc().restore();
 }
 
-
-void GuiDialog::preShow()
-{
-       bc().setReadOnly(kernel().isBufferReadonly());
-}
-
-
-void GuiDialog::postShow()
-{
-       // The widgets may not be valid, so refresh the button controller
-       bc().refresh();
-}
-
-
-void GuiDialog::preUpdate()
-{
-       bc().setReadOnly(kernel().isBufferReadonly());
-}
-
-
-void GuiDialog::postUpdate()
-{
-       // The widgets may not be valid, so refresh the button controller
-       bc().refresh();
-}
-
-
 void GuiDialog::checkStatus()
 {
        // buffer independant dialogs are always active.
@@ -102,14 +86,14 @@ void GuiDialog::checkStatus()
                return;
 
        // deactivate the dialog if we have no buffer
-       if (!kernel().isBufferAvailable()) {
+       if (!controller().isBufferAvailable()) {
                bc().setReadOnly(true);
                return;
        }
 
        // check whether this dialog may be active
        if (controller().canApply()) {
-               bool const readonly = kernel().isBufferReadonly();
+               bool const readonly = controller().isBufferReadonly();
                bc().setReadOnly(readonly);
                // refreshReadOnly() is too generous in _enabling_ widgets
                // update dialog to disable disabled widgets again
@@ -132,7 +116,7 @@ bool GuiDialog::isVisibleView() const
 
 bool GuiDialog::readOnly() const
 {
-       return kernel().isBufferReadonly();
+       return controller().isBufferReadonly();
 }
 
 
@@ -162,12 +146,6 @@ void GuiDialog::hideView()
 }
 
 
-bool GuiDialog::isValid()
-{
-       return true;
-}
-
-
 void GuiDialog::changed()
 {
        if (updating_)
@@ -205,6 +183,7 @@ void GuiDialog::slotRestore()
        RestoreButton();
 }
 
+
 void GuiDialog::updateView()
 {
        setUpdatesEnabled(false);
@@ -218,6 +197,83 @@ void GuiDialog::updateView()
        QDialog::update();
 }
 
+
+void GuiDialog::showData(string const & data)
+{
+       if (controller().isBufferDependent() && !controller().isBufferAvailable())
+               return;
+
+       if (!controller().initialiseParams(data)) {
+               lyxerr << "Dialog \"" << name_
+                      << "\" failed to translate the data "
+                       "string passed to show()" << std::endl;
+               return;
+       }
+
+       bc().setReadOnly(controller().isBufferReadonly());
+       showView();
+       // The widgets may not be valid, so refresh the button controller
+       bc().refresh();
+}
+
+
+void GuiDialog::updateData(string const & data)
+{
+       if (controller().isBufferDependent() && !controller().isBufferAvailable())
+               return;
+
+       if (!controller().initialiseParams(data)) {
+               lyxerr << "Dialog \"" << name_
+                      << "\" could not be initialized" << std::endl;
+               return;
+       }
+
+       bc().setReadOnly(controller().isBufferReadonly());
+       updateView();
+       // The widgets may not be valid, so refresh the button controller
+       bc().refresh();
+}
+
+
+void GuiDialog::hide()
+{
+       if (!isVisibleView())
+               return;
+
+       controller().clearParams();
+       hideView();
+       controller().disconnect(name_);
+}
+
+
+void GuiDialog::apply()
+{
+       if (controller().isBufferDependent()) {
+               if (!controller().isBufferAvailable() ||
+                   (controller().isBufferReadonly() && !controller().canApplyToReadOnly()))
+                       return;
+       }
+
+       applyView();
+       controller().dispatchParams();
+
+       if (controller().disconnectOnApply() && !is_closing_) {
+               controller().disconnect(name_);
+               controller().initialiseParams(string());
+               updateView();
+       }
+}
+
+
+void GuiDialog::setController(Controller * controller)
+{
+       BOOST_ASSERT(controller);
+       BOOST_ASSERT(!controller_);
+       controller_ = controller;
+       controller_->setLyXView(*lyxview_);
+}
+
+
 } // namespace frontend
 } // namespace lyx
 
index b43448a5f28fc238fec1a226143940ac9443a60e..42e6b47d22bc68f95cc1b2004f47217630355217 100644 (file)
@@ -32,8 +32,8 @@ public:
        /// \param lv is the access point for the dialog to the LyX kernel.
        /// \param name is the identifier given to the dialog by its parent
        /// container.
-       GuiDialog(LyXView & lv, std::string const & name);
-       //GuiDialog(GuiDialog &, docstring const &);
+       explicit GuiDialog(LyXView & lv, std::string const & name);
+       ~GuiDialog();
 
 public Q_SLOTS:
        // dialog closed from WM
@@ -74,11 +74,6 @@ public:
        ButtonController & bc() { return bc_; }
        //@}
 
-       void preShow();
-       void postShow();
-       void preUpdate();
-       void postUpdate();
-
        void setViewTitle(docstring const & title);
 
        ///
@@ -100,15 +95,76 @@ protected:
        ///
        virtual bool isVisibleView() const;
        /// is the dialog currently valid ?
-       virtual bool isValid();
+       virtual bool isValid() { return true; }
+
+public:
+       /** \name Container Access
+        *  These methods are publicly accessible because they are invoked
+        *  by the parent container acting on commands from the LyX kernel.
+        */
+       //@{
+       /// \param data is a string encoding of the data to be displayed.
+       /// It is passed to the Controller to be translated into a useable form.
+       void showData(std::string const & data);
+       void updateData(std::string const & data);
+
+       void hide();
+
+       /** This function is called, for example, if the GUI colours
+        *  have been changed.
+        */
+       void redraw() { redrawView(); }
+       //@}
+
+       /** 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_; }
+
+       /** \name Dialog Specialization
+        *  Methods to set the Controller and View and so specialise
+        *  to a particular dialog.
+        */
+       //@{
+       /// \param ptr is stored and destroyed by \c Dialog.
+       void setController(Controller * ptr);
+       //@}
+
+       /** \name Dialog Components
+        *  Methods to access the various components making up a dialog.
+        */
+       //@{
+       virtual Controller & controller() const { return *controller_; }
+       //@}
+
+       /** 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.
+        *  \param id identifies what should be updated.
+        */
+       virtual void partialUpdateView(int /*id*/) {}
+
+       ///
+       std::string name() const { return name_; }
+
+       void apply();
+       void redrawView() {}
 
 private:
-       /// update the dialog
+       /// Update the display of the dialog whilst it is still visible.
        virtual void updateView();
 
        ButtonController bc_;
        /// are we updating ?
        bool updating_;
+
+       bool is_closing_;
+       /** The Dialog's name is the means by which a dialog identifies
+        *  itself to the kernel.
+        */
+       std::string name_;
+       Controller * controller_;
+       LyXView * lyxview_; // FIXME: replace by moving to constructor
 };
 
 } // namespace frontend
index 5416079e6b32128737917fd647bd6acc81c5ac7d..0c5c02763d51cd023e3f472da763495efd9a2e53 100644 (file)
@@ -614,7 +614,7 @@ GuiDocumentDialog::GuiDocumentDialog(LyXView & lv)
 
 ControlDocument & GuiDocumentDialog::controller() const
 {
-       return static_cast<ControlDocument &>(Dialog::controller());
+       return static_cast<ControlDocument &>(GuiDialog::controller());
 }
 
 
index fcbc6dfd7a2a9a8a1b9f72394d66d48d236cf9d9..8d41adc024dc96f972862cb0f430005ad6c592c8 100644 (file)
@@ -42,7 +42,7 @@ GuiERTDialog::GuiERTDialog(LyXView & lv)
 
 ControlERT & GuiERTDialog::controller() const
 {
-       return static_cast<ControlERT &>(Dialog::controller());
+       return static_cast<ControlERT &>(GuiDialog::controller());
 }
 
 
index 525f96c97469519d134c426d2dfbac420e376697..a11931713dcc46806bdc4f9b2bf3cb1e5fc945b6 100644 (file)
@@ -26,6 +26,7 @@ class GuiEmbeddedFilesDialog : public QWidget, public Ui::GuiEmbeddedFilesUi
 
 public:
        GuiEmbeddedFilesDialog(ControlEmbeddedFiles &);
+       std::string name() const { return "embedding"; }
 
 public Q_SLOTS:
        ///
index f42c2f5308a238d83cda08fcce72fac80abb61c1..993ef5cebcc86c31a40c3766bc1647f9fe1444f0 100644 (file)
@@ -45,7 +45,7 @@ GuiErrorListDialog::GuiErrorListDialog(LyXView & lv)
 
 ControlErrorList & GuiErrorListDialog::controller() const
 {
-       return static_cast<ControlErrorList &>(Dialog::controller());
+       return static_cast<ControlErrorList &>(GuiDialog::controller());
 }
 
 
index 2f36bd5a0e56e139ead47690a7b77a541cca7f04..9544c119188e4d4c955b5385ffa675131edc7148 100644 (file)
@@ -186,7 +186,7 @@ GuiExternalDialog::GuiExternalDialog(LyXView & lv)
 
 ControlExternal & GuiExternalDialog::controller() const
 {
-       return static_cast<ControlExternal &>(Dialog::controller());
+       return static_cast<ControlExternal &>(GuiDialog::controller());
 }
 
 
@@ -538,7 +538,7 @@ void GuiExternalDialog::update_contents()
        InsetExternalParams const & params = controller().params();
 
        string const name =
-               params.filename.outputFilename(kernel().bufferFilepath());
+               params.filename.outputFilename(controller().bufferFilepath());
        fileED->setText(toqstr(name));
 
        externalCO->setCurrentIndex(
@@ -617,7 +617,7 @@ void GuiExternalDialog::updateTemplate()
 
        tab->setTabEnabled(
                tab->indexOf(optionstab), enabled);
-       extraED->setEnabled(enabled && !kernel().isBufferReadonly());
+       extraED->setEnabled(enabled && !controller().isBufferReadonly());
        extraFormatCO->setEnabled(enabled);
 
        if (enabled) {
@@ -632,7 +632,7 @@ void GuiExternalDialog::applyView()
        InsetExternalParams params = controller().params();
 
        params.filename.set(internal_path(fromqstr(fileED->text())),
-                           kernel().bufferFilepath());
+                           controller().bufferFilepath());
 
        params.settemplate(controller().getTemplate(
                                   externalCO->currentIndex()).lyxName);
index 263af7eab00b3c61db4170093f497015e78e7042..f0e3d51c2c1d3f1102d6e41cc1a9f1fa229e38f0 100644 (file)
@@ -56,7 +56,7 @@ GuiFloatDialog::GuiFloatDialog(LyXView & lv)
 
 ControlFloat & GuiFloatDialog::controller() const
 {
-       return static_cast<ControlFloat &>(Dialog::controller());
+       return static_cast<ControlFloat &>(GuiDialog::controller());
 }
 
 
index 56f0121e8c67eb7cd9e361f29f55d222ed44278d..1deda05c3fe7e73bcce3251ac46459ff9eeb9839 100644 (file)
@@ -412,7 +412,7 @@ void GuiGraphicsDialog::update_contents()
        }
 
        string const name =
-               igp.filename.outputFilename(kernel().bufferFilepath());
+               igp.filename.outputFilename(controller().bufferFilepath());
        filename->setText(toqstr(name));
 
        // set the bounding box values
@@ -559,7 +559,7 @@ void GuiGraphicsDialog::applyView()
        InsetGraphicsParams & igp = controller().params();
 
        igp.filename.set(internal_path(fromqstr(filename->text())),
-                        kernel().bufferFilepath());
+                        controller().bufferFilepath());
 
        // the bb section
        igp.bb.erase();
index 1ddcaad13ee9e5e970dc4e0c08de881dce1df308..898fbf1d7018a63970a4ae2b104b89113c33e404 100644 (file)
@@ -80,7 +80,7 @@ GuiIncludeDialog::GuiIncludeDialog(LyXView & lv)
 
 ControlInclude & GuiIncludeDialog::controller() const
 {
-       return static_cast<ControlInclude &>(Dialog::controller());
+       return static_cast<ControlInclude &>(GuiDialog::controller());
 }
 
 
index 0607c3e9174020d563d0dab7dd5dc42d7ed52de9..02d96f56e7100bc1adcf0708370e712af0e6fb96 100644 (file)
@@ -77,7 +77,7 @@ GuiIndexDialogBase::GuiIndexDialogBase(LyXView & lv,
 
 ControlCommand & GuiIndexDialogBase::controller() const
 {
-       return static_cast<ControlCommand &>(Dialog::controller());
+       return static_cast<ControlCommand &>(GuiDialog::controller());
 }
 
 
index dba31748cdbc83540b0491ee23080724690e91ab..a0bf60f310ce39b85bca3cf91d06e3db3b93eeef 100644 (file)
@@ -247,7 +247,7 @@ GuiListingsDialog::GuiListingsDialog(LyXView & lv)
 
 ControlListings & GuiListingsDialog::controller() const
 {
-       return static_cast<ControlListings &>(Dialog::controller());
+       return static_cast<ControlListings &>(GuiDialog::controller());
 }
 
 
index 0a678982e1929a613b88cd8a65faccb0a98f997e..ae7fc9b5f3e63f80fe83d46861166356bf79d93f 100644 (file)
@@ -119,7 +119,7 @@ GuiLogDialog::GuiLogDialog(LyXView & lv)
 
 ControlLog & GuiLogDialog::controller() const
 {
-       return static_cast<ControlLog &>(Dialog::controller());
+       return static_cast<ControlLog &>(GuiDialog::controller());
 }
 
 
index a8cda21df9393158f6e20cd8dfd18032504c10f7..939acbbe19d5018df17997a1a683f0996233f05f 100644 (file)
@@ -67,7 +67,7 @@ GuiMathMatrixDialog::GuiMathMatrixDialog(LyXView & lv)
 
 ControlMath & GuiMathMatrixDialog::controller() const
 {
-       return static_cast<ControlMath &>(Dialog::controller());
+       return static_cast<ControlMath &>(GuiDialog::controller());
 }
 
 
index d0024732538ff360f53352496db49ebb14f55454..0ede06c97ab60df30745be38037c86a28928d94c 100644 (file)
@@ -55,7 +55,7 @@ GuiNomenclDialog::GuiNomenclDialog(LyXView & lv)
 
 ControlCommand & GuiNomenclDialog::controller() const
 {
-       return static_cast<ControlCommand &>(Dialog::controller());
+       return static_cast<ControlCommand &>(GuiDialog::controller());
 }
 
 
index 007c1758e65e565021349ff7e2afa8fbf7100f13..de7319438537cd3fbe40c18a6ab91f1121800120 100644 (file)
@@ -44,7 +44,7 @@ GuiNoteDialog::GuiNoteDialog(LyXView & lv)
 
 ControlNote & GuiNoteDialog::controller() const
 {
-       return static_cast<ControlNote &>(Dialog::controller());
+       return static_cast<ControlNote &>(GuiDialog::controller());
 }
 
 
index dd6fc224181f722a985a32b261f1c66e288319b1..6e7c6cefdbfdbf5b907977e01c41a7b5a5bedd2f 100644 (file)
@@ -94,7 +94,7 @@ GuiParagraphDialog::GuiParagraphDialog(LyXView & lv)
 
 ControlParagraph & GuiParagraphDialog::controller() const
 {
-       return static_cast<ControlParagraph &>(Dialog::controller());
+       return static_cast<ControlParagraph &>(GuiDialog::controller());
 }
 
 
index 9c308305729ea483c5fd6eab9a279597959866bb..a5da7e5b8975a1e5499496bbb93cacc61250ce4a 100644 (file)
@@ -1961,7 +1961,7 @@ GuiPrefsDialog::GuiPrefsDialog(LyXView & lv)
 
 ControlPrefs & GuiPrefsDialog::controller() const
 {
-       return static_cast<ControlPrefs &>(Dialog::controller());
+       return static_cast<ControlPrefs &>(GuiDialog::controller());
 }
 
 
index 1b5dd919d2618db2e0c35c2a3408bbbbc8b9beb5..a495a24113c7065db8ab4e2e6b498a3f0c680c8d 100644 (file)
@@ -69,7 +69,7 @@ GuiPrintDialog::GuiPrintDialog(LyXView & lv)
 
 ControlPrint & GuiPrintDialog::controller() const
 {
-       return static_cast<ControlPrint &>(Dialog::controller());
+       return static_cast<ControlPrint &>(GuiDialog::controller());
 }
 
 
index 91979cb0c0737fafa6b91e2fe0b67ba39f0662a5..bf08efcc9ce338c848159b15b2da85f1a37e0c96 100644 (file)
@@ -90,7 +90,7 @@ GuiRefDialog::GuiRefDialog(LyXView & lv)
 
 ControlRef & GuiRefDialog::controller() const
 {
-       return static_cast<ControlRef &>(Dialog::controller());
+       return static_cast<ControlRef &>(GuiDialog::controller());
 }
 
 
@@ -244,16 +244,14 @@ void GuiRefDialog::applyView()
 
 bool GuiRefDialog::nameAllowed()
 {
-       Kernel::DocType const doc_type = kernel().docType();
-       return doc_type != Kernel::LATEX &&
-               doc_type != Kernel::LITERATE;
+       KernelDocType const doc_type = controller().docType();
+       return doc_type != LATEX && doc_type != LITERATE;
 }
 
 
 bool GuiRefDialog::typeAllowed()
 {
-       Kernel::DocType const doc_type = kernel().docType();
-       return doc_type != Kernel::DOCBOOK;
+       return controller().docType() != DOCBOOK;
 }
 
 
@@ -275,7 +273,7 @@ void GuiRefDialog::setGotoRef()
 
 void GuiRefDialog::gotoRef()
 {
-       string ref(fromqstr(referenceED->text()));
+       string ref = fromqstr(referenceED->text());
 
        if (at_ref_) {
                // go back
index 89c6918aa020bfacfe4baeae0d3a3d06159d887b..03fb76ba77257886f472bbc32123eab3fbf4578b 100644 (file)
@@ -65,7 +65,7 @@ GuiSearchDialog::GuiSearchDialog(LyXView & lv)
 
 ControlSearch & GuiSearchDialog::controller() const
 {
-       return static_cast<ControlSearch &>(Dialog::controller());
+       return static_cast<ControlSearch &>(GuiDialog::controller());
 }
 
 
index a6b8aeb11db2205fc5276dc81beb23b84a693af7..9e91b1e2ef4f9b8be8e449f719c1e29bca446bc2 100644 (file)
@@ -57,7 +57,7 @@ GuiSendtoDialog::GuiSendtoDialog(LyXView & lv)
 
 ControlSendto & GuiSendtoDialog::controller() const
 {
-       return static_cast<ControlSendto &>(Dialog::controller());
+       return static_cast<ControlSendto &>(GuiDialog::controller());
 }
 
 
index f49ab8986e073cd492af41aa2b8ad82b6996c2e7..c71019d411b7aeebf4fc1bb8befb95ccbea17d7d 100644 (file)
@@ -39,7 +39,7 @@ GuiShowFileDialog::GuiShowFileDialog(LyXView & lv)
 
 ControlShowFile & GuiShowFileDialog::controller() const
 {
-       return static_cast<ControlShowFile &>(Dialog::controller());
+       return static_cast<ControlShowFile &>(GuiDialog::controller());
 }
 
 
index 25391400a770d0e0053f21bcd05e8580ad604e7b..0ce77452d914fcf93714b7361d4dd0d617585b56 100644 (file)
@@ -64,7 +64,7 @@ GuiSpellcheckerDialog::GuiSpellcheckerDialog(LyXView & lv)
 
 ControlSpellchecker & GuiSpellcheckerDialog::controller() const
 {
-       return static_cast<ControlSpellchecker &>(Dialog::controller());
+       return static_cast<ControlSpellchecker &>(GuiDialog::controller());
 }
 
 
index 71ecc009b4201d09bec881f5f06d61bf2a0a9a65..66fbd7ba23939e7d022913de00d398dfe98bc4da 100644 (file)
@@ -150,7 +150,7 @@ GuiTabularDialog::GuiTabularDialog(LyXView & lv)
 
 ControlTabular & GuiTabularDialog::controller() const
 {
-       return static_cast<ControlTabular &>(Dialog::controller());
+       return static_cast<ControlTabular &>(GuiDialog::controller());
 }
 
 
index c40c24fa955d90e9b78ddfd8e70c3b3750a7ab6e..045807be3db2886e2dd2371e2a11a50a0a06330b 100644 (file)
@@ -49,7 +49,7 @@ GuiTabularCreateDialog::GuiTabularCreateDialog(LyXView & lv)
 
 ControlTabularCreate & GuiTabularCreateDialog::controller() const
 {
-       return static_cast<ControlTabularCreate &>(Dialog::controller());
+       return static_cast<ControlTabularCreate &>(GuiDialog::controller());
 }
 
 
index fa4c4284acc9a55c8940c1c3d56e35f82cbfcbe7..6c72efa39adfe3667a2738f241f23fc7731c5798 100644 (file)
@@ -62,7 +62,7 @@ GuiTexinfoDialog::GuiTexinfoDialog(LyXView & lv)
 
 ControlTexinfo & GuiTexinfoDialog::controller() const
 {
-       return static_cast<ControlTexinfo &>(Dialog::controller());
+       return static_cast<ControlTexinfo &>(GuiDialog::controller());
 }
 
 
index 8db27077dd804e7c2e6481e082a21305cc8be843..aab037436b6dc98f11a868cc420c4841bc686a9b 100644 (file)
@@ -66,7 +66,7 @@ GuiThesaurusDialog::GuiThesaurusDialog(LyXView & lv)
 
 ControlThesaurus & GuiThesaurusDialog::controller() const
 {
-       return static_cast<ControlThesaurus &>(Dialog::controller());
+       return static_cast<ControlThesaurus &>(GuiDialog::controller());
 }
 
 void GuiThesaurusDialog::change_adaptor()
index 204e1e83c142b4ca53369e4de26e01bd4c9cf3b8..538f4fc086eae6bd3ebbf88c2e687279490f1589 100644 (file)
@@ -53,7 +53,7 @@ GuiURLDialog::GuiURLDialog(LyXView & lv)
 
 ControlCommand & GuiURLDialog::controller() const
 {
-       return static_cast<ControlCommand &>(Dialog::controller());
+       return static_cast<ControlCommand &>(GuiDialog::controller());
 }
 
 
index ebbb347de4dcc1f913e2f4766a6d5be4c9a52116..ab5ee959fcf034b6ee1dbc685ea2607e395ba84c 100644 (file)
@@ -89,7 +89,7 @@ GuiVSpaceDialog::GuiVSpaceDialog(LyXView & lv)
 
 ControlVSpace & GuiVSpaceDialog::controller() const
 {
-       return static_cast<ControlVSpace &>(Dialog::controller());
+       return static_cast<ControlVSpace &>(GuiDialog::controller());
 }
 
 
index 28fb5a86d06b915240a55ce59be0eaf4b9868d56..d707445e82e707ffb992d67f36312da024f3d8e3 100644 (file)
@@ -64,7 +64,7 @@ GuiWrapDialog::GuiWrapDialog(LyXView & lv)
 
 ControlWrap & GuiWrapDialog::controller() const
 {
-       return static_cast<ControlWrap &>(Dialog::controller());
+       return static_cast<ControlWrap &>(GuiDialog::controller());
 }
 
 
index 69d82329bdebecb837cbe1492ebb34983912ac44..3cf6bcefb6e514f45a7f8a05f205063a5e32f15a 100644 (file)
@@ -53,7 +53,7 @@ QValidator::State LengthValidator::validate(QString & qtext, int &) const
                GlueLength gl;
                return (isValidGlueLength(text, &gl)) ?
                        QValidator::Acceptable : QValidator::Intermediate;
-               }
+       }
 
        Length l;
        bool const valid_length = isValidLength(text, &l);
@@ -192,7 +192,7 @@ QValidator::State PathValidator::validate(QString & qtext, int &) const
 void PathValidator::setChecker(lyx::frontend::KernelDocType const & type,
                               LyXRC const & lyxrc)
 {
-       latex_doc_ = type == lyx::frontend::Kernel::LATEX;
+       latex_doc_ = type == frontend::LATEX;
        tex_allows_spaces_ = lyxrc.tex_allows_spaces;
 }
 
index 8257fd7a26943454bfb3375afd66c94d06058b83..f13f8d63c32cc2ef86dbb1f8d14e1c401eabd74a 100644 (file)
@@ -26,6 +26,7 @@
 #define VALIDATOR_H
 
 #include "Length.h"
+#include "Dialog.h"
 
 #include <QValidator>
 
@@ -116,9 +117,6 @@ class DoubleAutoValidator : public QDoubleValidator {
 // Forward declarations
 class LyXRC;
 
-namespace frontend { class KernelDocType; }
-
-
 /** A class to ascertain whether the data passed to the @c validate()
  *  member function is a valid file path.
  *  The test is active only when the path is to be stored in a LaTeX