]> git.lyx.org Git - features.git/commitdiff
revert 18186: this cannot be done right now because of the way LFUN_BUFFER_PARAMS_APP...
authorAbdelrazak Younes <younes@lyx.org>
Thu, 3 May 2007 14:47:22 +0000 (14:47 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 3 May 2007 14:47:22 +0000 (14:47 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18187 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/controllers/ControlDocument.cpp
src/frontends/controllers/ControlDocument.h

index 804725c67353257fcae3fad3f9b880d4aa93f0bf..36c3bbd5294ab53884a2de1b607891643b23630a 100644 (file)
@@ -60,30 +60,28 @@ ControlDocument::~ControlDocument()
 
 bool ControlDocument::initialiseParams(std::string const &)
 {
+       bp_.reset(new BufferParams);
+       *bp_ = kernel().buffer().params();
        return true;
 }
 
 
 void ControlDocument::clearParams()
 {
+       bp_.reset();
 }
 
 
-BufferParams const & ControlDocument::params() const
+BufferParams & ControlDocument::params() const
 {
-       return kernel().buffer().params();
-}
-
-
-BufferParams & ControlDocument::params()
-{
-       return kernel().buffer().params();
+       BOOST_ASSERT(bp_.get());
+       return *bp_;
 }
 
 
 TextClass const & ControlDocument::textClass() const
 {
-       return textclasslist[params().textclass];
+       return textclasslist[bp_->textclass];
 }
 
 
@@ -110,14 +108,14 @@ void ControlDocument::dispatchParams()
        // Set the document class.
        textclass_type const old_class =
                kernel().buffer().params().textclass;
-       textclass_type const new_class = params().textclass;
+       textclass_type const new_class = bp_->textclass;
        if (new_class != old_class) {
                string const name = textclasslist[new_class].name();
                kernel().dispatch(FuncRequest(LFUN_TEXTCLASS_APPLY, name));
        }
 
        int const old_secnumdepth = kernel().buffer().params().secnumdepth;
-       int const new_secnumdepth = params().secnumdepth;
+       int const new_secnumdepth = bp_->secnumdepth;
 
        // Apply the BufferParams.
        dispatch_bufferparams(kernel(), params(), LFUN_BUFFER_PARAMS_APPLY);
@@ -153,7 +151,7 @@ void ControlDocument::dispatchParams()
 
 void ControlDocument::setLanguage() const
 {
-       Language const * const newL = params().language;
+       Language const * const newL = bp_->language;
        if (kernel().buffer().params().language == newL)
                return;
 
index 843558154c28e552a85de9061df0290023e78cdd..d85cdf306e3fc77a63a4898c14ba2c6238862a3c 100644 (file)
@@ -13,8 +13,8 @@
 #define CONTROLDOCUMENT_H
 
 #include "Dialog.h"
-
 #include "support/types.h"
+#include <boost/scoped_ptr.hpp>
 
 namespace lyx {
 
@@ -48,9 +48,7 @@ public:
        ///
        TextClass const & textClass() const;
        ///
-       BufferParams const & params() const;
-       ///
-       BufferParams & params();
+       BufferParams & params() const;
        ///
        void setLanguage() const;
        ///
@@ -65,6 +63,9 @@ public:
        bool const providesSC(std::string const & font) const;
        /// does this font provide size adjustment?
        bool const providesScale(std::string const & font) const;
+private:
+       ///
+       boost::scoped_ptr<BufferParams> bp_;
 };
 
 } // namespace frontend