[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/krita
From: Lukáš Tvrdý <lukast.dev () gmail ! com>
Date: 2010-10-17 15:11:30
Message-ID: 20101017151130.87A8BAC896 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1186795 by lukast:
Make the mousePressEvent for paintop KisImage-free.
Let's leave the work of transforming the coordinates from document to pixel
in the tool.
M +3 -3 image/brushengine/kis_paintop_settings.cpp
M +4 -3 image/brushengine/kis_paintop_settings.h
M +9 -6 plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.cpp
M +1 -1 plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.h
M +10 -2 ui/tool/kis_tool_freehand.cc
--- trunk/koffice/krita/image/brushengine/kis_paintop_settings.cpp #1186794:1186795
@@ -59,11 +59,11 @@
d->settingsWidget = widget;
}
-void KisPaintOpSettings::mousePressEvent(KoPointerEvent *e)
-{
- e->ignore();
+bool KisPaintOpSettings::mousePressEvent(const KisPaintInformation &pos, Qt::KeyboardModifiers \
modifiers){ + return true; // ignore the event by default
}
+
KisPaintOpSettingsSP KisPaintOpSettings::clone() const
{
QString paintopID = getString("paintop");
--- trunk/koffice/krita/image/brushengine/kis_paintop_settings.h #1186794:1186795
@@ -28,6 +28,7 @@
#include "kis_shared.h"
#include "kis_properties_configuration.h"
+#include "kis_paint_information.h"
class KoPointerEvent;
@@ -60,10 +61,10 @@
/**
* This function is called by a tool when the mouse is pressed. It's useful if
* the paintop needs mouse interaction for instance in the case of the duplicate op.
- * If the tool is supposed to ignore the event, the paint op should call e->accept();
- * and if the tool is supposed to use the event e->ignore(); should be called.
+ * If the tool is supposed to ignore the event, the paint op should return false
+ * and if the tool is supposed to use the event, return true.
*/
- virtual void mousePressEvent(KoPointerEvent *e);
+ virtual bool mousePressEvent(const KisPaintInformation &pos, Qt::KeyboardModifiers modifiers);
/**
* Clone the current settings object. Override this if your settings instance doesn't
--- trunk/koffice/krita/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.cpp \
#1186794:1186795 @@ -59,22 +59,25 @@
return m_offset;
}
-void KisDuplicateOpSettings::mousePressEvent(KoPointerEvent *e)
+bool KisDuplicateOpSettings::mousePressEvent(const KisPaintInformation &info, Qt::KeyboardModifiers \
modifiers) {
- if (e->modifiers() == Qt::ControlModifier) {
- m_position = m_image->documentToPixel(e->point);
+ bool ignoreEvent = true;
+ if (modifiers == Qt::ControlModifier) {
+ m_position = info.pos();
m_isOffsetNotUptodate = true;
- e->accept();
+ ignoreEvent = false;
} else {
if (m_isOffsetNotUptodate) {
- m_offset = m_image->documentToPixel(e->point) - m_position;
+ m_offset = info.pos() - m_position;
m_isOffsetNotUptodate = false;
}
- e->ignore();
+ ignoreEvent = true;
}
+ return ignoreEvent;
}
+
void KisDuplicateOpSettings::activate()
{
KisDuplicateOpSettingsWidget* options = \
dynamic_cast<KisDuplicateOpSettingsWidget*>(optionsWidget());
--- trunk/koffice/krita/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.h \
#1186794:1186795 @@ -43,7 +43,7 @@
bool paintIncremental();
QPointF offset() const;
- void mousePressEvent(KoPointerEvent *e);
+ virtual bool mousePressEvent(const KisPaintInformation& pos, Qt::KeyboardModifiers modifiers);
void activate();
void fromXML(const QDomElement& elt);
--- trunk/koffice/krita/ui/tool/kis_tool_freehand.cc #1186794:1186795
@@ -137,8 +137,16 @@
* FIXME: we need some better way to implement modifiers
* for a paintop level
*/
- currentPaintOpPreset()->settings()->mousePressEvent(e);
- if (e->isAccepted()) return;
+ bool ignoreEvent = \
currentPaintOpPreset()->settings()->mousePressEvent(KisPaintInformation(convertToPixelCoord(e->point), + \
pressureToCurve(e->pressure()), e->xTilt(), e->yTilt(), + \
KisVector2D::Zero(), + e->rotation(), \
e->tangentialPressure(), m_strokeTimeMeasure.elapsed()),e->modifiers()); + if (!ignoreEvent){
+ e->accept();
+ return;
+ }else{
+ e->ignore();
+ }
if(mode() == KisTool::HOVER_MODE &&
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic