mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
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
This commit is contained in:
parent
af67fb883b
commit
fd054e60b1
@ -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
|
||||
|
@ -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 :)
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 )
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
///
|
||||
virtual int docBook(Buffer const *, std::ostream &) const;
|
||||
int docBook(Buffer const *, std::ostream &) const;
|
||||
///
|
||||
UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
|
||||
string const &);
|
||||
private:
|
||||
///
|
||||
void init();
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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_)
|
||||
|
@ -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;
|
||||
///
|
||||
|
@ -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'));
|
||||
}
|
||||
|
||||
|
||||
|
@ -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; }
|
||||
|
@ -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_;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user