[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/krita
From: Sven Langkamp <sven.langkamp () gmail ! com>
Date: 2010-10-18 15:03:16
Message-ID: 20101018150316.6B160AC896 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1187181 by langkamp:
don't paint on local selections with painting tools
BUG:252453
M +6 -0 CMakeLists.txt
M +6 -5 plugins/tools/defaulttools/kis_tool_line.cc
M +1 -1 plugins/tools/tool_star/kis_tool_star.cc
M +1 -1 ui/tool/kis_tool_ellipse_base.cpp
M +1 -1 ui/tool/kis_tool_freehand.cc
M +16 -0 ui/tool/kis_tool_paint.cc
M +9 -0 ui/tool/kis_tool_paint.h
M +1 -1 ui/tool/kis_tool_polyline_base.cpp
M +1 -1 ui/tool/kis_tool_rectangle_base.cpp
--- trunk/koffice/krita/CMakeLists.txt #1187180:1187181
@@ -41,6 +41,12 @@
add_definitions(${OPENEXR_DEFINITIONS})
endif(OPENEXR_FOUND)
+check_cxx_compiler_flag("-fopenmp" OPENMP_FOUND)
+if(OPENMP_FOUND)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
+ message("OpenMP found")
+endif(OPENMP_FOUND)
+
if(WIN32)
if(MSVC)
# C4522: 'class' : multiple assignment operators specified
--- trunk/koffice/krita/plugins/tools/defaulttools/kis_tool_line.cc #1187180:1187181
@@ -156,11 +156,13 @@
image()->actionRecorder()->addAction(linePaintAction);
}
#endif
+ NodePaintAbility nodeAbility = nodePaintAbility();
+ if (nodeAbility == NONE) {
+ return;
+ }
- if (!currentNode()->inherits("KisShapeLayer")) {
- KisPaintDeviceSP device;
-
- if (currentNode() && (device = currentNode()->paintDevice())) {
+ if (nodeAbility == PAINT) {
+ KisPaintDeviceSP device = currentNode()->paintDevice();
delete m_painter;
m_painter = new KisPainter(device, currentSelection());
Q_CHECK_PTR(m_painter);
@@ -178,7 +180,6 @@
delete m_painter;
m_painter = 0;
}
- }
else {
KoPathShape* path = new KoPathShape();
path->setShapeId(KoPathShapeId);
--- trunk/koffice/krita/plugins/tools/tool_star/kis_tool_star.cc #1187180:1187181
@@ -70,7 +70,7 @@
if(PRESS_CONDITION(event, KisTool::HOVER_MODE,
Qt::LeftButton, Qt::NoModifier)) {
- if (!currentNode() || currentNode()->systemLocked())
+ if (nodePaintAbility() == NONE)
return;
setMode(KisTool::PAINT_MODE);
--- trunk/koffice/krita/ui/tool/kis_tool_ellipse_base.cpp #1187180:1187181
@@ -56,7 +56,7 @@
if(PRESS_CONDITION(event, KisTool::HOVER_MODE,
Qt::LeftButton, Qt::NoModifier)) {
- if (!currentNode() || currentNode()->systemLocked())
+ if (nodePaintAbility() == NONE)
return;
setMode(KisTool::PAINT_MODE);
--- trunk/koffice/krita/ui/tool/kis_tool_freehand.cc #1187180:1187181
@@ -155,7 +155,7 @@
!specialModifierActive()) {
- if (!currentNode() || !currentNode()->paintDevice() || currentNode()->systemLocked())
+ if (nodePaintAbility() != PAINT)
return;
setMode(KisTool::PAINT_MODE);
--- trunk/koffice/krita/ui/tool/kis_tool_paint.cc #1187180:1187181
@@ -365,4 +365,20 @@
}
}
+KisToolPaint::NodePaintAbility KisToolPaint::nodePaintAbility()
+{
+ KisNodeSP node = currentNode();
+ if (!node || node->systemLocked() || node->inherits("KisSelectionMask")) {
+ return NONE;
+ }
+ if (node->inherits("KisShapeLayer")) {
+ return VECTOR;
+ }
+ if (node->paintDevice()) {
+ return PAINT;
+ }
+ return NONE;
+}
+
+
#include "kis_tool_paint.moc"
--- trunk/koffice/krita/ui/tool/kis_tool_paint.h #1187180:1187181
@@ -116,7 +116,16 @@
return m_pressureSamples.at( qRound(pressure * LEVEL_OF_PRESSURE_RESOLUTION) );
}
+ enum NodePaintAbility {
+ NONE,
+ PAINT,
+ VECTOR
+ };
+ /// Checks if and how the tool can paint on the current node
+ NodePaintAbility nodePaintAbility();
+
+
public slots:
virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
--- trunk/koffice/krita/ui/tool/kis_tool_polyline_base.cpp #1187180:1187181
@@ -50,7 +50,7 @@
void KisToolPolylineBase::mousePressEvent(KoPointerEvent *event)
{
- if (!currentNode() || currentNode()->systemLocked()) {
+ if (nodePaintAbility() == NONE) {
return;
}
--- trunk/koffice/krita/ui/tool/kis_tool_rectangle_base.cpp #1187180:1187181
@@ -49,7 +49,7 @@
if(PRESS_CONDITION(event, KisTool::HOVER_MODE,
Qt::LeftButton, Qt::NoModifier)) {
- if (!currentNode() || currentNode()->systemLocked())
+ if (nodePaintAbility() == NONE)
return;
setMode(KisTool::PAINT_MODE);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic