]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetinclude.C
pos=string::npos for regex not found, use handcoded transform in lstring.C, fix the...
[lyx.git] / src / insets / insetinclude.C
index cafba467dd0afa6ff3e53119ef5516d1c37b12fb..6bccf7dfd3fab885aa1ca31b93e28ffd12edb452 100644 (file)
@@ -7,8 +7,8 @@
 #endif
 
 #include FORMS_H_LOCATION 
-#include "filedlg.h" 
 #include "insetinclude.h"
+#include "filedlg.h" 
 #include "buffer.h"
 #include "bufferlist.h"
 #include "debug.h"
@@ -210,7 +210,8 @@ InsetInclude::~InsetInclude()
        }
 }
 
-InsetInclude * InsetInclude::Clone() const
+
+Inset * InsetInclude::Clone() const
 { 
        InsetInclude * ii = new InsetInclude (contents, master); 
        ii->setNoLoad(isNoLoad());
@@ -225,10 +226,11 @@ InsetInclude * InsetInclude::Clone() const
        return ii;
 }
 
+
 void InsetInclude::Edit(int, int)
 {
        if(current_view->buffer()->isReadonly())
-               WarnReadonly();
+               WarnReadonly(current_view->buffer()->fileName());
 
        if (!form) {
                 form = create_form_include();
@@ -258,9 +260,9 @@ void InsetInclude::Edit(int, int)
 }
 
 
-void InsetInclude::Write(FILE * file)
+void InsetInclude::Write(ostream & os)
 {
-       fprintf(file, "Include %s\n", getCommand().c_str());
+       os << "Include " << getCommand() << "\n";
 }
 
 
@@ -314,12 +316,12 @@ bool InsetInclude::loadIfNeeded() const
 }
 
 
-int InsetInclude::Latex(FILE * file, signed char /*fragile*/)
+int InsetInclude::Latex(ostream & os, signed char /*fragile*/)
 {
        string include_file;
        signed char dummy = 0;
        Latex(include_file, dummy);
-       fprintf(file, "%s", include_file.c_str());
+       os << include_file;
        return 0;
 }
 
@@ -336,7 +338,7 @@ int InsetInclude::Latex(string & file, signed char /*fragile*/)
        incfile += contents;
 
        if (loadIfNeeded()) {
-               Buffer *tmp = bufferlist.getBuffer(getFileName());
+               Buffer * tmp = bufferlist.getBuffer(getFileName());
 
                if (tmp->params.textclass != master->params.textclass) {
                        lyxerr << "ERROR: Cannot handle include file `"
@@ -354,9 +356,9 @@ int InsetInclude::Latex(string & file, signed char /*fragile*/)
                if (!master->tmppath.empty()
                    && !master->niceFile) {
                        incfile = subst(incfile, '/','@');
-                       #ifdef __EMX__
+#ifdef __EMX__
                        incfile = subst(incfile, ':', '$');
-                       #endif
+#endif
                        writefile = AddName(master->tmppath, incfile);
                } else
                        writefile = getFileName();
@@ -434,9 +436,9 @@ string InsetInclude::getLabel(int) const
 }
 
 
-int InsetInclude::GetNumberOfLabels() const {
+int InsetInclude::GetNumberOfLabels() const
+{
     string label;
-    int nl;
 
     if (loadIfNeeded()) {
        Buffer * tmp = bufferlist.getBuffer(getFileName());
@@ -444,20 +446,20 @@ int InsetInclude::GetNumberOfLabels() const {
        label = tmp->getReferenceList('\n');
        tmp->setParentName(getMasterFilename());
     }
-       nl = (label.empty())? 0: 1;
+    int nl = (label.empty())? 0: 1;
        
     return nl;
 }
 
 
-string InsetInclude::getKeys() const
+string InsetInclude::getKeys(char delim) const
 {
        string lst;
        
        if (loadIfNeeded()) {
                Buffer *tmp = bufferlist.getBuffer(getFileName());
                tmp->setParentName(""); 
-               lst =  tmp->getBibkeyList(',');
+               lst =  tmp->getBibkeyList(delim);
                tmp->setParentName(getMasterFilename());
        }