#include "include_form.h"
#include "support/FileInfo.h"
#include "layout.h"
+#include "lyxfunc.h"
+
+using std::ostream;
+using std::endl;
extern BufferView * current_view;
-extern LyXRC * lyxrc;
extern BufferList bufferlist;
else
ext = "*.lyx";
// launches dialog
- fileDlg.SetButton(0, _("Documents"), lyxrc->document_path);
+ fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
// Use by default the master's path
string filename = fileDlg.Select(_("Select Child Document"),
}
+bool InsetInclude::display() const
+{
+ return !isInput();
+}
+
+
string InsetInclude::getScreenLabel() const
{
string temp;
}
+void InsetInclude::setContents(string const & c)
+{
+ InsetCommand::setContents(c);
+ filename = MakeAbsPath(contents,
+ OnlyPath(getMasterFilename()));
+}
+
+
bool InsetInclude::loadIfNeeded() const
{
if (isNoLoad() || isVerb()) return false;
}
-int InsetInclude::Latex(ostream & os, signed char /*fragile*/) const
+int InsetInclude::Latex(ostream & os,
+ bool /*fragile*/, bool /*fs*/) const
{
- string include_file;
- signed char dummy = 0;
- Latex(include_file, dummy);
- os << include_file;
- return 0;
-}
-
-
-int InsetInclude::Latex(string & file, signed char /*fragile*/) const
-{
- string writefile, incfile;
-
// Do nothing if no file name has been specified
if (contents.empty())
return 0;
// Use += to force a copy of contents (JMarc)
- incfile += contents;
+ // How does that force anything? (Lgb)
+ string incfile(contents);
if (loadIfNeeded()) {
Buffer * tmp = bufferlist.getBuffer(getFileName());
}
// write it to a file (so far the complete file)
- writefile = ChangeExtension(getFileName(), ".tex", false);
+ string writefile = ChangeExtension(getFileName(), ".tex", false);
if (!master->tmppath.empty()
&& !master->niceFile) {
incfile = subst(incfile, '/','@');
}
if (isVerb()) {
- file += '\\';
- file += command + '{';
- file += incfile + '}';
+ os << '\\' << command << '{' << incfile << '}';
}
else if (isInput()) {
// \input wants file with extension (default is .tex)
if (!IsLyXFilename(getFileName())) {
- file += '\\';
- file += command + '{';
- file += incfile + '}';
+ os << '\\' << command << '{' << incfile << '}';
} else {
- file += '\\';
- file += command + '{';
- file += ChangeExtension(incfile, ".tex", false)
- + '}';
+ os << '\\' << command << '{'
+ << ChangeExtension(incfile, ".tex", false)
+ << '}';
}
} else {
// \include don't want extension and demands that the
// file really have .tex
- file += '\\';
- file += command + '{';
- file += ChangeExtension(incfile, string(), false)
- + '}';
+ os << '\\' << command << '{'
+ << ChangeExtension(incfile, string(), false)
+ << '}';
}
return 0;