[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/krita/ui
From:       Vera Lukman <vla24 () sfu ! ca>
Date:       2009-12-03 9:47:48
Message-ID: 1259833668.519606.25216.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1057781 by vlukman:

The brush index detector function is improved so that the user is not allowed to \
select outside the pixmap (previously the user is allowed to select outside the \
pixmap). User can left click outside the palette to hide it.

 M  +6 -1      canvas/kis_qpainter_canvas.cpp  
 M  +21 -2     kis_popup_palette.cpp  
 M  +2 -0      kis_popup_palette.h  
 M  +1 -1      ko_favorite_resource_manager.h  
 M  +6 -1      opengl/kis_opengl_canvas2.cpp  


--- trunk/koffice/krita/ui/canvas/kis_qpainter_canvas.cpp #1057780:1057781
@@ -224,7 +224,12 @@
 
 void KisQPainterCanvas::mousePressEvent(QMouseEvent *e)
 {
-    if (m_d->blockMouseEvent.isActive() || \
m_d->canvas->view()->favoriteResourceManager()->isPopupPaletteVisible()) return; +    \
if (m_d->blockMouseEvent.isActive()) return; +    else if \
(m_d->canvas->view()->favoriteResourceManager()->isPopupPaletteVisible()) +    {
+        m_d->canvas->view()->favoriteResourceManager()->slotShowPopupPalette();
+        return;
+    }
     m_d->toolProxy->mousePressEvent(e, \
m_d->viewConverter->viewToDocument(widgetToView(e->pos() + m_d->documentOffset)));  }
 
--- trunk/koffice/krita/ui/kis_popup_palette.cpp #1057780:1057781
@@ -152,10 +152,19 @@
 
         if (pathBrush.contains(point))
         { //in favorite brushes area
-            int pos = calculateFavoriteBrush(point);;
+            int pos = calculateFavoriteBrush(point);
             qDebug() << "[KisPopupPalette] favorite brush position: " << pos;
             if (pos >= 0 && pos < m_resourceManager->favoriteBrushesTotal())
-                emit changeActivePaintop(pos);
+            {
+                QPixmap pixmap(m_resourceManager->favoriteBrushPixmap(pos));
+                float angle = pos*PI*2.0/m_resourceManager->favoriteBrushesTotal();
+                QPainterPath path;
+                path.addRect(BRUSH_RADIUS*sin(angle)-pixmap.width()/2+width()/2,
+                              BRUSH_RADIUS*cos(angle)-pixmap.height()/2+height()/2,
+                              pixmap.width(), pixmap.height());
+
+                if(path.contains(point)) emit changeActivePaintop(pos);
+            }
         }
         else if (pathColor.contains(point))
         {
@@ -248,6 +257,16 @@
     }
 }
 
+void KisPopupPalette::mouseMoveEvent(QMouseEvent* e)
+{
+    e->accept();
+}
+
+void KisPopupPalette::mousePressEvent(QMouseEvent* e)
+{
+    e->accept();
+}
+
 KisPopupPalette::~KisPopupPalette()
 {
     m_resourceManager = 0;
--- trunk/koffice/krita/ui/kis_popup_palette.h #1057780:1057781
@@ -47,6 +47,8 @@
     void paintEvent (QPaintEvent*);
     void resizeEvent (QResizeEvent*);
     void mouseReleaseEvent (QMouseEvent*);
+    void mouseMoveEvent (QMouseEvent*);
+    void mousePressEvent (QMouseEvent*);
 
     //functions to calculate favorite brush position in array
     int calculateFavoriteBrush(QPointF);
--- trunk/koffice/krita/ui/ko_favorite_resource_manager.h #1057780:1057781
@@ -79,7 +79,7 @@
     
 public slots:
     void slotChangePaintopLabel();
-    void slotShowPopupPalette(const QPoint&);
+    void slotShowPopupPalette(const QPoint& = QPoint(0,0));
     void slotChangeActivePaintop(int);
 
 private:
--- trunk/koffice/krita/ui/opengl/kis_opengl_canvas2.cpp #1057780:1057781
@@ -336,7 +336,12 @@
 
 void KisOpenGLCanvas2::mousePressEvent(QMouseEvent *e)
 {
-    if (m_d->blockMouseEvent.isActive()|| \
m_d->canvas->view()->favoriteResourceManager()->isPopupPaletteVisible()) return; +    \
if (m_d->blockMouseEvent.isActive()) return; +    else if \
(m_d->canvas->view()->favoriteResourceManager()->isPopupPaletteVisible()) +    {
+        m_d->canvas->view()->favoriteResourceManager()->slotShowPopupPalette();
+        return;
+    }
     m_d->toolProxy->mousePressEvent(e, \
m_d->viewConverter->viewToDocument(widgetToView(e->pos() + m_d->documentOffset)));  }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic