some bugs fixed
authortz
Fri, 20 Mar 1998 19:06:06 +0100
changeset 736 6db5efc5df90
parent 735 29c8681ce68d
child 737 ed5b109a0f91
some bugs fixed
HierarchicalListEditor.st
--- a/HierarchicalListEditor.st	Sat Mar 14 12:17:03 1998 +0100
+++ b/HierarchicalListEditor.st	Fri Mar 20 19:06:06 1998 +0100
@@ -1,10 +1,10 @@
 "
- COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
+ COPYRIGHT (c) 1997 by eXept Software AG
               All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
- inclusion of the above copyright notice.   This software may not
+ inclusion of the above copyright notice. This software may not
  be provided or otherwise made available to, or used by, any
  other person.  No title to or ownership of the software is
  hereby transferred.
@@ -13,7 +13,7 @@
 
 
 
-ListSpecEditor subclass:#HierarchicalListEditor
+ResourceSpecEditor subclass:#HierarchicalListEditor
 	instanceVariableNames:'treeView'
 	classVariableNames:''
 	poolDictionaries:''
@@ -24,12 +24,12 @@
 
 copyright
 "
- COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
+ COPYRIGHT (c) 1997 by eXept Software AG
               All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
- inclusion of the above copyright notice.   This software may not
+ inclusion of the above copyright notice. This software may not
  be provided or otherwise made available to, or used by, any
  other person.  No title to or ownership of the software is
  hereby transferred.
@@ -81,14 +81,19 @@
 !HierarchicalListEditor class methodsFor:'help specs'!
 
 helpSpec
-    "return a dictionary filled with helpKey -> helptext associations.
-     These are used by the activeHelp tool."
+    "This resource specification was automatically generated
+     by the UIHelpTool of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIHelpTool may not be able to read the specification."
 
     "
-    UIHelpTool openOnClass:HierarchicalListEditor    
+     UIHelpTool openOnClass:HierarchicalListEditor    
     "
 
-  ^ super helpSpec addPairsFrom:#(
+    <resource: #help>
+
+    ^super helpSpec addPairsFrom:#(
 
 #addChild
 'Adds a new child item.'
@@ -103,7 +108,7 @@
 'Opens a dialog for selecting and loading a hierarchical list spec from a class.'
 
 #fileNew
-'Creates a new hierarchical list.'
+'Creates a new hierarchical list. '
 
 #fileSave
 'Saves current hierarchical list spec.'
@@ -120,9 +125,14 @@
 !HierarchicalListEditor class methodsFor:'image specs'!
 
 createChildIcon
-    "Generated by the Image Editor"
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
     "
-    ImageEditor openOnClass:self andSelector:#createChildIcon
+     ImageEditor openOnClass:self andSelector:#createChildIcon
     "
 
     <resource: #image>
@@ -132,9 +142,14 @@
         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@AUUUUP@@A????2@@A????2 @A????0@@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A?????8@A<3L308@A33L33H@A30L33H@A33L33H@A<3L008@A?????8@C*****(@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@_??@_?? _??0_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8') ; yourself); yourself]!
 
 createSisterIcon
-    "Generated by the Image Editor"
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
     "
-    ImageEditor openOnClass:self andSelector:#createSisterIcon
+     ImageEditor openOnClass:self andSelector:#createSisterIcon
     "
 
     <resource: #image>
@@ -146,16 +161,17 @@
 !HierarchicalListEditor class methodsFor:'interface specs'!
 
 windowSpec
-    "this window spec was automatically generated by the ST/X UIPainter"
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
 
-    "do not manually edit this - the painter/builder may not be able to
-     handle the specification if its corrupted."
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
 
     "
      UIPainter new openOnClass:HierarchicalListEditor andSelector:#windowSpec
      HierarchicalListEditor new openInterface:#windowSpec
+     HierarchicalListEditor open
     "
-    "HierarchicalListEditor open"
 
     <resource: #canvas>
 
@@ -165,11 +181,11 @@
           #window: 
            #(#WindowSpec
               #name: 'Hierarchical List Editor'
-              #layout: #(#LayoutFrame 140 0 249 0 614 0 561 0)
+              #layout: #(#LayoutFrame 229 0 389 0 703 0 701 0)
               #label: 'Hierarchical List Editor'
               #min: #(#Point 10 10)
               #max: #(#Point 1160 870)
-              #bounds: #(#Rectangle 140 249 615 562)
+              #bounds: #(#Rectangle 229 389 704 702)
               #menu: #menu
               #usePreferredExtent: false
           )
@@ -207,27 +223,27 @@
                                    #(
                                      #(#LabelSpec
                                         #name: 'nameLabel'
-                                        #layout: #(#AlignmentOrigin 108 0 26 0 1 0.5)
+                                        #layout: #(#AlignmentOrigin 98 0 26 0 1 0.5)
                                         #label: 'Label:'
                                         #resizeForLabel: true
                                     )
                                      #(#InputFieldSpec
                                         #name: 'labelInputField'
-                                        #layout: #(#LayoutFrame 110 0 15 0 -5 1.0 37 0)
+                                        #layout: #(#LayoutFrame 100 0 15 0 -5 1.0 37 0)
                                         #activeHelpKey: #label
                                         #tabable: true
                                         #model: #itemName
                                     )
                                      #(#LabelSpec
                                         #name: 'valueLabel'
-                                        #layout: #(#AlignmentOrigin 108 0 52 0 1 0.5)
+                                        #layout: #(#AlignmentOrigin 98 0 52 0 1 0.5)
                                         #activeHelpKey: #contents
                                         #label: 'Contents:'
                                         #resizeForLabel: true
                                     )
                                      #(#InputFieldSpec
                                         #name: 'valueInputField'
-                                        #layout: #(#LayoutFrame 110 0 41 0 -5 1.0 63 0)
+                                        #layout: #(#LayoutFrame 100 0 41 0 -5 1.0 63 0)
                                         #activeHelpKey: #contents
                                         #tabable: true
                                         #model: #itemValue
@@ -261,10 +277,11 @@
 !HierarchicalListEditor class methodsFor:'menu specs'!
 
 menu
-    "this window spec was automatically generated by the ST/X MenuEditor"
+    "This resource specification was automatically generated
+     by the MenuEditor of ST/X."
 
-    "do not manually edit this - the builder may not be able to
-     handle the specification if its corrupted."
+    "Do not manually edit this!! If it is corrupted,
+     the MenuEditor may not be able to read the specification."
 
     "
      MenuEditor new openOnClass:HierarchicalListEditor andSelector:#menu
@@ -370,6 +387,20 @@
                 #submenuChannel: #menuHistory
             )
              #(#MenuItem
+                #label: 'Settings'
+                #submenu: 
+                 #(#Menu
+                    
+                     #(
+                       #(#MenuItem
+                          #label: 'Fonts'
+                          #submenuChannel: #menuFont
+                      )
+                    ) nil
+                    nil
+                )
+            )
+             #(#MenuItem
                 #label: 'Help'
                 #startGroup: #right
                 #submenuChannel: #menuHelp
@@ -380,10 +411,11 @@
 !
 
 menuEdit
-    "this window spec was automatically generated by the ST/X MenuEditor"
+    "This resource specification was automatically generated
+     by the MenuEditor of ST/X."
 
-    "do not manually edit this - the builder may not be able to
-     handle the specification if its corrupted."
+    "Do not manually edit this!! If it is corrupted,
+     the MenuEditor may not be able to read the specification."
 
     "
      MenuEditor new openOnClass:HierarchicalListEditor andSelector:#menuEdit
@@ -458,10 +490,11 @@
 !
 
 menuToolbar
-    "this window spec was automatically generated by the ST/X MenuEditor"
+    "This resource specification was automatically generated
+     by the MenuEditor of ST/X."
 
-    "do not manually edit this - the builder may not be able to
-     handle the specification if its corrupted."
+    "Do not manually edit this!! If it is corrupted,
+     the MenuEditor may not be able to read the specification."
 
     "
      MenuEditor new openOnClass:HierarchicalListEditor andSelector:#menuToolbar
@@ -743,7 +776,7 @@
 
 !
 
-buildFromListSpec: aListSpec
+buildFromResourceSpec: aListSpec
 
     treeView root: aListSpec
 
@@ -822,7 +855,7 @@
 
     self valueOfCanCopy value: self valueOfCanCut value.
 
-    self valueOfCanPaste value: (self class clipboard notNil and:[treeView selectedNode notNil]).
+    self valueOfCanPaste value: treeView selectedNode notNil & self valueOfCanPaste value.
 !
 
 updateInputFields
@@ -863,7 +896,7 @@
 openModalOnTreeItem: aTreeItem
     "build a tree from aTreeItem and open it modal"
 
-    super openModalOnListSpec: aTreeItem
+    super openModalOnResourceSpec: aTreeItem
 ! !
 
 !HierarchicalListEditor methodsFor:'user actions'!
@@ -898,8 +931,8 @@
     "copy current selected nodes into copy buffer"
 
     self class clipboard: OrderedCollection new.
-    treeView selectedNodesDo:[:aNode| self class clipboard add: aNode copy]
-
+    treeView selectedNodesDo:[:aNode| self class clipboard add: aNode copy].
+    self updateChannels
 !
 
 doCreateChild
@@ -971,14 +1004,10 @@
 !
 
 doNew
-    "remove all items; restart"
+    "first do super new; then make a build 
+     of a resource spec containing a root"
 
-    self askForModification
-    ifTrue: 
-    [
-        self isStandAlone ifTrue: [specClass := specSelector := nil].
-        self buildRoot
-    ]
+    super doNew ifTrue: [self buildRoot]
 
 
 
@@ -987,7 +1016,7 @@
 doPaste
     "paste after current selected item"
 
-    self askForItemModification
+    (self askForItemModification and: [self class clipboard notNil])
     ifTrue:
     [
         |copiedNode|
@@ -1038,10 +1067,8 @@
             , Character excla asString , '\\'
 
             , specSelector , '\'
-            , '    "this window spec was automatically generated by the ST/X HierarchicalListEditor"\\'
-            , '    "do not manually edit this - the builder may not be able to\'
-            , '     handle the specification if its corrupted."\\'
-            , '    "\'
+            , (self class codeGenerationComment replChar:$!! withString:'!!!!')
+            , '\\    "\'
             , '     HierarchicalListEditor openOnClass:' , cls name , ' andSelector:#' , specSelector , '\'
             , '    "\'.