diff -r bbb0a5c29671 -r 7a99c53780ef UIPainter.st --- a/UIPainter.st Sat Jun 21 14:34:32 1997 +0200 +++ b/UIPainter.st Sat Jun 21 17:04:35 1997 +0200 @@ -86,26 +86,6 @@ ! ! -!UIPainter class methodsFor:'help specs'! - -helpSpec - "return a dictionary filled with helpKey -> helptext associations. - These are used by the activeHelp tool." - - |dict| - - dict := super helpSpec. - dict at:#maxChars put:'set the maximum number of -characters that are allowed -in the editfield.'. - dict at:#id put:'enter the name of the field -here. This ID can be used -by the applicationModel -to access components, -using #componentAt:'. - ^ dict -! ! - !UIPainter class methodsFor:'icons'! iconAlignB @@ -192,7 +172,7 @@ #'labelImage:' #( ResourceRetriever nil iconAlignCenterV ) ) ) - #( 4 2 ) + #( 3 3 ) nil ) @@ -453,12 +433,14 @@ ^ #(#FullSpec + #'flags:' 0 #'window:' #(#WindowSpec #'name:' 'uIPainterView' #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'flags:' 0 #'label:' 'Tree-View' - #'bounds:' #(#Rectangle 0 0 478 429) + #'bounds:' #(#Rectangle 0 0 524 456) ) #'component:' #(#SpecCollection @@ -466,13 +448,15 @@ #( #(#MenuPanelSpec #'name:' 'menuPullDown' - #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 24 0) + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 25 0) + #'flags:' 0 #'tabable:' true #'menu:' #menuPullDown ) #(#MenuPanelSpec #'name:' 'menuAlignment' #'layout:' #(#LayoutFrame 0 0.0 29 0 233 0 54 0) + #'flags:' 0 #'tabable:' true #'menu:' #menuAlignment #'showSeparatingLines:' true @@ -480,12 +464,14 @@ #(#PanelViewSpec #'name:' 'panelViewButtons' #'layout:' #(#LayoutFrame -125 1.0 25 0.0 0 1.0 57 0.0) + #'flags:' 0 #'component:' #(#SpecCollection #'collection:' #( #(#ActionButtonSpec #'name:' 'moveLeft' + #'flags:' 0 #'label:' '' #'translateLabel:' true #'labelChannel:' #'LABELb_moveLeft.xbm' @@ -498,6 +484,7 @@ ) #(#ActionButtonSpec #'name:' 'moveRight' + #'flags:' 0 #'label:' '' #'translateLabel:' true #'labelChannel:' #'LABELb_moveRight.xbm' @@ -510,6 +497,7 @@ ) #(#ActionButtonSpec #'name:' 'moveUp' + #'flags:' 0 #'label:' '' #'translateLabel:' true #'labelChannel:' #'LABELb_moveUp.xbm' @@ -522,6 +510,7 @@ ) #(#ActionButtonSpec #'name:' 'moveDown' + #'flags:' 0 #'label:' '' #'translateLabel:' true #'labelChannel:' #'LABELb_moveDown.xbm' @@ -543,6 +532,7 @@ #(#SequenceViewSpec #'name:' 'objectTree' #'layout:' #(#LayoutFrame 0 0.0 59 0.0 0 0.35 -25 1.0) + #'flags:' 0 #'enableChannel:' #enableChannel #'tabable:' true #'menu:' #objectListMenu @@ -557,6 +547,7 @@ #(#NoteBookViewSpec #'name:' 'noteBook' #'layout:' #(#LayoutFrame 0 0.35 59 0.0 0 1.0 -55 1.0) + #'flags:' 0 #'enableChannel:' #enableChannel #'tabable:' true #'menu:' #tabList @@ -572,25 +563,28 @@ #(#HorizontalPanelViewSpec #'name:' 'modifyPanel' #'layout:' #(#LayoutFrame 0 0.35 -55 1.0 0 1.0 -25 1.0) + #'flags:' 0 #'component:' #(#SpecCollection #'collection:' #( #(#ActionButtonSpec #'name:' 'cancelButton' + #'flags:' 0 #'label:' 'cancel' #'tabable:' true #'model:' #cancel #'enableChannel:' #modifiedChannel - #'extent:' #(#Point 151 24) + #'extent:' #(#Point 166 24) ) #(#ActionButtonSpec #'name:' 'acceptButton' + #'flags:' 0 #'label:' 'ok' #'tabable:' true #'model:' #accept #'enableChannel:' #modifiedChannel - #'extent:' #(#Point 151 24) + #'extent:' #(#Point 166 24) ) ) ) @@ -603,10 +597,27 @@ #(#LabelSpec #'name:' 'helpInfo' #'layout:' #(#LayoutFrame 2 0.0 -25 1.0 -2 1.0 -2 1.0) + #'flags:' 0 #'label:' '' #'level:' -1 #'adjust:' #left ) + #(#ActionButtonSpec + #'name:' 'raiseGallery' + #'layout:' #(#LayoutFrame 322 0 1 0 421 0 23 0) + #'flags:' 0 + #'label:' 'Gallery' + #'initiallyInvisible:' true + #'model:' #raiseGallery + ) + #(#ActionButtonSpec + #'name:' 'raisePainter' + #'layout:' #(#LayoutFrame 424 0 1 0 524 0 23 0) + #'flags:' 0 + #'label:' 'Painter' + #'initiallyInvisible:' true + #'model:' #raisePainter + ) ) ) ) @@ -631,7 +642,7 @@ self isHelpToolSelected ifTrue:[ activeHelpTool accept ]. - self painter updateFromSpec:(specTool specEdited). + self painter updateFromSpec:(specTool specification). ]. self modifiedChannel value:false. objectList addDependent:self. @@ -642,7 +653,7 @@ "cancel all changes and read back attributes from current view " self modifiedChannel value ifTrue:[ - specTool specEdited:(self painter specForSelection). + specTool specification:(self painter specForSelection). layoutTool layoutView:(layoutTool layoutView). self modifiedChannel value:false. ] @@ -650,31 +661,58 @@ doubleClick objectList selectGroup +! + +raiseGallery + |top| + + top := selectionPanel window. + top map. + top bePartner. + (builder componentAt:#raiseGallery) beInvisible. + +! + +raisePainter + |top| + + top := self painter topView. + top map. + top bePartner. + (builder componentAt:#raisePainter) beInvisible. + + ! ! !UIPainter methodsFor:'active help'! +activeHelpApplicationClass + "gets application class keeping the associated help component + " + |cls| + + specClass notNil ifTrue:[ + specClass isBehavior ifFalse:[cls := Smalltalk at:specClass asSymbol] + ifTrue:[cls := specClass]. + + (cls isSubclassOf:UISpecification) ifTrue:[ + cls := UISpecificationTool + ] + ]. + ^ cls +! + activeHelpTool |cls| activeHelpTool isNil ifTrue:[ activeHelpTool := UIHelpTool new. - specClass notNil ifTrue:[ - specClass isBehavior ifFalse:[ - cls := Smalltalk at:specClass asSymbol - ] ifTrue:[ - cls := specClass - ]. - (cls isSubclassOf:UISpecification) ifTrue:[ - cls := self class - ]. + (cls := self activeHelpApplicationClass) notNil ifTrue:[ activeHelpTool dictionary:(cls helpSpec). - ]. + ] ]. ^ activeHelpTool - - "Modified: 17.6.1997 / 12:51:15 / cg" ! showHelp:aHelpText for:view @@ -854,7 +892,7 @@ objectListChanged "something changed in the painter view " - |oldSelection view slices list spec props size| + |oldSelection view slices list spec props size nameOfSpec| props := objectList selectedProperty. oldSelection := tabSelection. @@ -878,10 +916,16 @@ tabSelection := oldSelection ] ifFalse:[ tabSelection := list first - ] + ]. + nameOfSpec := spec class name. + ] ifTrue:[ + nameOfSpec := '' ]. + + self showHelp:nameOfSpec for:nil. + layoutTool layoutView:view. - specTool specEdited:spec. + specTool specification:spec. tabSelection notNil ifTrue:[ self isLayoutToolSelected ifTrue:[ @@ -965,15 +1009,23 @@ closeRequestFor:aTopView "handle a close request for a specific view " - |topView| + |topView id| topView := self window. topView == aTopView ifTrue:[ super closeRequestFor:aTopView ] ifFalse:[ + "/ aTopView beSlave. + aTopView beIndependent. + + aTopView unmap. + + aTopView = selectionPanel window ifTrue:[id := #raiseGallery] + ifFalse:[id := #raisePainter]. + + (builder componentAt:id) beVisible. topView raise. - topView device beep ]. ! @@ -1280,45 +1332,39 @@ doInstallHelp |dict cls src| - specClass isNil ifTrue:[ - ^ self information:'no class defined' - ]. - specClass isBehavior ifFalse:[ - cls := Smalltalk at:specClass asSymbol - ] ifTrue:[ - cls := specClass - ]. + cls := self activeHelpApplicationClass. cls isNil ifTrue:[ - ^ self information:'no class yet'. + ^ self information:'no application class defined' ]. activeHelpTool isNil ifTrue:[ ^ self information:'no help text defined' ]. dict := activeHelpTool dictionary. - (cls isSubclassOf:UISpecification) ifTrue:[ - cls := self class - ]. + src := '' writeStream. + + src nextPutAll: - src := '' writeStream. - src nextPutAll:'helpSpec +'helpSpec "return a dictionary filled with helpKey -> helptext associations. - These are used by the activeHelp tool." + These are used by the activeHelp tool. + " + ^ super helpSpec addPairsFrom:#( - |dict| - - dict := super helpSpec. '. - dict keysAndValuesDo:[:key :txt | + dict keysAndValuesDo:[:key :txt| |t| - + src nextPutLine:key storeString. + t := txt asString. - (t endsWith:Character cr) ifTrue:[t := t copyWithoutLast:1]. - src nextPutLine:' dict at:' , key storeString , ' put:' , t storeString , '.'. + (t endsWith:Character cr) ifTrue:[ + t := t copyWithoutLast:1 + ]. + src nextPutLine:t storeString; cr. ]. - src nextPutLine:' ^ dict'. + src nextPutLine:')'. src := src contents. Compiler compile:src forClass:cls class inCategory:'help specs' ! @@ -1364,7 +1410,11 @@ ] ]. - (view := Display viewFromUser) notNil ifTrue:[ + (view := Screen current viewFromUser) notNil ifTrue:[ + view device == Screen current ifTrue:[ + ^ self + ]. + painter := self painter. spec := UISpecification fromView:view topView. @@ -1379,12 +1429,19 @@ ! doRaise - self painter topView raise. + |top x| - selectionPanel notNil ifTrue:[ - selectionPanel window raise - ] + top := self painter topView. + top realized ifFalse:[ + self raisePainter + ]. + top raise. + top := selectionPanel window. + top realized ifFalse:[ + self raiseGallery + ]. + top raise. ! doStartApplication