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

List:       kde-commits
Subject:    extragear/graphics/kpovmodeler
From:       Andreas Zehender <az () azweb ! de>
Date:       2008-07-12 7:06:40
Message-ID: 1215846400.800918.27644.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 831216 by azehende:

use overlay frame for control point selection
remove porting warning in height field, that#s already ported
increased version number for bugfix release

 M  +18 -53    pmglview.cpp  
 M  +2 -9      pmglview.h  
 M  +0 -6      pmheightfieldroam.cpp  
 M  +1 -1      version.h  


--- trunk/extragear/graphics/kpovmodeler/pmglview.cpp #831215:831216
@@ -69,6 +69,7 @@
                     QWidget* parent, Qt::WFlags f )
       : PMViewBase( parent, f | Qt::WWinOwnDC | Qt::WNoAutoErase )
 {
+   setAttribute(Qt::WA_PaintOutsidePaintEvent,true);
    m_pPart = part;
    m_type = t;
    m_bScaleMode = false;
@@ -104,6 +105,18 @@
 
    PMRenderManager* rm = PMRenderManager::theManager( );
    rm->viewCreated( );
+   
+   QFrame* frame = new QFrame(this);
+   //frame->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
+   frame->setBackgroundRole(QPalette::Highlight);
+   frame->setAutoFillBackground(true);
+   QPalette pal = frame->palette();
+   QColor c = PMRenderManager::theManager( )->controlPointColor( 1 );
+   c.setAlpha(80);
+   pal.setColor(QPalette::Highlight, c);
+   frame->setPalette(pal);
+   frame->hide();
+   m_pDragOverlay = frame;   
 
    setMinimumSize( 50, 50 );
 
@@ -395,7 +408,7 @@
          iex = screenToInternalX( ex );
          isy = screenToInternalY( ey );
          iey = screenToInternalY( sy );
-         restoreSelectionBox( );
+	 m_pDragOverlay->hide();
 
          while( pit != m_controlPointsPosition.end( ) && cit != m_controlPoints.end( ) )
          {
@@ -489,9 +502,7 @@
       }
       else
       {
-         restoreSelectionBox( );
          m_selectionEnd = e->pos( );
-         saveSelectionBox( );
          paintSelectionBox( );
       }
    }
@@ -626,8 +637,6 @@
 
       if( m_bGraphicalChangeMode && !m_bMementoCreated )
          startChange( m_changeStartPos );
-      if( m_bMultipleSelectionMode )
-         restoreSelectionBox( );
 
       m_dTransX += pixels * m_autoScrollDirectionX / m_dScale;
       m_dTransY -= pixels * m_autoScrollDirectionY / m_dScale;
@@ -639,7 +648,6 @@
          m_selectionStart += QPoint( pixels * m_autoScrollDirectionX,
                                      pixels * m_autoScrollDirectionY );
 
-         saveSelectionBox( );
          paintSelectionBox( );
       }
 
@@ -1103,64 +1111,22 @@
 {
    if( !m_bSelectionStarted )
    {
-      saveSelectionBox( );
       paintSelectionBox( );
-
       m_bSelectionStarted = true;
    }
 }
 
-void PMGLView::restoreSelectionBox( )
-{
-   if( !m_bAboutToUpdate )
-   {
-      int sx, sy, ex, ey, w, h;
-      calculateSelectionBox( sx, sy, ex, ey, w, h );
-      QPainter painter( this );
-      if( !m_selectionPixmap[0].isNull( ) )
-         painter.drawPixmap( sx, sy, m_selectionPixmap[0], 0, 0, w, 1 );
-      if( !m_selectionPixmap[1].isNull( ) )
-         painter.drawPixmap( sx, ey, m_selectionPixmap[1], 0, 0, w, 1 );
-      if( !m_selectionPixmap[2].isNull( ) )
-         painter.drawPixmap( sx, sy+1, m_selectionPixmap[2], 0, 0, 1, h-2 );
-      if( !m_selectionPixmap[3].isNull( ) )
-         painter.drawPixmap( ex, sy+1, m_selectionPixmap[3], 0, 0, 1, h-2 );
-   }
-}
 
-void PMGLView::saveSelectionBox( )
-{
-   if( !m_bAboutToUpdate )
-   {
-      int sx, sy, ex, ey, w, h;
-      calculateSelectionBox( sx, sy, ex, ey, w, h );
-
-      m_selectionPixmap[0].scaled( w, 1 );
-      if( !m_selectionPixmap[0].isNull( ) )
-			bitBlt( &( m_selectionPixmap[0] ), 0, 0, this, sx, sy, w, 1/*, CopyROP*/ );
-      m_selectionPixmap[1].scaled( w, 1 );
-      if( !m_selectionPixmap[1].isNull( ) )
-         bitBlt( &( m_selectionPixmap[1] ), 0, 0, this, sx, ey, w, 1/*, CopyROP*/ );
-      m_selectionPixmap[2].scaled( 1, h-2 );
-      if( !m_selectionPixmap[2].isNull( ) )
-			bitBlt( &( m_selectionPixmap[2] ), 0, 0, this, sx, sy+1, 1, h-2/*, CopyROP */);
-      m_selectionPixmap[3].scaled( 1, h-2 );
-      if( !m_selectionPixmap[3].isNull( ) )
-			bitBlt( &( m_selectionPixmap[3] ), 0, 0, this, ex, sy+1, 1, h-2/*, CopyROP*/ );
-   }
-}
-
 void PMGLView::paintSelectionBox( )
 {
    if( !m_bAboutToUpdate )
    {
       int sx, sy, ex, ey, w, h;
       calculateSelectionBox( sx, sy, ex, ey, w, h );
-      QPainter p;
-      p.begin( this );
-      p.setPen( PMRenderManager::theManager( )->controlPointColor( 1 ) );
-      p.drawRect( sx, sy, w, h );
-      p.end( );
+      m_pDragOverlay->setGeometry(QRect(QPoint(sx, sy), QPoint(ex, ey)));
+      m_pDragOverlay->raise();
+      m_pDragOverlay->show();
+      m_pDragOverlay->update();
    }
 }
 
@@ -1220,7 +1186,6 @@
       m_bAboutToUpdate = false;
       if( m_bMultipleSelectionMode )
       {
-         saveSelectionBox( );
          paintSelectionBox( );
       }
 
--- trunk/extragear/graphics/kpovmodeler/pmglview.h #831215:831216
@@ -360,10 +360,6 @@
     */
    void restoreSelectionBox( );
    /**
-    * Saves the widget under the selection rect
-    */
-   void saveSelectionBox( );
-   /**
     * Paints the selection box
     */
    void paintSelectionBox( );
@@ -426,13 +422,10 @@
    bool m_bDeselectUnderMouse;
    bool m_bSelectUnderMouse;
 
-   /**
-    * Member variables for multiple selection mode
-    */
-   QPixmap m_selectionPixmap[4];
    QPoint m_selectionStart, m_selectionEnd;
    bool m_bMultipleSelectionMode;
    bool m_bSelectionStarted;
+   QWidget* m_pDragOverlay;
 
    /**
     * Member variables for autoscroll
@@ -517,7 +510,7 @@
     */
    QList<PMObjectAction*> m_objectActions;
    static bool s_bDirect;
-	QPixmap m_renderedScene;
+   QPixmap m_renderedScene;
 };
 
 /**
--- trunk/extragear/graphics/kpovmodeler/pmheightfieldroam.cpp #831215:831216
@@ -177,13 +177,7 @@
    if ( mapFile.depth( ) > 8 )
       colourIndex = false;
    else
-   {
-#ifdef __GNUC__
-#warning "kde4: port it !!!!!!!!!!"		   
-#endif	   
-      //scaledMap = scaledMap.convertDepthWithPalette( 8, mapFile.colorTable( ), 256 );
       colourIndex = true;
-   }
 
    for ( int y = 0, y2 = ( m_size - 1 ) ; y < m_size ; ++y, --y2 )
    {
--- trunk/extragear/graphics/kpovmodeler/version.h #831215:831216
@@ -15,4 +15,4 @@
 *                                                                        *
 **************************************************************************/
 
-#define KPOVMODELER_VERSION "1.1.2"
+#define KPOVMODELER_VERSION "1.1.3"
[prev in list] [next in list] [prev in thread] [next in thread] 

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