]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetIndex.cpp
Regularly check if preview is modified when visible on screen
[lyx.git] / src / insets / InsetIndex.cpp
index a328d27de635c885b6d978e1fccf0ec81a763e16..38472f0bdcc0911f3e1eaff40c0747c2bd9f6036 100644 (file)
@@ -351,7 +351,7 @@ void InsetIndex::string2params(string const & in, InsetIndexParams & params)
 
 
 void InsetIndex::addToToc(DocIterator const & cpit, bool output_active,
-                                                 UpdateType utype) const
+                                                 UpdateType utype, TocBackend & backend) const
 {
        DocIterator pit = cpit;
        pit.push_back(CursorSlice(const_cast<InsetIndex &>(*this)));
@@ -361,10 +361,10 @@ void InsetIndex::addToToc(DocIterator const & cpit, bool output_active,
                type += ":" + to_utf8(params_.index);
        // this is unlikely to be terribly long
        text().forOutliner(str, INT_MAX);
-       TocBuilder & b = buffer().tocBackend().builder(type);
+       TocBuilder & b = backend.builder(type);
        b.pushItem(pit, str, output_active);
        // Proceed with the rest of the inset.
-       InsetCollapsable::addToToc(cpit, output_active, utype);
+       InsetCollapsable::addToToc(cpit, output_active, utype, backend);
        b.pop();
 }
 
@@ -436,8 +436,10 @@ ParamInfo const & InsetPrintIndex::findInfo(string const & /* cmdName */)
        static ParamInfo param_info_;
        if (param_info_.empty()) {
                param_info_.add("type", ParamInfo::LATEX_OPTIONAL,
-                               ParamInfo::HANDLING_ESCAPE);
-               param_info_.add("name", ParamInfo::LATEX_REQUIRED);
+                               ParamInfo::HANDLING_ESCAPE);
+               param_info_.add("name", ParamInfo::LATEX_OPTIONAL,
+                               ParamInfo::HANDLING_LATEXIFY);
+               param_info_.add("literal", ParamInfo::LYX_INTERNAL);
        }
        return param_info_;
 }
@@ -560,6 +562,15 @@ bool InsetPrintIndex::getStatus(Cursor & cur, FuncRequest const & cmd,
 }
 
 
+void InsetPrintIndex::updateBuffer(ParIterator const &, UpdateType)
+{
+       Index const * index =
+               buffer().masterParams().indiceslist().findShortcut(getParam("type"));
+       if (index)
+               setParam("name", index->index());
+}
+
+
 void InsetPrintIndex::latex(otexstream & os, OutputParams const & runparams_in) const
 {
        if (!buffer().masterBuffer()->params().use_indices) {
@@ -577,6 +588,7 @@ void InsetPrintIndex::validate(LaTeXFeatures & features) const
        features.require("makeidx");
        if (buffer().masterBuffer()->params().use_indices)
                features.require("splitidx");
+       InsetCommand::validate(features);
 }