selection handling
authorClaus Gittinger <cg@exept.de>
Wed, 13 May 2009 23:42:46 +0200
changeset 2526 29b49d1b4d53
parent 2525 16c3872003d7
child 2527 c953939a481e
selection handling
UIPainterView.st
--- a/UIPainterView.st	Wed May 13 20:00:04 2009 +0200
+++ b/UIPainterView.st	Wed May 13 23:42:46 2009 +0200
@@ -1976,7 +1976,7 @@
     Cursor wait showWhile: [
         self removeAll.
         specOrSpecArray notNil ifTrue:[
-            spec    := UISpecification from:specOrSpecArray.
+            spec := UISpecification from:specOrSpecArray.
         ].
         builder := UIBuilder new isEditing:true.
         "set applicationClass, in order that subspecifications may be resolved"
@@ -2208,7 +2208,6 @@
     |item|
 
     item := treeView detectItemCorespondingToView:aView.
-
     (item notNil and:[item parent notNil]) ifTrue:[
         ^ item contents
     ].
@@ -2436,8 +2435,8 @@
 !
 
 fullSpecFor:aView
-    "generate a full spec for an object
-    "
+    "generate a full spec for an aView (or component)"
+
     |mySpec subSpecs|
 
     mySpec := self specFor:aView.
@@ -2548,11 +2547,18 @@
 !
 
 specForSelection
-    "returns spec assigned to current single selection or nil
-    "
-    ^ self specFor:(self singleSelection)
-
-
+    "returns the spec assigned to current single selection or nil.
+     Nil is also returned for multiple selections (sigh)"
+
+    |theSpec|
+
+    theSpec := self specFor:(self singleSelection).
+    theSpec isNil ifTrue:[
+        treeView isCanvasSelected ifTrue:[
+            theSpec := treeView canvasSpec.
+        ]
+    ].
+    ^ theSpec
 !
 
 updateFromSpec:aSpec