[PATCH 7/9] Add "Brush Outline and Crosshair" option to the general settings.

Silvio Heinrich plassy at web.de
Tue Dec 28 17:55:36 CET 2010


it will use the crosshair cursor and paints the brush outline simultaneously
this helps seeing the middle of the brush when using large brushes
---
 krita/image/kis_global.h             |    5 ++-
 krita/ui/forms/wdggeneralsettings.ui |    5 ++++
 krita/ui/tool/kis_tool_freehand.cc   |    6 ++--
 krita/ui/tool/kis_tool_paint.cc      |   38 ++++++++++++++++++++++++++++++++-
 4 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/krita/image/kis_global.h b/krita/image/kis_global.h
index e66e806..beb8717 100644
--- a/krita/image/kis_global.h
+++ b/krita/image/kis_global.h
@@ -43,9 +43,10 @@ enum enumCursorStyle {
     CURSOR_STYLE_CROSSHAIR = 1,
     CURSOR_STYLE_POINTER = 2,
     CURSOR_STYLE_OUTLINE = 3,
-    CURSOR_STYLE_NO_CURSOR = 4
+    CURSOR_STYLE_CROSS_OUTLINE = 4,
+    CURSOR_STYLE_NO_CURSOR = 5
 #if defined(HAVE_OPENGL)
-    , CURSOR_STYLE_3D_MODEL = 5
+    , CURSOR_STYLE_3D_MODEL = 6
 #endif
 };
 
diff --git a/krita/ui/forms/wdggeneralsettings.ui b/krita/ui/forms/wdggeneralsettings.ui
index aea9174..13e0e31 100644
--- a/krita/ui/forms/wdggeneralsettings.ui
+++ b/krita/ui/forms/wdggeneralsettings.ui
@@ -45,6 +45,11 @@
      </item>
      <item>
       <property name="text">
+       <string>Brush Outline and Crosshair</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
        <string>No Cursor</string>
       </property>
      </item>
diff --git a/krita/ui/tool/kis_tool_freehand.cc b/krita/ui/tool/kis_tool_freehand.cc
index bb50e6d..650af17 100644
--- a/krita/ui/tool/kis_tool_freehand.cc
+++ b/krita/ui/tool/kis_tool_freehand.cc
@@ -133,7 +133,7 @@ void KisToolFreehand::mousePressEvent(KoPointerEvent *e)
     m_outlineDocPoint = e->point;
 
     KisConfig cfg;
-    if(cfg.cursorStyle() == CURSOR_STYLE_OUTLINE) {
+    if(cfg.cursorStyle() == CURSOR_STYLE_OUTLINE || cfg.cursorStyle() == CURSOR_STYLE_CROSS_OUTLINE) {
         updateOutlineRect();
     }
 
@@ -188,7 +188,7 @@ void KisToolFreehand::mouseMoveEvent(KoPointerEvent *e)
         m_outlineDocPoint = e->point;
 
         KisConfig cfg;
-        if(cfg.cursorStyle() == CURSOR_STYLE_OUTLINE) {
+        if(cfg.cursorStyle() == CURSOR_STYLE_OUTLINE || cfg.cursorStyle() == CURSOR_STYLE_CROSS_OUTLINE) {
             updateOutlineRect();
         }
 
@@ -553,7 +553,7 @@ void KisToolFreehand::paint(QPainter& gc, const KoViewConverter &converter)
 
         if(m_explicitShowOutline ||
            mode() == KisTool::GESTURE_MODE ||
-           (cfg.cursorStyle() == CURSOR_STYLE_OUTLINE &&
+           ((cfg.cursorStyle() == CURSOR_STYLE_OUTLINE || cfg.cursorStyle() == CURSOR_STYLE_CROSS_OUTLINE) &&
             (mode() == HOVER_MODE ||
              (mode() == PAINT_MODE && cfg.showOutlineWhilePainting())))) {
 
diff --git a/krita/ui/tool/kis_tool_paint.cc b/krita/ui/tool/kis_tool_paint.cc
index 7e0ef4a..1121985 100644
--- a/krita/ui/tool/kis_tool_paint.cc
+++ b/krita/ui/tool/kis_tool_paint.cc
@@ -353,10 +353,44 @@ void KisToolPaint::resetCursorStyle()
 {
     KisTool::resetCursorStyle();
     KisConfig cfg;
-    if (cfg.cursorStyle() == CURSOR_STYLE_OUTLINE) {
+    
+    switch(cfg.cursorStyle())
+    {
+    case CURSOR_STYLE_OUTLINE:
+        if (m_supportOutline) {
+            useCursor(KisCursor::blankCursor());
+            break;
+        }
+        
+    case CURSOR_STYLE_CROSS_OUTLINE:
+        if (m_supportOutline) {
+            useCursor(KisCursor::crossCursor());
+            break;
+        }
+        
+#if defined(HAVE_OPENGL)
+    case CURSOR_STYLE_3D_MODEL:
+        if(isCanvasOpenGL()) {
+            if (m_supportOutline) {
+                useCursor(KisCursor::blankCursor());
+                break;
+            }
+        } else {
+            useCursor(KisCursor::arrowCursor());
+            break;
+        }
+#endif
+
+    default:
+        useCursor(cursor());
+        break;
+    }
+/*
+    if (cfg.cursorStyle() == CURSOR_STYLE_OUTLINE || cfg.cursorStyle() == CURSOR_STYLE_CROSS_OUTLINE) {
         if (m_supportOutline) {
             // do not show cursor, tool will paint outline
             useCursor(KisCursor::blankCursor());
+            useCursor(KisCursor::crossCursor());
         } else {
             // if the tool does not support outline, use tool icon cursor
             useCursor(cursor());
@@ -377,7 +411,7 @@ void KisToolPaint::resetCursorStyle()
         }
     }
 #endif
-
+//*/
 
 }
 
-- 
1.7.1




More information about the kimageshop mailing list