New SetInspectorView.
authorStefan Vogel <sv@exept.de>
Wed, 14 Feb 1996 10:51:50 +0100
changeset 370 7476940ca13f
parent 369 0744c8b6cbf8
child 371 f28c97e821c4
New SetInspectorView.
Make.proto
SetInspV.st
SetInspectorView.st
--- a/Make.proto	Sun Feb 11 17:29:06 1996 +0100
+++ b/Make.proto	Wed Feb 14 10:51:50 1996 +0100
@@ -36,6 +36,7 @@
 	    DebugView.$(O)                      \
 	    NewLauncher.$(O)                    \
 	    InspView.$(O)                       \
+	      SetInspV.$(O)                     \
 	      DictInspV.$(O)                    \
 	      ConInspV.$(O)                     \
 	      OCInspView.$(O)                   \
@@ -103,6 +104,7 @@
 ClrInspV.o: ClrInspV.st $(STCHDR) ../include/InspView.H ../include/SimpleView.H ../include/PseudoV.H ../include/DevDraw.H ../include/DMedium.H ../include/GC.H ../include/Object.H
 ConInspV.o: ConInspV.st $(STCHDR) ../include/InspView.H ../include/SimpleView.H ../include/PseudoV.H ../include/DevDraw.H ../include/DMedium.H ../include/GC.H ../include/Object.H
 DebugView.o: DebugView.st $(STCHDR) ../include/StdSysV.H ../include/TopView.H ../include/View.H ../include/SimpleView.H ../include/PseudoV.H ../include/DevDraw.H ../include/DMedium.H ../include/GC.H ../include/Object.H
+SetInspV.o: SetInspV.st $(STCHDR) ../include/InspView.H ../include/SimpleView.H ../include/PseudoV.H ../include/DevDraw.H ../include/DMedium.H ../include/GC.H ../include/Object.H
 DictInspV.o: DictInspV.st $(STCHDR) ../include/InspView.H ../include/SimpleView.H ../include/PseudoV.H ../include/DevDraw.H ../include/DMedium.H ../include/GC.H ../include/Object.H
 DiffTxtV.o: DiffTxtV.st $(STCHDR)
 Diff3TxtV.o: Diff3TxtV.st $(STCHDR)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SetInspV.st	Wed Feb 14 10:51:50 1996 +0100
@@ -0,0 +1,136 @@
+'From Smalltalk/X, Version:2.10.9 on 13-feb-1996 at 12:09:01'                   !
+
+InspectorView subclass:#SetInspectorView
+	instanceVariableNames:'keys'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Interface-Inspector'
+!
+
+!SetInspectorView class methodsFor:'documentation'!
+
+documentation
+"
+    A modified inspector for Sets
+"
+!
+
+examples
+"
+    #(a b c d e) asSet inspect
+"
+!
+
+history
+    "Created: 13.2.1996 / 10:09:14 / stefan"
+! !
+
+!SetInspectorView methodsFor:'initialization'!
+
+fieldMenu
+    |menu|
+
+    menu := super fieldMenu.
+    menu addLabels:#(
+                       '-'
+                       'remove element'
+                   )
+         selectors:#(
+                       nil 
+                       doRemoveKey
+                   ).
+
+    ^ menu
+! !
+
+!SetInspectorView methodsFor:'private'!
+
+fieldList 
+    "return a list of names for the selectionlist. Leave hasMore as
+     true, if a '...' entry should be added."
+
+    |aList|
+
+    inspectedObject isNil ifTrue:[^ #()].
+
+    keys := inspectedObject asSortedCollection:[:a :b | a printString < b printString].
+    aList := keys collect:[:k | k isSymbol ifTrue:[
+                                                k printString
+                                               ] ifFalse:[
+                                                k displayString
+                                               ]
+                                         ].
+    aList := aList asOrderedCollection.
+    aList addFirst:'self'.
+    ^ aList
+
+    "Modified: 9.2.1996 / 12:02:19 / stefan"
+!
+
+release 
+    "release inspected object"
+
+    keys := nil.
+    super release
+
+    "Created: 9.2.1996 / 12:04:30 / stefan"
+! !
+
+!SetInspectorView methodsFor:'user interaction'!
+
+doAccept:theText
+    "accept value for selected item"
+
+    |value|
+
+    value := Compiler evaluate:theText receiver:inspectedObject notifying:workspace.
+
+    inspectedObject add:value.
+    inspectedObject changed.
+    self inspect:inspectedObject
+
+
+!
+
+doRemoveKey
+    "remove selected item from keys"
+
+    |key|
+
+    selectedLine == 1 ifFalse:[
+        key := (keys at:selectedLine - 1).
+        (inspectedObject includes:key) ifTrue:[
+            listView cursor:(Cursor wait).
+            inspectedObject remove:key.
+            keys := nil.
+            selectedLine := nil.
+            inspectedObject changed.
+            listView cursor:(Cursor hand).
+            self inspect:inspectedObject. "force list update"
+        ].
+    ]
+
+
+!
+
+valueAtLine:lineNr
+    "helper - return the value of the selected entry"
+
+    |key|
+
+    lineNr == 1 ifTrue:[
+        ^ inspectedObject
+    ].
+    key := (keys at:lineNr - 1).
+    ^ key.
+
+    "Created: 9.2.1996 / 12:03:29 / stefan"
+! !
+
+!SetInspectorView class methodsFor:'documentation'!
+
+version
+"
+$Header: /cvs/stx/stx/libtool/Attic/SetInspV.st,v 1.1 1996-02-14 09:51:50 stefan Exp $
+"
+! !
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SetInspectorView.st	Wed Feb 14 10:51:50 1996 +0100
@@ -0,0 +1,136 @@
+'From Smalltalk/X, Version:2.10.9 on 13-feb-1996 at 12:09:01'                   !
+
+InspectorView subclass:#SetInspectorView
+	instanceVariableNames:'keys'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Interface-Inspector'
+!
+
+!SetInspectorView class methodsFor:'documentation'!
+
+documentation
+"
+    A modified inspector for Sets
+"
+!
+
+examples
+"
+    #(a b c d e) asSet inspect
+"
+!
+
+history
+    "Created: 13.2.1996 / 10:09:14 / stefan"
+! !
+
+!SetInspectorView methodsFor:'initialization'!
+
+fieldMenu
+    |menu|
+
+    menu := super fieldMenu.
+    menu addLabels:#(
+                       '-'
+                       'remove element'
+                   )
+         selectors:#(
+                       nil 
+                       doRemoveKey
+                   ).
+
+    ^ menu
+! !
+
+!SetInspectorView methodsFor:'private'!
+
+fieldList 
+    "return a list of names for the selectionlist. Leave hasMore as
+     true, if a '...' entry should be added."
+
+    |aList|
+
+    inspectedObject isNil ifTrue:[^ #()].
+
+    keys := inspectedObject asSortedCollection:[:a :b | a printString < b printString].
+    aList := keys collect:[:k | k isSymbol ifTrue:[
+                                                k printString
+                                               ] ifFalse:[
+                                                k displayString
+                                               ]
+                                         ].
+    aList := aList asOrderedCollection.
+    aList addFirst:'self'.
+    ^ aList
+
+    "Modified: 9.2.1996 / 12:02:19 / stefan"
+!
+
+release 
+    "release inspected object"
+
+    keys := nil.
+    super release
+
+    "Created: 9.2.1996 / 12:04:30 / stefan"
+! !
+
+!SetInspectorView methodsFor:'user interaction'!
+
+doAccept:theText
+    "accept value for selected item"
+
+    |value|
+
+    value := Compiler evaluate:theText receiver:inspectedObject notifying:workspace.
+
+    inspectedObject add:value.
+    inspectedObject changed.
+    self inspect:inspectedObject
+
+
+!
+
+doRemoveKey
+    "remove selected item from keys"
+
+    |key|
+
+    selectedLine == 1 ifFalse:[
+        key := (keys at:selectedLine - 1).
+        (inspectedObject includes:key) ifTrue:[
+            listView cursor:(Cursor wait).
+            inspectedObject remove:key.
+            keys := nil.
+            selectedLine := nil.
+            inspectedObject changed.
+            listView cursor:(Cursor hand).
+            self inspect:inspectedObject. "force list update"
+        ].
+    ]
+
+
+!
+
+valueAtLine:lineNr
+    "helper - return the value of the selected entry"
+
+    |key|
+
+    lineNr == 1 ifTrue:[
+        ^ inspectedObject
+    ].
+    key := (keys at:lineNr - 1).
+    ^ key.
+
+    "Created: 9.2.1996 / 12:03:29 / stefan"
+! !
+
+!SetInspectorView class methodsFor:'documentation'!
+
+version
+"
+$Header: /cvs/stx/stx/libtool/SetInspectorView.st,v 1.1 1996-02-14 09:51:50 stefan Exp $
+"
+! !