#include "frontends/alert.h"
#include "frontends/Application.h"
-#include "frontends/NoGuiFontLoader.h"
-#include "frontends/NoGuiFontMetrics.h"
#include "frontends/FontLoader.h"
#include "frontends/FontMetrics.h"
#include "support/ExceptionMessage.h"
#include "support/FileName.h"
+#include "support/ForkedCalls.h"
#include "support/lstrings.h"
#include "support/os.h"
#include "support/Package.h"
if (lyxrc.typewriter_font_name.empty())
lyxrc.typewriter_font_name = fromqstr(typewriterFontName());
+
+ general_timer_.setInterval(500);
+ connect(&general_timer_, SIGNAL(timeout()),
+ this, SLOT(handleRegularEvents()));
+ general_timer_.start();
}
}
+void GuiApplication::restoreGuiSession()
+{
+ if (!lyxrc.load_session)
+ return;
+
+ Session & session = LyX::ref().session();
+ vector<FileName> const & lastopened = session.lastOpened().getfiles();
+ // do not add to the lastfile list since these files are restored from
+ // last session, and should be already there (regular files), or should
+ // not be added at all (help files).
+ for_each(lastopened.begin(), lastopened.end(),
+ bind(&GuiView::loadDocument, current_view_, _1, false));
+
+ // clear this list to save a few bytes of RAM
+ session.lastOpened().clear();
+}
+
+
QString const GuiApplication::romanFontName()
{
QFont font;
}
+void GuiApplication::handleRegularEvents()
+{
+ ForkedCallsController::handleCompletedProcesses();
+}
+
+
bool GuiApplication::event(QEvent * e)
{
switch(e->type()) {
// So we acknowledge the event and delay the file opening
// until LyX is ready.
// FIXME UNICODE: FileName accept an utf8 encoded string.
- LyX::ref().addFileToLoad(FileName(fromqstr(foe->file())));
+ LyX::ref().addFileToLoad(fromqstr(foe->file()));
else
lyx::dispatch(FuncRequest(LFUN_FILE_OPEN,
qstring_to_ucs4(foe->file())));
frontend::FontLoader & theFontLoader()
{
- static frontend::NoGuiFontLoader no_gui_font_loader;
-
- if (!use_gui)
- return no_gui_font_loader;
-
BOOST_ASSERT(frontend::guiApp);
return frontend::guiApp->fontLoader();
}
frontend::FontMetrics const & theFontMetrics(FontInfo const & f)
{
- static frontend::NoGuiFontMetrics no_gui_font_metrics;
-
- if (!use_gui)
- return no_gui_font_metrics;
-
BOOST_ASSERT(frontend::guiApp);
return frontend::guiApp->fontLoader().metrics(f);
}