From fd054e60b18496cef6527be18a99cd2ec3e48346 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Vigna?= Date: Tue, 24 Jul 2001 15:07:09 +0000 Subject: [PATCH] Added copy constructor to inset.h and used it in most insets which permit it. Small fixes. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2323 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 6 +++ src/insets/ChangeLog | 18 +++++++++ src/insets/inset.C | 27 +++++++++++++ src/insets/inset.h | 10 +++-- src/insets/insetbib.C | 3 +- src/insets/insetcollapsable.C | 48 ++++++++++++++++------- src/insets/insetcollapsable.h | 4 ++ src/insets/insetcommand.C | 3 +- src/insets/insetert.C | 71 +++++++++++++++++++++++++++-------- src/insets/insetert.h | 27 ++++++------- src/insets/insetfloat.C | 15 ++++---- src/insets/insetfloat.h | 2 + src/insets/insetfoot.C | 12 ------ src/insets/insetfoot.h | 2 - src/insets/insetlist.C | 12 ------ src/insets/insetlist.h | 2 - src/insets/insetmarginal.C | 12 ------ src/insets/insetmarginal.h | 2 - src/insets/insetminipage.C | 48 +++++++---------------- src/insets/insetminipage.h | 4 +- src/insets/insetnote.C | 14 +------ src/insets/insetnote.h | 2 - src/insets/insettabular.C | 4 +- src/insets/insettext.C | 6 +-- src/lyxfont.C | 2 +- src/text.C | 8 ++-- 26 files changed, 203 insertions(+), 161 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 25d8504757..3bcfd1db51 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2001-07-24 Juergen Vigna + + * text.C (draw): honor the ignore_language. + + * lyxfont.C (LyXFont): set language to ignore_language in FONT_INIT1. + 2001-07-24 Jean-Marc Lasgouttes * lyxfunc.C (getStatus): BREAKLINE does _not_ insert a special diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index c3750d95d5..db6bff8698 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,21 @@ +2001-07-24 Juergen Vigna + + * 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 * insetminipage.C (InsetMinipage): set background color to red :) diff --git a/src/insets/inset.C b/src/insets/inset.C index 581006f0cb..f473f151f4 100644 --- a/src/insets/inset.C +++ b/src/insets/inset.C @@ -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 diff --git a/src/insets/inset.h b/src/insets/inset.h index 550c6cee31..b8b7dda913 100644 --- a/src/insets/inset.h +++ b/src/insets/inset.h @@ -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; diff --git a/src/insets/insetbib.C b/src/insets/insetbib.C index 28836d5053..9f4caab3f9 100644 --- a/src/insets/insetbib.C +++ b/src/insets/insetbib.C @@ -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)); } diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 5739b50801..1910cf36c8 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -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(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; diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index 8d6f61a8c8..15e29630f5 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -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; diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index d48bbbdcb4..dba48236cd 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -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 ) diff --git a/src/insets/insetert.C b/src/insets/insetert.C index acd54a0653..03506d0f62 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -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; +} diff --git a/src/insets/insetert.h b/src/insets/insetert.h index 116c2e9075..5d633bced2 100644 --- a/src/insets/insetert.h +++ b/src/insets/insetert.h @@ -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(); diff --git a/src/insets/insetfloat.C b/src/insets/insetfloat.C index eef703a5f5..d8596018a4 100644 --- a/src/insets/insetfloat.C +++ b/src/insets/insetfloat.C @@ -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(this), same_id); } diff --git a/src/insets/insetfloat.h b/src/insets/insetfloat.h index c92569fe2e..701b677790 100644 --- a/src/insets/insetfloat.h +++ b/src/insets/insetfloat.h @@ -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); diff --git a/src/insets/insetfoot.C b/src/insets/insetfoot.C index c188496afe..94a50917e9 100644 --- a/src/insets/insetfoot.C +++ b/src/insets/insetfoot.C @@ -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"); diff --git a/src/insets/insetfoot.h b/src/insets/insetfoot.h index c3689c2ac1..2a64b91872 100644 --- a/src/insets/insetfoot.h +++ b/src/insets/insetfoot.h @@ -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; diff --git a/src/insets/insetlist.C b/src/insets/insetlist.C index 27ad75489c..8c073dc86a 100644 --- a/src/insets/insetlist.C +++ b/src/insets/insetlist.C @@ -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"); diff --git a/src/insets/insetlist.h b/src/insets/insetlist.h index d077849b3c..ea9b1db588 100644 --- a/src/insets/insetlist.h +++ b/src/insets/insetlist.h @@ -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; diff --git a/src/insets/insetmarginal.C b/src/insets/insetmarginal.C index e61f47bb71..80980c9fd1 100644 --- a/src/insets/insetmarginal.C +++ b/src/insets/insetmarginal.C @@ -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"); diff --git a/src/insets/insetmarginal.h b/src/insets/insetmarginal.h index 741e992a32..09ae022f6e 100644 --- a/src/insets/insetmarginal.h +++ b/src/insets/insetmarginal.h @@ -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; diff --git a/src/insets/insetminipage.C b/src/insets/insetminipage.C index 3c357d1afe..ef57825e4c 100644 --- a/src/insets/insetminipage.C +++ b/src/insets/insetminipage.C @@ -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(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_) diff --git a/src/insets/insetminipage.h b/src/insets/insetminipage.h index 0f89a757e4..77aa106e1c 100644 --- a/src/insets/insetminipage.h +++ b/src/insets/insetminipage.h @@ -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; /// diff --git a/src/insets/insetnote.C b/src/insets/insetnote.C index c8945ee3c8..cb62aea19f 100644 --- a/src/insets/insetnote.C +++ b/src/insets/insetnote.C @@ -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')); } diff --git a/src/insets/insetnote.h b/src/insets/insetnote.h index a23fbdb219..f4f103f18c 100644 --- a/src/insets/insetnote.h +++ b/src/insets/insetnote.h @@ -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; } diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 26607fed2a..82c19e806d 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -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_; } diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 29c8cba48d..ed602b9b25 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -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); } diff --git a/src/lyxfont.C b/src/lyxfont.C index 819b401c11..de4d615fac 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -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) {} diff --git a/src/text.C b/src/text.C index c6b00c4e65..11de551bba 100644 --- a/src/text.C +++ b/src/text.C @@ -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; -- 2.39.5