#include <boost/bind.hpp>
+
+namespace lyx {
+
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
string current_layout;
-LyXView::LyXView()
- : work_area_(0),
+LyXView::LyXView(int id)
+ : id_(id), work_area_(0),
toolbars_(new Toolbars(*this)),
autosave_timeout_(new Timeout(5000)),
dialogs_(new Dialogs(*this)),
}
+// FIXME, there's only one WorkArea per LyXView possible for now.
void LyXView::setWorkArea(WorkArea * work_area)
{
work_area_ = work_area;
-}
-
-
-void LyXView::redrawWorkArea()
-{
- work_area_->redraw();
- updateStatusBar();
-}
-
-
-WorkArea * LyXView::workArea()
-{
- return work_area_;
+ work_area_ids_.clear();
+ work_area_ids_.push_back(work_area_->id());
}
connectBuffer(*work_area_->bufferView().buffer());
}
+ if (quitting)
+ return;
+
updateMenubar();
updateToolbars();
updateLayoutChoice();
updateWindowTitle();
- redrawWorkArea();
+ updateStatusBar();
+ work_area_->redraw();
}
connectBuffer(*work_area_->bufferView().buffer());
showErrorList("Parse");
}
- redrawWorkArea();
+ updateStatusBar();
+ work_area_->redraw();
return loaded;
}
if (errorsConnection_.connected())
disconnectBuffer();
+ bufferChangedConnection_ =
+ buf.changed.connect(
+ boost::bind(&WorkArea::redraw, work_area_));
+
errorsConnection_ =
buf.errors.connect(
boost::bind(&LyXView::showErrorList, this, _1));
void LyXView::disconnectBuffer()
{
+ errorsConnection_.disconnect();
+ bufferChangedConnection_.disconnect();
messageConnection_.disconnect();
busyConnection_.disconnect();
titleConnection_.disconnect();
}
-void LyXView::showDialogWithData(string const & name,
- string const & data)
+void LyXView::showDialogWithData(string const & name, string const & data)
{
getDialogs().show(name, data);
}
void LyXView::showInsetDialog(string const & name, string const & data,
- InsetBase * inset)
+ InsetBase * inset)
{
getDialogs().show(name, data, inset);
}
{
bool const math = work_area_->bufferView().cursor().inMathed();
bool const table =
- getLyXFunc().getStatus(FuncRequest(LFUN_LAYOUT_TABULAR)).enabled();
+ lyx::getStatus(FuncRequest(LFUN_LAYOUT_TABULAR)).enabled();
toolbars_->update(math, table);
// update redaonly status of open dialogs. This could also be in
// updateMenubar(), but since updateToolbars() and updateMenubar()
{
lyxerr[Debug::INFO] << "Running autoSave()" << endl;
- if (view()->buffer()) {
- ::autoSave(view());
- }
+ if (view()->buffer())
+ lyx::autoSave(view());
}
if (view()->buffer()) {
string const cur_title = buffer()->fileName();
if (!cur_title.empty()) {
- maximize_title += lyx::from_ascii(": ") + makeDisplayPath(cur_title, 30);
+ maximize_title += ": " + makeDisplayPath(cur_title, 30);
minimize_title = lyx::from_utf8(onlyFilename(cur_title));
if (!buffer()->isClean()) {
maximize_title += _(" (changed)");
void LyXView::dispatch(FuncRequest const & cmd)
{
- getLyXFunc().dispatch(cmd);
+ if (cmd.action == LFUN_WINDOW_CLOSE) {
+ close();
+ closed(id_);
+ return;
+ }
+
+ theLyXFunc().setLyXView(this);
+ lyx::dispatch(cmd);
}
}
return buffer_ptr;
}
+
+
+} // namespace lyx