#include "frontends/Application.h"
#include "frontends/FontMetrics.h"
#include "frontends/LyXView.h"
+#include "frontends/WorkAreaManager.h"
#include "BufferView.h"
#include "Buffer.h"
#include "BufferParams.h"
-#include "Color.h"
#include "CoordCache.h"
#include "Cursor.h"
#include "debug.h"
: buffer_view_(new BufferView(buffer)), lyx_view_(&lv),
cursor_visible_(false), cursor_timeout_(400)
{
+ buffer.workAreaManager().add(this);
// Setup the signals
timecon = cursor_timeout_.timeout
.connect(boost::bind(&WorkArea::toggleCursor, this));
- bufferChangedConnection_ =
- buffer.changed.connect(
- boost::bind(&WorkArea::redraw, this));
-
- bufferClosingConnection_ =
- buffer.closing.connect(
- boost::bind(&WorkArea::close, this));
-
cursor_timeout_.start();
}
WorkArea::~WorkArea()
{
- bufferChangedConnection_.disconnect();
- bufferClosingConnection_.disconnect();
-
+ buffer_view_->buffer().workAreaManager().remove(this);
delete buffer_view_;
}
}
-void WorkArea::processKeySym(KeySymbol const & key, key_modifier::state state)
+void WorkArea::processKeySym(KeySymbol const & key, KeyModifier mod)
{
// In order to avoid bad surprise in the middle of an operation, we better stop
// the blinking cursor.
stopBlinkingCursor();
theLyXFunc().setLyXView(lyx_view_);
- theLyXFunc().processKeySym(key, state);
+ theLyXFunc().processKeySym(key, mod);
}
-void WorkArea::dispatch(FuncRequest const & cmd0, key_modifier::state k)
+void WorkArea::dispatch(FuncRequest const & cmd0, KeyModifier mod)
{
// Handle drag&drop
if (cmd0.action == LFUN_FILE_OPEN) {
FuncRequest cmd;
if (cmd0.action == LFUN_MOUSE_PRESS) {
- if (k == key_modifier::shift)
+ if (mod == ShiftModifier)
cmd = FuncRequest(cmd0, "region-select");
- else if (k == key_modifier::ctrl)
+ else if (mod == ControlModifier)
cmd = FuncRequest(cmd0, "paragraph-select");
else
cmd = cmd0;
&& cmd.button() == mouse_button::none))
stopBlinkingCursor();
- bool const needRedraw = buffer_view_->workAreaDispatch(cmd);
-
- if (needRedraw)
- buffer_view_->buffer().changed();
+ buffer_view_->mouseEventDispatch(cmd);
// Skip these when selecting
if (cmd.action != LFUN_MOUSE_MOTION) {
{
// WARNING: Please don't put any code that will trigger a repaint here!
// We are already inside a paint event.
- lyx_view_->busy(true);
+ lyx_view_->setBusy(true);
buffer_view_->resize(width(), height());
lyx_view_->updateLayoutChoice();
- lyx_view_->busy(false);
+ lyx_view_->setBusy(false);
}