#include <config.h>
-#include <stdlib.h>
+#include <cstdlib>
#ifdef __GNUG__
#pragma implementation
#include "insetinclude.h"
#include "buffer.h"
#include "bufferlist.h"
-#include "error.h"
-#include "filetools.h"
+#include "debug.h"
+#include "support/filetools.h"
#include "lyxrc.h"
#include "LyXView.h"
#include "LaTeXFeatures.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "gettext.h"
#include "include_form.h"
-#include "FileInfo.h"
+#include "support/FileInfo.h"
extern BufferView *current_view;
{
// Should browsing too be disabled in RO-mode?
LyXFileDlg fileDlg;
- LString mpath = OnlyPath(inset->getMasterFilename());
- LString ext;
+ string mpath = OnlyPath(inset->getMasterFilename());
+ string ext;
if (fl_get_button(form->flag2)) // Use Input Button
ext = "*.tex";
fileDlg.SetButton(0, _("Documents"), lyxrc->document_path);
// Use by default the master's path
- LString filename = fileDlg.Select(_("Select Child Document"),
+ string filename = fileDlg.Select(_("Select Child Document"),
mpath, ext,
inset->getContents());
XFlush(fl_get_display());
// check selected filename
if (!filename.empty()) {
- LString filename2 = MakeRelPath(filename,
+ string filename2 = MakeRelPath(filename,
mpath);
- if (filename2.prefixIs(".."))
+ if (prefixIs(filename2, ".."))
fl_set_input(form->input,
filename.c_str());
else
}
-InsetInclude::InsetInclude(LString const & fname, Buffer *bf)
+InsetInclude::InsetInclude(string const & fname, Buffer *bf)
: InsetCommand("include")
{
master = bf;
if (!form) {
form = create_form_include();
- fl_set_form_atclose(form->include, IgnoreCloseBoxCB, NULL);
+ fl_set_form_atclose(form->include, IgnoreCloseBoxCB, 0);
}
form->vdata = this;
setInclude();
else if (getCmdName() == "input")
setInput();
- else if (getCmdName().contains("verbatim")) {
+ else if (contains(getCmdName(), "verbatim")) {
setVerb();
if (getCmdName() == "verbatiminput*")
setVisibleSpace(true);
}
-LString InsetInclude::getScreenLabel() const
+string InsetInclude::getScreenLabel() const
{
- LString temp;
+ string temp;
if (isInput())
temp += _("Input");
else if (isVerb()) {
// the readonly flag can/will be wrong, not anymore I think.
FileInfo finfo(getFileName());
bool ro = !finfo.writable();
- return ( bufferlist.readFile(getFileName(), ro) != NULL );
+ return ( bufferlist.readFile(getFileName(), ro) != 0 );
}
int InsetInclude::Latex(FILE *file, signed char /*fragile*/)
{
- LString include_file;
+ string include_file;
signed char dummy = 0;
Latex(include_file, dummy);
fprintf(file, "%s", include_file.c_str());
}
-int InsetInclude::Latex(LString &file, signed char /*fragile*/)
+int InsetInclude::Latex(string &file, signed char /*fragile*/)
{
- LString writefile, incfile;
+ string writefile, incfile;
// Do nothing if no file name has been specified
if (contents.empty())
Buffer *tmp = bufferlist.getBuffer(getFileName());
if (tmp->params.textclass != master->params.textclass) {
- lyxerr.print("ERROR: Cannot handle include file `"
- + MakeDisplayPath(getFileName())
- + "' which has textclass `"
- + lyxstyle.NameOfClass(tmp->params.textclass)
- + "' instead of `"
- + lyxstyle.NameOfClass(master->params.textclass)
- + "'.");
+ lyxerr << "ERROR: Cannot handle include file `"
+ << MakeDisplayPath(getFileName())
+ << "' which has textclass `"
+ << lyxstyle.NameOfClass(tmp->params.textclass)
+ << "' instead of `"
+ << lyxstyle.NameOfClass(master->params.textclass)
+ << "'." << endl;
return 0;
}
writefile = ChangeExtension(getFileName(), ".tex", false);
if (!master->tmppath.empty()
&& !master->niceFile) {
- incfile.subst('/','@');
+ subst(incfile, '/','@');
#ifdef __EMX__
- incfile.subst(':', '$');
+ subst(incfile, ':', '$');
#endif
writefile = AddName(master->tmppath, incfile);
} else
writefile = getFileName();
writefile = ChangeExtension(writefile,".tex",false);
- lyxerr.debug("incfile:" + incfile, Error::LATEX);
- lyxerr.debug("writefile:" + writefile, Error::LATEX);
+ lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
+ lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
tmp->markDepClean(master->tmppath);
// file really have .tex
file += '\\';
file += command + '{';
- file += ChangeExtension(incfile, LString(), false)
+ file += ChangeExtension(incfile, string(), false)
+ '}';
}
}
-LString InsetInclude::getLabel(int) const
+string InsetInclude::getLabel(int) const
{
- LString label;
- LString parentname;
+ string label;
+ string parentname;
if (loadIfNeeded()) {
int InsetInclude::GetNumberOfLabels() const {
- LString label;
+ string label;
int nl;
if (loadIfNeeded()) {
}
-LString InsetInclude::getKeys() const
+string InsetInclude::getKeys() const
{
- LString list;
+ string list;
if (loadIfNeeded()) {
Buffer *tmp = bufferlist.getBuffer(getFileName());