#endif
#include "BufferView_pimpl.h"
-#include "WorkArea.h"
-#include "lyxscreen.h"
+#include "frontends/WorkArea.h"
+#include "frontends/screen.h"
#include "lyxtext.h"
#include "lyxrow.h"
#include "paragraph.h"
-#include "LyXView.h"
+#include "frontends/LyXView.h"
#include "commandtags.h"
#include "lyxfunc.h"
#include "debug.h"
-#include "font.h"
#include "bufferview_funcs.h"
#include "TextCache.h"
#include "bufferlist.h"
#include "support/filetools.h"
#include "support/lyxfunctional.h"
+#include <boost/bind.hpp>
+
#include <ctime>
#include <unistd.h>
#include <sys/wait.h>
using std::endl;
using std::make_pair;
using std::min;
-using SigC::slot;
using lyx::pos_type;
using lyx::textclass_type;
inset_slept(false)
{
// Setup the signals
- workarea_.scrollCB.connect(slot(this, &BufferView::Pimpl::scrollCB));
+ workarea_.scrollCB.connect(boost::bind(&BufferView::Pimpl::scrollCB, this, _1));
workarea_.workAreaExpose
- .connect(slot(this, &BufferView::Pimpl::workAreaExpose));
+ .connect(boost::bind(&BufferView::Pimpl::workAreaExpose, this));
workarea_.workAreaEnter
- .connect(slot(this, &BufferView::Pimpl::enterView));
+ .connect(boost::bind(&BufferView::Pimpl::enterView, this));
workarea_.workAreaLeave
- .connect(slot(this, &BufferView::Pimpl::leaveView));
+ .connect(boost::bind(&BufferView::Pimpl::leaveView, this));
workarea_.workAreaButtonPress
- .connect(slot(this, &BufferView::Pimpl::workAreaButtonPress));
+ .connect(boost::bind(&BufferView::Pimpl::workAreaButtonPress, this, _1, _2, _3));
workarea_.workAreaButtonRelease
- .connect(slot(this,
- &BufferView::Pimpl::workAreaButtonRelease));
+ .connect(boost::bind(&BufferView::Pimpl::workAreaButtonRelease, this, _1, _2, _3));
workarea_.workAreaMotionNotify
- .connect(slot(this, &BufferView::Pimpl::workAreaMotionNotify));
+ .connect(boost::bind(&BufferView::Pimpl::workAreaMotionNotify, this, _1, _2, _3));
workarea_.workAreaDoubleClick
- .connect(slot(this, &BufferView::Pimpl::doubleClick));
+ .connect(boost::bind(&BufferView::Pimpl::doubleClick, this, _1, _2, _3));
workarea_.workAreaTripleClick
- .connect(slot(this, &BufferView::Pimpl::tripleClick));
+ .connect(boost::bind(&BufferView::Pimpl::tripleClick, this, _1, _2, _3));
workarea_.workAreaKeyPress
- .connect(slot(this, &BufferView::Pimpl::workAreaKeyPress));
+ .connect(boost::bind(&BufferView::Pimpl::workAreaKeyPress, this, _1, _2));
workarea_.selectionRequested
- .connect(slot(this, &BufferView::Pimpl::selectionRequested));
+ .connect(boost::bind(&BufferView::Pimpl::selectionRequested, this));
workarea_.selectionLost
- .connect(slot(this, &BufferView::Pimpl::selectionLost));
+ .connect(boost::bind(&BufferView::Pimpl::selectionLost, this));
- cursor_timeout.timeout.connect(slot(this,
- &BufferView::Pimpl::cursorToggle));
+ cursor_timeout.timeout.connect(boost::bind(&BufferView::Pimpl::cursorToggle, this));
cursor_timeout.start();
workarea_.setFocus();
saved_positions.resize(saved_positions_num);
}
-void BufferView::Pimpl::workAreaKeyPress(KeySym keysym, unsigned int state)
+void BufferView::Pimpl::workAreaKeyPress(KeySym keysym, key_modifier::state state)
{
bv_->owner()->getLyXFunc()->processKeySym(keysym, state);
}
-void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
+void BufferView::Pimpl::workAreaMotionNotify(int x, int y, mouse_button::state state)
{
// Only use motion with button 1
- if (!(state & Button1MotionMask))
+ if (!(state & mouse_button::button1))
return;
if (!buffer_ || !screen_.get()) return;
// Single-click on work area
void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
- unsigned int button)
+ mouse_button::state button)
{
if (!buffer_ || !screen_.get())
return;
// ok ok, this is a hack.
- // Why??? (Jug20020424)
- if (button == 4 || button == 5) {
- switch (button) {
- case 4:
- scrollUp(lyxrc.wheel_jump); // default 100, set in lyxrc
- break;
- case 5:
- scrollDown(lyxrc.wheel_jump);
- break;
- }
+
+ if (button == mouse_button::button4) {
+ scrollUp(lyxrc.wheel_jump);
+ // We shouldn't go further down as we really should only do the
+ // scrolling and be done with this. Otherwise we may open some
+ // dialogs (Jug 20020424).
+ return;
+ } else if (button == mouse_button::button5) {
+ scrollDown(lyxrc.wheel_jump);
// We shouldn't go further down as we really should only do the
// scrolling and be done with this. Otherwise we may open some
// dialogs (Jug 20020424).
// it could get cleared on the unlocking of the inset so
// we have to check this first
bool paste_internally = false;
- if (button == 2 && bv_->getLyXText()->selection.set()) {
+ if (button == mouse_button::button2 && bv_->getLyXText()->selection.set()) {
owner_->getLyXFunc()->dispatch(LFUN_COPY);
paste_internally = true;
}
// I'm not sure we should continue here if we hit an inset (Jug20020403)
// Right click on a footnote flag opens float menu
- if (button == 3) {
+ if (button == mouse_button::button3) {
selection_possible = false;
return;
}
// Insert primary selection with middle mouse
// if there is a local selection in the current buffer,
// insert this
- if (button == 2) {
+ if (button == mouse_button::button2) {
if (paste_internally)
owner_->getLyXFunc()->dispatch(LFUN_PASTE);
else
}
-void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button)
+void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, mouse_button::state button)
{
- // select a word
if (!buffer_)
return;
if (text->bv_owner && bv_->theLockingInset())
return;
- if (screen_.get() && button == 1) {
+ if (screen_.get() && button == mouse_button::button1) {
if (text->bv_owner) {
screen_->hideCursor();
screen_->toggleSelection(text, bv_);
}
-void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button)
+void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, mouse_button::state button)
{
- // select a line
if (!buffer_)
return;
if (text->bv_owner && bv_->theLockingInset())
return;
- if (screen_.get() && (button == 1)) {
+ if (screen_.get() && (button == mouse_button::button1)) {
if (text->bv_owner) {
screen_->hideCursor();
screen_->toggleSelection(text, bv_);
void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
- unsigned int button)
+ mouse_button::state button)
{
// do nothing if we used the mouse wheel
- if (!buffer_ || !screen_.get() || button == 4 || button == 5)
+ if (!buffer_ || !screen_.get() || button == mouse_button::button4 || button == mouse_button::button5)
return;
// If we hit an inset, we have the inset coordinates in these
selection_possible = false;
- if (button == 2)
+ if (button == mouse_button::button2)
return;
// finish selection
- if (button == 1) {
+ if (button == mouse_button::button1) {
workarea_.haveSelection(bv_->getLyXText()->selection.set());
}
// Maybe we want to edit a bibitem ale970302
if (bv_->text->cursor.par()->bibkey && x < 20 +
bibitemMaxWidth(bv_, textclasslist[buffer_->params.textclass].defaultfont())) {
- bv_->text->cursor.par()->bibkey->edit(bv_, 0, 0, 0);
+ bv_->text->cursor.par()->bibkey->edit(bv_, 0, 0, mouse_button::none);
}
return;