]> git.lyx.org Git - features.git/commitdiff
Added copy constructor to inset.h and used it in most insets which permit
authorJürgen Vigna <jug@sad.it>
Tue, 24 Jul 2001 15:07:09 +0000 (15:07 +0000)
committerJürgen Vigna <jug@sad.it>
Tue, 24 Jul 2001 15:07:09 +0000 (15:07 +0000)
it. Small fixes.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2323 a592a061-630c-0410-9148-cb99ea01b6c8

26 files changed:
src/ChangeLog
src/insets/ChangeLog
src/insets/inset.C
src/insets/inset.h
src/insets/insetbib.C
src/insets/insetcollapsable.C
src/insets/insetcollapsable.h
src/insets/insetcommand.C
src/insets/insetert.C
src/insets/insetert.h
src/insets/insetfloat.C
src/insets/insetfloat.h
src/insets/insetfoot.C
src/insets/insetfoot.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/insetnote.C
src/insets/insetnote.h
src/insets/insettabular.C
src/insets/insettext.C
src/lyxfont.C
src/text.C

index 25d85047573e45c2350d6025ffb020a02cffd069..3bcfd1db51689177fa70cda3066b06b7ed0e9a4a 100644 (file)
@@ -1,3 +1,9 @@
+2001-07-24  Juergen Vigna  <jug@sad.it>
+
+       * text.C (draw): honor the ignore_language.
+
+       * lyxfont.C (LyXFont): set language to ignore_language in FONT_INIT1.
+
 2001-07-24  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * lyxfunc.C (getStatus): BREAKLINE does _not_ insert a special
index c3750d95d56fd9504c9620d2bd4734ad91a4cfdf..db6bff8698b6018f5b138866a1cfbc9680f199a2 100644 (file)
@@ -1,3 +1,21 @@
+2001-07-24  Juergen Vigna  <jug@sad.it>
+
+       * insetert.C (InsetERT): put init after the paragraph initialization,
+       as otherwise we don't set the draw_label right.
+
+       * insetcollapsable.C (insetMotionNotify): fixed opening/closing the
+       insets with the mouse without having strange selections.
+       (edit): if the inset was collapsed and we open it here then put the
+       cursor always at the beginning of the inset.
+       (get_new_label): 15 instead of 10 max chars in the label.
+
+       * insetert.C (localDispatch): added and handle various stuff we
+       need to handle here (font setting on paragraph break, not permitted
+       layout setting, etc.).
+
+       * inset.h: added default copy-consturctor and implemented this in
+       various insets with the change to use this in the clone function!
+
 2001-07-24  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
        * insetminipage.C (InsetMinipage): set background color to red :)
index 581006f0cb0c98cd6da5787d61c8a158fea99dc2..f473f151f448c9b1e213dd227af4901dc9c0ec2d 100644 (file)
@@ -33,6 +33,23 @@ using std::endl;
 // Initialization of the counter for the inset id's,
 unsigned int Inset::inset_id = 0;
 
+Inset::Inset()
+       : top_x(0), top_baseline(0), scx(0), id_(inset_id++), owner_(0),
+         background_color_(LColor::inherit)
+{}
+
+
+Inset::Inset(Inset const & in, bool same_id)
+       : top_x(0), top_baseline(0), scx(0), owner_(0), name(in.name),
+         background_color_(in.background_color_)
+{
+       if (same_id)
+               id_ = in.id();
+       else
+               id_ = inset_id++;
+}
+
+
 bool Inset::deletable() const
 {
        return true;
@@ -120,6 +137,16 @@ void Inset::id(int id_arg)
 
 // some stuff for inset locking
 
+UpdatableInset::UpdatableInset()
+       : Inset(), cursor_visible_(false), block_drawing_(false)
+{}
+
+
+UpdatableInset::UpdatableInset(UpdatableInset const & in, bool same_id)
+       : Inset(in, same_id), cursor_visible_(false), block_drawing_(false)
+{}
+
+
 void UpdatableInset::insetButtonPress(BufferView *, int x, int y, int button)
 {
        lyxerr[Debug::INFO] << "Inset Button Press x=" << x
index 550c6cee318ded07621a8f2690be4c5a51092c0a..b8b7dda9138d04ea535a3de237366c5c1bf6e96e 100644 (file)
@@ -129,8 +129,10 @@ public:
        };
        
        ///
-       Inset() : top_x(0), top_baseline(0), scx(0), id_(inset_id++), owner_(0), background_color_(LColor::inherit) {}
-       /// Virtual base destructor
+       Inset();
+       ///
+       Inset(Inset const & in, bool same_id = false);
+       ///
        virtual ~Inset() {}
        ///
        virtual int ascent(BufferView *, LyXFont const &) const = 0;
@@ -352,7 +354,9 @@ public:
        }
 
        ///
-       UpdatableInset() : cursor_visible_(false), block_drawing_(false) {}
+       UpdatableInset();
+       ///
+       UpdatableInset(UpdatableInset const & in, bool same_id = false);
 
        ///
        virtual EDITABLE editable() const;
index 28836d50530b86902787ddab6f01bb0e53b540ab..9f4caab3f9359a27173cbe23ca7ae776365bec85 100644 (file)
@@ -33,9 +33,8 @@ int InsetBibKey::key_counter = 0;
 const string key_prefix = "key-";
 
 InsetBibKey::InsetBibKey(InsetCommandParams const & p)
-       : InsetCommand(p)
+       : InsetCommand(p), counter(1)
 {
-       counter = 1;
        if (getContents().empty())
                setContents(key_prefix + tostr(++key_counter));
 }
index 5739b508013bebb7c68f7cb1891634d2834681d0..1910cf36c827a937f78b37b7e18262af510c1169 100644 (file)
@@ -36,11 +36,9 @@ using std::max;
 InsetCollapsable::InsetCollapsable(bool collapsed)
        : UpdatableInset(), collapsed_(collapsed), 
          button_length(0), button_top_y(0), button_bottom_y(0),
-         label("Label"), draw_label(label), autocollapse(true), 
+         label("Label"), draw_label(label), autocollapse(false), 
          oldWidth(0), need_update(FULL),
          inlined(false), change_label_with_text(false)
-         
-
 {
        inset.setOwner(this);
        inset.setAutoBreakRows(true);
@@ -50,6 +48,26 @@ InsetCollapsable::InsetCollapsable(bool collapsed)
 }
 
 
+InsetCollapsable::InsetCollapsable(InsetCollapsable const & in, bool same_id)
+       : UpdatableInset(in, same_id), collapsed_(in.collapsed_), 
+         framecolor(in.framecolor), labelfont(in.labelfont),
+         button_length(0), button_top_y(0), button_bottom_y(0),
+         label(in.label), draw_label(label), autocollapse(in.autocollapse), 
+         oldWidth(0), need_update(FULL),
+         inlined(in.inlined), change_label_with_text(in.change_label_with_text)
+{
+       inset.init(&(in.inset), same_id);
+       inset.setOwner(this);
+}
+
+
+Inset * InsetCollapsable::clone(Buffer const &, bool same_id) const
+{
+       return new InsetCollapsable(*const_cast<InsetCollapsable *>(this),
+                                                               same_id);
+}
+
+
 bool InsetCollapsable::insertInset(BufferView * bv, Inset * in)
 {
        if (!insetAllowed(in->lyxCode())) {
@@ -266,16 +284,20 @@ void InsetCollapsable::edit(BufferView * bv, int xp, int yp,
                if (!bv->lockInset(this))
                        return;
                bv->updateInset(this, false);
-               inset.edit(bv, 0, 0, button);
+               inset.edit(bv);
        } else {
                if (!bv->lockInset(this))
                        return;
-               LyXFont font(LyXFont::ALL_SANE);
-               int yy = ascent(bv, font) + yp -
-                   (ascent_collapsed(bv->painter()) +
-                    descent_collapsed(bv->painter()) +
-                    inset.ascent(bv, font));
-               inset.edit(bv, xp, yy, button);
+               if (yp <= button_bottom_y) {
+                       inset.edit(bv);
+               } else {
+                       LyXFont font(LyXFont::ALL_SANE);
+                       int yy = ascent(bv, font) + yp -
+                               (ascent_collapsed(bv->painter()) +
+                                descent_collapsed(bv->painter()) +
+                                inset.ascent(bv, font));
+                       inset.edit(bv, xp, yy, button);
+               }
        }
 }
 
@@ -360,7 +382,7 @@ void InsetCollapsable::insetButtonRelease(BufferView * bv,
                        bv->unlockInset(this);
                        bv->updateInset(this, false);
                }
-       } else if (!collapsed_ && (y > button_top_y)) {
+       } else if (!collapsed_ && (y > button_bottom_y)) {
                LyXFont font(LyXFont::ALL_SANE);
                int yy = ascent(bv, font) + y -
                    (ascent_collapsed(bv->painter()) +
@@ -374,7 +396,7 @@ void InsetCollapsable::insetButtonRelease(BufferView * bv,
 void InsetCollapsable::insetMotionNotify(BufferView * bv,
                                         int x, int y, int state)
 {
-       if (x > button_bottom_y) {
+       if (y > button_bottom_y) {
                LyXFont font(LyXFont::ALL_SANE);
                int yy = ascent(bv, font) + y -
                    (ascent_collapsed(bv->painter()) +
@@ -622,7 +644,7 @@ void InsetCollapsable::setLabel(string const & l, bool flag)
 string InsetCollapsable::get_new_label() const
 {
        string la;
-       Paragraph::size_type const max_length = 10;
+       Paragraph::size_type const max_length = 15;
 
        int n = std::min(max_length, inset.paragraph()->size());
        int i,j;
index 8d6f61a8c80ffedd9d26413927ab91b3632a8240..15e29630f59d86161c9c52398abf8c39315b3055 100644 (file)
@@ -44,6 +44,10 @@ public:
        /// inset is initially collapsed if bool = true
        InsetCollapsable(bool = false);
        ///
+       InsetCollapsable(InsetCollapsable const & in, bool same_id = false);
+       ///
+       Inset * clone(Buffer const &, bool same_id = false) const;
+       
        void read(Buffer const *, LyXLex &);
        ///
        void write(Buffer const *, std::ostream &) const;
index d48bbbdcb4dbcc7a8531608c294020a53c2e65a9..dba48236cdb414d3dbeb170dcc02b122a0d95018 100644 (file)
@@ -180,8 +180,7 @@ string const InsetCommandParams::getCommand() const
 
 InsetCommand::InsetCommand(InsetCommandParams const & p, bool)
        : p_( p.getCmdName(), p.getContents(), p.getOptions() )
-{
-}
+{}
 
 
 void InsetCommand::setParams(InsetCommandParams const & p )
index acd54a065360a3733c7deebe5d589e9053252240..03506d0f62d18fa74eae79a444a69794e232afec 100644 (file)
@@ -20,6 +20,8 @@
 #include "insets/insettext.h"
 #include "support/LOstream.h"
 #include "lyx_gui_misc.h"
+#include "BufferView.h"
+#include "LyXView.h"
 
 using std::ostream;
 
@@ -34,28 +36,39 @@ void InsetERT::init()
 #else
        labelfont.setColor(LColor::latex);
 #endif
-       setAutoCollapse(false);
        setInsetName("ERT");
 }
 
+
 InsetERT::InsetERT() : InsetCollapsable()
 {
        init();
 }
 
 
+#if 0
+InsetERT::InsetERT(InsetERT const & in, bool same_id)
+       : InsetCollapsable(in, same_id)
+{
+}
+#endif
+
+
 InsetERT::InsetERT(string const & contents, bool collapsed)
        : InsetCollapsable(collapsed)
 {
-       init();
-
-       LyXFont const font(LyXFont::ALL_INHERIT);
+       LyXFont font(LyXFont::ALL_INHERIT);
+       font.setFamily(LyXFont::TYPEWRITER_FAMILY);
+       font.setColor(LColor::latex);
        string::const_iterator cit = contents.begin();
        string::const_iterator end = contents.end();
        Paragraph::size_type pos = 0;
        for (; cit != end; ++cit) {
                inset.paragraph()->insertChar(pos++, *cit, font);
        }
+       // the init has to be after the initialization of the paragraph
+       // because of the label settings (draw_label for ert insets).
+       init();
 }
 
 
@@ -66,18 +79,6 @@ void InsetERT::write(Buffer const * buf, ostream & os) const
 }
 
 
-Inset * InsetERT::clone(Buffer const &, bool same_id) const
-{
-       InsetERT * result = new InsetERT;
-       result->inset.init(&inset, same_id);
-       
-       result->collapsed_ = collapsed_;
-       if (same_id)
-               result->id_ = id_;
-       return result;
-}
-
-
 string const InsetERT::editMessage() const 
 {
        return _("Opened ERT Inset");
@@ -107,7 +108,12 @@ void InsetERT::edit(BufferView * bv, int x, int y, unsigned int button)
 #ifndef NO_LATEX
        LyXFont font(LyXFont::ALL_SANE);
        font.setLatex (LyXFont::ON);
+#else
+       LyXFont font(LyXFont::ALL_INHERIT);
+       font.setFamily(LyXFont::TYPEWRITER_FAMILY);
+       font.setColor(LColor::latex);
 #endif
+       inset.setFont(bv, font);
 }
 
 
@@ -158,3 +164,36 @@ int InsetERT::docBook(Buffer const *, std::ostream &) const
 {
        return 0;
 }
+
+
+UpdatableInset::RESULT
+InsetERT::localDispatch(BufferView * bv, kb_action action, string const & arg)
+{
+       UpdatableInset::RESULT result = DISPATCHED_NOUPDATE;
+       
+       switch(action) {
+       case LFUN_LAYOUT:
+               bv->owner()->setLayout(inset.paragraph()->getLayout());
+               break;
+       default:
+               result = InsetCollapsable::localDispatch(bv, action, arg);
+       }
+       switch(action) {
+       case LFUN_BREAKPARAGRAPH:
+       case LFUN_BREAKPARAGRAPHKEEPLAYOUT: {
+#ifndef NO_LATEX
+               LyXFont font(LyXFont::ALL_SANE);
+               font.setLatex (LyXFont::ON);
+#else
+               LyXFont font(LyXFont::ALL_INHERIT);
+               font.setFamily(LyXFont::TYPEWRITER_FAMILY);
+               font.setColor(LColor::latex);
+#endif
+               inset.setFont(bv, font);
+       }
+               break;
+       default:
+               break;
+       }
+       return result;
+}
index 116c2e9075db5364edaad8b16ed70353b9f7e51e..5d633bced2879d2bedb1e247344d6530bcfb62fa 100644 (file)
@@ -32,32 +32,33 @@ public:
        ///
        InsetERT(string const & contents, bool collapsed);
        ///
-       virtual void write(Buffer const * buf, std::ostream & os) const;
+       void write(Buffer const * buf, std::ostream & os) const;
        ///
-       virtual Inset * clone(Buffer const &, bool same_id = false) const;
+       string const editMessage() const;
        ///
-       virtual string const editMessage() const;
+       bool insertInset(BufferView *, Inset *);
        ///
-       virtual bool insertInset(BufferView *, Inset *);
+       bool insetAllowed(Inset::Code) const { return false; }
        ///
-       virtual bool insetAllowed(Inset::Code) const { return false; }
-       ///
-       virtual void setFont(BufferView *, LyXFont const &,
+       void setFont(BufferView *, LyXFont const &,
                             bool toggleall = false, bool selectall = false);
        ///
-       virtual void edit(BufferView *, int, int, unsigned int);
+       void edit(BufferView *, int, int, unsigned int);
        ///
-       virtual void edit(BufferView * bv, bool front = true);
+       void edit(BufferView * bv, bool front = true);
        ///
-       virtual int latex(Buffer const *, std::ostream &, bool fragile,
+       int latex(Buffer const *, std::ostream &, bool fragile,
                          bool free_spc) const;
        ///
-       virtual int ascii(Buffer const *,
+       int ascii(Buffer const *,
                          std::ostream &, int linelen = 0) const;
        ///
-       virtual int linuxdoc(Buffer const *, std::ostream &) const;
+       int linuxdoc(Buffer const *, std::ostream &) const;
+       ///
+       int docBook(Buffer const *, std::ostream &) const;
        ///
-       virtual int docBook(Buffer const *, std::ostream &) const;
+       UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
+                                            string const &);
 private:
        ///
        void init();
index eef703a5f545ac86890497448bce4118698a7eb9..d8596018a4001427d178e30bc5a47b1870b54555 100644 (file)
@@ -107,12 +107,17 @@ InsetFloat::InsetFloat(string const & type)
        font.decSize();
        font.setColor(LColor::collapsable);
        setLabelFont(font);
-       setAutoCollapse(false);
        floatType_ = type;
        setInsetName(type);
 }
 
 
+InsetFloat::InsetFloat(InsetFloat const & in, bool same_id)
+       : InsetCollapsable(in, same_id), floatType_(in.floatType_),
+         floatPlacement_(in.floatPlacement_), wide_(in.wide_)
+{}
+
+
 void InsetFloat::write(Buffer const * buf, ostream & os) const
 {
        os << "Float " // getInsetName()
@@ -173,13 +178,7 @@ void InsetFloat::validate(LaTeXFeatures & features) const
 
 Inset * InsetFloat::clone(Buffer const &, bool same_id) const
 {
-       InsetFloat * result = new InsetFloat(floatType_);
-       result->inset.init(&inset, same_id);
-
-       result->collapsed_ = collapsed_;
-       if (same_id)
-               result->id_ = id_;
-       return result;
+       return new InsetFloat(*const_cast<InsetFloat *>(this), same_id);
 }
 
 
index c92569fe2e017978fa5dcf3114a767d829a35fa1..701b6777901e9dfbffc1863373f492cba25f78b0 100644 (file)
@@ -28,6 +28,8 @@ public:
        ///
        InsetFloat(string const &);
        ///
+       InsetFloat(InsetFloat const &, bool same_id = false);
+       ///
        void write(Buffer const * buf, std::ostream & os) const;
        ///
        void read(Buffer const * buf, LyXLex & lex);
index c188496afe81e60c34d3294eae24974607ac0cd9..94a50917e9f7abcf72833691b76146e6a9e562d6 100644 (file)
@@ -32,18 +32,6 @@ InsetFoot::InsetFoot()
 }
 
 
-Inset * InsetFoot::clone(Buffer const &, bool same_id) const
-{
-       InsetFoot * result = new InsetFoot;
-       result->inset.init(&inset, same_id);
-
-       result->collapsed_ = collapsed_;
-       if (same_id)
-               result->id_ = id_;
-       return result;
-}
-
-
 string const InsetFoot::editMessage() const
 {
        return _("Opened Footnote Inset");
index c3689c2ac1016d47e88d5242cf0b9e37a309eb6a..2a64b918726127adba50fea8d8cc33cb2d9206a8 100644 (file)
@@ -28,8 +28,6 @@ public:
        ///
        InsetFoot();
        ///
-       Inset * clone(Buffer const &, bool same_id = false) const;
-       ///
        Inset::Code lyxCode() const { return Inset::FOOT_CODE; }
        ///
        int latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
index 27ad75489cc4500b753187416df0bd08e12c172c..8c073dc86ab8060e375ab9752757ea167bc27031 100644 (file)
@@ -57,18 +57,6 @@ void InsetList::write(Buffer const * buf, ostream & os) const
 }
 
 
-Inset * InsetList::clone(Buffer const &, bool same_id) const
-{
-       InsetList * result = new InsetList;
-       result->inset.init(&inset, same_id);
-       
-       result->collapsed_ = collapsed_;
-       if (same_id)
-               result->id_ = id_;
-       return result;
-}
-
-
 string const InsetList::editMessage() const
 {
        return _("Opened List Inset");
index d077849b3c8d25fdbc7a75e12073e87f77865335..ea9b1db588596e90d5ae1d8d0443542eaa4a18b4 100644 (file)
@@ -28,8 +28,6 @@ public:
        ///
        void write(Buffer const * buf, std::ostream & os) const;
        ///
-       virtual Inset * clone(Buffer const &, bool same_id = false) const;
-       ///
        Inset::Code lyxCode() const { return Inset::FOOT_CODE; }
        ///
        int latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
index e61f47bb719d722c6b6ca3014c3d6c439f58d8b1..80980c9fd15e7e9c96feebda74c9a2405466a2e9 100644 (file)
@@ -32,18 +32,6 @@ InsetMarginal::InsetMarginal()
 }
 
 
-Inset * InsetMarginal::clone(Buffer const &, bool same_id) const
-{
-       InsetMarginal * result = new InsetMarginal;
-       result->inset.init(&inset, same_id);
-       
-       result->collapsed_ = collapsed_;
-       if (same_id)
-               result->id_ = id_;
-       return result;
-}
-
-
 string const InsetMarginal::editMessage() const
 {
        return _("Opened Marginal Note Inset");
index 741e992a32af6f1ca327c98d49f5012b842c7a8e..09ae022f6e70cf2de77518eb80c1788a7d06743a 100644 (file)
@@ -26,8 +26,6 @@ public:
        ///
        InsetMarginal();
        ///
-       Inset * clone(Buffer const &, bool same_id = false) const;
-       ///
        Inset::Code lyxCode() const { return Inset::MARGIN_CODE; }
        ///
        int latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
index 3c357d1afefe61f270a411fd372599c33b043a32..ef57825e4c1bae44fcc57e93a27ad9755b9eed14 100644 (file)
@@ -76,6 +76,19 @@ InsetMinipage::InsetMinipage()
 }
 
 
+InsetMinipage::InsetMinipage(InsetMinipage const & in, bool same_id)
+       : InsetCollapsable(in, same_id),
+         pos_(in.pos_), inner_pos_(in.inner_pos_),
+         height_(in.height_), width_(in.width_)
+{}
+
+
+Inset * InsetMinipage::clone(Buffer const &, bool same_id) const
+{
+       return new InsetMinipage(*const_cast<InsetMinipage *>(this), same_id);
+}
+
+
 InsetMinipage::~InsetMinipage()
 {
        hideDialog();
@@ -151,47 +164,12 @@ void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
                                   << endl;
                }
        }
-#ifdef WITH_WARNINGS
-#warning Remove me before final 1.2.0 (Jug)
-#warning Can we please remove this as soon as possible? (Lgb)
-#endif
-       // this is only for compatibility to the intermediate format and should
-       // vanish till the final 1.2.0!
-       if (lex.IsOK()) {
-               if (token.empty()) {
-                       lex.next();
-                       token = lex.GetString();
-               }
-               if (token == "widthp") {
-                       lex.next();
-                       // only do this if the width_-string was not already set!
-                       if (width_.empty())
-                               width_ = lex.GetString() + "%";
-                       token = string();
-               }
-       }
        if (!token.empty())
                lex.pushToken(token);
        InsetCollapsable::read(buf, lex);
 }
 
 
-Inset * InsetMinipage::clone(Buffer const &, bool same_id) const
-{
-       InsetMinipage * result = new InsetMinipage;
-       result->inset.init(&inset, same_id);
-       
-       result->collapsed_ = collapsed_;
-       result->pos_ = pos_;
-       result->inner_pos_ = inner_pos_;
-       result->height_ = height_;
-       result->width_ = width_;
-       if (same_id)
-               result->id_ = id_;
-       return result;
-}
-
-
 int InsetMinipage::ascent(BufferView * bv, LyXFont const & font) const
 {
        if (collapsed_)
index 0f89a757e42582632e72972fdc61ca1bcb390932..77aa106e1cf37e6ecd2ed7da8189bd2f55a57e9a 100644 (file)
@@ -41,13 +41,15 @@ public:
        ///
        InsetMinipage();
        ///
+       InsetMinipage(InsetMinipage const &, bool same_id = false);
+       ///
        ~InsetMinipage();
        ///
        void write(Buffer const * buf, std::ostream & os) const;
        ///
        void read(Buffer const * buf, LyXLex & lex);
        ///
-       virtual Inset * clone(Buffer const &, bool same_id = false) const;
+       Inset * clone(Buffer const &, bool same_id = false) const;
        ///
        int ascent(BufferView *, LyXFont const &) const;
        ///
index c8945ee3c8e53b9e92b1fbdc5c9806141026039f..cb62aea19f42c78cc4da249281ddf2655e9f6bbc 100644 (file)
@@ -58,19 +58,7 @@ InsetNote::InsetNote(Buffer const * buf, string const & contents,
        Paragraph * par = inset.paragraph();
        Paragraph::size_type pos = 0;
        buf->insertStringAsLines(par, pos, LyXFont(LyXFont::ALL_INHERIT), 
-                                strip(contents, '\n'));
-}
-
-
-Inset * InsetNote::clone(Buffer const &, bool same_id) const
-{
-       InsetNote * result = new InsetNote;
-       result->inset.init(&inset, same_id);
-
-       result->collapsed_ = collapsed_;
-       if (same_id)
-               result->id_ = id_;
-       return result;
+                                strip(contents, '\n'));
 }
 
 
index a23fbdb2191a29a2fc09719c23ae6cb9f4280b99..f4f103f18cd73d714bb400c1daa056e6d0d79ff3 100644 (file)
@@ -28,8 +28,6 @@ public:
        /// constructor with initial contents
        InsetNote(Buffer const *, string const & contents, bool collapsed);
        ///
-       virtual Inset * clone(Buffer const &, bool) const;
-       ///
        virtual string const editMessage() const;
        ///
        virtual Inset::Code lyxCode() const { return Inset::IGNORE_CODE; }
index 26607fed2a69a40860f6e487555e543e9ab747e7..82c19e806d653b23160d88b06255f230a42153d8 100644 (file)
@@ -141,7 +141,7 @@ InsetTabular::InsetTabular(Buffer const & buf, int rows, int columns)
 
 InsetTabular::InsetTabular(InsetTabular const & tab, Buffer const & buf,
                                                   bool same_id)
-       : buffer(&buf)
+       : UpdatableInset(tab, same_id), buffer(&buf)
 {
        tabular.reset(new LyXTabular(this, *(tab.tabular)));
        the_locking_inset = 0;
@@ -150,8 +150,6 @@ InsetTabular::InsetTabular(InsetTabular const & tab, Buffer const & buf,
        actrow = actcell = 0;
        sel_cell_start = sel_cell_end = 0;
        need_update = INIT;
-       if (same_id)
-               id_ = tab.id_;
 }
 
 
index 29c8cba48d37626d616503b1ce013574ceee49e3..ed602b9b25450ff7f5f759ba20fe213ee67c3677 100644 (file)
@@ -153,15 +153,16 @@ void InsetText::init(InsetText const * ins, bool same_id)
        autoBreakRows = false;
        drawFrame_ = NEVER;
        xpos = 0.0;
+       frame_color = LColor::insetframe;
        if (ins) {
                setParagraphData(ins->par);
                autoBreakRows = ins->autoBreakRows;
                drawFrame_ = ins->drawFrame_;
+               frame_color = ins->frame_color;
                if (same_id)
                        id_ = ins->id_;
        }
        par->setInsetOwner(this);
-       frame_color = LColor::insetframe;
        locked = false;
        old_par = 0;
        last_drawn_width = -1;
@@ -204,8 +205,7 @@ void InsetText::clear()
 
 Inset * InsetText::clone(Buffer const &, bool same_id) const
 {
-       InsetText * t = new InsetText(*this, same_id);
-       return t;
+       return  new InsetText(*this, same_id);
 }
 
 
index 819b401c116cdfe6935fa71afa4453e3daa8a073..de4d615face303227ded968a7d3b04bf39a7a369 100644 (file)
@@ -169,7 +169,7 @@ bool LyXFont::FontBits::operator!=(LyXFont::FontBits const & fb1) const
 
 
 LyXFont::LyXFont(LyXFont::FONT_INIT1)
-       : bits(inherit), lang(default_language)
+       : bits(inherit), lang(ignore_language)
 {}
 
 
index c6b00c4e65df2b6b455a3ef65f8d1c09ba093a93..11de551bbaa0848f75f7ea866d025038c46d7325 100644 (file)
@@ -361,8 +361,8 @@ bool LyXText::isBoundary(Buffer const * buf, Paragraph * par,
 
 
 void LyXText::draw(BufferView * bview, Row const * row,
-                  Paragraph::size_type & vpos,
-                  int offset, float & x, bool cleared)
+                   Paragraph::size_type & vpos,
+                   int offset, float & x, bool cleared)
 {
        Painter & pain = bview->painter();
        
@@ -448,10 +448,10 @@ void LyXText::draw(BufferView * bview, Row const * row,
                ++vpos;
 
                if (lyxrc.mark_foreign_language &&
+                       font.language() != ignore_language &&
                    font.language() != bview->buffer()->params.language) {
                        int const y = offset + row->height() - 1;
-                       pain.line(int(tmpx), y, int(x), y,
-                                 LColor::language);
+                       pain.line(int(tmpx), y, int(x), y, LColor::language);
                }
 
                return;