]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetInclude.cpp
Move the global formats and system_formats variables into the
[lyx.git] / src / insets / InsetInclude.cpp
index 482fdb2110f434afd9594dfc17d11f1033a40457..9b5c3f0961f119f2ed6ff50e38d4cb9dd4d40feb 100644 (file)
@@ -170,10 +170,10 @@ InsetLabel * createLabel(Buffer * buf, docstring const & label_str)
 
 InsetInclude::InsetInclude(Buffer * buf, InsetCommandParams const & p)
        : InsetCommand(buf, p), include_label(uniqueID()),
-         preview_(new RenderMonitoredPreview(this)), failedtoload_(false),
+         preview_(make_unique<RenderMonitoredPreview>(this)), failedtoload_(false),
          set_label_(false), label_(0), child_buffer_(0)
 {
-       preview_->fileChanged(bind(&InsetInclude::fileChanged, this));
+       preview_->connect([=](){ fileChanged(); });
 
        if (isListings(params())) {
                InsetListingsParams listing_params(to_utf8(p["lstparams"]));
@@ -185,10 +185,10 @@ InsetInclude::InsetInclude(Buffer * buf, InsetCommandParams const & p)
 
 InsetInclude::InsetInclude(InsetInclude const & other)
        : InsetCommand(other), include_label(other.include_label),
-         preview_(new RenderMonitoredPreview(this)), failedtoload_(false),
+         preview_(make_unique<RenderMonitoredPreview>(this)), failedtoload_(false),
          set_label_(false), label_(0), child_buffer_(0)
 {
-       preview_->fileChanged(bind(&InsetInclude::fileChanged, this));
+       preview_->connect([=](){ fileChanged(); });
 
        if (other.label_)
                label_ = new InsetLabel(*other.label_);
@@ -310,7 +310,7 @@ void InsetInclude::editIncluded(string const & file)
                lyx::dispatch(fr);
        } else
                // tex file or other text file in verbatim mode
-               formats.edit(buffer(),
+               theFormats().edit(buffer(),
                        support::makeAbsPath(file, support::onlyPath(buffer().absFileName())),
                        "text");
 }
@@ -640,7 +640,8 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
                                        "file\n`%1$s'\n"
                                        "Please, check whether it actually exists."),
                                        included_file.displayName());
-                               Alert::warning(_("Missing included file"), text);
+                               throw ExceptionMessage(ErrorException, _("Error: "),
+                                                      text);
                        }
                        return;
                }
@@ -695,7 +696,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
                // Don't assume the child's format is latex
                string const inc_format = tmp->params().bufferFormat();
                FileName const tmpwritefile(changeExtension(writefile.absFileName(),
-                       formats.extension(inc_format)));
+                       theFormats().extension(inc_format)));
 
                // FIXME: handle non existing files
                // The included file might be written in a different encoding
@@ -1164,7 +1165,8 @@ void InsetInclude::addToToc(DocIterator const & cpit, bool output_active,
                        return;
 
                // Include Tocs from children
-               childbuffer->inset().addToToc(cpit, output_active, utype, backend);
+               childbuffer->inset().addToToc(DocIterator(), output_active, utype,
+                                             backend);
                //Copy missing outliner names (though the user has been warned against
                //having different document class and module selection between master
                //and child).