]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetexternal.C
The BIG UNDO patch. Recodes undo handling for better use inside InsetText.
[lyx.git] / src / insets / insetexternal.C
index b95ae9939712e1e54a7c91b8c27d058cdc9ffa8e..8eaa064280d004d94d4b9048869e3bafdaf9870d 100644 (file)
@@ -4,7 +4,7 @@
  *           LyX, The Document Processor
  *     
  *         Copyright 1995 Matthias Ettrich
- *          Copyright 1995-2000 The LyX Team.
+ *          Copyright 1995-2001 The LyX Team.
  *
  * ====================================================== */
 
@@ -34,9 +34,9 @@
 using std::endl;
 
 InsetExternal::InsetExternal() 
-       : view(0)
+       : view_(0)
 {
-       tempname = lyx::tempName(string(), "lyxext");
+       tempname_ = lyx::tempName(string(), "lyxext");
        //ExternalTemplateManager::Templates::const_iterator i1;
        params_.templ = ExternalTemplateManager::get().getTemplates().begin()->second;
 }
@@ -44,7 +44,7 @@ InsetExternal::InsetExternal()
 
 InsetExternal::~InsetExternal()
 {
-       lyx::unlink(tempname);
+       lyx::unlink(tempname_);
        hideDialog();
 }
 
@@ -63,28 +63,28 @@ void InsetExternal::setFromParams(Params const & p)
 }      
 
 
-string const InsetExternal::EditMessage() const
+string const InsetExternal::editMessage() const
 {
        return doSubstitution(0, params_.templ.guiName);
 }
 
 
-void InsetExternal::Edit(BufferView * bv,
+void InsetExternal::edit(BufferView * bv,
                         int /*x*/, int /*y*/, unsigned int /*button*/)
 {
-       view = bv;
-       view->owner()->getDialogs()->showExternal(this);
+       view_ = bv;
+       view_->owner()->getDialogs()->showExternal(this);
 }
 
 
-void InsetExternal::Write(Buffer const *, std::ostream & os) const
+void InsetExternal::write(Buffer const *, std::ostream & os) const
 {
        os << "External " << params_.templ.lyxName << ",\"" << params_.filename 
           << "\",\"" << params_.parameters << "\"\n";
 }
 
 
-void InsetExternal::Read(Buffer const *, LyXLex & lex)
+void InsetExternal::read(Buffer const *, LyXLex & lex)
 {
        string format;
        string token;
@@ -142,32 +142,32 @@ int InsetExternal::write(string const & format,
 }
 
 
-int InsetExternal::Latex(Buffer const * buf,
+int InsetExternal::latex(Buffer const * buf,
                         std::ostream & os, bool, bool) const
 {
        return write("LaTeX", buf, os);
 }
 
 
-int InsetExternal::Ascii(Buffer const * buf, std::ostream & os, int) const
+int InsetExternal::ascii(Buffer const * buf, std::ostream & os, int) const
 {
        return write("Ascii", buf, os);
 }
 
 
-int InsetExternal::Linuxdoc(Buffer const * buf, std::ostream & os) const
+int InsetExternal::linuxdoc(Buffer const * buf, std::ostream & os) const
 {
        return write("LinuxDoc", buf, os);
 }
 
 
-int InsetExternal::DocBook(Buffer const * buf, std::ostream & os) const
+int InsetExternal::docBook(Buffer const * buf, std::ostream & os) const
 {
        return write("DocBook", buf, os);
 }
 
 
-void InsetExternal::Validate(LaTeXFeatures & features) const
+void InsetExternal::validate(LaTeXFeatures & features) const
 {
        ExternalTemplate const & et = params_.templ;
        ExternalTemplate::Formats::const_iterator cit =
@@ -185,10 +185,13 @@ void InsetExternal::Validate(LaTeXFeatures & features) const
 }
 
 
-Inset * InsetExternal::Clone(Buffer const &) const
+Inset * InsetExternal::clone(Buffer const &, bool same_id) const
 {
        InsetExternal * inset = new InsetExternal();
        inset->params_ = params_;
+       inset->view_ = view_;
+       if (same_id)
+               inset->id_ = id_;
        return inset;
 }
 
@@ -227,7 +230,7 @@ string const InsetExternal::doSubstitution(Buffer const * buffer,
        result = subst(result, "$$Basename", basename);
        result = subst(result, "$$Parameters", params_.parameters);
        result = ReplaceEnvironmentPath(result);
-       result = subst(result, "$$Tempname", tempname);
+       result = subst(result, "$$Tempname", tempname_);
        result = subst(result, "$$Sysdir", system_lyxdir);
        
        // Handle the $$Contents(filename) syntax
@@ -263,9 +266,9 @@ void InsetExternal::updateExternal() const
        if (cit == et.formats.end())
                return;
        
-       executeCommand(doSubstitution(view->buffer(),
+       executeCommand(doSubstitution(view_->buffer(),
                                      (*cit).second.updateCommand),
-                      view->buffer());
+                      view_->buffer());
 }
 
 
@@ -275,9 +278,9 @@ void InsetExternal::viewExternal() const
        if (et.automaticProduction)
                updateExternal();
 
-       executeCommand(doSubstitution(view->buffer(),
+       executeCommand(doSubstitution(view_->buffer(),
                                      et.viewCommand),
-                      view->buffer());
+                      view_->buffer());
 }
 
 
@@ -287,9 +290,9 @@ void InsetExternal::editExternal() const
        if (et.automaticProduction)
                updateExternal();
 
-       executeCommand(doSubstitution(view->buffer(),
+       executeCommand(doSubstitution(view_->buffer(),
                                      et.editCommand),
-                      view->buffer());
+                      view_->buffer());
 }