]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetinclude.C
prepare for 1.1.6pre2
[lyx.git] / src / insets / insetinclude.C
index 087d9a2104696ae66b609ca8f9bf9e452dce8be2..60cc1b2269be721721a06f08f7e3095e7ddb35e0 100644 (file)
@@ -138,7 +138,7 @@ void include_cb(FL_OBJECT *, long arg)
        }
 
        case 1:
-               if(!current_view->buffer()->isReadonly()) {
+               if (!current_view->buffer()->isReadonly()) {
                        inset->setContents(fl_get_input(form->input));
                        // don't typeset
                        inset->setNoLoad(fl_get_button(form->flag1));
@@ -160,7 +160,7 @@ void include_cb(FL_OBJECT *, long arg)
                fl_hide_form(form->include);
                break;
        case 5:
-               if(!current_view->buffer()->isReadonly()) {
+               if (!current_view->buffer()->isReadonly()) {
                        inset->setContents(fl_get_input(form->input));
                        inset->setNoLoad(fl_get_button(form->flag1));
                        if (fl_get_button(form->flag2))
@@ -203,8 +203,8 @@ string unique_id() {
 }
 
 
-InsetInclude::InsetInclude(InsetCommandParams const & p, Buffer * bf)
-       : InsetCommand(p), master(bf)
+InsetInclude::InsetInclude(InsetCommandParams const & p, Buffer const & bf)
+       : InsetCommand(p), master(&bf)
 {
        flag = InsetInclude::INCLUDE;
        noload = false;
@@ -229,9 +229,9 @@ InsetInclude::~InsetInclude()
 }
 
 
-Inset * InsetInclude::Clone() const
+Inset * InsetInclude::Clone(Buffer const & buffer) const
 { 
-       InsetInclude * ii = new InsetInclude (params(), master); 
+       InsetInclude * ii = new InsetInclude (params(), buffer); 
        ii->setNoLoad(isNoLoad());
        // By default, the newly created inset is of `include' type,
        // so we do not test this case.
@@ -247,12 +247,12 @@ Inset * InsetInclude::Clone() const
 
 void InsetInclude::Edit(BufferView * bv, int, int, unsigned int)
 {
-       if(bv->buffer()->isReadonly())
+       if (bv->buffer()->isReadonly())
                WarnReadonly(bv->buffer()->fileName());
 
        if (!form) {
                 form = create_form_include();
-               fl_set_form_atclose(form->include, IgnoreCloseBoxCB, 0);
+               fl_set_form_atclose(form->include, CancelCloseBoxCB, 0);
        }
         form->include->u_vdata = this;
     
@@ -272,7 +272,8 @@ void InsetInclude::Edit(BufferView * bv, int, int, unsigned int)
         if (form->include->visible) {
                fl_raise_form(form->include);
        } else {
-               fl_show_form(form->include, FL_PLACE_MOUSE, FL_FULLBORDER,
+               fl_show_form(form->include,
+                            FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
                             _("Include"));
        }
 }
@@ -440,7 +441,7 @@ int InsetInclude::Linuxdoc(Buffer const * buffer, ostream & os) const
                } else
                        writefile = getFileName();
 
-               if(IsLyXFilename(getFileName()))
+               if (IsLyXFilename(getFileName()))
                        writefile = ChangeExtension(writefile, ".sgml");
 
                lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
@@ -450,7 +451,9 @@ int InsetInclude::Linuxdoc(Buffer const * buffer, ostream & os) const
        } 
 
        if (isVerb()) {
-               os << "<!-- includefile verbatim=\"" << incfile << "\" -->";
+               os << "<inlinegraphic fileref=\"" << '&' << include_label << ';'
+                  << "\" format=\"linespecific\">"
+                  << "</inlinegraphic>";
        } else 
                os << '&' << include_label << ';';
        
@@ -476,7 +479,7 @@ int InsetInclude::DocBook(Buffer const * buffer, ostream & os) const
                        writefile = AddName(buffer->tmppath, incfile);
                } else
                        writefile = getFileName();
-               if(IsLyXFilename(getFileName()))
+               if (IsLyXFilename(getFileName()))
                        writefile = ChangeExtension(writefile, ".sgml");
 
                lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
@@ -486,7 +489,9 @@ int InsetInclude::DocBook(Buffer const * buffer, ostream & os) const
        } 
 
        if (isVerb()) {
-               os << "<inlinegraphic fileref=\"" << incfile << "\" format=\"linespecific\">";
+               os << "<inlinegraphic fileref=\"" << '&' << include_label << ';'
+                  << "\" format=\"linespecific\">"
+                  << "</inlinegraphic>";
        } else 
                os << '&' << include_label << ';';
        
@@ -498,16 +503,17 @@ void InsetInclude::Validate(LaTeXFeatures & features) const
 {
 
        string incfile(getContents());
-       string writefile = ChangeExtension(getFileName(), ".sgml");
+       string writefile; // = ChangeExtension(getFileName(), ".sgml");
+
        if (!master->tmppath.empty() && !master->niceFile) {
                incfile = subst(incfile, '/','@');
                writefile = AddName(master->tmppath, incfile);
        } else
-               // writefile = getFileName();
+               writefile = getFileName();
                // Use the relative path.
-               writefile = incfile;
+               //writefile = incfile;
 
-       if(IsLyXFilename(getFileName()))
+       if (IsLyXFilename(getFileName()))
                writefile = ChangeExtension(writefile, ".sgml");
 
        features.IncludedFiles[include_label] = writefile;