X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetLabel.cpp;h=b0cf6dfcf55e00d05c2c85f55666c8d897b606f5;hb=2c357c1d23b7b83839a9beb8225d4f1ae4f793b4;hp=95fb3e6bb5af59525152f8c3a44a5e8995a2ff24;hpb=897436efbb9bd641b61467d185a2dfae9839e575;p=lyx.git diff --git a/src/insets/InsetLabel.cpp b/src/insets/InsetLabel.cpp index 95fb3e6bb5..b0cf6dfcf5 100644 --- a/src/insets/InsetLabel.cpp +++ b/src/insets/InsetLabel.cpp @@ -16,38 +16,39 @@ #include "BufferView.h" #include "DispatchResult.h" #include "FuncRequest.h" -#include "InsetList.h" #include "Text.h" -#include "Paragraph.h" -#include "ParIterator.h" #include "sgml.h" #include "support/lstrings.h" #include "support/lyxalgo.h" -#include "support/std_ostream.h" +using namespace std; +using namespace lyx::support; namespace lyx { -using support::escape; - -using std::string; -using std::ostream; -using std::vector; - InsetLabel::InsetLabel(InsetCommandParams const & p) : InsetCommand(p, "label") {} -std::auto_ptr InsetLabel::doClone() const +CommandInfo const * InsetLabel::findInfo(string const & /* cmdName */) +{ + static const char * const paramnames[] = {"name", ""}; + static const bool isoptional[] = {false}; + static const CommandInfo info = {1, paramnames, isoptional}; + return &info; +} + + +Inset * InsetLabel::clone() const { - return std::auto_ptr(new InsetLabel(params())); + return new InsetLabel(params()); } -void InsetLabel::getLabelList(Buffer const &, std::vector & list) const +void InsetLabel::getLabelList(Buffer const &, vector & list) const { list.push_back(getParam("name")); } @@ -64,7 +65,7 @@ void InsetLabel::doDispatch(Cursor & cur, FuncRequest & cmd) switch (cmd.action) { case LFUN_INSET_MODIFY: { - InsetCommandParams p("label"); + InsetCommandParams p(LABEL_CODE); // FIXME UNICODE InsetCommandMailer::string2params("label", to_utf8(cmd.argument()), p); if (p.getCmdName().empty()) { @@ -72,8 +73,8 @@ void InsetLabel::doDispatch(Cursor & cur, FuncRequest & cmd) break; } if (p["name"] != params()["name"]) - cur.bv().buffer()->changeRefsIfUnique(params()["name"], - p["name"], Inset::REF_CODE); + cur.bv().buffer().changeRefsIfUnique(params()["name"], + p["name"], REF_CODE); setParams(p); break; }