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

List:       kde-commits
Subject:    koffice/lib/kofficeui
From:       Thorsten Zachmann <t.zachmann () zagge ! de>
Date:       2005-10-09 4:49:51
Message-ID: 1128833391.836378.23363.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 468711 by zachmann:

o Added a function to set the guide lines
o Added a function to get the positions of the guide lines


 M  +45 -0     koGuideLines.cpp  
 M  +21 -0     koGuideLines.h  


--- trunk/koffice/lib/kofficeui/koGuideLines.cpp #468710:468711
@@ -320,6 +320,51 @@
 }
 
 
+void KoGuideLines::setGuideLines( const QValueList<double> &horizontalPos, const \
QValueList<double> &verticalPos ) +{
+    erase();
+    for ( KoGuideLineData *gd = m_guides.first(); gd; gd = m_guides.next() )
+    {
+        m_guides.remove( gd );
+    }
+    m_guides.clear();
+
+    QValueList<double>::ConstIterator it = horizontalPos.begin();
+    for ( ; it != horizontalPos.end(); ++it )
+    {
+        KoGuideLineData *gd = new KoGuideLineData( Qt::Horizontal, *it, \
m_view->canvas()->size() ); +        gd->setSelected( false );
+        m_guides.append( gd );
+    }
+    it = verticalPos.begin();
+    for ( ; it != verticalPos.end(); ++it )
+    {
+        KoGuideLineData *gd = new KoGuideLineData( Qt::Vertical, *it, \
m_view->canvas()->size() ); +        gd->setSelected( false );
+        m_guides.append( gd );
+    }
+    paint();
+}
+
+
+void KoGuideLines::getGuideLines( QValueList<double> &horizontalPos, \
QValueList<double> &verticalPos ) +{
+    horizontalPos.clear();
+    verticalPos.clear();
+    for ( KoGuideLineData *gd = m_guides.first(); gd; gd = m_guides.next() )
+    {
+        if ( gd->orientation() == Qt::Horizontal )
+        {
+            horizontalPos.append( gd->position() );
+        }
+        else
+        {
+            verticalPos.append( gd->position() );
+        }
+    }
+}
+
+
 void KoGuideLines::paintGuide( KoGuideLineData *gd, const QSize &size, bool \
updateCanvas, int dx, int dy )  {
     if ( gd->orientation() == Qt::Vertical ) 
--- trunk/koffice/lib/kofficeui/koGuideLines.h #468710:468711
@@ -173,6 +173,27 @@
      */
     void paint( bool updateCanvas = true );
 
+    /**
+     * @brief Set the guide lines.
+     *
+     * This removes all existing guides and set up ne ones at the positions given.
+     *
+     * @param horizontalPos A list of the position of the horizontal guide lines.
+     * @param verticalPos A list of the position of the vertical guide lines.
+     */
+    void setGuideLines( const QValueList<double> &horizontalPos, const \
QValueList<double> &verticalPos ); +
+    /**
+     * @brief Get the position of the guide lines
+     *
+     * This filles the passed lists with the positions of the guide lines. 
+     * The lists will be emptied before any positions are added.
+     *
+     * @param horizontalPos A list of the position of the horizontal guide lines.
+     * @param verticalPos A list of the position of the vertical guide lines.
+     */
+    void getGuideLines( QValueList<double> &horizontalPos, QValueList<double> \
&verticalPos ); +
 public slots:
     /**
      * @brief Move Guide


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

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