#include "gettext.h"
#include "lyxfunc.h"
#include "BufferView.h"
+#include "lyxtextclasslist.h"
#include "frontends/Dialogs.h"
#include "frontends/Toolbar.h"
+#include "frontends/Timeout.h"
#include "frontends/Menubar.h"
#include "support/filetools.h" // OnlyFilename()
#include <unistd.h>
using std::endl;
-using lyx::layout_type;
extern void AutoSave(BufferView *);
extern void QuitLyX();
-layout_type current_layout = 0;
+string current_layout;
LyXView::LyXView()
intl = new Intl;
+ // Give the timeout some default sensible value.
+ autosave_timeout = new Timeout(5000);
+
dialogs_ = new Dialogs(this);
- // temporary until all dialogs moved into Dialogs.
- dialogs_->updateBufferDependent
- .connect(SigC::slot(&updateAllVisibleBufferRelatedDialogs));
dialogs_->hideBufferDependent
.connect(SigC::slot(&CloseAllBufferRelatedDialogs));
Dialogs::redrawGUI.connect(SigC::slot(this, &LyXView::redraw));
delete minibuffer;
delete lyxfunc;
delete intl;
+ delete autosave_timeout;
delete dialogs_;
}
}
-void LyXView::setLayout(layout_type layout)
+void LyXView::setLayout(string const & layout)
{
toolbar->setLayout(layout);
}
void LyXView::updateToolbar()
{
toolbar->update();
- menubar->update();
}
menubar->set("main_nobuffer");
else
menubar->set("main");
+ menubar->update();
}
void LyXView::resetAutosaveTimer()
{
if (lyxrc.autosave)
- autosave_timeout.restart();
+ autosave_timeout->restart();
}
if (last_textclass != int(buffer()->params.textclass)) {
toolbar->updateLayoutList(true);
last_textclass = int(buffer()->params.textclass);
- current_layout = 0;
+ current_layout = textclasslist[last_textclass].defaultLayoutName();
} else {
toolbar->updateLayoutList(false);
}
-
- layout_type layout = bufferview->getLyXText()->cursor.par()->getLayout();
+
+ string const & layout =
+ bufferview->getLyXText()->cursor.par()->layout();
if (layout != current_layout) {
toolbar->setLayout(layout);
if (view()->available()) {
string const cur_title = buffer()->fileName();
- if (!cur_title.empty()){
+ if (!cur_title.empty()) {
title += ": " + MakeDisplayPath(cur_title, 30);
if (!buffer()->isLyxClean())
title += _(" (Changed)");
void LyXView::showState()
{
message(currentState(view()));
- getToolbar()->update();
- menubar->update();
}