mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
* frontends/WorkArea.h(workAreaResize, scrollDocView, workAreaKeyPress,
dispatch, selectionReuqested, selectionLost): remove signals * BufferView.[Ch] (selectionRequested, selectionLost, workAreaResize, workAreaKeyPress, workAreaDispatch): add forwarding functions to the pimpl * BufferView_pimpl.C (Pimpl): Remove the setup of the now deleted signals, also remove corresponding connection objects. * frontends/xforms/XWorkArea.h: * frontends/qt2/QWorkArea.h: * frontends/qt4/QWorkArea.h: * frontends/gtk/GWorkArea.h: add LyXView as class variable view_ (qt classes also get view() medthod) * frontends/qt2/QWorkArea.C: * frontends/qt2/QContentPane.C: * frontends/qt4/QWorkArea.C: * frontends/xforms/XWorkArea.C: * frontends/gtk/GWorkArea.C: Change from calling signals to call the functions directly through view_.view() git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13671 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b5cdc90ef9
commit
67d576f75e
@ -235,6 +235,36 @@ bool BufferView::dispatch(FuncRequest const & ev)
|
||||
}
|
||||
|
||||
|
||||
void BufferView::selectionRequested()
|
||||
{
|
||||
pimpl_->selectionRequested();
|
||||
}
|
||||
|
||||
|
||||
void BufferView::selectionLost()
|
||||
{
|
||||
pimpl_->selectionLost();
|
||||
}
|
||||
|
||||
|
||||
void BufferView::workAreaResize()
|
||||
{
|
||||
pimpl_->workAreaResize();
|
||||
}
|
||||
|
||||
|
||||
void BufferView::workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state)
|
||||
{
|
||||
pimpl_->workAreaKeyPress(key, state);
|
||||
}
|
||||
|
||||
|
||||
bool BufferView::workAreaDispatch(FuncRequest const & ev)
|
||||
{
|
||||
return pimpl_->workAreaDispatch(ev);
|
||||
}
|
||||
|
||||
|
||||
void BufferView::scroll(int lines)
|
||||
{
|
||||
pimpl_->scroll(lines);
|
||||
|
@ -15,6 +15,8 @@
|
||||
#ifndef BUFFER_VIEW_H
|
||||
#define BUFFER_VIEW_H
|
||||
|
||||
#include "frontends/LyXKeySym.h"
|
||||
|
||||
#include "support/types.h"
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
@ -175,6 +177,20 @@ public:
|
||||
/// execute the given function
|
||||
bool dispatch(FuncRequest const & argument);
|
||||
|
||||
///
|
||||
void selectionRequested();
|
||||
///
|
||||
void selectionLost();
|
||||
|
||||
///
|
||||
void workAreaResize();
|
||||
|
||||
/// Receive a keypress
|
||||
void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
|
||||
|
||||
/// a function should be executed from the workarea
|
||||
bool workAreaDispatch(FuncRequest const & ev);
|
||||
|
||||
/// clear the X selection
|
||||
void unsetXSel();
|
||||
|
||||
|
@ -116,14 +116,7 @@ unsigned int const saved_positions_num = 20;
|
||||
// to these connections we avoid a segfault upon startup, and also at exit.
|
||||
// (Lgb)
|
||||
|
||||
boost::signals::connection dispatchcon;
|
||||
boost::signals::connection timecon;
|
||||
boost::signals::connection doccon;
|
||||
boost::signals::connection resizecon;
|
||||
boost::signals::connection kpresscon;
|
||||
boost::signals::connection selectioncon;
|
||||
boost::signals::connection lostcon;
|
||||
|
||||
|
||||
/// Return an inset of this class if it exists at the current cursor position
|
||||
template <class T>
|
||||
@ -153,22 +146,11 @@ BufferView::Pimpl::Pimpl(BufferView & bv, LyXView * owner,
|
||||
screen_.reset(LyXScreenFactory::create(workarea()));
|
||||
|
||||
// Setup the signals
|
||||
doccon = workarea().scrollDocView
|
||||
.connect(boost::bind(&BufferView::Pimpl::scrollDocView, this, _1));
|
||||
resizecon = workarea().workAreaResize
|
||||
.connect(boost::bind(&BufferView::Pimpl::workAreaResize, this));
|
||||
dispatchcon = workarea().dispatch
|
||||
.connect(boost::bind(&BufferView::Pimpl::workAreaDispatch, this, _1));
|
||||
kpresscon = workarea().workAreaKeyPress
|
||||
.connect(boost::bind(&BufferView::Pimpl::workAreaKeyPress, this, _1, _2));
|
||||
selectioncon = workarea().selectionRequested
|
||||
.connect(boost::bind(&BufferView::Pimpl::selectionRequested, this));
|
||||
lostcon = workarea().selectionLost
|
||||
.connect(boost::bind(&BufferView::Pimpl::selectionLost, this));
|
||||
|
||||
timecon = cursor_timeout.timeout
|
||||
.connect(boost::bind(&BufferView::Pimpl::cursorToggle, this));
|
||||
|
||||
cursor_timeout.start();
|
||||
|
||||
saved_positions.resize(saved_positions_num);
|
||||
// load saved bookmarks
|
||||
lyx::Session::BookmarkList & bmList = LyX::ref().session().loadBookmarks();
|
||||
|
@ -58,19 +58,6 @@ public:
|
||||
virtual std::string const getClipboard() const = 0;
|
||||
/// fill the clipboard
|
||||
virtual void putClipboard(std::string const &) const = 0;
|
||||
|
||||
/// work area dimensions have changed
|
||||
boost::signal<void()> workAreaResize;
|
||||
/// the scrollbar has changed
|
||||
boost::signal<void(int)> scrollDocView;
|
||||
/// a key combination has been pressed
|
||||
boost::signal<void(LyXKeySymPtr, key_modifier::state)> workAreaKeyPress;
|
||||
/// some mouse event
|
||||
boost::signal<void(FuncRequest)> dispatch;
|
||||
/// emitted when an X client has requested our selection
|
||||
boost::signal<void()> selectionRequested;
|
||||
/// emitted when another X client has stolen our selection
|
||||
boost::signal<void()> selectionLost;
|
||||
};
|
||||
|
||||
#endif // WORKAREA_H
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "GtkmmX.h"
|
||||
#include "GLyXKeySym.h"
|
||||
|
||||
#include "BufferView.h"
|
||||
#include "debug.h"
|
||||
#include "funcrequest.h"
|
||||
#include "LColor.h"
|
||||
@ -172,7 +173,7 @@ void inputCommitRelay(GtkIMContext */*imcontext*/, gchar * str, GWorkArea * area
|
||||
|
||||
|
||||
GWorkArea::GWorkArea(LyXView & owner, int width, int height)
|
||||
: workAreaPixmap_(0), painter_(*this), draw_(0), colorHandler_(*this),
|
||||
: view_(owner), workAreaPixmap_(0), painter_(*this), draw_(0), colorHandler_(*this),
|
||||
adjusting_(false)
|
||||
{
|
||||
workArea_.set_size_request(width, height);
|
||||
@ -331,7 +332,7 @@ bool GWorkArea::onConfigure(GdkEventConfigure * /*event*/)
|
||||
gtk_im_context_set_client_window(
|
||||
imContext_, workArea_.get_window()->gobj());
|
||||
}
|
||||
workAreaResize();
|
||||
view_.view()->workAreaResize();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -374,7 +375,7 @@ void GWorkArea::onScroll()
|
||||
adjusting_ = true;
|
||||
|
||||
double val = vscrollbar_.get_adjustment()->get_value();
|
||||
scrollDocView(static_cast<int>(val));
|
||||
view_.view()->scrollDocView(static_cast<int>(val));
|
||||
adjusting_ = false;
|
||||
}
|
||||
|
||||
@ -420,7 +421,7 @@ bool GWorkArea::onButtonPress(GdkEventButton * event)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
dispatch(FuncRequest(ka,
|
||||
view_.view()->workAreaDispatch(FuncRequest(ka,
|
||||
static_cast<int>(event->x),
|
||||
static_cast<int>(event->y),
|
||||
gButtonToLyx(event->button)));
|
||||
@ -431,7 +432,7 @@ bool GWorkArea::onButtonPress(GdkEventButton * event)
|
||||
|
||||
bool GWorkArea::onButtonRelease(GdkEventButton * event)
|
||||
{
|
||||
dispatch(FuncRequest(LFUN_MOUSE_RELEASE,
|
||||
view_.view()->workAreaDispatch(FuncRequest(LFUN_MOUSE_RELEASE,
|
||||
static_cast<int>(event->x),
|
||||
static_cast<int>(event->y),
|
||||
gButtonToLyx(event->button)));
|
||||
@ -456,7 +457,7 @@ bool GWorkArea::onMotionNotify(GdkEventMotion * event)
|
||||
}
|
||||
timeBefore = event->time;
|
||||
}
|
||||
dispatch(FuncRequest(LFUN_MOUSE_MOTION,
|
||||
view_.view()->workAreaDispatch(FuncRequest(LFUN_MOUSE_MOTION,
|
||||
static_cast<int>(event->x),
|
||||
static_cast<int>(event->y),
|
||||
gtkButtonState(event->state)));
|
||||
@ -480,7 +481,7 @@ bool GWorkArea::onKeyPress(GdkEventKey * event)
|
||||
!inputGet) {
|
||||
#endif
|
||||
GLyXKeySym *glk = new GLyXKeySym(event->keyval);
|
||||
workAreaKeyPress(LyXKeySymPtr(glk),
|
||||
view_.view()->workAreaKeyPress(LyXKeySymPtr(glk),
|
||||
gtkKeyState(event->state));
|
||||
#ifdef I18N
|
||||
} else if (!inputCache_.empty())
|
||||
@ -493,7 +494,7 @@ bool GWorkArea::onKeyPress(GdkEventKey * event)
|
||||
void GWorkArea::onClipboardGet(Gtk::SelectionData & /*selection_data*/,
|
||||
guint /*info*/)
|
||||
{
|
||||
selectionRequested();
|
||||
view_.view()->selectionRequested();
|
||||
}
|
||||
|
||||
|
||||
@ -519,7 +520,7 @@ void GWorkArea::haveSelection(bool toHave) const
|
||||
}
|
||||
|
||||
|
||||
// ENCODING: Gtk::Clipboard returns UTF-8, we assume that the backend
|
||||
// ENCODING: Gtk::Clipboard returns UTF-8, we assume that the backend
|
||||
// wants ISO-8859-1 and convert it to that.
|
||||
string const GWorkArea::getClipboard() const
|
||||
{
|
||||
@ -530,7 +531,7 @@ string const GWorkArea::getClipboard() const
|
||||
}
|
||||
|
||||
|
||||
// ENCODING: we assume that the backend passes us ISO-8859-1 and
|
||||
// ENCODING: we assume that the backend passes us ISO-8859-1 and
|
||||
// convert from that to UTF-8 before passing to GTK
|
||||
void GWorkArea::putClipboard(string const & str) const
|
||||
{
|
||||
|
@ -97,6 +97,7 @@ private:
|
||||
bool onKeyPress(GdkEventKey * event);
|
||||
void onClipboardGet(Gtk::SelectionData & selection_data, guint info);
|
||||
void onClipboardClear();
|
||||
LyXView & view_;
|
||||
Gtk::HBox hbox_;
|
||||
Gtk::DrawingArea workArea_;
|
||||
Gtk::VScrollbar vscrollbar_;
|
||||
|
@ -10,6 +10,9 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "BufferView.h"
|
||||
#include "frontends/LyXView.h"
|
||||
|
||||
// Qt defines a macro 'signals' that clashes with a boost namespace.
|
||||
// All is well if the namespace is visible first.
|
||||
#include "QWorkArea.h"
|
||||
@ -155,7 +158,7 @@ void QContentPane::generateSyntheticMouseEvent()
|
||||
synthetic_mouse_event_.scrollbar_value_old = scrollbar_value;
|
||||
|
||||
// ... and dispatch the event to the LyX core.
|
||||
wa_->dispatch(synthetic_mouse_event_.cmd);
|
||||
wa_->view().view()->workAreaDispatch(synthetic_mouse_event_.cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +166,7 @@ void QContentPane::generateSyntheticMouseEvent()
|
||||
void QContentPane::scrollBarChanged(int val)
|
||||
{
|
||||
if (track_scrollbar_)
|
||||
wa_->scrollDocView(val);
|
||||
wa_->view().view()->scrollDocView(val);
|
||||
}
|
||||
|
||||
|
||||
@ -174,13 +177,13 @@ void QContentPane::mousePressEvent(QMouseEvent * e)
|
||||
FuncRequest cmd(LFUN_MOUSE_TRIPLE,
|
||||
dc_event_.x, dc_event_.y,
|
||||
q_button_state(dc_event_.state));
|
||||
wa_->dispatch(cmd);
|
||||
wa_->view().view()->workAreaDispatch(cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
FuncRequest const cmd(LFUN_MOUSE_PRESS, e->x(), e->y(),
|
||||
q_button_state(e->button()));
|
||||
wa_->dispatch(cmd);
|
||||
wa_->view().view()->workAreaDispatch(cmd);
|
||||
}
|
||||
|
||||
|
||||
@ -191,7 +194,7 @@ void QContentPane::mouseReleaseEvent(QMouseEvent * e)
|
||||
|
||||
FuncRequest const cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(),
|
||||
q_button_state(e->button()));
|
||||
wa_->dispatch(cmd);
|
||||
wa_->view().view()->workAreaDispatch(cmd);
|
||||
}
|
||||
|
||||
|
||||
@ -251,7 +254,7 @@ void QContentPane::mouseMoveEvent(QMouseEvent * e)
|
||||
synthetic_mouse_event_.scrollbar_value_old = scrollbar_value;
|
||||
|
||||
// ... and dispatch the event to the LyX core.
|
||||
wa_->dispatch(cmd);
|
||||
wa_->view().view()->workAreaDispatch(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -289,7 +292,7 @@ void QContentPane::keyeventTimeout()
|
||||
boost::shared_ptr<QLyXKeySym> sym(new QLyXKeySym);
|
||||
sym->set(ev.get());
|
||||
|
||||
wa_->workAreaKeyPress(sym, q_key_state(ev->state()));
|
||||
wa_->view().view()->workAreaKeyPress(sym, q_key_state(ev->state()));
|
||||
keyeventQueue_.pop();
|
||||
|
||||
handle_autos = false;
|
||||
@ -310,7 +313,7 @@ void QContentPane::doubleClickTimeout()
|
||||
FuncRequest cmd(LFUN_MOUSE_DOUBLE,
|
||||
dc_event_.x, dc_event_.y,
|
||||
q_button_state(dc_event_.state));
|
||||
wa_->dispatch(cmd);
|
||||
wa_->view().view()->workAreaDispatch(cmd);
|
||||
}
|
||||
|
||||
|
||||
@ -331,7 +334,7 @@ void QContentPane::resizeEvent(QResizeEvent *)
|
||||
}
|
||||
|
||||
pixmap_->resize(width(), height());
|
||||
wa_->workAreaResize();
|
||||
wa_->view().view()->workAreaResize();
|
||||
}
|
||||
|
||||
|
||||
@ -339,7 +342,7 @@ void QContentPane::paintEvent(QPaintEvent * e)
|
||||
{
|
||||
if (!pixmap_.get()) {
|
||||
pixmap_.reset(new QPixmap(width(), height()));
|
||||
wa_->workAreaResize();
|
||||
wa_->view().view()->workAreaResize();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,9 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "frontends/LyXView.h"
|
||||
#include "BufferView.h"
|
||||
|
||||
#include "QWorkArea.h"
|
||||
|
||||
#include "lcolorcache.h"
|
||||
@ -46,11 +49,11 @@ using std::string;
|
||||
namespace os = lyx::support::os;
|
||||
|
||||
namespace {
|
||||
QWorkArea const * wa_ptr = 0;
|
||||
QWorkArea * wa_ptr = 0;
|
||||
}
|
||||
|
||||
QWorkArea::QWorkArea(LyXView &, int, int)
|
||||
: WorkArea(), QWidget(qApp->mainWidget()), painter_(*this)
|
||||
QWorkArea::QWorkArea(LyXView & owner, int, int)
|
||||
: WorkArea(), QWidget(qApp->mainWidget()), owner_(owner), painter_(*this)
|
||||
{
|
||||
scrollbar_ = new QScrollBar(QScrollBar::Vertical, this);
|
||||
content_ = new QContentPane(this);
|
||||
@ -103,12 +106,12 @@ bool lyxX11EventFilter(XEvent * xev)
|
||||
case SelectionRequest:
|
||||
lyxerr[Debug::GUI] << "X requested selection." << endl;
|
||||
if (wa_ptr)
|
||||
wa_ptr->selectionRequested();
|
||||
wa_ptr->view().view()->selectionRequested();
|
||||
break;
|
||||
case SelectionClear:
|
||||
lyxerr[Debug::GUI] << "Lost selection." << endl;
|
||||
if (wa_ptr)
|
||||
wa_ptr->selectionLost();
|
||||
wa_ptr->view().view()->selectionLost();
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
@ -183,7 +186,7 @@ pascal OSErr handleOpenDocuments(const AppleEvent* inEvent,
|
||||
|
||||
void QWorkArea::haveSelection(bool own) const
|
||||
{
|
||||
wa_ptr = this;
|
||||
wa_ptr = const_cast<QWorkArea*>(this);
|
||||
|
||||
if (!QApplication::clipboard()->supportsSelection())
|
||||
return;
|
||||
@ -230,7 +233,7 @@ void QWorkArea::dragEnterEvent(QDragEnterEvent * event)
|
||||
}
|
||||
|
||||
|
||||
void QWorkArea::dropEvent(QDropEvent* event)
|
||||
void QWorkArea::dropEvent(QDropEvent * event)
|
||||
{
|
||||
QStringList files;
|
||||
|
||||
@ -238,9 +241,9 @@ void QWorkArea::dropEvent(QDropEvent* event)
|
||||
lyxerr[Debug::GUI] << "QWorkArea::dropEvent: got URIs!"
|
||||
<< endl;
|
||||
for (QStringList::Iterator i = files.begin();
|
||||
i!=files.end(); ++i) {
|
||||
i != files.end(); ++i) {
|
||||
string const file = os::internal_path(fromqstr(*i));
|
||||
dispatch(FuncRequest(LFUN_FILE_OPEN, file));
|
||||
view().view()->workAreaDispatch(FuncRequest(LFUN_FILE_OPEN, file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,15 @@ public:
|
||||
|
||||
/// get the content pane widget
|
||||
QWidget * getContent() const { return content_; }
|
||||
///
|
||||
LyXView & view()
|
||||
{
|
||||
return owner_;
|
||||
}
|
||||
private:
|
||||
/// The owning LyXView
|
||||
LyXView & owner_;
|
||||
|
||||
/// scroll bar
|
||||
QScrollBar * scrollbar_;
|
||||
/// content
|
||||
|
@ -60,7 +60,7 @@ namespace os = lyx::support::os;
|
||||
|
||||
namespace {
|
||||
|
||||
QWorkArea const * wa_ptr = 0;
|
||||
QWorkArea * wa_ptr = 0;
|
||||
|
||||
/// return the LyX key state from Qt's
|
||||
key_modifier::state q_key_state(Qt::ButtonState state)
|
||||
@ -120,8 +120,8 @@ SyntheticMouseEvent::SyntheticMouseEvent()
|
||||
{}
|
||||
|
||||
|
||||
QWorkArea::QWorkArea(LyXView &, int w, int h)
|
||||
: QAbstractScrollArea(qApp->mainWidget()), WorkArea(), painter_(this)
|
||||
QWorkArea::QWorkArea(LyXView & owner, int w, int h)
|
||||
: QAbstractScrollArea(qApp->mainWidget()), WorkArea(), view_(owner), painter_(this)
|
||||
{
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
@ -224,7 +224,7 @@ void QWorkArea::adjustViewWithScrollBar(int action)
|
||||
<< " linestep=" << verticalScrollBar()->lineStep()
|
||||
<< endl;
|
||||
|
||||
this->scrollDocView(verticalScrollBar()->sliderPosition());
|
||||
view_.view()->scrollDocView(verticalScrollBar()->sliderPosition());
|
||||
}
|
||||
|
||||
|
||||
@ -292,7 +292,7 @@ void QWorkArea::dropEvent(QDropEvent* event)
|
||||
for (QStringList::Iterator i = files.begin();
|
||||
i!=files.end(); ++i) {
|
||||
string const file = os::internal_path(fromqstr(*i));
|
||||
dispatch(FuncRequest(LFUN_FILE_OPEN, file));
|
||||
view_.view()->workAreaDispatch(FuncRequest(LFUN_FILE_OPEN, file));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -305,13 +305,13 @@ void QWorkArea::mousePressEvent(QMouseEvent * e)
|
||||
FuncRequest cmd(LFUN_MOUSE_TRIPLE,
|
||||
dc_event_.x, dc_event_.y,
|
||||
q_button_state(dc_event_.state));
|
||||
this->dispatch(cmd);
|
||||
view_.view()->workAreaDispatch(cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
FuncRequest const cmd(LFUN_MOUSE_PRESS, e->x(), e->y(),
|
||||
q_button_state(e->button()));
|
||||
this->dispatch(cmd);
|
||||
view_.view()->workAreaDispatch(cmd);
|
||||
}
|
||||
|
||||
|
||||
@ -322,7 +322,7 @@ void QWorkArea::mouseReleaseEvent(QMouseEvent * e)
|
||||
|
||||
FuncRequest const cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(),
|
||||
q_button_state(e->button()));
|
||||
this->dispatch(cmd);
|
||||
view_.view()->workAreaDispatch(cmd);
|
||||
}
|
||||
|
||||
|
||||
@ -382,7 +382,7 @@ void QWorkArea::mouseMoveEvent(QMouseEvent * e)
|
||||
synthetic_mouse_event_.scrollbar_value_old = scrollbar_value;
|
||||
|
||||
// ... and dispatch the event to the LyX core.
|
||||
this->dispatch(cmd);
|
||||
view_.view()->workAreaDispatch(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -412,7 +412,7 @@ void QWorkArea::generateSyntheticMouseEvent()
|
||||
synthetic_mouse_event_.scrollbar_value_old = scrollbar_value;
|
||||
|
||||
// ... and dispatch the event to the LyX core.
|
||||
this->dispatch(synthetic_mouse_event_.cmd);
|
||||
view_.view()->workAreaDispatch(synthetic_mouse_event_.cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -429,7 +429,7 @@ void QWorkArea::keyPressEvent(QKeyEvent * e)
|
||||
|
||||
boost::shared_ptr<QLyXKeySym> sym(new QLyXKeySym);
|
||||
sym->set(e);
|
||||
this->workAreaKeyPress(sym, q_key_state(e->state()));
|
||||
view_.view()->workAreaKeyPress(sym, q_key_state(e->state()));
|
||||
|
||||
}
|
||||
|
||||
@ -448,17 +448,17 @@ void QWorkArea::keyeventTimeout()
|
||||
continue;
|
||||
}
|
||||
|
||||
boost::shared_ptr<QLyXKeySym> sym(new QLyXKeySym);
|
||||
boost::shared_ptr<QLyXKeySym> sym(new QLyXKeySym);
|
||||
sym->set(ev.get());
|
||||
|
||||
lyxerr[Debug::GUI] << BOOST_CURRENT_FUNCTION
|
||||
<< " count=" << ev->count()
|
||||
<< " text=" << (const char *) ev->text()
|
||||
<< " isAutoRepeat=" << ev->isAutoRepeat()
|
||||
<< " key=" << ev->key()
|
||||
<< endl;
|
||||
lyxerr[Debug::GUI] << BOOST_CURRENT_FUNCTION
|
||||
<< " count=" << ev->count()
|
||||
<< " text=" << (const char *) ev->text()
|
||||
<< " isAutoRepeat=" << ev->isAutoRepeat()
|
||||
<< " key=" << ev->key()
|
||||
<< endl;
|
||||
|
||||
this->workAreaKeyPress(sym, q_key_state(ev->state()));
|
||||
view_.view()->workAreaKeyPress(sym, q_key_state(ev->state()));
|
||||
keyeventQueue_.pop();
|
||||
|
||||
handle_autos = false;
|
||||
@ -481,7 +481,7 @@ void QWorkArea::mouseDoubleClickEvent(QMouseEvent * e)
|
||||
FuncRequest cmd(LFUN_MOUSE_DOUBLE,
|
||||
dc_event_.x, dc_event_.y,
|
||||
q_button_state(dc_event_.state));
|
||||
this->dispatch(cmd);
|
||||
view_.view()->workAreaDispatch(cmd);
|
||||
}
|
||||
|
||||
|
||||
@ -495,7 +495,7 @@ void QWorkArea::resizeEvent(QResizeEvent * resizeEvent)
|
||||
screen_device_ = QPixmap(viewport()->width(), viewport()->height());
|
||||
paint_device_ = QImage(viewport()->width(), viewport()->height(), QImage::Format_RGB32);
|
||||
|
||||
this->workAreaResize();
|
||||
view_.view()->workAreaResize();
|
||||
|
||||
/*
|
||||
lyxerr[Debug::GUI] << BOOST_CURRENT_FUNCTION
|
||||
@ -538,6 +538,7 @@ void QWorkArea::paintEvent(QPaintEvent * e)
|
||||
q.drawPixmap(e->rect(), screen_device_, e->rect());
|
||||
}
|
||||
|
||||
|
||||
QPixmap QWorkArea::copyScreen(int x, int y, int w, int h) const
|
||||
{
|
||||
return screen_device_.copy(x, y, w, h);
|
||||
@ -588,12 +589,12 @@ bool lyxX11EventFilter(XEvent * xev)
|
||||
case SelectionRequest:
|
||||
lyxerr[Debug::GUI] << "X requested selection." << endl;
|
||||
if (wa_ptr)
|
||||
wa_ptr->selectionRequested();
|
||||
wa_ptr->view().view()->selectionRequested();
|
||||
break;
|
||||
case SelectionClear:
|
||||
lyxerr[Debug::GUI] << "Lost selection." << endl;
|
||||
if (wa_ptr)
|
||||
wa_ptr->selectionLost();
|
||||
wa_ptr->view().view()->selectionLost();
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
@ -657,7 +658,7 @@ pascal OSErr handleOpenDocuments(const AppleEvent* inEvent,
|
||||
FSRefMakePath(&ref, (UInt8*)qstr_buf,
|
||||
1024);
|
||||
s_arg=QString::fromUtf8(qstr_buf);
|
||||
wa_ptr->dispatch(
|
||||
wa_ptr->view().view()->workAreaDispatch(
|
||||
FuncRequest(LFUN_FILE_OPEN,
|
||||
fromqstr(s_arg)));
|
||||
break;
|
||||
|
@ -145,6 +145,10 @@ public:
|
||||
*/
|
||||
void drawScreen(int x, int y, QPixmap pixmap);
|
||||
|
||||
LyXView & view()
|
||||
{
|
||||
return view_;
|
||||
}
|
||||
protected:
|
||||
|
||||
/// repaint part of the widget
|
||||
@ -185,7 +189,9 @@ public slots:
|
||||
void adjustViewWithScrollBar(int action = 0);
|
||||
|
||||
private:
|
||||
|
||||
///
|
||||
LyXView & view_;
|
||||
|
||||
/// Buffer view width.
|
||||
int workWidth_;
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "XWorkArea.h"
|
||||
#include "BufferView.h"
|
||||
|
||||
#include "Color.h"
|
||||
#include "XFormsView.h"
|
||||
@ -108,7 +109,7 @@ int C_event_cb(FL_FORM * form, void * xev)
|
||||
|
||||
|
||||
XWorkArea::XWorkArea(LyXView & owner, int w, int h)
|
||||
: workareapixmap(0), painter_(*this)
|
||||
: view_(owner), workareapixmap(0), painter_(*this)
|
||||
{
|
||||
fl_freeze_all_forms();
|
||||
|
||||
@ -219,7 +220,7 @@ void XWorkArea::redraw(int width, int height)
|
||||
height,
|
||||
fl_get_visual_depth());
|
||||
|
||||
workAreaResize();
|
||||
view_.view()->workAreaResize();
|
||||
}
|
||||
|
||||
|
||||
@ -276,7 +277,7 @@ void XWorkArea::scroll_cb()
|
||||
<< "scroll: docheight: " << doc_height_ << endl;
|
||||
}
|
||||
|
||||
scrollDocView(int(val));
|
||||
view_.view()->scrollDocView(int(val));
|
||||
waitForX(false);
|
||||
}
|
||||
|
||||
@ -331,7 +332,7 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
||||
|
||||
// Should really have used xbutton.state
|
||||
lyxerr[Debug::WORKAREA] << "Workarea event: PUSH" << endl;
|
||||
area->dispatch(
|
||||
area->view_.view()->workAreaDispatch(
|
||||
FuncRequest(LFUN_MOUSE_PRESS,
|
||||
ev->xbutton.x - ob->x,
|
||||
ev->xbutton.y - ob->y,
|
||||
@ -349,7 +350,7 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
||||
|
||||
lyxerr[Debug::WORKAREA] << "Workarea event: RELEASE" << endl;
|
||||
|
||||
area->dispatch(
|
||||
area->view_.view()->workAreaDispatch(
|
||||
FuncRequest(LFUN_MOUSE_RELEASE,
|
||||
ev->xbutton.x - ob->x,
|
||||
ev->xbutton.y - ob->y,
|
||||
@ -418,7 +419,7 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
||||
ev->xbutton.x - ob->x,
|
||||
ev->xbutton.y - ob->y,
|
||||
x_button_state(key));
|
||||
area->dispatch(cmd);
|
||||
area->view_.view()->workAreaDispatch(cmd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -509,7 +510,7 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
||||
XLyXKeySym * xlk = new XLyXKeySym;
|
||||
xlk->initFromKeySym(ret_key);
|
||||
|
||||
area->workAreaKeyPress(LyXKeySymPtr(xlk),
|
||||
area->view_.view()->workAreaKeyPress(LyXKeySymPtr(xlk),
|
||||
x_key_state(ret_state));
|
||||
break;
|
||||
}
|
||||
@ -542,7 +543,7 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
||||
ev->xbutton.x - ob->x,
|
||||
ev->xbutton.y - ob->y,
|
||||
x_button_state(key));
|
||||
area->dispatch(cmd);
|
||||
area->view_.view()->workAreaDispatch(cmd);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -558,7 +559,7 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
||||
ev->xbutton.x - ob->x,
|
||||
ev->xbutton.y - ob->y,
|
||||
x_button_state(key));
|
||||
area->dispatch(cmd);
|
||||
area->view_.view()->workAreaDispatch(cmd);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -601,11 +602,11 @@ int XWorkArea::event_cb(XEvent * xev)
|
||||
switch (xev->type) {
|
||||
case SelectionRequest:
|
||||
lyxerr[Debug::GUI] << "X requested selection." << endl;
|
||||
selectionRequested();
|
||||
view_.view()->selectionRequested();
|
||||
break;
|
||||
case SelectionClear:
|
||||
lyxerr[Debug::GUI] << "Lost selection." << endl;
|
||||
selectionLost();
|
||||
view_.view()->selectionLost();
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
@ -65,6 +65,8 @@ public:
|
||||
/// handles SelectionRequest X Event, to fill the clipboard
|
||||
int event_cb(XEvent * xev);
|
||||
private:
|
||||
LyXView & view_;
|
||||
|
||||
/// generate the pixmap, and copy backing pixmap to it,
|
||||
/// and send resize event if needed
|
||||
void redraw(int, int);
|
||||
|
Loading…
Reference in New Issue
Block a user