if we have a buffer we don't need to pass part of it separately...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24132 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2008-04-05 20:24:05 +00:00
parent 383490dde8
commit efe09aeb50
5 changed files with 14 additions and 19 deletions

View File

@ -103,7 +103,7 @@ Inset * createInsetHelper(Buffer & buf, FuncRequest const & cmd)
case LFUN_FLEX_INSERT: {
string s = cmd.getArg(0);
return new InsetFlex(buf, buf.params().documentClassPtr(), s);
return new InsetFlex(buf, s);
}
case LFUN_NOTE_INSERT: {
@ -515,11 +515,9 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
} else if (tmptok == "Flex") {
lex.next();
string s = lex.getString();
inset.reset(new InsetFlex(buf,
buf.params().documentClassPtr(), s));
inset.reset(new InsetFlex(buf, s));
} else if (tmptok == "Branch") {
inset.reset(new InsetBranch(buf,
InsetBranchParams()));
inset.reset(new InsetBranch(buf, InsetBranchParams()));
} else if (tmptok == "Environment") {
lex.next();
inset.reset(new InsetEnvironment(buf, lex.getDocString()));

View File

@ -76,15 +76,16 @@ InsetCollapsable::Geometry InsetCollapsable::geometry() const
InsetCollapsable::InsetCollapsable(Buffer const & buf,
CollapseStatus status, DocumentClass * dc)
CollapseStatus status)
: InsetText(buf), status_(status),
openinlined_(false), autoOpen_(false), mouse_hover_(false)
{
setLayout(dc);
DocumentClass const & dc = buf.params().documentClass();
setLayout(&dc);
setAutoBreakRows(true);
setDrawFrame(true);
setFrameColor(Color_collapsableframe);
paragraphs().back().setLayout(buf.params().documentClass().emptyLayout());
paragraphs().back().setLayout(dc.emptyLayout());
}
@ -161,8 +162,7 @@ void InsetCollapsable::read(Lexer & lex)
lex.setContext("InsetCollapsable::read");
string tmp_token;
status_ = Collapsed;
lex >> "status";
lex >> tmp_token;
lex >> "status" >> tmp_token;
if (tmp_token == "open")
status_ = Open;

View File

@ -33,8 +33,7 @@ namespace frontend { class Painter; }
class InsetCollapsable : public InsetText {
public:
///
InsetCollapsable(Buffer const &,
CollapseStatus status = Inset::Open, DocumentClass * tc = 0);
InsetCollapsable(Buffer const &, CollapseStatus status = Inset::Open);
///
InsetCollapsable(InsetCollapsable const & rhs);
///

View File

@ -39,12 +39,11 @@ using namespace std;
namespace lyx {
InsetFlex::InsetFlex(Buffer const & buf,
DocumentClass * dc, string const & layoutName)
: InsetCollapsable(buf, Collapsed, dc),
name_(layoutName)
InsetFlex::InsetFlex(Buffer const & buf, string const & layoutName)
: InsetCollapsable(buf, Collapsed), name_(layoutName)
{
setLayout(dc); // again, because now the name is initialized
// again, because now the name is initialized
setLayout(buf.params().documentClassPtr());
packages_ = getLayout().requires();
preamble_ = getLayout().preamble();
}

View File

@ -23,8 +23,7 @@ namespace lyx {
class InsetFlex : public InsetCollapsable {
public:
///
InsetFlex(Buffer const &, DocumentClass * dc,
std::string const & layoutName);
InsetFlex(Buffer const &, std::string const & layoutName);
///
docstring name() const { return from_utf8(name_); }