]> git.lyx.org Git - features.git/commitdiff
Inset patch from Angus.
authorJürgen Vigna <jug@sad.it>
Tue, 10 Oct 2000 11:50:43 +0000 (11:50 +0000)
committerJürgen Vigna <jug@sad.it>
Tue, 10 Oct 2000 11:50:43 +0000 (11:50 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1095 a592a061-630c-0410-9148-cb99ea01b6c8

63 files changed:
ChangeLog
src/BufferView_pimpl.C
src/buffer.C
src/converter.C
src/converter.h
src/frontends/xforms/FormTabular.C
src/insets/figinset.C
src/insets/figinset.h
src/insets/insetbib.C
src/insets/insetbib.h
src/insets/insetcite.h
src/insets/insetcollapsable.C
src/insets/insetcollapsable.h
src/insets/inseterror.h
src/insets/insetert.C
src/insets/insetert.h
src/insets/insetexternal.C
src/insets/insetexternal.h
src/insets/insetfloat.C
src/insets/insetfloat.h
src/insets/insetfoot.C
src/insets/insetfoot.h
src/insets/insetgraphics.C
src/insets/insetgraphics.h
src/insets/insetinclude.C
src/insets/insetinclude.h
src/insets/insetindex.h
src/insets/insetinfo.C
src/insets/insetinfo.h
src/insets/insetlabel.h
src/insets/insetlatexaccent.C
src/insets/insetlatexaccent.h
src/insets/insetlist.C
src/insets/insetlist.h
src/insets/insetmarginal.C
src/insets/insetmarginal.h
src/insets/insetminipage.C
src/insets/insetminipage.h
src/insets/insetparent.C
src/insets/insetparent.h
src/insets/insetquotes.C
src/insets/insetquotes.h
src/insets/insetref.C
src/insets/insetref.h
src/insets/insetspecialchar.C
src/insets/insetspecialchar.h
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/insets/insettheorem.C
src/insets/insettheorem.h
src/insets/insettoc.h
src/insets/inseturl.h
src/insets/lyxinset.h
src/lyx_cb.C
src/lyx_cb.h
src/lyxfunc.C
src/mathed/formula.C
src/mathed/formula.h
src/mathed/formulamacro.C
src/mathed/formulamacro.h
src/paragraph.C

index 254b6f1666eccf668ce38dfbc7d1fa15df121768..dbb2a87832db18e5d9b348c9870abc2994ae900c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2000-10-10  Angus Leeming <a.leeming@ic.ac.uk>
+
+       * src/BufferView_pimpl.C (buffer): cleaned up a little.
+
+       * src/insets/figinset.[Ch]:
+       * src/insets/insetinclude.[Ch]:
+       * src/insets/insetinclude.[Ch]:
+       * src/insets/insetparent.[Ch]:
+       * src/insets/insetref.[Ch]:
+       * src/insets/insettabular.[Ch] (c-tor): Buffer passed as const &.
+
+       * src/insets/*.[Ch]:
+       * src/mathed/formula.[Ch]:
+       * src/mathed/formulamacro.C (Clone): passed Buffer const &.
+
+       * src/buffer.C (parseSingleLyXformat2Token, readInset):
+       * src/lyx_cb.C (FigureApplyCB):
+       * src/lyxfunc.C (getStatus, Dispatch):
+       * src/frontends/xforms/FormTabular.C:  use modified c-tors to some
+       insets.
+
+       * src/lyxfunc.C (Dispatch): string "ref" not used. Removed.
+
+       * src/converter.[Ch] (Formats::View):
+       * src/lyx_cb.[Ch] (ShowMessage): constify Buffer * parameter.
+
+       * src/paragraph.C (CopyIntoMinibuffer, Clone): Insets::Clone() passed
+       *current_view->buffer(). This will change later, but this patch is way
+       big enough already!
+
 2000-10-09  Juergen Vigna  <jug@sad.it>
 
        * src/text.C (GetRow): small fix.
index 85886425b5ac412b5393bcc9901e5b00033ee34f..e87f4b499d120353d60a5b6c44c80393f9585125 100644 (file)
@@ -161,12 +161,17 @@ void BufferView::Pimpl::buffer(Buffer * b)
                bv_->text->first = screen_->TopCursorVisible(bv_->text);
                owner_->updateMenubar();
                owner_->updateToolbar();
+               // Similarly, buffer-dependent dialogs should be updated or
+               // hidden. This should go here because some dialogs (eg ToC)
+               // require bv_->text.
+               owner_->getDialogs()->updateBufferDependent();
                redraw();
                bv_->insetWakeup();
        } else {
                lyxerr[Debug::INFO] << "  No Buffer!" << endl;
                owner_->updateMenubar();
                owner_->updateToolbar();
+               owner_->getDialogs()->hideBufferDependent();
                updateScrollbar();
                workarea_->redraw();
 
@@ -181,15 +186,6 @@ void BufferView::Pimpl::buffer(Buffer * b)
        owner_->updateLayoutChoice();
        owner_->getMiniBuffer()->Init();
        owner_->updateWindowTitle();
-       // Similarly, buffer-dependent dialogs should be updated or hidden.
-       // This should go here because some dialogs (ToC) require bv_->text.
-       if (buffer_) owner_->getDialogs()->updateBufferDependent();
-#ifdef WITH_WARNINGS
-#warning Is this the right place for this?
-// What was wrong with where it used to be in the previous if(buffer_) above?
-// There also used to be a hideBufferDependent somewhere here but I haven't
-// time at present to check.  This should at least fix the segfault.
-#endif
 }
 
 
index d2fd0ec56d22e633f8f0d4b891151b2034593294..742c4693867c6fdc10aedb9bfd79e9774a15edb2 100644 (file)
@@ -882,7 +882,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
                par->InsertChar(pos, LyXParagraph::META_NEWLINE, font);
                ++pos;
        } else if (token == "\\LyXTable") {
-               Inset * inset = new InsetTabular(this);
+               Inset * inset = new InsetTabular(*this);
                inset->Read(this, lex);
                par->InsertInset(pos, inset, font);
                ++pos;
@@ -960,7 +960,7 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par,
                } else if (inscmd.getCmdName() == "index") {
                        inset = new InsetIndex(inscmd);
                } else if (inscmd.getCmdName() == "include") {
-                       inset = new InsetInclude(inscmd, this);
+                       inset = new InsetInclude(inscmd, *this);
                } else if (inscmd.getCmdName() == "label") {
                        inset = new InsetLabel(inscmd);
                } else if (inscmd.getCmdName() == "url"
@@ -973,7 +973,7 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par,
                           || inscmd.getCmdName() == "prettyref") {
                        if (!inscmd.getOptions().empty()
                            || !inscmd.getContents().empty()) {
-                               inset = new InsetRef(inscmd);
+                               inset = new InsetRef(inscmd, *this);
                        }
                } else if (inscmd.getCmdName() == "tableofcontents"
                           || inscmd.getCmdName() == "listofalgorithms"
@@ -983,7 +983,7 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par,
                } else if (inscmd.getCmdName() == "printindex") {
                        inset = new InsetPrintIndex(inscmd);
                } else if (inscmd.getCmdName() == "lyxparent") {
-                       inset = new InsetParent(inscmd, this);
+                       inset = new InsetParent(inscmd, *this);
                }
        } else {
                if (tmptok == "Quotes") {
@@ -995,16 +995,16 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par,
                } else if (tmptok == "Formula") {
                        inset = new InsetFormula;
                } else if (tmptok == "Figure") {
-                       inset = new InsetFig(100, 100, this);
+                       inset = new InsetFig(100, 100, *this);
                } else if (tmptok == "Info") {
                        inset = new InsetInfo;
                } else if (tmptok == "Include") {
                        InsetCommandParams p( "Include" );
-                       inset = new InsetInclude(p, this);
+                       inset = new InsetInclude(p, *this);
                } else if (tmptok == "ERT") {
                        inset = new InsetERT;
                } else if (tmptok == "Tabular") {
-                       inset = new InsetTabular(this);
+                       inset = new InsetTabular(*this);
                } else if (tmptok == "Text") {
                        inset = new InsetText;
                } else if (tmptok == "Foot") {
index 13d8e2e4682d2e1a58b9618ec7083c4abea64d67..b778351703f018d63e1edc3ad207448293309e23 100644 (file)
@@ -98,7 +98,7 @@ void Formats::SetViewer(string const & name, string const & command)
 }
 
 
-bool Formats::View(Buffer * buffer, string const & filename)
+bool Formats::View(Buffer const * buffer, string const & filename)
 {
        if (filename.empty())
                return false;
index 757fe944d90cd326876e338849d9c751a4d15e58..92eb41e01f54b7bb2bd8d46f8747a26c51e0cbf0 100644 (file)
@@ -81,7 +81,7 @@ public:
        void SetViewer(string const & name, string const & command);
        ///
        static
-       bool View(Buffer * buffer, string const & filename);
+       bool View(Buffer const * buffer, string const & filename);
        ///
        static
        Format * GetFormat(string const & name);
index 2e05c2ad85b58c8ceefe7e218ba15aac62abb63c..4b7a492275d87d602dbc7c908f2f3a91a6dbe4a1 100644 (file)
@@ -707,7 +707,7 @@ void FormTabular::apply_create()
 //    comm->setMinibuffer(_("Inserting tabular inset..."));
     ysize = int(fl_get_slider_value(create_tabular_->slider_columns) + 0.5);
     xsize = int(fl_get_slider_value(create_tabular_->slider_rows) + 0.5);
-    InsetTabular * in = new InsetTabular(lv_->buffer(),xsize,ysize);
+    InsetTabular * in = new InsetTabular(*lv_->buffer(),xsize,ysize);
     if (!lv_->view()->open_new_inset(in)) {
        delete in;
     }
index b0bfa738fd080ee2e8cd7caa02b90709e8d1cd69..490a520fad862ed4b20322ec12832ae1efa65d58 100644 (file)
@@ -926,8 +926,8 @@ void UnregisterFigure(InsetFig * fi)
 }
 
 
-InsetFig::InsetFig(int tmpx, int tmpy, Buffer * o)
-       : owner(o)
+InsetFig::InsetFig(int tmpx, int tmpy, Buffer const & o)
+       : owner(&o)
 {
        wid = tmpx;
        hgh = tmpy;
@@ -1220,13 +1220,13 @@ void InsetFig::Edit(BufferView * bv, int, int, unsigned int)
 }
 
 
-Inset * InsetFig::Clone() const
+Inset * InsetFig::Clone(Buffer const & buffer) const
 {
-       InsetFig * tmp = new InsetFig(100, 100, owner);
+       InsetFig * tmp = new InsetFig(100, 100, buffer);
 
        if (lyxerr.debugging()) {
                lyxerr << "Clone Figure: buffer:["
-                      << current_view->buffer()
+                      << &buffer
                       << "], cbuffer:[xx]" << endl;
        }
 
index 58afd4ebe67f9ec9d9b1fd90b8d899b1fd4c1abf..421a0da786b8f5858806fb6aff6762199008d14b 100644 (file)
@@ -20,7 +20,7 @@ struct Figref;
 class InsetFig: public Inset {
 public:
        ///
-       InsetFig(int tmpx, int tmpy, Buffer *);
+       InsetFig(int tmpx, int tmpy, Buffer const &);
        ///
        ~InsetFig();
        ///
@@ -58,7 +58,7 @@ public:
        ///
        Inset::Code LyxCode() const;
        ///
-       Inset * Clone() const;
+       Inset * Clone(Buffer const &) const;
        ///
        void CallbackFig(long arg);
        ///
@@ -134,7 +134,7 @@ public:
 private:
 
        ///
-       Buffer * owner;
+       Buffer const * owner;
        /// restore values on the form
        void RestoreForm();
        /// recompute screen params
index 7a586aabf26ef5c045043ae0aa2a9868970fe01f..330c453e34497bc515588c359587a537f9eff780 100644 (file)
@@ -87,7 +87,7 @@ InsetBibKey::~InsetBibKey()
 }
 
 
-Inset * InsetBibKey::Clone() const
+Inset * InsetBibKey::Clone(Buffer const &) const
 {
        InsetBibKey * b = new InsetBibKey(params());
        b->setCounter(counter);
index 05f257bd3e70547acec08350de8f769f07b4aaf7..3c02c7618db0ec8cee5da2c1fe5ad75d727e3eaa 100644 (file)
@@ -34,7 +34,7 @@ public:
        ///
        ~InsetBibKey();
        ///
-       Inset * Clone() const;
+       Inset * Clone(Buffer const &) const;
        /** Currently \bibitem is used as a LyX2.x command,
            so we need this method.
        */
@@ -82,7 +82,9 @@ public:
        ///
        ~InsetBibtex();
        ///
-       Inset * Clone() const { return new InsetBibtex(params()); }
+       Inset * Clone(Buffer const &) const {
+               return new InsetBibtex(params());
+       }
        ///
        string const getScreenLabel() const;
        ///
index 43d3c21a273b9d62262613024a78e7b8e6b8edf9..8fa126caa52a7c9e100b43e4340350fdf294ac4d 100644 (file)
@@ -24,7 +24,9 @@ public:
        ///
        InsetCitation(InsetCommandParams const &);
        ///
-       Inset * Clone() const { return new InsetCitation(params()); }
+       Inset * Clone(Buffer const &) const {
+               return new InsetCitation(params());
+       }
        ///
        string const getScreenLabel() const;
        ///
index 345cd2b42dd10bd90bf64d44d1fff0598f3b0f4f..2870b5d3bdfed4473dabe6d1f29ba9f987b5553a 100644 (file)
@@ -49,7 +49,7 @@ InsetCollapsable::InsetCollapsable()
 }
 
 
-Inset * InsetCollapsable::Clone() const
+Inset * InsetCollapsable::Clone(Buffer const &) const
 {
     InsetCollapsable * result = new InsetCollapsable();
     result->inset->init(inset);
index 907d7b0ea789c87d3b5512b85f29581399e5d2fd..87b89ffbe9cb6622c1a514db576ac60200db2372 100644 (file)
@@ -43,7 +43,7 @@ public:
     ///
     InsetCollapsable();
     ///
-    Inset * Clone() const;
+    Inset * Clone(Buffer const &) const;
     ///
     void Read(Buffer const *, LyXLex &);
     ///
index d2b79d33cb84195919231a91d47dcfa5a152968a..5ed89186b3a3bf5afb50161c7171ff7c62f38eba 100644 (file)
@@ -65,7 +65,7 @@ public:
        ///
        EDITABLE Editable() const { return IS_EDITABLE; }
        ///
-       Inset * Clone() const { return new InsetError(contents); }
+       Inset * Clone(Buffer const &) const { return new InsetError(contents); }
        ///
        Inset::Code LyxCode() const { return Inset::NO_CODE; }
        /// We don't want "begin" and "end inset" in lyx-file
index f90eaba32fcc1d717ae963113328b8cee079c3dd..b4188498884956dfdb524659139bc79e1548d98a 100644 (file)
@@ -44,7 +44,7 @@ void InsetERT::Write(Buffer const * buf, ostream & os) const
 }
 
 
-Inset * InsetERT::Clone() const
+Inset * InsetERT::Clone(Buffer const &) const
 {
     InsetERT * result = new InsetERT;
     result->inset->init(inset);
index 0ba3405cb3f30b3ff538a7e4d699a7911e0edda9..d50f1e244f97879c38245f11278aaf31285aba8c 100644 (file)
@@ -32,7 +32,7 @@ public:
        ///
        void Write(Buffer const * buf, std::ostream & os) const;
        ///
-       Inset * Clone() const;
+       Inset * Clone(Buffer const &) const;
        ///
        string const EditMessage() const;
        ///
index a60d7facac2f74b2c920f90d8b123e0886508e68..ad95586f74a4216e6324cf466a5dd19e9d0d4355 100644 (file)
@@ -392,7 +392,7 @@ void InsetExternal::Validate(LaTeXFeatures & features) const
 }
 
 
-Inset * InsetExternal::Clone() const
+Inset * InsetExternal::Clone(Buffer const &) const
 {
        InsetExternal * inset = new InsetExternal();
        inset->templatename = templatename;
index 6162638a5e1de07e05acd735b0638530e2f0ffeb..ae5568b88e7d5054f94d6bdf7ffadadb5b62191c 100644 (file)
@@ -59,7 +59,7 @@ public:
        virtual Inset::Code LyxCode() const { return EXTERNAL_CODE; }
   
        ///
-       virtual Inset * Clone() const;
+       virtual Inset * Clone(Buffer const &) const;
 
        /// returns the text of the button
        virtual string const getScreenLabel() const;
index 507ec59681726f9c9a893b343af68a8c0ee0aa63..b4777149246274b0a985609ca98b89cf21012bd5 100644 (file)
@@ -135,7 +135,7 @@ void InsetFloat::Validate(LaTeXFeatures & features) const
 }
 
 
-Inset * InsetFloat::Clone() const
+Inset * InsetFloat::Clone(Buffer const &) const
 {
        InsetFloat * result = new InsetFloat(floatType);
        result->inset->init(inset);
index 821fd7409fd2eb96b29c26ae8c3a6768ff9cfee2..6f28d4caed7cf53611ddbdfe2f4f3f804c519d23 100644 (file)
@@ -34,7 +34,7 @@ public:
        ///
        void Validate(LaTeXFeatures & features) const;
        ///
-       Inset * Clone() const;
+       Inset * Clone(Buffer const &) const;
        ///
        Inset::Code LyxCode() const { return Inset::FLOAT_CODE; }
        ///
index 03f3fae71440ce1b2c7a1dafdc52b847baaa4d43..396c10330ec386cd67c4cdb2b83e27ba2c4123b4 100644 (file)
@@ -34,7 +34,7 @@ InsetFoot::InsetFoot()
 }
 
 
-Inset * InsetFoot::Clone() const
+Inset * InsetFoot::Clone(Buffer const &) const
 {
     InsetFoot * result = new InsetFoot;
     result->inset->init(inset);
index 8c83d5a65c9468a899fddae4eb141884c3899510..26b7f2f7fa26b1b613531970a9080f4017a8039a 100644 (file)
@@ -28,7 +28,7 @@ public:
        ///
        InsetFoot();
        ///
-       Inset * Clone() const;
+       Inset * Clone(Buffer const &) const;
        ///
        Inset::Code LyxCode() const { return Inset::FOOT_CODE; }
        ///
index 4435b3f4612af50f7b54bfb28f219a382deb833b..af5035b804c226a0bd7b05a5d9c6e13c45c11570 100644 (file)
@@ -663,7 +663,7 @@ InsetGraphicsParams InsetGraphics::getParams() const
        return params;
 }
 
-Inset * InsetGraphics::Clone() const
+Inset * InsetGraphics::Clone(Buffer const &) const
 {
        InsetGraphics * newInset = new InsetGraphics;
 
index 72e9cafef0327515abe5526a7dae361dcdc3c8bc..ead8ed152ccb0ef78fd35ab82d9f10929424aa51 100644 (file)
@@ -86,7 +86,7 @@ public:
        Inset::Code LyxCode() const { return Inset::GRAPHICS_CODE; }
 
        ///
-       Inset * Clone() const;
+       Inset * Clone(Buffer const &) const;
 
        /** Set the inset parameters, used by the GUIndependent dialog.
            Return true of new params are different from what was so far.
index 087d9a2104696ae66b609ca8f9bf9e452dce8be2..8153c087cc90fa6037ddcccc933a8ec8de4e32fb 100644 (file)
@@ -203,8 +203,8 @@ string unique_id() {
 }
 
 
-InsetInclude::InsetInclude(InsetCommandParams const & p, Buffer * bf)
-       : InsetCommand(p), master(bf)
+InsetInclude::InsetInclude(InsetCommandParams const & p, Buffer const & bf)
+       : InsetCommand(p), master(&bf)
 {
        flag = InsetInclude::INCLUDE;
        noload = false;
@@ -229,9 +229,9 @@ InsetInclude::~InsetInclude()
 }
 
 
-Inset * InsetInclude::Clone() const
+Inset * InsetInclude::Clone(Buffer const & buffer) const
 { 
-       InsetInclude * ii = new InsetInclude (params(), master); 
+       InsetInclude * ii = new InsetInclude (params(), buffer); 
        ii->setNoLoad(isNoLoad());
        // By default, the newly created inset is of `include' type,
        // so we do not test this case.
index a4a24d141ba2778a204ca4326b828ee2b08203fb..a6d8c78b7c31b5dbf00b800c9874aaf7f3f2f44a 100644 (file)
@@ -27,11 +27,11 @@ struct LaTeXFeatures;
 class InsetInclude: public InsetCommand {
 public:
        ///
-       InsetInclude(InsetCommandParams const &, Buffer *);
+       InsetInclude(InsetCommandParams const &, Buffer const &);
        ///
        ~InsetInclude();
         ///
-        Inset * Clone() const;
+        Inset * Clone(Buffer const &) const;
        ///
        Inset::Code LyxCode() const { return Inset::INCLUDE_CODE; }
        /// This returns the list of labels on the child buffer
@@ -114,7 +114,7 @@ private:
        ///
         int flag;
         ///
-       Buffer * master;
+       Buffer const * master;
        ///
        string include_label;
 };
index 7d0120ab4f6408f595084715a08ede1070f046d1..686a8c0588d75cb37d6c869dd1eaf89b338e0fab 100644 (file)
@@ -27,7 +27,9 @@ public:
        ///
        InsetIndex(InsetCommandParams const &);
        ///
-       Inset * Clone() const { return new InsetIndex(params());}
+       Inset * Clone(Buffer const &) const {
+               return new InsetIndex(params());
+       }
        ///
        string const getScreenLabel() const;
        ///
@@ -42,7 +44,9 @@ public:
        ///
        InsetPrintIndex(InsetCommandParams const &);
        ///
-       Inset * Clone() const { return new InsetPrintIndex(params());}
+       Inset * Clone(Buffer const &) const {
+               return new InsetPrintIndex(params());
+       }
        /// Updates needed features for this inset.
        void Validate(LaTeXFeatures & features) const;
        ///
index ae77a9b5cea8f457b01b67b759a5bdf6e426e607..f0d355a13f399a034469b679bf84bc7cf2fea164 100644 (file)
@@ -237,7 +237,7 @@ void InsetInfo::Edit(BufferView *bv, int, int, unsigned int)
 }
 
 
-Inset * InsetInfo::Clone() const
+Inset * InsetInfo::Clone(Buffer const &) const
 {
        return new InsetInfo(contents);
 }
index 08f1ebc95a2d5daf148baa96c6d60d39544a86fc..6312551c7c62595197b36567a3a88fd978a73065 100644 (file)
@@ -67,7 +67,7 @@ public:
        ///
        Inset::Code LyxCode() const;
        ///
-       Inset * Clone() const;
+       Inset * Clone(Buffer const &) const;
        ///
        static void CloseInfoCB(FL_OBJECT *, long data);
 private:
index 38b7c534b4fa7a1f5c7a7e0bdf74907e14130078..87211ae6fe600aacd986174a9d4d98e7200c326a 100644 (file)
@@ -23,7 +23,7 @@ public:
        ///
        InsetLabel(InsetCommandParams const &);
        ///
-       Inset * Clone() const { return new InsetLabel(params()); }
+       Inset * Clone(Buffer const &) const { return new InsetLabel(params()); }
        ///
        string const getScreenLabel() const { return getContents(); }
        ///
index a6a5b0a324b4dc29a40e182c98d1fbfc7cd0951c..eca8a501215654fdde6936ffe1e6502934d17d97 100644 (file)
@@ -662,7 +662,7 @@ bool InsetLatexAccent::DirectWrite() const
 }
 
 
-Inset * InsetLatexAccent::Clone() const
+Inset * InsetLatexAccent::Clone(Buffer const &) const
 {
        return new InsetLatexAccent(contents);
 }
index e583ab57ce1ac7e07947587d9a509fa4d0701e8f..9d7cbe436233f3b4bcaccaf6883c735df9861493 100644 (file)
@@ -67,7 +67,7 @@ public:
        ///
        bool DirectWrite() const;
        ///
-       Inset * Clone() const;
+       Inset * Clone(Buffer const &) const;
        ///
        Inset::Code LyxCode()const;
        ///
index a71be8a62914c2e1d4bb849bd1d24489830f8fcb..2a4be5c851f02c313462c1595fa7265dd19245e9 100644 (file)
@@ -57,7 +57,7 @@ void InsetList::Write(Buffer const * buf, ostream & os) const
 }
 
 
-Inset * InsetList::Clone() const
+Inset * InsetList::Clone(Buffer const &) const
 {
        InsetList * result = new InsetList;
        result->inset->init(inset);
index bb8c02eb112070eb257cdac53765c56477feb343..dc1e415e1af170c0f57b5e244ebfb2682d576e1e 100644 (file)
@@ -28,7 +28,7 @@ public:
        ///
        void Write(Buffer const * buf, std::ostream & os) const;
        ///
-       Inset * Clone() const;
+       Inset * Clone(Buffer const &) const;
        ///
        Inset::Code LyxCode() const { return Inset::FOOT_CODE; }
        ///
index 9d078780a9a08d4a876ac80c14bf73ef34487716..758b7cfd25eddf98d461137536bdf6dd98ea8ba1 100644 (file)
@@ -35,7 +35,7 @@ InsetMarginal::InsetMarginal()
 }
 
 
-Inset * InsetMarginal::Clone() const
+Inset * InsetMarginal::Clone(Buffer const &) const
 {
        InsetMarginal * result = new InsetMarginal;
        result->inset->init(inset);
index d8253c6343cdaa2048e7c4a38421ecc048ee6565..775fdd61d8ec778a6dca3e5d1b1f889554e900aa 100644 (file)
@@ -26,7 +26,7 @@ public:
        ///
        InsetMarginal();
        ///
-       Inset * Clone() const;
+       Inset * Clone(Buffer const &) const;
        ///
        Inset::Code LyxCode() const { return Inset::MARGIN_CODE; }
        ///
index 7d34868024834ff7880f12c7b6bc771e7fc8729d..ceb7d8da5c9423e2dda4e8e0f68d90450ae2dcd3 100644 (file)
@@ -75,7 +75,7 @@ void InsetMinipage::Write(Buffer const * buf, ostream & os) const
 }
 
 
-Inset * InsetMinipage::Clone() const
+Inset * InsetMinipage::Clone(Buffer const &) const
 {
        InsetMinipage * result = new InsetMinipage;
        result->inset->init(inset);
index a85ab503ee8467e281673cd80ca8d03dbcbcdb0e..aff41a6eeceb2680a407b550e31ddd734a46142d 100644 (file)
@@ -28,7 +28,7 @@ public:
        ///
        void Write(Buffer const * buf, std::ostream & os) const;
        ///
-       Inset * Clone() const;
+       Inset * Clone(Buffer const &) const;
        ///
        Inset::Code LyxCode() const { return Inset::MINIPAGE_CODE; }
        ///
index b6a9381a20752e1f7fcf14673d42324aa77f2683..3c6a7f2975012366f569ad65159cb71c97b8b4b6 100644 (file)
 using std::ostream;
 
 
-InsetParent::InsetParent(InsetCommandParams const & p, Buffer * bf)
+InsetParent::InsetParent(InsetCommandParams const & p, Buffer const & bf)
        : InsetCommand(p)
 {
        string fn = p.getContents();
-       if (bf)
-               setContents(MakeAbsPath(fn, OnlyPath(bf->fileName())));
-       else
-               setContents(fn);
+       setContents(MakeAbsPath(fn, OnlyPath(bf.fileName())));
 }
 
 
index 548acbaea466d0ce8ec89c6f01933da493e72a57..1d21a127457b0fed1f77f3787bd1d4f7c40fe322 100644 (file)
@@ -27,9 +27,11 @@ class Buffer;
 class InsetParent : public InsetCommand {
 public:
        ///
-       InsetParent(InsetCommandParams const &, Buffer * owner = 0);
+       InsetParent(InsetCommandParams const &, Buffer const &);
        ///
-       Inset * Clone() const { return new InsetParent(params()); }
+       Inset * Clone(Buffer const & buffer) const {
+               return new InsetParent(params(), buffer);
+       }
        ///
        string const getScreenLabel() const;
         ///
index 93104a4a43ac55f809308bd3fac748efe1d63aa5..54a709292f01077d976a3ae58504b3b14d3c69b2 100644 (file)
@@ -311,7 +311,7 @@ void InsetQuotes::Validate(LaTeXFeatures & features) const
 }
 
 
-Inset * InsetQuotes::Clone() const
+Inset * InsetQuotes::Clone(Buffer const &) const
 {
   return new InsetQuotes(language, side, times);
 }
index 978891bc48d44d85440f3539efa0ef34f3be573d..2ed6f4e6627f0c699bbad1955e5b9d61966666e8 100644 (file)
@@ -97,7 +97,7 @@ public:
        ///
        void Validate(LaTeXFeatures &) const;
        ///
-       Inset * Clone() const;
+       Inset * Clone(Buffer const &) const;
        ///
        Inset::Code LyxCode() const;
 private:
index ca83db0a0e9c5bb1c5a9aedeb0c04eb7eb56e865..ff995a8a9f37a95f33db70b716e38b5ae6abf1e1 100644 (file)
 
 using std::ostream;
 
-extern BufferView * current_view;
-
-
-InsetRef::InsetRef(InsetCommandParams const & p)
-       : InsetCommand(p)
+InsetRef::InsetRef(InsetCommandParams const & p, Buffer const & buf)
+       : InsetCommand(p), isLatex(buf.isLatex())
 {}
 
 void InsetRef::Edit(BufferView * bv, int, int, unsigned int button)
@@ -50,7 +47,7 @@ string const InsetRef::getScreenLabel() const
 
        temp += getContents();
 
-       if(!current_view->buffer()->isLatex()
+       if(!isLatex
           && !getOptions().empty()) {
                temp += "||";
                temp += getOptions();
index 621dcf1252013bc708326a9806c979537d2b2d38..392b80a36fc6af7fc053565dc79add0c7eda02e4 100644 (file)
@@ -24,9 +24,11 @@ struct LaTeXFeatures;
 class InsetRef : public InsetCommand {
 public:
        ///
-       InsetRef(InsetCommandParams const &);
+       InsetRef(InsetCommandParams const &, Buffer const &);
        ///
-       Inset * Clone() const { return new InsetRef(params()); }
+       Inset * Clone(Buffer const & buffer) const {
+               return new InsetRef(params(), buffer);
+       }
        ///
        string const getScreenLabel() const;
        ///
@@ -51,5 +53,7 @@ public:
 private:
        /// This function escapes 8-bit characters
        string const escape(string const &) const;
+       ///
+       bool isLatex;
 };
 #endif
index ca1b9cb4de8937012a370284231114937d11e102..9f404779675684c96f7ab0c4604f0ef4ef56b5e5 100644 (file)
@@ -221,7 +221,7 @@ int InsetSpecialChar::DocBook(Buffer const * buf, ostream & os) const
 }
 
 
-Inset * InsetSpecialChar::Clone() const
+Inset * InsetSpecialChar::Clone(Buffer const &) const
 {
        return new InsetSpecialChar(kind);
 }
index 928892878be2697a88f8b9f39ab0da6947992c78..33315256d9f88ef0933bf2047bce042a7e753a4f 100644 (file)
@@ -65,7 +65,7 @@ public:
        ///
        int DocBook(Buffer const *, std::ostream &) const;
        ///
-       Inset * Clone() const;
+       Inset * Clone(Buffer const &) const;
        ///  
        Inset::Code LyxCode() const
        {
index 0c2bf5647e076af65d59c01106e7230fbcac9231..608b25448a7fea8a798a96c7a628e5b407255963 100644 (file)
@@ -115,8 +115,8 @@ bool cellstart(LyXParagraph::size_type p)
 }
 
 
-InsetTabular::InsetTabular(Buffer * buf, int rows, int columns)
-       : buffer(buf)
+InsetTabular::InsetTabular(Buffer const & buf, int rows, int columns)
+       : buffer(&buf)
 {
     if (rows <= 0)
         rows = 1;
@@ -137,8 +137,8 @@ InsetTabular::InsetTabular(Buffer * buf, int rows, int columns)
 }
 
 
-InsetTabular::InsetTabular(InsetTabular const & tab, Buffer * buf)
-       : buffer(buf)
+InsetTabular::InsetTabular(InsetTabular const & tab, Buffer const & buf)
+       : buffer(&buf)
 {
     tabular = new LyXTabular(this, *(tab.tabular));
     the_locking_inset = 0;
@@ -161,9 +161,9 @@ InsetTabular::~InsetTabular()
 }
 
 
-Inset * InsetTabular::Clone() const
+Inset * InsetTabular::Clone(Buffer const & buf) const
 {
-    InsetTabular * t = new InsetTabular(*this, buffer);
+    InsetTabular * t = new InsetTabular(*this, buf);
     delete t->tabular;
     t->tabular = tabular->Clone(t);
     return t;
index ecacb2dba7a5719eeb844d0574a427c8da894488..ad1807de1d2b6e3a73a7959f00b02542b112fae7 100644 (file)
@@ -73,13 +73,13 @@ public:
        SELECTION
     };
     ///
-    InsetTabular(Buffer *, int rows = 1, int columns = 1);
+    InsetTabular(Buffer const &, int rows = 1, int columns = 1);
     ///
-    InsetTabular(InsetTabular const &, Buffer *);
+    InsetTabular(InsetTabular const &, Buffer const &);
     ///
     ~InsetTabular();
     ///
-    Inset * Clone() const;
+    Inset * Clone(Buffer const &) const;
     ///
     void Read(Buffer const *, LyXLex &);
     ///
@@ -160,7 +160,7 @@ public:
     ///
     int getMaxWidth(Painter & pain, UpdatableInset const *) const;
     ///
-    Buffer * BufferOwner() const { return buffer; }
+    Buffer * BufferOwner() const { return const_cast<Buffer *>(buffer); }
     ///
     LyXText * getLyXText(BufferView *) const;
     ///
@@ -235,7 +235,7 @@ private:
     ///
     InsetText * the_locking_inset;
     ///
-    Buffer * buffer;
+    Buffer const * buffer;
     ///
     mutable LyXCursor cursor;
     ///
index 87bfa469d0d09bee1200a4c28781a7b0509b4416..2f9fcf9ca02a62954b0342ab658b6a609ef899a0 100644 (file)
@@ -138,7 +138,7 @@ void InsetText::clear()
 }
 
 
-Inset * InsetText::Clone() const
+Inset * InsetText::Clone(Buffer const &) const
 {
     InsetText * t = new InsetText(*this);
     return t;
index 631582fddd12b9b99ca5952b9f2aebf8e1d7faab..1e5354d345853261272de0b8b2520d770487b553 100644 (file)
@@ -75,7 +75,7 @@ public:
     ///
     ~InsetText();
     ///
-    Inset * Clone() const;
+    Inset * Clone(Buffer const &) const;
     ///
     InsetText & operator=(InsetText const & it);
     ///
index 11ef790d8b1a09a101e261cccfebd41c6c46185f..16b19a9d88cde1c4f4f6edba5513578faa6bc805 100644 (file)
@@ -54,7 +54,7 @@ void InsetTheorem::Write(Buffer const * buf, ostream & os) const
 }
 
 
-Inset * InsetTheorem::Clone() const
+Inset * InsetTheorem::Clone(Buffer const &) const
 {
        InsetTheorem * result = new InsetTheorem;
        
index e2a6a8a3808884b3a9abb4dac5e2ac7045f0960c..84ad0e0653c515ccf683ca3a4335c59d3546d40c 100644 (file)
@@ -28,7 +28,7 @@ public:
        ///
        void Write(Buffer const * buf, std::ostream & os) const;
        ///
-       Inset * Clone() const;
+       Inset * Clone(Buffer const &) const;
        ///
        Inset::Code LyxCode() const { return Inset::THEOREM_CODE; }
        ///
index 9acd77bde8d5d0424f9ea8ed24a43f16c2769082..3c7d8bed37587ed116c22583710f8f3ca9a921b1 100644 (file)
@@ -25,7 +25,7 @@ public:
        ///
        InsetTOC(InsetCommandParams const & p) : InsetCommand(p) {}
        ///
-        Inset * Clone() const { return new InsetTOC(params()); }
+        Inset * Clone(Buffer const &) const { return new InsetTOC(params()); }
        ///
        string const getScreenLabel() const;
        ///
index 1aaddcfab20e7eb3a21bd2e79bd70d5fa801b099..c2a83633797f14d57a2444f035854be43c686e2c 100644 (file)
@@ -27,7 +27,7 @@ public:
        explicit
        InsetUrl(InsetCommandParams const &);
         ///
-       Inset * Clone() const { return new InsetUrl(params()); }
+       Inset * Clone(Buffer const &) const { return new InsetUrl(params()); }
        ///
        Inset::Code LyxCode() const { return Inset::URL_CODE; }
        ///
index 0e50b02f49b2f7889945ba8252cbf1489296a295..ac3b65768112d23d0d4b4cb7369f5425b7af5f8b 100644 (file)
@@ -190,7 +190,7 @@ public:
        }
 
        ///
-       virtual Inset * Clone() const = 0;
+       virtual Inset * Clone(Buffer const &) const = 0;
 
        /// returns true to override begin and end inset in file
        virtual bool DirectWrite() const;
index c09fe4cc8aa5eca359dd21ac9c2b9fecffe60aad..7878bb0fb939daea8de0a629da010ab1d942d961 100644 (file)
@@ -154,7 +154,7 @@ void MenuReload(Buffer * buf);
 void MenuLayoutSave();
 
 
-void ShowMessage(Buffer * buf,
+void ShowMessage(Buffer const * buf,
                 string const & msg1,
                 string const & msg2,
                 string const & msg3, int delay)
@@ -836,7 +836,7 @@ void FigureApplyCB(FL_OBJECT *, long)
        
        current_view->owner()->getMiniBuffer()->Set(_("Inserting figure..."));
        if (fl_get_button(fd_form_figure->radio_inline)) {
-               InsetFig * new_inset = new InsetFig(100, 20, buffer);
+               InsetFig * new_inset = new InsetFig(100, 20, *buffer);
                current_view->insertInset(new_inset);
                current_view->owner()->getMiniBuffer()->Set(_("Figure inserted"));
                new_inset->Edit(current_view, 0, 0, 0);
@@ -890,7 +890,7 @@ void FigureApplyCB(FL_OBJECT *, long)
        
        current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
       
-       Inset * new_inset = new InsetFig(100, 100, buffer);
+       Inset * new_inset = new InsetFig(100, 100, *buffer);
        current_view->insertInset(new_inset);
        new_inset->Edit(current_view, 0, 0, 0);
        current_view->update(BufferView::SELECT|BufferView::FITCUR);
index 8904ee965f780c21f5c481dcf3c4e9db74959fe7..fdeef102c21d63067d933e1a060907695d1ef281 100644 (file)
@@ -19,7 +19,7 @@ extern bool BindFileSet;
 ///
 extern LyXFont const UserFreeFont(BufferParams const & params);
 ///
-void ShowMessage(Buffer * buf,
+void ShowMessage(Buffer const * buf,
                 string const & msg1,
                 string const & msg2 = string(),
                 string const & msg3 = string(), int delay = 6);
index 45c612511c7bc414d709aa2efbc8431d3d4bc816..7e99347deaf676a81b4af540b36612ffdf408560 100644 (file)
@@ -523,7 +523,7 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
                        flag |= ret;
                        disable = false;
                } else {
-                   static InsetTabular inset(owner->buffer(), 1, 1);
+                   static InsetTabular inset(*owner->buffer(), 1, 1);
                    func_status ret;
 
                    disable = true;
@@ -855,7 +855,6 @@ string const LyXFunc::Dispatch(int ac,
                meta_fake_bit = Mod1Mask;
                string buf;
                keyseq.print(buf, true);
-               string res = string("M-") + buf;
                setMessage(buf); // RVDK_PATCH_5
        }
        break;  
@@ -1495,7 +1494,7 @@ string const LyXFunc::Dispatch(int ac,
                        InsetCommandParams p;
                        p.setFromString(argument);
 
-                       InsetRef * inset = new InsetRef(p);
+                       InsetRef * inset = new InsetRef(p, *owner->buffer());
                        if (!owner->view()->insertInset(inset))
                                delete inset;
                        else
@@ -2347,7 +2346,7 @@ string const LyXFunc::Dispatch(int ac,
                if (!argument.empty())
                        ::sscanf(argument.c_str(),"%d%d", &r, &c);
                InsetTabular * new_inset =
-                       new InsetTabular(owner->buffer(), r, c);
+                       new InsetTabular(*owner->buffer(), r, c);
                if (owner->view()->insertInset(new_inset))
                        new_inset->Edit(owner->view(), 0, 0, 0);
                else
@@ -2796,7 +2795,7 @@ string const LyXFunc::Dispatch(int ac,
        {
                lyxerr << "arg " << argument << endl;
                InsetCommandParams p( "lyxparent", argument );
-               Inset * inset = new InsetParent(p, owner->buffer());
+               Inset * inset = new InsetParent(p, *owner->buffer());
                if (!owner->view()->insertInset(inset, "Standard", true))
                        delete inset;
        }
@@ -2805,7 +2804,7 @@ string const LyXFunc::Dispatch(int ac,
        case LFUN_CHILDINSERT:
        {
                InsetCommandParams p( "Include", argument );
-               Inset * inset = new InsetInclude(p, owner->buffer());
+               Inset * inset = new InsetInclude(p, *owner->buffer());
                if (owner->view()->insertInset(inset, "Standard", true))
                        inset->Edit(owner->view(), 0, 0, 0);
                else
index 75e49f5ca55ec2c8f9a6b1e8a290b08154bf48a8..19399b6a519b307950a03f61af0043e7595fff49 100644 (file)
@@ -301,7 +301,7 @@ InsetFormula::~InsetFormula()
 }
 
 
-Inset * InsetFormula::Clone() const
+Inset * InsetFormula::Clone(Buffer const &) const
 {
     InsetFormula * f = new InsetFormula(par);
     f->label = label;
index 99a018f276c7b7225f48019bb0ee442c8c409c3c..f1dc758789d6001f1405c6cce1630de87aa68b1c 100644 (file)
@@ -64,7 +64,7 @@ public:
        ///
        void Validate(LaTeXFeatures &) const;
        ///
-       Inset * Clone() const;
+       Inset * Clone(Buffer const &) const;
        ///
        Inset::Code LyxCode() const { return Inset::MATH_CODE; }
        ///
index 10f9c5d238cc125c0ccf2e74d7a5ff533ccb30a1..5504ab93a04f5e969df23016246542d1b28d216a 100644 (file)
@@ -61,7 +61,7 @@ InsetFormulaMacro::~InsetFormulaMacro()
 }
 
 
-Inset * InsetFormulaMacro::Clone() const
+Inset * InsetFormulaMacro::Clone(Buffer const &) const
 {
    return new InsetFormulaMacro(name);
 }
index 3a66cfddc9fc16278a477e196b38120966e268ed..1e75f11717340e858bd10995365890b40861b5de 100644 (file)
@@ -56,7 +56,7 @@ public:
        ///
        int DocBook(Buffer const *, std::ostream &) const;
        ///
-       Inset * Clone() const;
+       Inset * Clone(Buffer const &) const;
 
        /// what appears in the minibuffer when opening
        string const EditMessage() const;
index ed9ed0703891aa18bbbedbae1c7e11cedaff8716..e822a99261d4c75d3edfc249deb7f60b5efe841a 100644 (file)
@@ -410,7 +410,7 @@ void LyXParagraph::CopyIntoMinibuffer(BufferParams const & bparams,
        minibuffer_inset = 0;
        if (minibuffer_char == LyXParagraph::META_INSET) {
                if (GetInset(pos)) {
-                       minibuffer_inset = GetInset(pos)->Clone();
+                       minibuffer_inset = GetInset(pos)->Clone(*current_view->buffer());
                } else {
                        minibuffer_inset = 0;
                        minibuffer_char = ' ';
@@ -1610,7 +1610,8 @@ LyXParagraph * LyXParagraph::Clone() const
    
         // ale970302
        if (bibkey)
-               result->bibkey = static_cast<InsetBibKey *>(bibkey->Clone());
+               result->bibkey = static_cast<InsetBibKey *>
+                                (bibkey->Clone(*current_view->buffer()));
        else
                result->bibkey = 0;
     
@@ -1621,7 +1622,7 @@ LyXParagraph * LyXParagraph::Clone() const
        result->insetlist = insetlist;
        for (InsetList::iterator it = result->insetlist.begin();
             it != result->insetlist.end(); ++it)
-               (*it).inset = (*it).inset->Clone();
+               (*it).inset = (*it).inset->Clone(*current_view->buffer());
        return result;
 }