#include "GuiWorkArea.h"
+#include "GuiApplication.h"
#include "QLPainter.h"
#include "QLyXKeySym.h"
-
-#include "ColorCache.h"
#include "qt_helpers.h"
-#include "Application.h"
+
+#include "LyXView.h"
+
#include "BufferView.h"
#include "debug.h"
#include "funcrequest.h"
#include "LColor.h"
+
#include "support/os.h"
#include <QLayout>
viewport()->setAutoFillBackground(false);
viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
-
- viewport()->setFocusPolicy(Qt::WheelFocus);
- viewport()->setFocus();
setFocusPolicy(Qt::WheelFocus);
viewport()->setCursor(Qt::IBeamCursor);
resize(w, h);
- workWidth_ = w;
- workHeight_ = h;
synthetic_mouse_event_.timeout.timeout.connect(
boost::bind(&GuiWorkArea::generateSyntheticMouseEvent,
this, SLOT(adjustViewWithScrollBar(int)));
// PageStep only depends on the viewport height.
- verticalScrollBar()->setPageStep(workHeight_);
+ verticalScrollBar()->setPageStep(viewport()->height());
lyxerr[Debug::GUI] << BOOST_CURRENT_FUNCTION
<< "\n Area width\t" << width()
setAttribute(Qt::WA_InputMethodEnabled, true);
}
+
GuiWorkArea::~GuiWorkArea()
{
}
lyxerr[Debug::GUI] << "GuiWorkArea::dropEvent: got URIs!" << endl;
for (int i = 0; i!=files.size(); ++i) {
- string const file = os::internal_path(fromqstr(files.at(i).toString()));
+ string const file = os::internal_path(fromqstr(files.at(i).toLocalFile()));
if (!file.empty())
dispatch(FuncRequest(LFUN_FILE_OPEN, file));
}
void GuiWorkArea::resizeEvent(QResizeEvent *)
{
- workWidth_ = viewport()->width();
- workHeight_ = viewport()->height();
-
verticalScrollBar()->setPageStep(viewport()->height());
-
-// screen_device_ = QPixmap(viewport()->width(), viewport()->height());
-// paint_device_ = QImage(viewport()->width(), viewport()->height(), QImage::Format_RGB32);
paint_device_ = QPixmap(viewport()->width(), viewport()->height());
-
resizeBufferView();
-
- /*
- lyxerr[Debug::GUI] << BOOST_CURRENT_FUNCTION
- << "\n QWidget width\t" << this->QWidget::width()
- << "\n QWidget height\t" << this->QWidget::height()
- << "\n viewport width\t" << viewport()->width()
- << "\n viewport height\t" << viewport()->height()
- << "\n QResizeEvent rect left\t" << rect().left()
- << "\n QResizeEvent rect right\t" << rect().right()
- << endl;
- */
}
void GuiWorkArea::update(int x, int y, int w, int h)
{
- //screen_device_.fromImage(paint_device_);
- //QPainter q(&screen_device_);
- //q.drawImage(x, y, paint_device_.copy(x, y, w, h));
-
viewport()->update(x, y, w, h);
}
show_vcursor_ = true;
- QColor const & required_color = lcolorcache.get(LColor::cursor);
+ QColor const & required_color = guiApp->colorCache().get(LColor::cursor);
if (x==cursor_x_ && y==cursor_y_ && h==cursor_h_
&& cursor_color_ == required_color
// ideally, such special coding should not be necessary
if (text == "^")
key = Qt::Key_AsciiCircum;
- QKeyEvent ev(QEvent::KeyPress, key, 0, text);
+ // FIXME: Needs for investigation, this key is not really used,
+ // the ctor below just check if key is different from 0.
+ QKeyEvent ev(QEvent::KeyPress, key,
+ Qt::NoModifier, text);
keyPressEvent(&ev);
}
e->accept();
}
+void GuiWorkArea::focusInEvent(QFocusEvent * ev)
+{
+ QAbstractScrollArea::focusInEvent(ev);
+ lyx_view_.updateToolbars();
+}
+
+
+void GuiWorkArea::focusOutEvent(QFocusEvent * ev)
+{
+ QAbstractScrollArea::focusOutEvent(ev);
+ lyx_view_.updateToolbars();
+}
+
} // namespace frontend
} // namespace lyx