diff -r 118bfaf3f76b -r 1198f19712ff UIPainter.st --- a/UIPainter.st Mon Jan 19 14:18:27 1998 +0100 +++ b/UIPainter.st Tue Jan 20 20:38:01 1998 +0100 @@ -23,7 +23,7 @@ SelectionInTreeView subclass:#TreeView instanceVariableNames:'lastDrawnMaster cvsEventsDisabled imageMasterParent imageEmptyParent imageMasterChild windowSpec' - classVariableNames:'ImageMasterParent ImageMasterChild ImageEmptyParent' + classVariableNames:'Images' poolDictionaries:'' privateIn:UIPainter ! @@ -2873,54 +2873,6 @@ "returns the default name (id) of the application " ^ 'Canvas' -! - -imageEmptyParent - - - - ImageEmptyParent isNil ifTrue:[ - ImageEmptyParent := Image fromFile:('xpmBitmaps/document_images/tiny_dir.xpm'). - ]. - ^ ImageEmptyParent - - " - ImageEmptyParent := nil - " - - "Modified: / 29.10.1997 / 03:36:37 / cg" -! - -imageMasterChild - - - - ImageMasterChild isNil ifTrue:[ - ImageMasterChild := Image fromFile:('xpmBitmaps/document_images/tiny_file_plain_gray.xpm'). - ]. - ^ ImageMasterChild - - " - ImageMasterChild := nil - " - - "Modified: / 29.10.1997 / 03:36:42 / cg" -! - -imageMasterParent - - - - ImageMasterParent isNil ifTrue:[ - ImageMasterParent := Image fromFile:('xpmBitmaps/document_images/tiny_yellow_dir_gray.xpm'). - ]. - ^ ImageMasterParent - - " - ImageMasterParent := nil - " - - "Modified: / 29.10.1997 / 03:36:47 / cg" ! ! !UIPainter::TreeView class methodsFor:'documentation'! @@ -3351,72 +3303,28 @@ !UIPainter::TreeView methodsFor:'initialization'! -fetchImageResources - "get special images for UIPainter, - returns the maximum extent of all images" - - |extent| - - extent := super fetchImageResources. - - imageMasterChild := self class imageMasterChild. - imageMasterChild notNil ifTrue:[ - imageMasterChild := imageMasterChild onDevice:device. - extent := extent max:(imageMasterChild extent). - ]. - imageMasterParent := self class imageMasterParent. - imageMasterParent notNil ifTrue:[ - imageMasterParent := imageMasterParent onDevice:device. - extent := extent max:(imageMasterParent extent). - ]. - imageEmptyParent := self class imageEmptyParent. - imageEmptyParent notNil ifTrue:[ - imageEmptyParent := imageEmptyParent onDevice:device. - extent := extent max:(imageEmptyParent extent). - ]. - - ^ extent. - - "Modified: 19.9.1997 / 17:18:46 / stefan" -! - initialize "initialization; set multiple select and model " + Images := Images ? IdentityDictionary new. super initialize. self multipleSelectOk:true. cvsEventsDisabled := false. - + self showDirectoryIndicator: true. + self showDirectoryIndicatorForRoot: false ! ! !UIPainter::TreeView methodsFor:'private'! figureFor:aNode - "returns image for an item; testing whether item is the first - entry into the selection - " - |master subComp| - - subComp := (aNode parent isNil or:[aNode contents spec class supportsSubComponents]). - - selection size == 0 ifFalse:[ - master := listOfNodes at:(selection first). - - aNode == master ifTrue:[ - lastDrawnMaster := master. - subComp ifFalse:[^ imageMasterChild] - ifTrue:[^ imageMasterParent]. - ] - ]. - subComp ifFalse:[ - ^ imageItem - ]. - aNode hasChildren ifTrue:[ - aNode isExpandable ifTrue:[ ^ imageClosed ] - ifFalse:[ ^ imageOpened ] - ]. - ^ imageEmptyParent - + "returns image for an spec item" + + |cls| + + cls := aNode contents spec class. + aNode contents spec isNil ifTrue: [cls := UISpecification]. + cls := cls withAllSuperclasses detect: [:cls| cls class implements: #icon] ifNone: [^nil]. + ^Images at: cls name ifAbsent: [Images at: cls name put: (cls icon onDevice: device)] ! selectionChangedFrom:oldSelection