#include "insets/InsetBibtex.h"
#include "insets/InsetCaption.h"
#include "insets/InsetCitation.h"
-#include "insets/InsetCharStyle.h"
+#include "insets/InsetFlex.h"
#include "insets/InsetEnvironment.h"
#include "insets/InsetERT.h"
#include "insets/InsetListings.h"
Inset * createInset(BufferView * bv, FuncRequest const & cmd)
{
- BufferParams const & params = bv->buffer()->params();
+ BufferParams const & params = bv->buffer().params();
try {
case LFUN_CLEARDOUBLEPAGE_INSERT:
return new InsetClearDoublePage;
- case LFUN_CHARSTYLE_INSERT: {
+ case LFUN_FLEX_INSERT: {
string s = cmd.getArg(0);
TextClass tclass = params.getTextClass();
- CharStyles::iterator found_cs = tclass.charstyle(s);
- if (found_cs != tclass.charstyles().end())
- return new InsetCharStyle(params, found_cs);
- else
- return new InsetCharStyle(params, s);
+ InsetLayout il = tclass.insetlayout(from_utf8(s));
+ return new InsetFlex(params, il);
}
case LFUN_NOTE_INSERT: {
string const argument = to_utf8(cmd.argument());
if (argument == "figure")
return new InsetWrap(params, argument);
- lyxerr << "Non-existent floatflt type: " << argument << endl;
+ lyxerr << "Non-existent wrapfig type: " << argument << endl;
return 0;
}
r = 2;
if (c <= 0)
c = 2;
- return new InsetTabular(*bv->buffer(), r, c);
+ return new InsetTabular(bv->buffer(), r, c);
}
case LFUN_CAPTION_INSERT: {
return new InsetListings(params, par);
} else if (name == "external") {
- Buffer const & buffer = *bv->buffer();
+ Buffer const & buffer = bv->buffer();
InsetExternalParams iep;
InsetExternalMailer::string2params(to_utf8(cmd.argument()),
buffer, iep);
return inset.release();
} else if (name == "graphics") {
- Buffer const & buffer = *bv->buffer();
+ Buffer const & buffer = bv->buffer();
InsetGraphicsParams igp;
InsetGraphicsMailer::string2params(to_utf8(cmd.argument()),
buffer, igp);
InsetCommandParams icp(name);
InsetCommandMailer::string2params(name, to_utf8(cmd.argument()),
icp);
- return new InsetRef(icp, *bv->buffer());
+ return new InsetRef(icp, bv->buffer());
} else if (name == "toc") {
InsetCommandParams icp("tableofcontents");
// the various \\footcite commands. We should increase the
// file format number and read these commands here, too.
// Then we should use is_possible_cite_command() in
- // src/frontends/controllers/frontend_helpers.cpp to test for valid cite
- // commands.
+ // InsetCitation to test for valid cite commands.
if (compare_ascii_no_case(cmdName.substr(0,4), "cite") == 0) {
inset.reset(new InsetCitation(inscmd));
} else if (cmdName == "bibitem") {
inset.reset(new InsetNote(buf.params(), tmptok));
} else if (tmptok == "Box") {
inset.reset(new InsetBox(buf.params(), tmptok));
- } else if (tmptok == "CharStyle") {
+ } else if (tmptok == "Flex") {
lex.next();
string s = lex.getString();
- CharStyles::iterator found_cs = tclass.charstyle(s);
- if (found_cs != tclass.charstyles().end())
- inset.reset(new InsetCharStyle(buf.params(), found_cs));
- else {
- // "Undefined" inset
- inset.reset(new InsetCharStyle(buf.params(), s));
- }
+ InsetLayout il = tclass.insetlayout(from_utf8(s));
+ inset.reset(new InsetFlex(buf.params(), il));
} else if (tmptok == "Branch") {
inset.reset(new InsetBranch(buf.params(),
InsetBranchParams()));
inset->read(buf, lex);
-#ifdef WITH_WARNINGS
-#warning hack..
-#endif
+// FIXME: hack..
if (inset->lyxCode() == Inset::MATHMACRO_CODE) {
MathMacroTemplate const * tmpl =
static_cast<MathMacroTemplate*>(inset.get());