ca@164: " ca@164: COPYRIGHT (c) 1995 by eXept Software AG ca@164: All Rights Reserved ca@164: ca@164: This software is furnished under a license and may be used ca@164: only in accordance with the terms of that license and with the ca@164: inclusion of the above copyright notice. This software may not ca@164: be provided or otherwise made available to, or used by, any ca@164: other person. No title to or ownership of the software is ca@164: hereby transferred. ca@164: " cg@1386: "{ Package: 'stx:libtool2' }" cg@1386: ca@164: ApplicationModel subclass:#UISpecificationTool ca@759: instanceVariableNames:'modifiedHolder aspects specification selection specChannel ca@1307: buildInView listOfSpecViews' ca@164: classVariableNames:'' ca@164: poolDictionaries:'' ca@164: category:'Interface-UIPainter' ca@164: ! ca@164: ca@1307: ViewScroller subclass:#BuildInView ca@1573: instanceVariableNames:'' ca@1307: classVariableNames:'' ca@1307: poolDictionaries:'' ca@1307: privateIn:UISpecificationTool ca@1307: ! ca@1307: ca@164: !UISpecificationTool class methodsFor:'documentation'! ca@164: ca@164: copyright ca@164: " ca@164: COPYRIGHT (c) 1995 by eXept Software AG ca@164: All Rights Reserved ca@164: ca@164: This software is furnished under a license and may be used ca@164: only in accordance with the terms of that license and with the ca@164: inclusion of the above copyright notice. This software may not ca@164: be provided or otherwise made available to, or used by, any ca@164: other person. No title to or ownership of the software is ca@164: hereby transferred. ca@164: " ca@164: ca@164: ca@164: ca@164: ! ca@164: ca@164: documentation ca@164: " ca@164: used by the UIPainter to manipulate the specifications of the selected component ca@164: ca@164: [author:] ca@164: Claus Atzkern ca@164: ca@164: [see also:] ca@164: UIPainter ca@164: UILayoutTool ca@164: UIHelpTool ca@164: " ca@164: ! ! ca@164: cg@1963: !UISpecificationTool class methodsFor:'help specs'! cg@1963: cg@1963: helpSpec cg@1963: "This resource specification was automatically generated cg@1963: by the UIHelpTool of ST/X." cg@1963: cg@1963: "Do not manually edit this!! If it is corrupted, cg@1963: the UIHelpTool may not be able to read the specification." cg@1963: cg@1963: " cg@1963: UIHelpTool openOnClass:UISpecificationTool cg@1963: " cg@1963: cg@1963: cg@1963: cg@1963: ^ super helpSpec addPairsFrom:#( cg@1963: sv@2316: #allowSymbolicColors cg@2335: 'ColorMenu is allowed to return a symbolic color name' cg@2335: cg@2335: #allowSymbolicFonts cg@2335: 'FontMenu is allowed to return a symbolic font name' sv@2316: cg@1963: #autoScrollHorizontal cg@1963: '' cg@1963: cg@2209: #browseAction cg@2209: 'Browse/Create the Action method.' cg@2209: cg@2237: #browseAspectMethod cg@2237: 'Browse/Create the Aspect method.' cg@2237: sv@2283: #editListSpec sv@2283: 'Edit the contents of the list (inline)' sv@2283: cg@2239: #formatString cg@2239: '' cg@2239: sv@2316: #labelsAreColored sv@2316: 'Show color in ColorMenuLabels' sv@2316: cg@2377: #showFrame cg@2377: 'Show the frame' cg@2377: cg@2239: #textModel cg@2239: '' cg@2239: cg@2377: #translateLabel cg@2377: '' cg@2377: cg@1963: ) cg@1963: ! ! cg@1963: cg@2209: !UISpecificationTool class methodsFor:'image specs'! cg@2209: cg@2209: browseActionImage cg@2209: ^ UIPainter browseActionImage sv@2283: ! sv@2283: sv@2283: editTableIcon sv@2283: ^ UIPainter editTableIcon cg@2209: ! ! cg@2209: ca@164: !UISpecificationTool class methodsFor:'interface specs'! ca@164: ca@164: windowSpec ca@1307: "This resource specification was automatically generated ca@1307: by the UIPainter of ST/X." ca@164: ca@1307: "Do not manually edit this!! If it is corrupted, ca@1307: the UIPainter may not be able to read the specification." ca@164: ca@164: " ca@164: UIPainter new openOnClass:UISpecificationTool andSelector:#windowSpec ca@164: UISpecificationTool new openInterface:#windowSpec ca@1307: UISpecificationTool open ca@164: " ca@164: ca@164: ca@164: ca@1307: ^ ca@1307: #(#FullSpec ca@1307: #name: #windowSpec ca@1307: #window: ca@1307: #(#WindowSpec ca@1307: #label: 'unnamed canvas' ca@1307: #name: 'unnamed canvas' ca@1313: #bounds: #(#Rectangle 12 22 312 322) ca@1307: ) ca@1307: #component: ca@1307: #(#SpecCollection ca@1307: #collection: #( ca@1307: #(#ArbitraryComponentSpec ca@1313: #name: 'BuildInView' ca@1307: #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) ca@1313: #hasVerticalScrollBar: true ca@1313: #miniScrollerVertical: true ca@1313: #autoHideScrollBars: true ca@1307: #hasBorder: false ca@1313: #component: #buildInView ca@1307: ) ca@1307: ) ca@1307: ca@1307: ) ca@164: ) ca@164: ! ! ca@164: cg@1781: !UISpecificationTool class methodsFor:'resources'! cg@1781: cg@1781: classResources cg@1781: "my translations are found in the UIPainter classes resources" cg@1781: cg@1781: ^ UIPainter classResources cg@1781: ! ! cg@1781: cg@1331: !UISpecificationTool methodsFor:'accessing-channels'! ca@1315: ca@1315: modifiedHolder:aValueHolder ca@1315: "set the value holder set to true in case of modifying attributes ca@1315: " ca@1315: ca@1315: modifiedHolder removeDependent:self. ca@164: ca@1315: (modifiedHolder := aValueHolder) notNil ifTrue:[ ca@1315: modifiedHolder addDependent:self. ca@1315: ]. cg@1063: ca@1315: ! ! ca@1315: cg@1331: !UISpecificationTool methodsFor:'accessing-specification'! cg@1063: cg@2245: listOfAspects cg@2245: ^ masterApplication listOfAspects cg@2245: cg@2245: "Created: / 12-01-2008 / 19:24:39 / cg" cg@2245: ! cg@2245: cg@2245: listOfCallbacks cg@2245: ^ masterApplication listOfCallbacks cg@2245: cg@2245: "Created: / 12-01-2008 / 19:25:05 / cg" cg@2245: ! cg@2245: ca@172: specification ca@172: "gets current edit specification ca@172: " ca@172: ^ specification ca@172: ca@172: ca@172: ! ca@172: ca@172: specification:aSpec ca@172: "sets current edit specification ca@172: " ca@1315: aSpec notNil ifTrue:[ ca@1315: "/ same type of spec - simply change the spec; no need to setup everything ca@1315: specification class == aSpec class ifTrue:[ ca@1315: specification := aSpec. ca@1315: specChannel value:specification. ca@1315: ^ self ca@1315: ] ca@1307: ]. ca@428: ca@1315: "/ release resources ca@1315: specChannel release. ca@1315: aspects release. ca@1315: selection := listOfSpecViews := nil. ca@1573: buildInView destroyAllClientViews. ca@1315: ca@1315: (specification := aSpec) isNil ifTrue:[ ca@1315: aspects := specChannel := nil. ca@1315: ^ self ca@1307: ]. ca@1307: ca@1307: "/ some tricky specs need the builder during the addBindings phase. ca@1307: "/ This is passed down in a special UIBindingsDictionary ca@1307: "/ (remain backward compatible) cg@536: ca@1307: aspects := UISpecification newBindingsDictionary. ca@1307: aspects builder:builder. ca@1307: aspects at:#modifiedChannel put:modifiedHolder. ca@1307: aspects at:#acceptChannel put:self acceptChannel. ca@172: cg@2245: aspects at:#listOfAspects put:[self listOfAspects]. cg@2245: aspects at:#listOfCallbacks put:[self listOfCallbacks]. cg@2245: ca@1307: specChannel := specification asValue. ca@1307: specification class addBindingsTo:aspects for:specification channel:specChannel. cg@536: ca@1307: "/ arrange for being notified, if any aspect changes ca@1307: aspects do:[:el| el addDependent:self ]. cg@2245: cg@2245: "Modified: / 12-01-2008 / 19:28:47 / cg" ca@172: ! ! ca@172: cg@364: !UISpecificationTool methodsFor:'actions'! cg@364: cg@364: setMaxExtent cg@364: "set the windows maxExtent from its current extent" cg@364: cg@364: |canvas currentExtent| cg@364: cg@2211: canvas := self masterApplication canvas. cg@364: currentExtent := canvas extent. cg@364: (self aspectFor:#maxX) value:currentExtent x. cg@364: (self aspectFor:#maxY) value:currentExtent y. cg@364: cg@364: "Modified: / 29.10.1997 / 18:29:17 / cg" cg@364: ! cg@364: cg@364: setMinExtent cg@364: "set the windows minExtent from its current extent" cg@364: cg@364: |canvas currentExtent| cg@364: cg@2211: canvas := self masterApplication canvas. cg@364: currentExtent := canvas extent. cg@364: (self aspectFor:#minX) value:currentExtent x. cg@364: (self aspectFor:#minY) value:currentExtent y. cg@364: cg@364: "Created: / 29.10.1997 / 18:17:55 / cg" cg@364: "Modified: / 29.10.1997 / 18:28:53 / cg" cg@364: ! ! cg@364: ca@164: !UISpecificationTool methodsFor:'bindings'! ca@164: ca@1315: acceptChannel cg@2245: ^ masterApplication acceptChannel ca@1315: cg@2245: "Modified: / 12-01-2008 / 11:28:38 / cg" ca@1315: ! ca@1315: ca@164: aspectFor:aKey cg@2245: "returns the aspect for a key or nil" cg@2245: ca@164: aspects notNil ifTrue:[ ca@164: ^ aspects at:aKey ifAbsent:nil ca@164: ]. ca@164: ^ super aspectFor:aKey ca@164: cg@2245: "Modified: / 12-01-2008 / 11:28:52 / cg" ca@428: ! ca@428: ca@1313: buildInView ca@1313: ^ buildInView ca@1307: ! ca@1307: sv@584: specificationFor:aKey sv@584: "this is called if our current specification contains sv@584: subspecifications or subcanvases. sv@584: Get the subspecification from the current specification" sv@584: ca@1307: specification notNil ifTrue:[ ca@1307: ^ specification class perform:aKey ifNotUnderstood:nil sv@584: ]. sv@584: ^ nil ca@172: ! ! ca@172: ca@172: !UISpecificationTool methodsFor:'change & update'! ca@164: ca@172: update ca@172: "reload specification ca@164: " ca@172: specChannel notNil ifTrue:[ ca@172: specChannel value:specification. ca@172: ] ca@164: ca@164: ca@164: ! ca@164: ca@164: update:something with:someArgument from:someone ca@164: "any attribute changed its state in the current specification ca@164: " ca@164: someone ~~ modifiedHolder ifTrue:[ cg@893: "/ any in the spec has changed. cg@893: "/ update my modified holders value cg@893: cg@1071: modifiedHolder value:true ca@164: ] ca@164: cg@893: "Modified: / 16.7.1998 / 19:25:59 / cg" ca@164: ! ! ca@164: cg@1956: !UISpecificationTool methodsFor:'help'! cg@1956: cg@2524: basicFlyByHelpTextForKey:aKey cg@2524: "activeHelp interface: return some help text for a key. cg@2524: Redefined to ask the current components Spec first." cg@2524: cg@2524: |helpText| cg@2524: cg@2524: "/ first, ask the master (a hook for expecco, to provide different help texts) cg@2524: masterApplication notNil ifTrue:[ cg@2524: helpText := masterApplication basicFlyByHelpTextForKey:aKey. cg@2524: helpText notNil ifTrue:[^ helpText ]. cg@2545: cg@2545: "/ then, ask the master about the spec cg@2545: helpText := masterApplication basicHelpTextFromSpecification:specification forKey:aKey. cg@2545: ] ifFalse:[ cg@2545: "/ then, ask the spec cg@2545: helpText := (specification helpSpec) at:aKey ifAbsent:nil. cg@2524: ]. cg@2524: helpText notNil ifTrue:[^ helpText ]. cg@2524: cg@2524: "/ finally, ask myself... cg@2524: ^ super basicFlyByHelpTextForKey:aKey. cg@2524: ! cg@2524: cg@1956: basicHelpTextForKey:aKey cg@1956: "activeHelp interface: return some help text for a key. cg@1956: Redefined to ask the current components Spec first." cg@1956: cg@1956: |helpText| cg@1956: cg@2524: "/ first, ask the master (a hook for expecco, to provide different help texts) cg@2524: masterApplication notNil ifTrue:[ cg@2524: helpText := masterApplication basicHelpTextForKey:aKey. cg@2524: helpText notNil ifTrue:[^ helpText ]. cg@2545: cg@2545: "/ then, ask the master about the spec cg@2545: helpText := masterApplication basicHelpTextFromSpecification:specification forKey:aKey. cg@2545: ] ifFalse:[ cg@2545: "/ then, ask the spec cg@2545: helpText := (specification helpSpec) at:aKey ifAbsent:nil. cg@2524: ]. cg@2524: helpText notNil ifTrue:[^ helpText ]. cg@2524: cg@2524: "/ finally, ask myself... cg@2524: ^ super basicHelpTextForKey:aKey. cg@1956: ! ! cg@1956: ca@1315: !UISpecificationTool methodsFor:'initialization'! ca@1315: ca@1315: initialize ca@1315: super initialize. ca@1315: buildInView := BuildInView new. ca@1573: buildInView keepViews:true. ca@1315: ! ! ca@1315: ca@164: !UISpecificationTool methodsFor:'selection'! ca@164: ca@164: selection:something ca@172: "selection changed ca@172: " ca@1307: |slices index spec window| ca@164: ca@172: specification notNil ifTrue:[ ca@172: slices := specification class slices. ca@1307: index := slices findFirst:[:aSlice| aSlice first = something ]. ca@164: ca@1307: index ~~ 0 ifTrue:[ ca@1307: spec := specification class perform:((slices at:index) last) ca@428: ] ca@164: ]. ca@164: ca@172: spec ~= selection ifTrue:[ ca@1307: (selection := spec) notNil ifTrue:[ ca@1307: listOfSpecViews isNil ifTrue:[ ca@1307: listOfSpecViews := Array new:(slices size). ca@1307: ] ifFalse:[ ca@1307: window := listOfSpecViews at:index ca@1307: ]. ca@1307: window isNil ifTrue:[ ca@1307: builder buildFromSpec:spec in:(window := SimpleView new). ca@1307: listOfSpecViews at:index put:window. ca@1307: ]. ca@1307: ]. ca@1315: buildInView scrolledView:window. ca@164: ]. ca@164: ! ! ca@164: ca@1307: !UISpecificationTool::BuildInView methodsFor:'accessing'! ca@759: ca@2160: mapped ca@2160: super mapped. ca@2160: ca@2160: scrolledView notNil ifTrue:[ ca@2160: scrolledView beVisible. ca@2160: scrolledView raise. ca@2160: ]. ca@2160: ! ca@2160: ca@1307: scrolledView:aView ca@1307: "set the view to be scrolled" ca@1573: |wrapper y| ca@1307: ca@1307: scrolledView == aView ifTrue:[^ self]. ca@759: ca@2160: scrolledView notNil ifTrue:[ ca@2160: scrolledView unmap. ca@2160: ]. ca@2160: (scrolledView := aView) notNil ifTrue:[ ca@2160: scrolledView superView ~~ frame ifTrue:[ ca@2160: scrolledView borderWidth:0; level:0. ca@1307: ca@2160: frame addSubView:scrolledView. ca@1573: ca@2160: scrolledView subViews size == 1 ifTrue:[ ca@2160: wrapper := scrolledView subViews first. ca@2160: wrapper isScrollWrapper ifTrue:[ ca@2160: "/ give it a full-relative size, and let it do ca@2160: "/ the scrolling itself. ca@2160: y := 1.0 ca@2160: ] ca@2160: ]. ca@2160: y isNil ifTrue:[ cg@2350: y := scrolledView preferredHeight ca@2160: ]. ca@2160: scrolledView origin:0@0 corner:1.0 @ y. ca@2160: scrolledView allViewBackground:(self viewBackground). cg@1351: ]. ca@2160: ]. ca@2160: shown ifTrue:[ ca@2160: scrolledView beVisible. ca@2160: scrolledView raise. ca@1307: self sizeChanged:nil. ca@1307: ]. ca@1573: model value:scrolledView. ca@759: ! ! ca@759: ca@1313: !UISpecificationTool::BuildInView methodsFor:'initialization'! ca@1313: ca@1313: level:aLevel ca@1313: super level:0 ca@1313: ! ca@1313: ca@1313: realize ca@1315: ca@1313: super realize. ca@1313: superView notNil ifTrue:[superView level:0]. ca@1313: ! ! ca@1313: ca@164: !UISpecificationTool class methodsFor:'documentation'! ca@164: ca@164: version ca@164: ^ '$Header$' ca@164: ! !