#include "lcolorcache.h"
#include "qt_helpers.h"
-
+#include "BufferView.h"
#include "debug.h"
#include "funcrequest.h"
#include "LColor.h"
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)
{}
-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);
<< " linestep=" << verticalScrollBar()->lineStep()
<< endl;
- this->scrollDocView(verticalScrollBar()->sliderPosition());
+ view_.view()->scrollDocView(verticalScrollBar()->sliderPosition());
}
void QWorkArea::haveSelection(bool own) const
{
- wa_ptr = this;
+ /// \todo ask X11 and MAC devels why this wa_ptr is useful.
+ wa_ptr = const_cast<QWorkArea*>(this);
if (!QApplication::clipboard()->supportsSelection())
return;
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));
}
}
}
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);
}
FuncRequest const cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(),
q_button_state(e->button()));
- this->dispatch(cmd);
+ view_.view()->workAreaDispatch(cmd);
}
synthetic_mouse_event_.scrollbar_value_old = scrollbar_value;
// ... and dispatch the event to the LyX core.
- this->dispatch(cmd);
+ view_.view()->workAreaDispatch(cmd);
}
}
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);
}
}
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()));
}
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;
FuncRequest cmd(LFUN_MOUSE_DOUBLE,
dc_event_.x, dc_event_.y,
q_button_state(dc_event_.state));
- this->dispatch(cmd);
+ view_.view()->workAreaDispatch(cmd);
}
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
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);
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;
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;