Alexander Lazarević uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-laza.180.mcz ==================== Summary ==================== Name: Morphic-laza.180 Author: laza Time: 9 September 2009, 1:01:20 am UUID: 2972d84e-b80d-e24b-9f2b-a73b82495250 Ancestors: Morphic-ar.172 empty log message =============== Diff against Morphic-ar.172 =============== Item was added: + ----- Method: SystemProgressMorph>>setLabel:at: (in category 'labelling') ----- + setLabel: shortDescription at: slot + (labels at: slot) contents: shortDescription. + self recenter! Item was changed: ----- Method: SystemProgressMorph>>nextSlotFor: (in category 'private') ----- nextSlotFor: shortDescription | bar slots label | lock critical: [ + slots := labels size. - slots := bars size. activeSlots = slots ifTrue: [^0]. activeSlots := activeSlots + 1. 1 to: slots do: [:index | + label := (labels at: index). + label ifNil: [ - bar := (bars at: index). - bar ifNil: [ bar := bars at: index put: (SystemProgressBarMorph new extent: BarWidth@BarHeight). label := labels at: index put: (StringMorph contents: shortDescription font: font). self addMorphBack: label; addMorphBack: bar. ^index]. + label owner ifNil: [ - bar owner ifNil: [ bar := bars at: index. label := labels at: index. self addMorphBack: (label contents: shortDescription); addMorphBack: (bar barSize: 0). ^index]]] ! Item was changed: ----- Method: SystemProgressMorph>>label:min:max: (in category 'private') ----- label: shortDescription min: minValue max: maxValue | slot range newBarSize barSize lastRefresh | + ((range := maxValue - minValue) < 0 or: [(slot := self nextSlotFor: shortDescription) = 0]) - ((range := maxValue - minValue) <= 0 or: [(slot := self nextSlotFor: shortDescription) = 0]) ifTrue: [^[:barVal| 0 ]]. + range <= 0 ifTrue: [self removeMorph: (bars at: slot)]. + self recenter. self openInWorld. - self align: self fullBounds center with: Display boundingBox center. barSize := -1. "Enforces a inital draw of the morph" lastRefresh := 0. + ^[:barVal | + barVal isString ifTrue: [ + self setLabel: barVal at: slot. + self currentWorld displayWorld]. + (barVal isNumber and: [barVal between: minValue and: maxValue]) ifTrue: [ - ^[:barVal | - (barVal between: minValue and: maxValue) ifTrue: [ newBarSize := (barVal - minValue / range * BarWidth) truncated. newBarSize = barSize ifFalse: [ barSize := newBarSize. (bars at: slot) barSize: barSize. Time primMillisecondClock - lastRefresh > 25 ifTrue: [ self currentWorld displayWorld. lastRefresh := Time primMillisecondClock]]]. slot] ! Item was added: + ----- Method: SystemProgressMorph class>>exampleChangeLabel (in category 'examples') ----- + exampleChangeLabel + "SystemProgressMorph exampleChangeLabel" + | classes | + classes := Smalltalk allClasses copyFrom: 1 to: 100. + 'InitialLabel' + displayProgressAt: Display center + from: 0 to: classes size + during: [:bar | 1 to: classes size do: [:i | + bar value: i. + bar value: i printString, '/', classes size printString, ' ', (classes at: i) printString. + (Delay forMilliseconds: 100) wait]] + ! Item was changed: ----- Method: SystemProgressMorph>>labelAt:put: (in category 'labelling') ----- labelAt: progressBlock put: aString + "Change the label for the given progressBlock to aString." + "progressBlock value: aString"! - "Change the label for the given progressBlock to aString. - Fixme: I don't know how to map from progressBlock to label. - For now we just use the top-level label since this works just fine." - labels first ifNotNil:[:lbl| lbl contents: aString].! Item was added: + ----- Method: SystemProgressMorph>>recenter (in category 'private') ----- + recenter + self align: self fullBounds center with: Display boundingBox center. + ! Item was changed: ----- Method: SystemProgressMorph>>initialize (in category 'initialization') ----- initialize super initialize. activeSlots := 0. bars := Array new: 10. labels := Array new: 10. + font := Preferences standardMenuFont. - font := Preferences windowTitleFont. lock := Semaphore forMutualExclusion. self setDefaultParameters; setProperty: #morphicLayerNumber toValue: self morphicLayerNumber; layoutPolicy: TableLayout new; listDirection: #topToBottom; + cellPositioning: #leftCenter; - cellPositioning: #topCenter; cellInset: 5; listCentering: #center; hResizing: #shrinkWrap; vResizing: #shrinkWrap; + layoutInset:30@30; + minWidth: 150! - layoutInset:4@4.! Item was added: + ----- Method: SystemProgressMorph class>>exampleLabelOnly (in category 'examples') ----- + exampleLabelOnly + "SystemProgressMorph exampleLabelOnly" + | words | + words := #(zero one two three four five six seven eight nine ten) reversed. + UIManager default informUserDuring: [:bar | + words do: [:each| + bar value: 'Countdown: ', each. + (Delay forSeconds: 1) wait]].! Item was changed: ----- Method: SystemProgressBarMorph>>drawOn: (in category 'drawing') ----- drawOn: aCanvas | area | super drawOn: aCanvas. barSize > 0 ifTrue: [ area := self innerBounds. area := area origin extent: barSize-2@area extent y. + aCanvas fillRectangle: area color: (Preferences menuTitleColor alpha: 1) darker. - aCanvas fillRectangle: area color: Preferences menuTitleColor. ]. ! Item was added: + ----- Method: SystemProgressMorph class>>informUserAt:during: (in category 'instance creation') ----- + informUserAt: aPoint during: workBlock + ProgressInitiationException + display: ' ' + at: aPoint + from: 0 + to: 0 + during: workBlock! Item was changed: ----- Method: SystemProgressMorph>>freeSlot: (in category 'private') ----- freeSlot: number number > 0 ifTrue: [ lock critical: [ (bars at: number) delete. (labels at: number) delete. activeSlots := activeSlots - 1. activeSlots = 0 ifTrue: [self delete] + ifFalse: [self recenter]]]! - ifFalse: [self align: self fullBounds center with: Display boundingBox center]]]! |
On 09.09.2009, at 01:02, [hidden email] wrote: > Alexander Lazarević uploaded a new version of Morphic to > project The Trunk: > http://source.squeak.org/trunk/Morphic-laza.180.mcz > > ==================== Summary ==================== > > Name: Morphic-laza.180 > Author: laza > Time: 9 September 2009, 1:01:20 am > UUID: 2972d84e-b80d-e24b-9f2b-a73b82495250 > Ancestors: Morphic-ar.172 > > empty log message Bad Alex! - Bert - |
:) Ah yes.
After several attempts to make the package load without an error I was tired to copy the same log message again and again. I promise to try harder next time! Alex On Wed, Sep 9, 2009 at 1:38 AM, Bert Freudenberg<[hidden email]> wrote: > > On 09.09.2009, at 01:02, [hidden email] wrote: > >> Alexander Lazarević uploaded a new version of Morphic to project The >> Trunk: >> http://source.squeak.org/trunk/Morphic-laza.180.mcz >> >> ==================== Summary ==================== >> >> Name: Morphic-laza.180 >> Author: laza >> Time: 9 September 2009, 1:01:20 am >> UUID: 2972d84e-b80d-e24b-9f2b-a73b82495250 >> Ancestors: Morphic-ar.172 >> >> empty log message > > > Bad Alex! > > - Bert - > > > > |
Free forum by Nabble | Edit this page |