get rid of same_id from function signatures

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7044 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-05-26 09:13:55 +00:00
parent d1cf27fd88
commit 46e5fe4a67
81 changed files with 844 additions and 252 deletions

View File

@ -1,3 +1,7 @@
2003-05-26 Lars Gullik Bjønnes <larsbj@gullik.net>
* remove same_id from function signatures, adjust.
2003-05-25 Lars Gullik Bjønnes <larsbj@gullik.net>
* undo_funcs.C (createUndo): use the id functions directly, adjust.

View File

@ -1,3 +1,7 @@
2003-05-26 Lars Gullik Bjønnes <larsbj@gullik.net>
* remove same_id from function signatures, adjust
2003-05-24 Lars Gullik Bjønnes <larsbj@gullik.net>
* insettext.C (InsetText): adjust

View File

@ -40,18 +40,27 @@ Inset::Inset()
{}
Inset::Inset(Inset const & in, bool same_id)
Inset::Inset(Inset const & in)
: InsetBase(),
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++;
id_ = inset_id++;
}
// Inset::Inset(Inset const & in, bool same_id)
// : InsetBase(),
// 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::directWrite() const
{
return false;
@ -170,4 +179,3 @@ int Inset::width(BufferView * bv, LyXFont const & font) const
dimension(bv, font, dim);
return dim.width();
}

View File

@ -158,7 +158,9 @@ public:
///
Inset();
///
Inset(Inset const & in, bool same_id = false);
Inset(Inset const & in);
///
//Inset(Inset const & in, bool same_id);
///
virtual void dimension(BufferView *, LyXFont const &, Dimension &) const = 0;
///
@ -209,7 +211,9 @@ public:
}
///
virtual Inset * clone(Buffer const &, bool same_ids = false) const = 0;
virtual Inset * clone(Buffer const &) const = 0;
///
//virtual Inset * clone(Buffer const &, bool same_ids) const = 0;
/// returns true to override begin and end inset in file
virtual bool directWrite() const;

View File

@ -43,7 +43,7 @@ InsetBibitem::~InsetBibitem()
}
Inset * InsetBibitem::clone(Buffer const &, bool) const
Inset * InsetBibitem::clone(Buffer const &) const
{
InsetBibitem * b = new InsetBibitem(params());
b->setCounter(counter);
@ -51,6 +51,14 @@ Inset * InsetBibitem::clone(Buffer const &, bool) const
}
// Inset * InsetBibitem::clone(Buffer const &, bool) const
// {
// InsetBibitem * b = new InsetBibitem(params());
// b->setCounter(counter);
// return b;
// }
dispatch_result InsetBibitem::localDispatch(FuncRequest const & cmd)
{
switch (cmd.action) {

View File

@ -29,7 +29,9 @@ public:
///
~InsetBibitem();
///
Inset * clone(Buffer const &, bool same_id = false) const;
Inset * clone(Buffer const &) const;
///
//Inset * clone(Buffer const &, bool same_id) const;
///
virtual dispatch_result localDispatch(FuncRequest const & cmd);
/** Currently \bibitem is used as a LyX2.x command,

View File

@ -35,11 +35,16 @@ using std::vector;
using std::pair;
InsetBibtex::InsetBibtex(InsetCommandParams const & p, bool)
InsetBibtex::InsetBibtex(InsetCommandParams const & p)
: InsetCommand(p)
{}
// InsetBibtex::InsetBibtex(InsetCommandParams const & p, bool)
// : InsetCommand(p, false)
// {}
InsetBibtex::~InsetBibtex()
{
InsetCommandMailer mailer("bibtex", *this);

View File

@ -23,13 +23,19 @@ class Buffer;
class InsetBibtex : public InsetCommand {
public:
///
InsetBibtex(InsetCommandParams const &, bool same_id = false);
InsetBibtex(InsetCommandParams const &);
///
//InsetBibtex(InsetCommandParams const &, bool same_id);
///
~InsetBibtex();
///
Inset * clone(Buffer const &, bool same_id = false) const {
return new InsetBibtex(params(), same_id);
Inset * clone(Buffer const &) const {
return new InsetBibtex(params());
}
///
//Inset * clone(Buffer const &, bool same_id) const {
// return new InsetBibtex(params(), same_id);
//}
/// small wrapper for the time being
virtual dispatch_result localDispatch(FuncRequest const & cmd);
///

View File

@ -221,11 +221,16 @@ string const getBasicLabel(string const & keyList, string const & after)
} // anon namespace
InsetCitation::InsetCitation(InsetCommandParams const & p, bool)
InsetCitation::InsetCitation(InsetCommandParams const & p)
: InsetCommand(p)
{}
// InsetCitation::InsetCitation(InsetCommandParams const & p, bool)
// : InsetCommand(p, false)
// {}
InsetCitation::~InsetCitation()
{
InsetCommandMailer mailer("citation", *this);

View File

@ -21,14 +21,20 @@
class InsetCitation : public InsetCommand {
public:
///
InsetCitation(InsetCommandParams const &, bool same_id = false);
InsetCitation(InsetCommandParams const &);
///
//InsetCitation(InsetCommandParams const &, bool same_id);
///
~InsetCitation();
///
Inset * clone(Buffer const &, bool same_id = false) const {
return new InsetCitation(params(), same_id);
Inset * clone(Buffer const &) const {
return new InsetCitation(params());
}
///
//Inset * clone(Buffer const &, bool same_id) const {
// return new InsetCitation(params(), same_id);
//}
///
string const getScreenLabel(Buffer const *) const;
///
EDITABLE editable() const { return IS_EDITABLE; }

View File

@ -56,8 +56,8 @@ InsetCollapsable::InsetCollapsable(BufferParams const & bp, bool collapsed)
}
InsetCollapsable::InsetCollapsable(InsetCollapsable const & in, bool same_id)
: UpdatableInset(in, same_id), collapsed_(in.collapsed_),
InsetCollapsable::InsetCollapsable(InsetCollapsable const & in)
: UpdatableInset(in), collapsed_(in.collapsed_),
framecolor(in.framecolor), labelfont(in.labelfont), inset(in.inset),
button_length(0), button_top_y(0), button_bottom_y(0),
label(in.label),
@ -66,11 +66,26 @@ InsetCollapsable::InsetCollapsable(InsetCollapsable const & in, bool same_id)
#endif
oldWidth(0), in_update(false), first_after_edit(false)
{
inset.init(&(in.inset), same_id);
inset.init(&(in.inset));
inset.setOwner(this);
}
// InsetCollapsable::InsetCollapsable(InsetCollapsable const & in, bool same_id)
// : UpdatableInset(in, same_id), collapsed_(in.collapsed_),
// framecolor(in.framecolor), labelfont(in.labelfont), inset(in.inset),
// button_length(0), button_top_y(0), button_bottom_y(0),
// label(in.label),
// #if 0
// autocollapse(in.autocollapse),
// #endif
// oldWidth(0), in_update(false), first_after_edit(false)
// {
// inset.init(&(in.inset), same_id);
// inset.setOwner(this);
// }
bool InsetCollapsable::insertInset(BufferView * bv, Inset * in)
{
if (!insetAllowed(in->lyxCode())) {

View File

@ -37,9 +37,11 @@ public:
///
static int const TEXT_TO_BOTTOM_OFFSET = 2;
/// inset is initially collapsed if bool = true
InsetCollapsable(BufferParams const &, bool = false);
InsetCollapsable(BufferParams const &, bool collapsed = false);
///
InsetCollapsable(InsetCollapsable const & in, bool same_id = false);
InsetCollapsable(InsetCollapsable const & in);
///
//InsetCollapsable(InsetCollapsable const & in, bool same_id);
///
void read(Buffer const *, LyXLex &);
///
@ -156,9 +158,9 @@ public:
void toggleSelection(BufferView * bv, bool kill_selection) {
inset.toggleSelection(bv, kill_selection);
}
void markErased();
bool nextChange(BufferView * bv, lyx::pos_type & length);
///

View File

@ -26,11 +26,16 @@
using std::ostream;
InsetCommand::InsetCommand(InsetCommandParams const & p, bool)
InsetCommand::InsetCommand(InsetCommandParams const & p)
: p_(p.getCmdName(), p.getContents(), p.getOptions())
{}
// InsetCommand::InsetCommand(InsetCommandParams const & p, bool)
// : p_(p.getCmdName(), p.getContents(), p.getOptions())
// {}
void InsetCommand::setParams(InsetCommandParams const & p)
{
p_.setCmdName(p.getCmdName());
@ -115,7 +120,7 @@ void InsetCommandMailer::string2params(string const & in,
if (in.empty())
return;
istringstream data(STRCONV(in));
LyXLex lex(0,0);
lex.setStream(data);

View File

@ -31,7 +31,10 @@ class InsetCommand : public InsetButton, boost::noncopyable {
public:
///
explicit
InsetCommand(InsetCommandParams const &, bool same_id = false);
InsetCommand(InsetCommandParams const &);
///
//explicit
//InsetCommand(InsetCommandParams const &, bool same_id);
///
void write(Buffer const *, std::ostream & os) const
{ p_.write(os); }

View File

@ -35,17 +35,28 @@ InsetEnvironment::InsetEnvironment
}
InsetEnvironment::InsetEnvironment(InsetEnvironment const & in, bool same_id)
: InsetText(in, same_id), layout_(in.layout_)
InsetEnvironment::InsetEnvironment(InsetEnvironment const & in)
: InsetText(in), layout_(in.layout_)
{}
Inset * InsetEnvironment::clone(Buffer const &, bool same_id) const
// InsetEnvironment::InsetEnvironment(InsetEnvironment const & in, bool same_id)
// : InsetText(in, same_id), layout_(in.layout_)
// {}
Inset * InsetEnvironment::clone(Buffer const &) const
{
return new InsetEnvironment(*this, same_id);
return new InsetEnvironment(*this);
}
// Inset * InsetEnvironment::clone(Buffer const &, bool same_id) const
// {
// return new InsetEnvironment(*this, same_id);
// }
void InsetEnvironment::write(Buffer const * buf, ostream & os) const
{
os << "Environment " << getInsetName() << "\n";

View File

@ -20,13 +20,17 @@ public:
///
InsetEnvironment(BufferParams const &, string const & name);
///
InsetEnvironment(InsetEnvironment const &, bool same_id = false);
InsetEnvironment(InsetEnvironment const &);
///
//InsetEnvironment(InsetEnvironment const &, bool same_id);
///
void write(Buffer const * buf, std::ostream & os) const;
///
void read(Buffer const * buf, LyXLex & lex);
///
Inset * clone(Buffer const &, bool same_id = false) const;
Inset * clone(Buffer const &) const;
///
//Inset * clone(Buffer const &, bool same_id) const;
///
Inset::Code lyxCode() const { return Inset::ENVIRONMENT_CODE; }
///

View File

@ -28,11 +28,16 @@
using std::ostream;
InsetError::InsetError(string const & str, bool)
InsetError::InsetError(string const & str)
: contents(str)
{}
// InsetError::InsetError(string const & str, bool)
// : contents(str)
// {}
InsetError::~InsetError()
{
Dialogs::hide("error", this);

View File

@ -24,7 +24,10 @@ class InsetError : public Inset {
public:
///
explicit
InsetError(string const &, bool same_id = false);
InsetError(string const &);
///
//explicit
//InsetError(string const &, bool same_id);
///
~InsetError();
///
@ -53,10 +56,14 @@ public:
///
EDITABLE editable() const { return IS_EDITABLE; }
///
Inset * clone(Buffer const &, bool same_id = false) const {
return new InsetError(contents, same_id);
Inset * clone(Buffer const &) const {
return new InsetError(contents);
}
///
//Inset * clone(Buffer const &, bool same_id) const {
// return new InsetError(contents, same_id);
//}
///
Inset::Code lyxCode() const { return Inset::ERROR_CODE; }
/// We don't want "begin" and "end inset" in lyx-file
bool directWrite() const { return true; };

View File

@ -63,19 +63,32 @@ InsetERT::InsetERT(BufferParams const & bp, bool collapsed)
}
InsetERT::InsetERT(InsetERT const & in, bool same_id)
: InsetCollapsable(in, same_id), status_(in.status_)
InsetERT::InsetERT(InsetERT const & in)
: InsetCollapsable(in), status_(in.status_)
{
init();
}
Inset * InsetERT::clone(Buffer const &, bool same_id) const
// InsetERT::InsetERT(InsetERT const & in, bool same_id)
// : InsetCollapsable(in, same_id), status_(in.status_)
// {
// init();
// }
Inset * InsetERT::clone(Buffer const &) const
{
return new InsetERT(*const_cast<InsetERT *>(this), same_id);
return new InsetERT(*const_cast<InsetERT *>(this));
}
// Inset * InsetERT::clone(Buffer const &, bool same_id) const
// {
// return new InsetERT(*const_cast<InsetERT *>(this), same_id);
// }
InsetERT::InsetERT(BufferParams const & bp,
Language const * l, string const & contents, bool collapsed)
: InsetCollapsable(bp, collapsed)

View File

@ -38,9 +38,13 @@ public:
///
InsetERT(BufferParams const &, bool collapsed = false);
///
InsetERT(InsetERT const &, bool same_id = false);
InsetERT(InsetERT const &);
///
Inset * clone(Buffer const &, bool same_id = false) const;
//InsetERT(InsetERT const &, bool same_id);
///
Inset * clone(Buffer const &) const;
///
//Inset * clone(Buffer const &, bool same_id) const;
///
InsetERT(BufferParams const &,
Language const *, string const & contents, bool collapsed);

View File

@ -223,17 +223,26 @@ void InsetExternal::validate(LaTeXFeatures & features) const
}
Inset * InsetExternal::clone(Buffer const &, bool same_id) const
Inset * InsetExternal::clone(Buffer const &) const
{
InsetExternal * inset = new InsetExternal;
inset->params_ = params_;
inset->view_ = view_;
if (same_id)
inset->id_ = id_;
return inset;
}
// Inset * InsetExternal::clone(Buffer const &, bool same_id) const
// {
// InsetExternal * inset = new InsetExternal;
// inset->params_ = params_;
// inset->view_ = view_;
// if (same_id)
// inset->id_ = id_;
// return inset;
// }
string const InsetExternal::getScreenLabel(Buffer const *) const
{
ExternalTemplate const & et = params_.templ;

View File

@ -37,7 +37,7 @@ public:
///
virtual ~InsetExternal();
///
virtual dispatch_result localDispatch(FuncRequest const & cmd);
virtual dispatch_result localDispatch(FuncRequest const & cmd);
/// what appears in the minibuffer when opening
virtual string const editMessage() const;
///
@ -69,7 +69,9 @@ public:
virtual Inset::Code lyxCode() const { return EXTERNAL_CODE; }
///
virtual Inset * clone(Buffer const &, bool same_id = false) const;
virtual Inset * clone(Buffer const &) const;
///
//virtual Inset * clone(Buffer const &, bool same_id) const;
/// returns the text of the button
virtual string const getScreenLabel(Buffer const *) const;

View File

@ -145,11 +145,16 @@ InsetFloat::InsetFloat(BufferParams const & bp, string const & type)
}
InsetFloat::InsetFloat(InsetFloat const & in, bool same_id)
: InsetCollapsable(in, same_id), params_(in.params_)
InsetFloat::InsetFloat(InsetFloat const & in)
: InsetCollapsable(in), params_(in.params_)
{}
// InsetFloat::InsetFloat(InsetFloat const & in, bool same_id)
// : InsetCollapsable(in, same_id), params_(in.params_)
// {}
InsetFloat::~InsetFloat()
{
InsetFloatMailer mailer(*this);
@ -259,12 +264,18 @@ void InsetFloat::validate(LaTeXFeatures & features) const
}
Inset * InsetFloat::clone(Buffer const &, bool same_id) const
Inset * InsetFloat::clone(Buffer const &) const
{
return new InsetFloat(*const_cast<InsetFloat *>(this), same_id);
return new InsetFloat(*const_cast<InsetFloat *>(this));
}
// Inset * InsetFloat::clone(Buffer const &, bool same_id) const
// {
// return new InsetFloat(*const_cast<InsetFloat *>(this), same_id);
// }
string const InsetFloat::editMessage() const
{
return _("Opened Float Inset");

View File

@ -41,11 +41,13 @@ public:
///
InsetFloat(BufferParams const &, string const &);
///
InsetFloat(InsetFloat const &, bool same_id = false);
InsetFloat(InsetFloat const &);
///
//InsetFloat(InsetFloat const &, bool same_id);
///
~InsetFloat();
///
virtual dispatch_result localDispatch(FuncRequest const & cmd);
virtual dispatch_result localDispatch(FuncRequest const & cmd);
///
void write(Buffer const * buf, std::ostream & os) const;
///
@ -53,7 +55,9 @@ public:
///
void validate(LaTeXFeatures & features) const;
///
Inset * clone(Buffer const &, bool same_id = false) const;
Inset * clone(Buffer const &) const;
///
//Inset * clone(Buffer const &, bool same_id) const;
///
Inset::Code lyxCode() const { return Inset::FLOAT_CODE; }
///
@ -77,7 +81,7 @@ public:
bool showInsetDialog(BufferView *) const;
///
InsetFloatParams const & params() const { return params_; }
private:
///
InsetFloatParams params_;

View File

@ -26,10 +26,14 @@ public:
///
~InsetFloatList();
///
Inset * clone(Buffer const &, bool = false) const {
Inset * clone(Buffer const &) const {
return new InsetFloatList(getCmdName());
}
///
//Inset * clone(Buffer const &, bool = false) const {
// return new InsetFloatList(getCmdName());
//}
///
dispatch_result localDispatch(FuncRequest const & cmd);
///
string const getScreenLabel(Buffer const *) const;

View File

@ -38,20 +38,34 @@ InsetFoot::InsetFoot(BufferParams const & bp)
}
InsetFoot::InsetFoot(InsetFoot const & in, bool same_id)
: InsetFootlike(in, same_id)
InsetFoot::InsetFoot(InsetFoot const & in)
: InsetFootlike(in)
{
setLabel(_("foot"));
setInsetName("Foot");
}
Inset * InsetFoot::clone(Buffer const &, bool same_id) const
// InsetFoot::InsetFoot(InsetFoot const & in, bool same_id)
// : InsetFootlike(in, same_id)
// {
// setLabel(_("foot"));
// setInsetName("Foot");
// }
Inset * InsetFoot::clone(Buffer const &) const
{
return new InsetFoot(*const_cast<InsetFoot *>(this), same_id);
return new InsetFoot(*const_cast<InsetFoot *>(this));
}
// Inset * InsetFoot::clone(Buffer const &, bool same_id) const
// {
// return new InsetFoot(*const_cast<InsetFoot *>(this), same_id);
// }
string const InsetFoot::editMessage() const
{
return _("Opened Footnote Inset");

View File

@ -25,9 +25,13 @@ public:
///
InsetFoot(BufferParams const &);
///
InsetFoot(InsetFoot const &, bool same_id = false);
InsetFoot(InsetFoot const &);
///
Inset * clone(Buffer const &, bool same_id = false) const;
//InsetFoot(InsetFoot const &, bool same_id);
///
Inset * clone(Buffer const &) const;
///
//Inset * clone(Buffer const &, bool same_id) const;
///
Inset::Code lyxCode() const { return Inset::FOOT_CODE; }
///

View File

@ -32,8 +32,8 @@ InsetFootlike::InsetFootlike(BufferParams const & bp)
}
InsetFootlike::InsetFootlike(InsetFootlike const & in, bool same_id)
: InsetCollapsable(in, same_id)
InsetFootlike::InsetFootlike(InsetFootlike const & in)
: InsetCollapsable(in)
{
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
@ -43,6 +43,17 @@ InsetFootlike::InsetFootlike(InsetFootlike const & in, bool same_id)
}
// InsetFootlike::InsetFootlike(InsetFootlike const & in, bool same_id)
// : InsetCollapsable(in, same_id)
// {
// LyXFont font(LyXFont::ALL_SANE);
// font.decSize();
// font.decSize();
// font.setColor(LColor::collapsable);
// setLabelFont(font);
// }
void InsetFootlike::write(Buffer const * buf, ostream & os) const
{
os << getInsetName() << "\n";

View File

@ -22,7 +22,9 @@ public:
///
InsetFootlike(BufferParams const &);
///
InsetFootlike(InsetFootlike const &, bool same_id = false);
InsetFootlike(InsetFootlike const &);
///
//InsetFootlike(InsetFootlike const &, bool same_id);
///
void write(Buffer const * buf, std::ostream & os) const;
///

View File

@ -193,9 +193,8 @@ InsetGraphics::InsetGraphics()
InsetGraphics::InsetGraphics(InsetGraphics const & ig,
string const & filepath,
bool same_id)
: Inset(ig, same_id),
string const & filepath)
: Inset(ig),
graphic_label(uniqueID()),
cache_(new Cache(*this))
{
@ -203,12 +202,29 @@ InsetGraphics::InsetGraphics(InsetGraphics const & ig,
}
Inset * InsetGraphics::clone(Buffer const & buffer, bool same_id) const
// InsetGraphics::InsetGraphics(InsetGraphics const & ig,
// string const & filepath,
// bool same_id)
// : Inset(ig, same_id),
// graphic_label(uniqueID()),
// cache_(new Cache(*this))
// {
// setParams(ig.params(), filepath);
// }
Inset * InsetGraphics::clone(Buffer const & buffer) const
{
return new InsetGraphics(*this, buffer.filePath(), same_id);
return new InsetGraphics(*this, buffer.filePath());
}
// Inset * InsetGraphics::clone(Buffer const & buffer, bool same_id) const
// {
// return new InsetGraphics(*this, buffer.filePath(), same_id);
// }
InsetGraphics::~InsetGraphics()
{
InsetGraphicsMailer mailer(*this);
@ -230,7 +246,7 @@ dispatch_result InsetGraphics::localDispatch(FuncRequest const & cmd)
return DISPATCHED;
}
case LFUN_INSET_DIALOG_UPDATE:
case LFUN_INSET_DIALOG_UPDATE:
InsetGraphicsMailer(*this).updateDialog(cmd.view());
return DISPATCHED;

View File

@ -28,8 +28,10 @@ public:
///
InsetGraphics();
///
InsetGraphics(InsetGraphics const &, string const & filepath,
bool same_id = false);
InsetGraphics(InsetGraphics const &, string const & filepath);
///
//InsetGraphics(InsetGraphics const &, string const & filepath,
// bool same_id);
///
~InsetGraphics();
///
@ -67,7 +69,9 @@ public:
Inset::Code lyxCode() const { return Inset::GRAPHICS_CODE; }
///
virtual Inset * clone(Buffer const &, bool same_id = false) const;
virtual Inset * clone(Buffer const &) const;
///
//virtual Inset * clone(Buffer const &, bool same_id) const;
/** Set the inset parameters, used by the GUIndependent dialog.
Return true of new params are different from what was so far.

View File

@ -20,10 +20,14 @@ public:
///
InsetHFill();
///
virtual Inset * clone(Buffer const &, bool = false) const {
virtual Inset * clone(Buffer const &) const {
return new InsetHFill();
}
///
//virtual Inset * clone(Buffer const &, bool /*same_id*/) const {
// return new InsetHFill();
//}
///
string const getScreenLabel(Buffer const *) const { return getContents(); }
///
Inset::Code lyxCode() const { return Inset::HFILL_CODE; }

View File

@ -126,7 +126,7 @@ dispatch_result InsetInclude::localDispatch(FuncRequest const & cmd)
return DISPATCHED;
}
case LFUN_INSET_DIALOG_UPDATE:
case LFUN_INSET_DIALOG_UPDATE:
InsetIncludeMailer(*this).updateDialog(cmd.view());
return DISPATCHED;
@ -191,7 +191,7 @@ void InsetInclude::set(Params const & p)
}
Inset * InsetInclude::clone(Buffer const & buffer, bool) const
Inset * InsetInclude::clone(Buffer const & buffer) const
{
Params p(params_);
p.masterFilename_ = buffer.fileName();
@ -200,6 +200,15 @@ Inset * InsetInclude::clone(Buffer const & buffer, bool) const
}
// Inset * InsetInclude::clone(Buffer const & buffer, bool) const
// {
// Params p(params_);
// p.masterFilename_ = buffer.fileName();
// return new InsetInclude(p);
// }
void InsetInclude::write(Buffer const *, ostream & os) const
{
os << "Include " << params_.cparams.getCommand() << '\n'
@ -618,7 +627,7 @@ void InsetIncludeMailer::string2params(string const & in,
if (in.empty())
return;
istringstream data(STRCONV(in));
LyXLex lex(0,0);
lex.setStream(data);

View File

@ -57,7 +57,7 @@ public:
~InsetInclude();
///
virtual dispatch_result localDispatch(FuncRequest const & cmd);
virtual dispatch_result localDispatch(FuncRequest const & cmd);
/// Override these InsetButton methods if Previewing
int ascent(BufferView *, LyXFont const &) const;
@ -74,7 +74,9 @@ public:
void set(Params const & params);
///
virtual Inset * clone(Buffer const &, bool same_id = false) const;
virtual Inset * clone(Buffer const &) const;
///
//virtual Inset * clone(Buffer const &, bool same_id) const;
///
Inset::Code lyxCode() const { return Inset::INCLUDE_CODE; }
/// This returns the list of labels on the child buffer

View File

@ -21,11 +21,16 @@
using std::ostream;
InsetIndex::InsetIndex(InsetCommandParams const & p, bool)
InsetIndex::InsetIndex(InsetCommandParams const & p)
: InsetCommand(p)
{}
// InsetIndex::InsetIndex(InsetCommandParams const & p, bool)
// : InsetCommand(p, false)
// {}
InsetIndex::~InsetIndex()
{
InsetCommandMailer mailer("index", *this);
@ -45,7 +50,7 @@ dispatch_result InsetIndex::localDispatch(FuncRequest const & cmd)
case LFUN_INSET_EDIT:
InsetCommandMailer("index", *this).showDialog(cmd.view());
return DISPATCHED;
default:
return UNDISPATCHED;
}
@ -67,11 +72,16 @@ Inset::Code InsetIndex::lyxCode() const
InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p, bool)
InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
: InsetCommand(p)
{}
// InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p, bool)
// : InsetCommand(p, false)
// {}
InsetPrintIndex::~InsetPrintIndex()
{}

View File

@ -22,14 +22,20 @@ struct LaTeXFeatures;
class InsetIndex : public InsetCommand {
public:
///
InsetIndex(InsetCommandParams const &, bool same_id = false);
InsetIndex(InsetCommandParams const &);
///
//InsetIndex(InsetCommandParams const &, bool same_id);
///
~InsetIndex();
///
virtual Inset * clone(Buffer const &, bool same_id = false) const {
return new InsetIndex(params(), same_id);
virtual Inset * clone(Buffer const &) const {
return new InsetIndex(params());
}
///
//virtual Inset * clone(Buffer const &, bool same_id) const {
// return new InsetIndex(params(), same_id);
//}
///
dispatch_result localDispatch(FuncRequest const & cmd);
///
string const getScreenLabel(Buffer const *) const;
@ -45,14 +51,20 @@ public:
class InsetPrintIndex : public InsetCommand {
public:
///
InsetPrintIndex(InsetCommandParams const &, bool same_id = false);
InsetPrintIndex(InsetCommandParams const &);
///
//InsetPrintIndex(InsetCommandParams const &, bool same_id);
///
~InsetPrintIndex();
///
Inset * clone(Buffer const &, bool same_id = false) const {
return new InsetPrintIndex(params(), same_id);
Inset * clone(Buffer const &) const {
return new InsetPrintIndex(params());
}
///
//Inset * clone(Buffer const &, bool same_id) const {
// return new InsetPrintIndex(params(), same_id);
//}
///
//dispatch_result localDispatch(FuncRequest const & cmd);
/// Updates needed features for this inset.
void validate(LaTeXFeatures & features) const;

View File

@ -27,11 +27,16 @@ using std::vector;
using std::pair;
InsetLabel::InsetLabel(InsetCommandParams const & p, bool)
InsetLabel::InsetLabel(InsetCommandParams const & p)
: InsetCommand(p)
{}
// InsetLabel::InsetLabel(InsetCommandParams const & p, bool)
// : InsetCommand(p, false)
// {}
InsetLabel::~InsetLabel()
{
InsetCommandMailer mailer("label", *this);

View File

@ -18,14 +18,20 @@
class InsetLabel : public InsetCommand {
public:
///
InsetLabel(InsetCommandParams const &, bool same_id = false);
InsetLabel(InsetCommandParams const &);
///
//InsetLabel(InsetCommandParams const &, bool same_id);
///
~InsetLabel();
///
virtual Inset * clone(Buffer const &, bool same_id = false) const {
return new InsetLabel(params(), same_id);
virtual Inset * clone(Buffer const &) const {
return new InsetLabel(params());
}
///
//virtual Inset * clone(Buffer const &, bool same_id) const {
// return new InsetLabel(params(), same_id);
//}
///
virtual dispatch_result localDispatch(FuncRequest const & cmd);
///
string const getScreenLabel(Buffer const *) const { return getContents(); }

View File

@ -656,12 +656,18 @@ bool InsetLatexAccent::directWrite() const
}
Inset * InsetLatexAccent::clone(Buffer const &, bool) const
Inset * InsetLatexAccent::clone(Buffer const &) const
{
return new InsetLatexAccent(contents);
}
// Inset * InsetLatexAccent::clone(Buffer const &, bool) const
// {
// return new InsetLatexAccent(contents);
// }
Inset::Code InsetLatexAccent::lyxCode() const
{
return Inset::ACCENT_CODE;

View File

@ -60,7 +60,9 @@ public:
///
bool directWrite() const;
///
virtual Inset * clone(Buffer const &, bool same_id = false) const;
virtual Inset * clone(Buffer const &) const;
///
//virtual Inset * clone(Buffer const &, bool same_id) const;
///
Inset::Code lyxCode()const;
///

View File

@ -33,20 +33,34 @@ InsetMarginal::InsetMarginal(BufferParams const & bp)
}
InsetMarginal::InsetMarginal(InsetMarginal const & in, bool same_id)
: InsetFootlike(in, same_id)
InsetMarginal::InsetMarginal(InsetMarginal const & in)
: InsetFootlike(in)
{
setLabel(_("margin"));
setInsetName("Marginal");
}
Inset * InsetMarginal::clone(Buffer const &, bool same_id) const
// InsetMarginal::InsetMarginal(InsetMarginal const & in, bool same_id)
// : InsetFootlike(in, same_id)
// {
// setLabel(_("margin"));
// setInsetName("Marginal");
// }
Inset * InsetMarginal::clone(Buffer const &) const
{
return new InsetMarginal(*const_cast<InsetMarginal *>(this), same_id);
return new InsetMarginal(*const_cast<InsetMarginal *>(this));
}
// Inset * InsetMarginal::clone(Buffer const &, bool same_id) const
// {
// return new InsetMarginal(*const_cast<InsetMarginal *>(this), same_id);
// }
string const InsetMarginal::editMessage() const
{
return _("Opened Marginal Note Inset");

View File

@ -24,9 +24,13 @@ public:
///
InsetMarginal(BufferParams const &);
///
InsetMarginal(InsetMarginal const &, bool same_id = false);
InsetMarginal(InsetMarginal const &);
///
Inset * clone(Buffer const &, bool same_id = false) const;
//InsetMarginal(InsetMarginal const &, bool same_id);
///
Inset * clone(Buffer const &) const;
///
//Inset * clone(Buffer const &, bool same_id) const;
///
Inset::Code lyxCode() const { return Inset::MARGIN_CODE; }
///

View File

@ -88,17 +88,28 @@ InsetMinipage::InsetMinipage(BufferParams const & bp)
}
InsetMinipage::InsetMinipage(InsetMinipage const & in, bool same_id)
: InsetCollapsable(in, same_id), params_(in.params_)
InsetMinipage::InsetMinipage(InsetMinipage const & in)
: InsetCollapsable(in), params_(in.params_)
{}
Inset * InsetMinipage::clone(Buffer const &, bool same_id) const
// InsetMinipage::InsetMinipage(InsetMinipage const & in, bool same_id)
// : InsetCollapsable(in, same_id), params_(in.params_)
// {}
Inset * InsetMinipage::clone(Buffer const &) const
{
return new InsetMinipage(*const_cast<InsetMinipage *>(this), same_id);
return new InsetMinipage(*const_cast<InsetMinipage *>(this));
}
// Inset * InsetMinipage::clone(Buffer const &, bool same_id) const
// {
// return new InsetMinipage(*const_cast<InsetMinipage *>(this), same_id);
// }
InsetMinipage::~InsetMinipage()
{
InsetMinipageMailer mailer(*this);
@ -127,7 +138,7 @@ dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
return DISPATCHED;
}
case LFUN_INSET_DIALOG_UPDATE:
case LFUN_INSET_DIALOG_UPDATE:
InsetMinipageMailer(*this).updateDialog(cmd.view());
return DISPATCHED;
@ -349,7 +360,7 @@ void InsetMinipageMailer::string2params(string const & in,
if (in.empty())
return;
istringstream data(STRCONV(in));
LyXLex lex(0,0);
lex.setStream(data);

View File

@ -56,17 +56,21 @@ public:
///
InsetMinipage(BufferParams const &);
///
InsetMinipage(InsetMinipage const &, bool same_id = false);
InsetMinipage(InsetMinipage const &);
///
//InsetMinipage(InsetMinipage const &, bool same_id);
///
~InsetMinipage();
///
virtual dispatch_result localDispatch(FuncRequest const & cmd);
virtual dispatch_result localDispatch(FuncRequest const & cmd);
///
void write(Buffer const * buf, std::ostream & os) const;
///
void read(Buffer const * buf, LyXLex & lex);
///
Inset * clone(Buffer const &, bool same_id = false) const;
Inset * clone(Buffer const &) const;
///
//Inset * clone(Buffer const &, bool same_id) const;
///
void dimension(BufferView *, LyXFont const &, Dimension &) const;
///

View File

@ -20,10 +20,15 @@ public:
InsetNewline() {}
virtual Inset * clone(Buffer const &, bool = false) const {
virtual Inset * clone(Buffer const &) const {
return new InsetNewline;
}
//virtual Inset * clone(Buffer const &, bool same_id) const {
// return new InsetNewline;
//}
Inset::Code lyxCode() const { return Inset::NEWLINE_CODE; }
void dimension(BufferView *, LyXFont const &, Dimension &) const;

View File

@ -46,19 +46,32 @@ InsetNote::InsetNote(BufferParams const & bp)
}
InsetNote::InsetNote(InsetNote const & in, bool same_id)
: InsetCollapsable(in, same_id)
InsetNote::InsetNote(InsetNote const & in)
: InsetCollapsable(in)
{
init();
}
Inset * InsetNote::clone(Buffer const &, bool same_id) const
// InsetNote::InsetNote(InsetNote const & in, bool same_id)
// : InsetCollapsable(in, same_id)
// {
// init();
// }
Inset * InsetNote::clone(Buffer const &) const
{
return new InsetNote(*const_cast<InsetNote *>(this), same_id);
return new InsetNote(*const_cast<InsetNote *>(this));
}
// Inset * InsetNote::clone(Buffer const &, bool same_id) const
// {
// return new InsetNote(*const_cast<InsetNote *>(this), same_id);
// }
string const InsetNote::editMessage() const
{
return _("Opened Note Inset");

View File

@ -23,9 +23,13 @@ public:
///
InsetNote(BufferParams const &);
///
InsetNote(InsetNote const &, bool same_id = false);
InsetNote(InsetNote const &);
///
Inset * clone(Buffer const &, bool same_id = false) const;
//InsetNote(InsetNote const &, bool same_id);
///
Inset * clone(Buffer const &) const;
///
//Inset * clone(Buffer const &, bool same_id) const;
///
string const editMessage() const;
///

View File

@ -37,8 +37,8 @@ InsetOptArg::InsetOptArg(BufferParams const & ins)
}
InsetOptArg::InsetOptArg(InsetOptArg const & in, bool same_id)
: InsetCollapsable(in, same_id)
InsetOptArg::InsetOptArg(InsetOptArg const & in)
: InsetCollapsable(in)
{
LyXFont font(LyXFont::ALL_SANE);
font.setColor(LColor::collapsable);
@ -47,12 +47,28 @@ InsetOptArg::InsetOptArg(InsetOptArg const & in, bool same_id)
}
Inset * InsetOptArg::clone(Buffer const &, bool same_id) const
// InsetOptArg::InsetOptArg(InsetOptArg const & in, bool same_id)
// : InsetCollapsable(in, same_id)
// {
// LyXFont font(LyXFont::ALL_SANE);
// font.setColor(LColor::collapsable);
// setLabelFont(font);
// setLabel(_("opt"));
// }
Inset * InsetOptArg::clone(Buffer const &) const
{
return new InsetOptArg(*this, same_id);
return new InsetOptArg(*this);
}
// Inset * InsetOptArg::clone(Buffer const &, bool same_id) const
// {
// return new InsetOptArg(*this, same_id);
// }
string const InsetOptArg::editMessage() const
{
return _("Opened Optional Argument Inset");

View File

@ -25,10 +25,13 @@ class InsetOptArg : public InsetCollapsable {
public:
InsetOptArg(BufferParams const &);
InsetOptArg(InsetOptArg const &, bool same_id = false);
InsetOptArg(InsetOptArg const &);
//InsetOptArg(InsetOptArg const &, bool same_id);
/// make a duplicate of this inset
Inset * clone(Buffer const &, bool same_id = false) const;
Inset * clone(Buffer const &) const;
/// make a duplicate of this inset
//Inset * clone(Buffer const &, bool same_id) const;
/// this inset is editable
EDITABLE editable() const { return IS_EDITABLE; }

View File

@ -27,7 +27,7 @@
using std::ostream;
InsetParent::InsetParent(InsetCommandParams const & p, Buffer const & bf, bool)
InsetParent::InsetParent(InsetCommandParams const & p, Buffer const & bf)
: InsetCommand(p)
{
string const fn = p.getContents();
@ -35,6 +35,14 @@ InsetParent::InsetParent(InsetCommandParams const & p, Buffer const & bf, bool)
}
// InsetParent::InsetParent(InsetCommandParams const & p, Buffer const & bf, bool)
// : InsetCommand(p, false)
// {
// string const fn = p.getContents();
// setContents(MakeAbsPath(fn, bf.filePath()));
// }
string const InsetParent::getScreenLabel(Buffer const *) const
{
return bformat(_("Parent: %1$s"), getContents());

View File

@ -25,12 +25,18 @@ class Buffer;
class InsetParent : public InsetCommand {
public:
///
InsetParent(InsetCommandParams const &, Buffer const &, bool same_id = false);
InsetParent(InsetCommandParams const &, Buffer const &);
///
virtual Inset * clone(Buffer const & buffer, bool same_id = false) const {
return new InsetParent(params(), buffer, same_id);
//InsetParent(InsetCommandParams const &, Buffer const &, bool same_id);
///
virtual Inset * clone(Buffer const & buffer) const {
return new InsetParent(params(), buffer);
}
///
//virtual Inset * clone(Buffer const & buffer, bool same_id) const {
// return new InsetParent(params(), buffer, same_id);
//}
///
dispatch_result localDispatch(FuncRequest const & cmd);
///
string const getScreenLabel(Buffer const *) const;

View File

@ -335,7 +335,7 @@ void InsetQuotes::validate(LaTeXFeatures & features) const
&& lyxrc.fontenc != "T1") {
if (times_ == SingleQ)
switch (type) {
case ',': features.require("quotesinglbase"); break;
case ',': features.require("quotesinglbase"); break;
case '<': features.require("guilsinglleft"); break;
case '>': features.require("guilsinglright"); break;
default: break;
@ -351,12 +351,18 @@ void InsetQuotes::validate(LaTeXFeatures & features) const
}
Inset * InsetQuotes::clone(Buffer const &, bool) const
Inset * InsetQuotes::clone(Buffer const &) const
{
return new InsetQuotes(language_, side_, times_);
return new InsetQuotes(language_, side_, times_);
}
// Inset * InsetQuotes::clone(Buffer const &, bool) const
// {
// return new InsetQuotes(language_, side_, times_);
// }
Inset::Code InsetQuotes::lyxCode() const
{
return Inset::QUOTE_CODE;

View File

@ -68,7 +68,9 @@ public:
/// Create the right quote inset after character c
InsetQuotes(char c, BufferParams const & params);
///
Inset * clone(Buffer const &, bool same_id = false) const;
Inset * clone(Buffer const &) const;
///
//Inset * clone(Buffer const &, bool same_id) const;
///
void dimension(BufferView *, LyXFont const &, Dimension &) const;

View File

@ -23,11 +23,16 @@
using std::ostream;
InsetRef::InsetRef(InsetCommandParams const & p, Buffer const & buf, bool)
InsetRef::InsetRef(InsetCommandParams const & p, Buffer const & buf)
: InsetCommand(p), isLatex(buf.isLatex())
{}
// InsetRef::InsetRef(InsetCommandParams const & p, Buffer const & buf, bool)
// : InsetCommand(p, false), isLatex(buf.isLatex())
// {}
InsetRef::~InsetRef()
{
InsetCommandMailer("ref", *this).hideDialog();
@ -37,7 +42,7 @@ InsetRef::~InsetRef()
dispatch_result InsetRef::localDispatch(FuncRequest const & cmd)
{
switch (cmd.action) {
case LFUN_INSET_EDIT:
case LFUN_INSET_EDIT:
// Eventually trigger dialog with button 3 not 1
if (cmd.button() == mouse_button::button3)
cmd.view()->owner()->
@ -45,7 +50,7 @@ dispatch_result InsetRef::localDispatch(FuncRequest const & cmd)
if (cmd.button() == mouse_button::button1)
InsetCommandMailer("ref", *this).showDialog(cmd.view());
return DISPATCHED;
default:
return UNDISPATCHED;
}

View File

@ -36,14 +36,20 @@ public:
static string const & getName(int type);
///
InsetRef(InsetCommandParams const &, Buffer const &, bool same_id = false);
InsetRef(InsetCommandParams const &, Buffer const &);
///
//InsetRef(InsetCommandParams const &, Buffer const &, bool same_id);
///
~InsetRef();
///
virtual Inset * clone(Buffer const & buffer, bool same_id = false) const {
return new InsetRef(params(), buffer, same_id);
virtual Inset * clone(Buffer const & buffer) const {
return new InsetRef(params(), buffer);
}
///
//virtual Inset * clone(Buffer const & buffer, bool same_id) const {
// return new InsetRef(params(), buffer, same_id);
//}
///
dispatch_result localDispatch(FuncRequest const & cmd);
///
string const getScreenLabel(Buffer const *) const;

View File

@ -250,12 +250,18 @@ int InsetSpace::docbook(Buffer const *, ostream & os, bool) const
}
Inset * InsetSpace::clone(Buffer const &, bool) const
Inset * InsetSpace::clone(Buffer const &) const
{
return new InsetSpace(kind_);
}
// Inset * InsetSpace::clone(Buffer const &, bool) const
// {
// return new InsetSpace(kind_);
// }
bool InsetSpace::isChar() const
{
return true;

View File

@ -70,7 +70,9 @@ public:
///
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
///
virtual Inset * clone(Buffer const &, bool same_id = false) const;
virtual Inset * clone(Buffer const &) const;
///
//virtual Inset * clone(Buffer const &, bool same_id) const;
///
Inset::Code lyxCode() const { return Inset::SPACE_CODE; }
/// We don't need \begin_inset and \end_inset

View File

@ -244,12 +244,18 @@ int InsetSpecialChar::docbook(Buffer const *, ostream & os, bool) const
}
Inset * InsetSpecialChar::clone(Buffer const &, bool) const
Inset * InsetSpecialChar::clone(Buffer const &) const
{
return new InsetSpecialChar(kind_);
}
// Inset * InsetSpecialChar::clone(Buffer const &, bool) const
// {
// return new InsetSpecialChar(kind_);
// }
void InsetSpecialChar::validate(LaTeXFeatures & features) const
{
if (kind_ == MENU_SEPARATOR) {

View File

@ -63,7 +63,9 @@ public:
///
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
///
virtual Inset * clone(Buffer const &, bool same_id = false) const;
virtual Inset * clone(Buffer const &) const;
///
//virtual Inset * clone(Buffer const &, bool same_id) const;
///
Inset::Code lyxCode() const { return Inset::SPECIALCHAR_CODE; }
/// We don't need \begin_inset and \end_inset

View File

@ -174,12 +174,11 @@ InsetTabular::InsetTabular(Buffer const & buf, int rows, int columns)
}
InsetTabular::InsetTabular(InsetTabular const & tab, Buffer const & buf,
bool same_id)
: UpdatableInset(tab, same_id), buffer(&buf)
InsetTabular::InsetTabular(InsetTabular const & tab, Buffer const & buf)
: UpdatableInset(tab), buffer(&buf)
{
tabular.reset(new LyXTabular(buf.params,
this, *(tab.tabular), same_id));
this, *(tab.tabular)));
the_locking_inset = 0;
old_locking_inset = 0;
locked = false;
@ -194,6 +193,26 @@ InsetTabular::InsetTabular(InsetTabular const & tab, Buffer const & buf,
}
// InsetTabular::InsetTabular(InsetTabular const & tab, Buffer const & buf,
// bool same_id)
// : UpdatableInset(tab, same_id), buffer(&buf)
// {
// tabular.reset(new LyXTabular(buf.params,
// this, *(tab.tabular), same_id));
// the_locking_inset = 0;
// old_locking_inset = 0;
// locked = false;
// oldcell = -1;
// actrow = actcell = 0;
// clearSelection();
// need_update = INIT;
// in_update = false;
// in_reset_pos = 0;
// inset_x = 0;
// inset_y = 0;
// }
InsetTabular::~InsetTabular()
{
InsetTabularMailer mailer(*this);
@ -201,12 +220,18 @@ InsetTabular::~InsetTabular()
}
Inset * InsetTabular::clone(Buffer const & buf, bool same_id) const
Inset * InsetTabular::clone(Buffer const & buf) const
{
return new InsetTabular(*this, buf, same_id);
return new InsetTabular(*this, buf);
}
// Inset * InsetTabular::clone(Buffer const & buf, bool same_id) const
// {
// return new InsetTabular(*this, buf, same_id);
// }
BufferView * InsetTabular::view() const
{
return buffer->getUser();

View File

@ -76,11 +76,15 @@ public:
///
InsetTabular(Buffer const &, int rows = 1, int columns = 1);
///
InsetTabular(InsetTabular const &, Buffer const &, bool same_id = false);
InsetTabular(InsetTabular const &, Buffer const &);
///
//InsetTabular(InsetTabular const &, Buffer const &, bool same_id);
///
~InsetTabular();
///
Inset * clone(Buffer const &, bool same_id = false) const;
Inset * clone(Buffer const &) const;
///
//Inset * clone(Buffer const &, bool same_id) const;
///
void read(Buffer const *, LyXLex &);
///

View File

@ -143,18 +143,26 @@ InsetText::InsetText(BufferParams const & bp)
paragraphs.begin()->layout(bp.getLyXTextClass().defaultLayout());
if (bp.tracking_changes)
paragraphs.begin()->trackChanges();
init();
init(0);
}
InsetText::InsetText(InsetText const & in, bool same_id)
: UpdatableInset(in, same_id), lt(0), in_update(false), do_resize(0),
InsetText::InsetText(InsetText const & in)
: UpdatableInset(in), lt(0), in_update(false), do_resize(0),
do_reinit(false)
{
init(&in, same_id);
init(&in);
}
// InsetText::InsetText(InsetText const & in, bool same_id)
// : UpdatableInset(in, same_id), lt(0), in_update(false), do_resize(0),
// do_reinit(false)
// {
// init(&in, same_id);
// }
InsetText & InsetText::operator=(InsetText const & it)
{
init(&it);
@ -162,15 +170,13 @@ InsetText & InsetText::operator=(InsetText const & it)
}
void InsetText::init(InsetText const * ins, bool same_id)
void InsetText::init(InsetText const * ins)
{
if (ins) {
setParagraphData(ins->paragraphs, same_id);
setParagraphData(ins->paragraphs);
autoBreakRows = ins->autoBreakRows;
drawFrame_ = ins->drawFrame_;
frame_color = ins->frame_color;
if (same_id)
id_ = ins->id_;
} else {
for_each(paragraphs.begin(), paragraphs.end(),
boost::bind(&Paragraph::setInsetOwner, _1, this));
@ -195,6 +201,39 @@ void InsetText::init(InsetText const * ins, bool same_id)
}
// void InsetText::init(InsetText const * ins, bool same_id)
// {
// if (ins) {
// setParagraphData(ins->paragraphs, same_id);
// autoBreakRows = ins->autoBreakRows;
// drawFrame_ = ins->drawFrame_;
// frame_color = ins->frame_color;
// if (same_id)
// id_ = ins->id_;
// } else {
// for_each(paragraphs.begin(), paragraphs.end(),
// boost::bind(&Paragraph::setInsetOwner, _1, this));
// the_locking_inset = 0;
// drawFrame_ = NEVER;
// frame_color = LColor::insetframe;
// autoBreakRows = false;
// }
// top_y = 0;
// old_max_width = 0;
// no_selection = true;
// need_update = FULL;
// drawTextXOffset = 0;
// drawTextYOffset = 0;
// locked = false;
// old_par = 0;
// last_drawn_width = -1;
// cached_bview = 0;
// sstate.lpar = 0;
// in_insetAllowed = false;
// }
InsetText::~InsetText()
{
paragraphs.clear();
@ -226,12 +265,18 @@ void InsetText::clear(bool just_mark_erased)
}
Inset * InsetText::clone(Buffer const &, bool same_id) const
Inset * InsetText::clone(Buffer const &) const
{
return new InsetText(*this, same_id);
return new InsetText(*this);
}
// Inset * InsetText::clone(Buffer const &, bool same_id) const
// {
// return new InsetText(*this, same_id);
// }
void InsetText::write(Buffer const * buf, ostream & os) const
{
os << "Text\n";
@ -1940,39 +1985,22 @@ int InsetText::getMaxWidth(BufferView * bv, UpdatableInset const * inset) const
}
void InsetText::setParagraphData(ParagraphList const & plist, bool same_id)
void InsetText::setParagraphData(ParagraphList const & plist)
{
// we have to unlock any locked inset otherwise we're in troubles
the_locking_inset = 0;
#warning CHECK not adhering to same_id here might wreck havoc (Lgb)
// But it it makes no difference that is a lot better.
if (same_id) {
lyxerr << "Same_id called with 'true'" << endl;
lyxerr << "Please report this to the list." << endl;
paragraphs.clear();
ParagraphList::iterator it = plist.begin();
ParagraphList::iterator end = plist.end();
for (; it != end; ++it) {
int const id = it->id();
paragraphs.push_back(*it);
Paragraph & tmp = paragraphs.back();
tmp.setInsetOwner(this);
tmp.id(id);
}
} else {
#warning FIXME.
// See if this can be simplified when std::list is in effect.
paragraphs.clear();
// See if this can be simplified when std::list is in effect.
paragraphs.clear();
ParagraphList::iterator it = plist.begin();
ParagraphList::iterator end = plist.end();
for (; it != end; ++it) {
paragraphs.push_back(*it);
Paragraph & tmp = paragraphs.back();
tmp.setInsetOwner(this);
}
ParagraphList::iterator it = plist.begin();
ParagraphList::iterator end = plist.end();
for (; it != end; ++it) {
paragraphs.push_back(*it);
Paragraph & tmp = paragraphs.back();
tmp.setInsetOwner(this);
}
reinitLyXText();
@ -1980,6 +2008,46 @@ void InsetText::setParagraphData(ParagraphList const & plist, bool same_id)
}
// void InsetText::setParagraphData(ParagraphList const & plist, bool same_id)
// {
// // we have to unlock any locked inset otherwise we're in troubles
// the_locking_inset = 0;
// #warning CHECK not adhering to same_id here might wreck havoc (Lgb)
// // But it it makes no difference that is a lot better.
// if (same_id) {
// lyxerr << "Same_id called with 'true'" << endl;
// lyxerr << "Please report this to the list." << endl;
// paragraphs.clear();
// ParagraphList::iterator it = plist.begin();
// ParagraphList::iterator end = plist.end();
// for (; it != end; ++it) {
// int const id = it->id();
// paragraphs.push_back(*it);
// Paragraph & tmp = paragraphs.back();
// tmp.setInsetOwner(this);
// tmp.id(id);
// }
// } else {
// #warning FIXME.
// // See if this can be simplified when std::list is in effect.
// paragraphs.clear();
// ParagraphList::iterator it = plist.begin();
// ParagraphList::iterator end = plist.end();
// for (; it != end; ++it) {
// paragraphs.push_back(*it);
// Paragraph & tmp = paragraphs.back();
// tmp.setInsetOwner(this);
// }
// }
// reinitLyXText();
// need_update = INIT;
// }
void InsetText::markNew(bool track_changes)
{
ParagraphList::iterator pit = paragraphs.begin();

View File

@ -73,11 +73,16 @@ public:
InsetText(BufferParams const &);
///
explicit
InsetText(InsetText const &, bool same_id = false);
InsetText(InsetText const &);
///
//explicit
//InsetText(InsetText const &, bool same_id);
///
~InsetText();
///
Inset * clone(Buffer const &, bool same_id = false) const;
Inset * clone(Buffer const &) const;
///
//Inset * clone(Buffer const &, bool same_id) const;
///
InsetText & operator=(InsetText const & it);
/// empty inset to empty par, or just mark as erased
@ -147,11 +152,15 @@ public:
///
int getMaxWidth(BufferView *, UpdatableInset const *) const;
///
void init(InsetText const * ins = 0, bool same_id = false);
void init(InsetText const * ins);
///
//void init(InsetText const * ins, bool same_id);
///
void writeParagraphData(Buffer const *, std::ostream &) const;
///
void setParagraphData(ParagraphList const &, bool same_id = false);
void setParagraphData(ParagraphList const &);
///
//void setParagraphData(ParagraphList const &, bool same_id);
///
void setText(string const &, LyXFont const &);
///

View File

@ -25,7 +25,9 @@ public:
///
void write(Buffer const * buf, std::ostream & os) const;
///
virtual Inset * clone(Buffer const &, bool same_id = false) const;
virtual Inset * clone(Buffer const &) const;
///
//virtual Inset * clone(Buffer const &, bool same_id) const;
///
Inset::Code lyxCode() const { return Inset::THEOREM_CODE; }
///

View File

@ -23,11 +23,16 @@ using std::vector;
using std::ostream;
InsetTOC::InsetTOC(InsetCommandParams const & p, bool same_id)
: InsetCommand(p, same_id)
InsetTOC::InsetTOC(InsetCommandParams const & p)
: InsetCommand(p)
{}
// InsetTOC::InsetTOC(InsetCommandParams const & p, bool same_id)
// : InsetCommand(p, same_id)
// {}
InsetTOC::~InsetTOC()
{
InsetCommandMailer mailer("toc", *this);

View File

@ -20,14 +20,20 @@
class InsetTOC : public InsetCommand {
public:
///
InsetTOC(InsetCommandParams const &, bool same_id = false);
InsetTOC(InsetCommandParams const &);
///
//InsetTOC(InsetCommandParams const &, bool same_id);
///
~InsetTOC();
///
virtual Inset * clone(Buffer const &, bool same_id = false) const {
return new InsetTOC(params(), same_id);
virtual Inset * clone(Buffer const &) const {
return new InsetTOC(params());
}
///
//virtual Inset * clone(Buffer const &, bool same_id) const {
// return new InsetTOC(params(), same_id);
//}
///
dispatch_result localDispatch(FuncRequest const & cmd);
///
string const getScreenLabel(Buffer const *) const;

View File

@ -24,11 +24,16 @@
using std::ostream;
InsetUrl::InsetUrl(InsetCommandParams const & p, bool)
InsetUrl::InsetUrl(InsetCommandParams const & p)
: InsetCommand(p)
{}
// InsetUrl::InsetUrl(InsetCommandParams const & p, bool)
// : InsetCommand(p, false)
// {}
InsetUrl::~InsetUrl()
{
InsetCommandMailer("url", *this).hideDialog();

View File

@ -23,14 +23,21 @@ class InsetUrl : public InsetCommand {
public:
///
explicit
InsetUrl(InsetCommandParams const &, bool same_id = false);
InsetUrl(InsetCommandParams const &);
///
//explicit
//InsetUrl(InsetCommandParams const &, bool same_id);
///
~InsetUrl();
///
virtual Inset * clone(Buffer const &, bool same_id = false) const {
return new InsetUrl(params(), same_id);
virtual Inset * clone(Buffer const &) const {
return new InsetUrl(params());
}
///
//virtual Inset * clone(Buffer const &, bool same_id) const {
// return new InsetUrl(params(), same_id);
//}
///
dispatch_result localDispatch(FuncRequest const & cmd);
///
Inset::Code lyxCode() const { return Inset::URL_CODE; }

View File

@ -75,11 +75,16 @@ InsetWrap::InsetWrap(BufferParams const & bp, string const & type)
}
InsetWrap::InsetWrap(InsetWrap const & in, bool same_id)
: InsetCollapsable(in, same_id), params_(in.params_)
InsetWrap::InsetWrap(InsetWrap const & in)
: InsetCollapsable(in), params_(in.params_)
{}
// InsetWrap::InsetWrap(InsetWrap const & in, bool same_id)
// : InsetCollapsable(in, same_id), params_(in.params_)
// {}
InsetWrap::~InsetWrap()
{
InsetWrapMailer mailer(*this);
@ -180,12 +185,18 @@ void InsetWrap::validate(LaTeXFeatures & features) const
}
Inset * InsetWrap::clone(Buffer const &, bool same_id) const
Inset * InsetWrap::clone(Buffer const &) const
{
return new InsetWrap(*const_cast<InsetWrap *>(this), same_id);
return new InsetWrap(*const_cast<InsetWrap *>(this));
}
// Inset * InsetWrap::clone(Buffer const &, bool same_id) const
// {
// return new InsetWrap(*const_cast<InsetWrap *>(this), same_id);
// }
string const InsetWrap::editMessage() const
{
return _("Opened Wrap Inset");
@ -307,7 +318,7 @@ void InsetWrapMailer::string2params(string const & in,
if (in.empty())
return;
istringstream data(STRCONV(in));
LyXLex lex(0,0);
lex.setStream(data);

View File

@ -22,7 +22,7 @@ struct InsetWrapParams {
void write(std::ostream &) const;
///
void read(LyXLex &);
///
string type;
///
@ -39,11 +39,13 @@ public:
///
InsetWrap(BufferParams const &, string const &);
///
InsetWrap(InsetWrap const &, bool same_id = false);
InsetWrap(InsetWrap const &);
///
//InsetWrap(InsetWrap const &, bool same_id);
///
~InsetWrap();
///
virtual dispatch_result localDispatch(FuncRequest const & cmd);
virtual dispatch_result localDispatch(FuncRequest const & cmd);
///
void write(Buffer const * buf, std::ostream & os) const;
///
@ -51,7 +53,9 @@ public:
///
void validate(LaTeXFeatures & features) const;
///
Inset * clone(Buffer const &, bool same_id = false) const;
Inset * clone(Buffer const &) const;
///
//Inset * clone(Buffer const &, bool same_id) const;
///
Inset::Code lyxCode() const { return Inset::WRAP_CODE; }
///

View File

@ -30,11 +30,16 @@ UpdatableInset::UpdatableInset()
{}
UpdatableInset::UpdatableInset(UpdatableInset const & in, bool same_id)
: Inset(in, same_id), block_drawing_(false)
UpdatableInset::UpdatableInset(UpdatableInset const & in)
: Inset(in), block_drawing_(false)
{}
// UpdatableInset::UpdatableInset(UpdatableInset const & in, bool same_id)
// : Inset(in, same_id), block_drawing_(false)
// {}
void UpdatableInset::insetUnlock(BufferView *)
{
lyxerr[Debug::INFO] << "Inset Unlock" << std::endl;

View File

@ -49,7 +49,9 @@ public:
///
UpdatableInset();
///
UpdatableInset(UpdatableInset const & in, bool same_id = false);
UpdatableInset(UpdatableInset const & in);
///
//UpdatableInset(UpdatableInset const & in, bool same_id);
/// check if the font of the char we want inserting is correct
/// and modify it if it is not.
@ -122,7 +124,7 @@ public:
/// find the next change in the inset
virtual bool nextChange(BufferView * bv, lyx::pos_type & length);
///
// needed for search/replace functionality
///

View File

@ -1,3 +1,6 @@
2003-05-26 Lars Gullik Bjønnes <larsbj@gullik.net>
* remove same_id from function signatures, adjust
2003-05-19 André Pönitz <poenitz@gmx.net>
@ -49,15 +52,15 @@
* math_cursor.C: boost::format -> bformat all over the place
2003-05-06 Ling Li <ling@caltech.edu>
* Makefile, math_makeboxinset.[Ch]:
* math_factory.C (createMathInset):
* math_parser.C (parse1): New support for \makebox.
* math_nestinset.C (drawMarkers, drawMarkers2):
* math_boxinset.C, math_frameboxinset.C (draw):
Fix spacing and marker length.
* Makefile, math_makeboxinset.[Ch]:
* math_factory.C (createMathInset):
* math_parser.C (parse1): New support for \makebox.
* math_nestinset.C (drawMarkers, drawMarkers2):
* math_boxinset.C, math_frameboxinset.C (draw):
Fix spacing and marker length.
2003-05-03 John Levon <levon@movementarian.org>
* formula.C:
@ -117,10 +120,10 @@
2003-03-05 Ling Li <ling@caltech.edu>
* math_casesinset.[Ch] (validate): request feature "amsmath"
2003-03-04 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* math_braceinset.C (metrics): fix computation of descent
* math_braceinset.C (metrics): fix computation of descent
2003-03-04 Angus Leeming <leeming@lyx.org>

View File

@ -114,12 +114,18 @@ InsetFormula::~InsetFormula()
{}
Inset * InsetFormula::clone(Buffer const &, bool) const
Inset * InsetFormula::clone(Buffer const &) const
{
return new InsetFormula(*this);
}
// Inset * InsetFormula::clone(Buffer const &, bool) const
// {
// return new InsetFormula(*this);
// }
void InsetFormula::write(Buffer const *, ostream & os) const
{
WriteStream wi(os, false, false);
@ -190,7 +196,7 @@ void InsetFormula::read(Buffer const *, LyXLex & lex)
lyxerr << "this is size 1\n";
if (par_->cell(0)[0]->asFontInset()) {
lyxerr << "this is a font inset \n";
lyxerr << "replacing " << par_.nucleus()->cell(0) <<
lyxerr << "replacing " << par_.nucleus()->cell(0) <<
" with " << par_->cell(0)[0]->cell(0) << "\n";
}
}
@ -331,4 +337,3 @@ string const InsetFormula::PreviewImpl::latexString() const
parent().par_->write(wi);
return STRCONV(ls.str());
}

View File

@ -54,7 +54,9 @@ public:
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
///
Inset * clone(Buffer const &, bool same_id = false) const;
Inset * clone(Buffer const &) const;
///
//Inset * clone(Buffer const &, bool same_id) const;
///
void validate(LaTeXFeatures & features) const;
///

View File

@ -30,7 +30,9 @@ public:
///
InsetFormulaBase();
///
Inset * clone(Buffer const &, bool same_id = false) const = 0;
Inset * clone(Buffer const &) const = 0;
///
//Inset * clone(Buffer const &, bool same_id) const = 0;
///
virtual void draw(BufferView *,LyXFont const &, int, float &) const = 0;
/// lowest x coordinate

View File

@ -66,12 +66,18 @@ InsetFormulaMacro::InsetFormulaMacro(string const & s)
}
Inset * InsetFormulaMacro::clone(Buffer const &, bool) const
Inset * InsetFormulaMacro::clone(Buffer const &) const
{
return new InsetFormulaMacro(*this);
}
// Inset * InsetFormulaMacro::clone(Buffer const &, bool) const
// {
// return new InsetFormulaMacro(*this);
// }
void InsetFormulaMacro::write(Buffer const *, ostream & os) const
{
os << "FormulaMacro ";

View File

@ -52,7 +52,9 @@ public:
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
///
Inset * clone(Buffer const &, bool same_id = false) const;
Inset * clone(Buffer const &) const;
///
//Inset * clone(Buffer const &, bool same_id) const;
///
Inset::Code lyxCode() const;
///

View File

@ -99,7 +99,7 @@ Paragraph::Paragraph(Paragraph const & lp)
InsetList::iterator it = insetlist.begin();
InsetList::iterator end = insetlist.end();
for (; it != end; ++it) {
it.setInset(it.getInset()->clone(**buffer_, false));
it.setInset(it.getInset()->clone(**buffer_));
// tell the new inset who is the boss now
it.getInset()->parOwner(this);
}

View File

@ -117,23 +117,11 @@ LyXTabular::LyXTabular(BufferParams const & bp,
LyXTabular::LyXTabular(BufferParams const & bp,
InsetTabular * inset, LyXTabular const & lt,
bool same_id)
InsetTabular * inset, LyXTabular const & lt)
{
owner_ = inset;
cur_cell = -1;
Init(bp, lt.rows_, lt.columns_, &lt);
// we really should change again to have InsetText as a pointer
// and allocate it then we would not have to do this stuff all
// double!
if (same_id) {
for (int i = 0; i < rows_; ++i) {
for (int j = 0; j < columns_; ++j) {
cell_info[i][j].inset.id(lt.cell_info[i][j].inset.id());
cell_info[i][j].inset.setParagraphData(lt.cell_info[i][j].inset.paragraphs, true);
}
}
}
#if 0
#ifdef WITH_WARNINGS
#warning Jürgen, can you make it the other way round. So that copy assignment depends on the copy constructor and not the other way. (Lgb)
@ -143,6 +131,33 @@ LyXTabular::LyXTabular(BufferParams const & bp,
}
// LyXTabular::LyXTabular(BufferParams const & bp,
// InsetTabular * inset, LyXTabular const & lt,
// bool same_id)
// {
// owner_ = inset;
// cur_cell = -1;
// Init(bp, lt.rows_, lt.columns_, &lt);
// // we really should change again to have InsetText as a pointer
// // and allocate it then we would not have to do this stuff all
// // double!
// if (same_id) {
// for (int i = 0; i < rows_; ++i) {
// for (int j = 0; j < columns_; ++j) {
// cell_info[i][j].inset.id(lt.cell_info[i][j].inset.id());
// cell_info[i][j].inset.setParagraphData(lt.cell_info[i][j].inset.paragraphs, true);
// }
// }
// }
// #if 0
// #ifdef WITH_WARNINGS
// #warning Jürgen, can you make it the other way round. So that copy assignment depends on the copy constructor and not the other way. (Lgb)
// #endif
// operator=(lt);
// #endif
// }
LyXTabular::LyXTabular(Buffer const * buf, InsetTabular * inset, LyXLex & lex)
{
owner_ = inset;
@ -177,9 +192,9 @@ LyXTabular & LyXTabular::operator=(LyXTabular const & lt)
LyXTabular * LyXTabular::clone(BufferParams const & bp,
InsetTabular * inset, bool same_id)
InsetTabular * inset)
{
LyXTabular * result = new LyXTabular(bp, inset, *this, same_id);
LyXTabular * result = new LyXTabular(bp, inset, *this);
#if 0
// don't know if this is good but I need to Clone also
// the text-insets here, this is for the Undo-facility!
@ -194,6 +209,24 @@ LyXTabular * LyXTabular::clone(BufferParams const & bp,
}
// LyXTabular * LyXTabular::clone(BufferParams const & bp,
// InsetTabular * inset, bool same_id)
// {
// LyXTabular * result = new LyXTabular(bp, inset, *this, same_id);
// #if 0
// // don't know if this is good but I need to Clone also
// // the text-insets here, this is for the Undo-facility!
// for (int i = 0; i < rows_; ++i) {
// for (int j = 0; j < columns_; ++j) {
// result->cell_info[i][j].inset = cell_info[i][j].inset;
// result->cell_info[i][j].inset.setOwner(inset);
// }
// }
// #endif
// return result;
// }
/* activates all lines and sets all widths to 0 */
void LyXTabular::Init(BufferParams const & bp,
int rows_arg, int columns_arg, LyXTabular const * lt)

View File

@ -180,15 +180,20 @@ public:
InsetTabular *, int columns_arg, int rows_arg);
///
LyXTabular(BufferParams const &,
InsetTabular *, LyXTabular const &, bool same_id = false);
InsetTabular *, LyXTabular const &);
///
//LyXTabular(BufferParams const &,
// InsetTabular *, LyXTabular const &, bool same_id = false);
///
explicit
LyXTabular(Buffer const *, InsetTabular *, LyXLex & lex);
///
LyXTabular & operator=(LyXTabular const &);
///
LyXTabular * clone(BufferParams const &,
InsetTabular *, bool same_id = false);
LyXTabular * clone(BufferParams const &, InsetTabular *);
///
//LyXTabular * clone(BufferParams const &,
// InsetTabular *, bool same_id = false);
/// Returns true if there is a topline, returns false if not
bool TopLine(int cell, bool onlycolumn = false) const;