]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetNote.cpp
Change inset label from ": filename" to "Program Listing: filename" for listings...
[lyx.git] / src / insets / InsetNote.cpp
index 85aa740bc1aaa391b6d682f7117113f0ca836199..c44d637a56ca55a1e2ba718ebca2233f71a52d80 100644 (file)
@@ -202,7 +202,7 @@ bool InsetNote::getStatus(Cursor & cur, FuncRequest const & cmd,
 
        case LFUN_INSET_MODIFY:
                // disallow comment and greyed out in commands
-               flag.enabled(!cur.paragraph().layout().isCommand() ||
+               flag.setEnabled(!cur.paragraph().layout().isCommand() ||
                                cmd.getArg(2) == "Note");
                if (cmd.getArg(0) == "note") {
                        InsetNoteParams params;
@@ -212,7 +212,7 @@ bool InsetNote::getStatus(Cursor & cur, FuncRequest const & cmd,
                return true;
 
        case LFUN_INSET_DIALOG_UPDATE:
-               flag.enabled(true);
+               flag.setEnabled(true);
                return true;
 
        default:
@@ -221,19 +221,10 @@ bool InsetNote::getStatus(Cursor & cur, FuncRequest const & cmd,
 }
 
 
-void InsetNote::updateLabels(ParIterator const & it)
+void InsetNote::addToToc(DocIterator const & cpit)
 {
-       DocumentClass const & tclass = buffer().params().documentClass();
-       Counters savecnt = tclass.counters();
-       InsetCollapsable::updateLabels(it);
-       tclass.counters() = savecnt;
-}
-
-
-void InsetNote::addToToc(ParConstIterator const & cpit) const
-{
-       ParConstIterator pit = cpit;
-       pit.push_back(*this);
+       DocIterator pit = cpit;
+       pit.push_back(CursorSlice(*this));
 
        Toc & toc = buffer().tocBackend().toc("note");
        docstring str;
@@ -368,24 +359,10 @@ void InsetNote::string2params(string const & in, InsetNoteParams & params)
                return;
 
        istringstream data(in);
-       Lexer lex(0,0);
+       Lexer lex;
        lex.setStream(data);
-
-       string name;
-       lex >> name;
-       if (!lex || name != "note") {
-               LYXERR0("Expected arg 1 to be \"note\" in " << in);
-               return;
-       }
-
-       // This is part of the inset proper that is usually swallowed
-       // by Text::readInset
-       string id;
-       lex >> id;
-       if (!lex || id != "Note") {
-               LYXERR0("Expected arg 1 to be \"Note\" in " << in);
-               return;
-       }
+       lex.setContext("InsetNote::string2params");
+       lex >> "note" >> "Note";
 
        params.read(lex);
 }