#include "paragraph.h"
#include "frontends/Alert.h"
+#include "frontends/Application.h"
#include "frontends/FileDialog.h"
#include "frontends/lyx_gui.h"
-#include "frontends/LyXView.h"
#include "support/filefilterlist.h"
#include "support/filetools.h"
+#include "support/fontutils.h"
#include "support/forkedcall.h"
#include "support/fs_extras.h"
#include "support/lyxlib.h"
using std::istream_iterator;
-extern BufferList bufferlist;
// this should be static, but I need it in buffer.C
bool quitting; // flag, that we are quitting the program
lyxerr[Debug::INFO] << "Running QuitLyX." << endl;
if (lyx_gui::use_gui) {
- if (!noask && !bufferlist.quitWriteAll())
+ if (!noask && !theApp->bufferList().quitWriteAll())
return;
LyX::cref().session().writeFile();
quitting = true;
// close buffers first
- bufferlist.closeAll();
+ theApp->bufferList().closeAll();
// do any other cleanup procedures now
lyxerr[Debug::INFO] << "Deleting tmp dir " << package().temp_dir() << endl;
Alert::warning(_("Unable to remove temporary directory"), msg);
}
- lyx_gui::exit(0);
+ theApp->exit(0);
+ // Restore original font resources after Application is destroyed.
+ lyx::support::restoreFontResources();
}
// should probably be moved into BufferList (Lgb)
// Perfect target for a thread...
{
- if (!bv->available())
+ if (!bv->buffer())
return;
if (bv->buffer()->isBakClean() || bv->buffer()->isReadonly()) {
// We don't save now, but we'll try again later
- bv->owner()->resetAutosaveTimer();
+ bv->buffer()->resetAutosaveTimers();
return;
}
autosave.start();
bv->buffer()->markBakClean();
- bv->owner()->resetAutosaveTimer();
+ bv->buffer()->resetAutosaveTimers();
}
// Insert ascii file (if filename is empty, prompt for one)
void insertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
{
- if (!bv->available())
+ if (!bv->buffer())
return;
// FIXME: We don't know the encoding of the file
return;
// clear the selection
- if (bv->text() == bv->getLyXText())
+ LyXText const & text = bv->buffer()->text();
+ if (&text == bv->getLyXText())
bv->cursor().clearSelection();
if (asParagraph)
bv->getLyXText()->insertStringAsParagraphs(bv->cursor(), tmpstr);
(asParagraph) ? LFUN_FILE_INSERT_ASCII_PARA : LFUN_FILE_INSERT_ASCII);
FileDialog::Result result =
- fileDlg.open(bv->owner()->buffer()->filePath(),
+ fileDlg.open(bv->buffer()->filePath(),
FileFilterList(), string());
if (result.first == FileDialog::Later)