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

List:       kde-commits
Subject:    koffice/krita/image
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2007-10-24 18:52:52
Message-ID: 1193251972.098569.14991.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 728945 by rempt:

Add a method to KisLayer to get the layer's selection, or,
failing that, the global selection (which may be 0). Start
with seeing what happens when the paint dev doesn't have a
selection() call anymore; first port of call was 
KisRecordedFilterAction.


 M  +1 -1      kis_image.cc  
 M  +9 -0      kis_layer.cc  
 M  +6 -0      kis_layer.h  
 M  +3 -1      kis_paint_device.h  
 M  +4 -4      kis_recorded_filter_action.cc  


--- trunk/koffice/krita/image/kis_image.cc #728944:728945
@@ -100,7 +100,7 @@
 
     vKisAnnotationSP annotations;
 
-    KisSelectionSP globalSelection;
+    KisSelectionSP globalSelection; // XXX_SELECTION: Use the selection from the root layer for this
 
 };
 
--- trunk/koffice/krita/image/kis_layer.cc #728944:728945
@@ -192,6 +192,15 @@
     return selection;
 }
 
+KisSelectionSP KisLayer::selection() const
+{
+    KisSelectionMaskSP selMask = selectionMask();
+    if (selMask)
+        return selMask->selection();
+    else
+        return m_d->image->globalSelection();
+}
+
 bool KisLayer::hasEffectMasks() const
 {
     QList<KisNodeSP> masks = childNodes( QStringList( "KisEffectMask" ), KoProperties() );
--- trunk/koffice/krita/image/kis_layer.h #728944:728945
@@ -103,6 +103,12 @@
      */
     virtual KisSelectionMaskSP selectionMask() const;
 
+    /**
+     * @return the selection contained in the first KisSelectionMask associated
+     * with this layer or the image, if either exists, otherwise, return 0.
+     */
+    virtual KisSelectionSP selection() const;
+
     virtual KoDocumentSectionModel::PropertyList sectionModelProperties() const;
     virtual void setSectionModelProperties( const KoDocumentSectionModel::PropertyList &properties  );
 
--- trunk/koffice/krita/image/kis_paint_device.h #728944:728945
@@ -545,8 +545,10 @@
      * @return the current selection or create one if this paintdevice
      * hasn't got a selection yet.
      */
-        KisSelectionSP KDE_DEPRECATED selection();
+    KisSelectionSP KDE_DEPRECATED selection();
 
+public:
+
     /**
      * @return the current selection or create one if this
      * paintdevice hasn't got a selection yet.
--- trunk/koffice/krita/image/kis_recorded_filter_action.cc #728944:728945
@@ -68,12 +68,12 @@
     // Filters should work only on the visible part of an image.
     QRect rect = r1.intersect(r2);
 
-    if (dev->hasSelection()) {
-        QRect r3 = dev->selection()->selectedExactRect();
+    if (KisSelectionSP selection = d->layer->selection()) {
+        QRect r3 = selection->selectedExactRect();
         rect = rect.intersect(r3);
     }
 
-    const_cast<KisFilter*>(d->filter)->process( d->layer->paintDevice(), rect, kfc);
+    const_cast<KisFilter*>(d->filter)->process( dev, rect, kfc);
 }
 
 void KisRecordedFilterAction::toXML(QDomDocument& doc, QDomElement& elt)
@@ -103,7 +103,7 @@
 
 KisRecordedFilterActionFactory::~KisRecordedFilterActionFactory()
 {
-    
+
 }
 
 KisRecordedAction* KisRecordedFilterActionFactory::fromXML(KisImageSP img, const QDomElement& elt)
[prev in list] [next in list] [prev in thread] [next in thread] 

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