#include <config.h>
+#include <assert.h>
#include <algorithm>
#include <functional>
#include "support/filetools.h"
#include "support/lyxmanip.h"
#include "support/lyxfunctional.h"
+#include "support/LAssert.h"
#include "lyx_gui_misc.h"
#include "lastfiles.h"
#include "debug.h"
#include "lyxtext.h"
#include "lyx_cb.h"
#include "bufferview_funcs.h"
+#include "BufferView.h"
#include "gettext.h"
#include "LyXView.h"
#include "vc-backend.h"
}
-bool BufferList::QwriteAll()
+bool BufferList::qwriteAll()
{
bool askMoreConfirmation = false;
string unsaved;
}
-void BufferList::resize()
-{
- for_each(bstore.begin(), bstore.end(), mem_fun(&Buffer::resize));
-}
-
-
bool BufferList::close(Buffer * buf)
{
lyx::Assert(buf);
if (buf->getUser()) buf->getUser()->insetUnlock();
if (buf->paragraph && !buf->isLyxClean() && !quitting) {
if (buf->getUser())
- ProhibitInput(buf->getUser());
+ buf->getUser()->owner()->prohibitInput();
string fname;
if (buf->isUnnamed())
fname = OnlyFilename(buf->fileName());
reask = false;
} else {
if (buf->getUser())
- AllowInput(buf->getUser());
+ buf->getUser()->owner()->allowInput();
return false;
}
break;
break;
case 3: // Cancel
if (buf->getUser())
- AllowInput(buf->getUser());
+ buf->getUser()->owner()->allowInput();
return false;
}
}
if (buf->getUser())
- AllowInput(buf->getUser());
+ buf->getUser()->owner()->allowInput();
}
bstore.release(buf);
if (tname.empty()) {
tname = LibFileSearch("templates", "defaults.lyx");
}
- if (!tname.empty() && IsLyXFilename(tname)) {
+ if (!tname.empty()) {
bool templateok = false;
LyXLex lex(0, 0);
lex.setFile(tname);
- if (lex.IsOK()) {
+ if (lex.isOK()) {
if (b->readFile(lex)) {
templateok = true;
}
WriteAlert(_("Error!"), _("Unable to open template"),
MakeDisplayPath(tname));
// no template, start with empty buffer
- b->paragraph = new LyXParagraph;
+ b->paragraph = new Paragraph;
}
} else { // start with empty buffer
- b->paragraph = new LyXParagraph;
+ b->paragraph = new Paragraph;
}
if (!lyxrc.new_ask_filename && !isNamed) {
Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
{
- // make sure our path is absolute
- string const s = MakeAbsPath(filename);
+ // get absolute path of file and add ".lyx" to the filename if
+ // necessary
+ string s = FileSearch(string(), filename, "lyx");
+ if (s.empty()) {
+ s = filename;
+ }
// file already open?
if (exists(s)) {