Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1507.mcz ==================== Summary ==================== Name: Morphic-mt.1507 Author: mt Time: 22 August 2019, 3:22:40.651931 pm UUID: c98ab63c-5f59-2f42-89cd-9296468afd0f Ancestors: Morphic-mt.1506 Complements Morphic-mt.1506 including cellInset-to-cellGap conversion. =============== Diff against Morphic-mt.1506 =============== Item was changed: ----- Method: AlignmentMorph class>>columnPrototype (in category 'instance creation') ----- columnPrototype "Answer a prototypical column" | sampleMorphs aColumn | sampleMorphs := #(red yellow green) collect: [:aColor | Morph new extent: 130 @ 38; color: (Color perform: aColor); setNameTo: aColor asString; yourself]. aColumn := self inAColumn: sampleMorphs. aColumn setNameTo: 'Column'. aColumn color: Color veryVeryLightGray. + aColumn cellGap: 4; layoutInset: 6. - aColumn cellInset: 4; layoutInset: 6. aColumn enableDragNDrop. aColumn setBalloonText: 'Things dropped into here will automatically be organized into a column. Once you have added your own items here, you will want to remove the sample colored rectangles that this started with, and you will want to change this balloon help message to one of your own!!' translated. ^ aColumn! Item was changed: ----- Method: AlignmentMorph class>>rowPrototype (in category 'instance creation') ----- rowPrototype "Answer a prototypical row" | sampleMorphs aRow | sampleMorphs := (1 to: (2 + 3 atRandom)) collect: [:integer | EllipseMorph new extent: ((60 + (20 atRandom)) @ (80 + ((20 atRandom)))); color: Color random; setNameTo: ('egg', integer asString); yourself]. aRow := self inARow: sampleMorphs. aRow setNameTo: 'Row'. aRow enableDragNDrop. + aRow cellGap: 6. - aRow cellInset: 6. aRow layoutInset: 8. aRow setBalloonText: 'Things dropped into here will automatically be organized into a row. Once you have added your own items here, you will want to remove the sample colored eggs that this started with, and you will want to change this balloon help message to one of your own!!' translated. aRow color: Color veryVeryLightGray. ^ aRow "AlignmentMorph rowPrototype openInHand"! Item was changed: ----- Method: BorderedMorph>>addMorph:fullFrame: (in category 'resize handling') ----- addMorph: aMorph fullFrame: aLayoutFrame "Add aMorph according to aLayoutFrame." + self cellGap > 0 ifTrue: [ - self cellInset > 0 ifTrue: [ | left right bottom top spacing | + spacing := self cellGap. - spacing := self cellInset. left := aLayoutFrame leftOffset ifNil: [0]. right := aLayoutFrame rightOffset ifNil: [0]. bottom := aLayoutFrame bottomOffset ifNil: [0]. top := aLayoutFrame topOffset ifNil: [0]. "Add a spacing to the frame if it is not top or leftmost." aLayoutFrame leftFraction = 0 ifFalse: [left := left + spacing] ifTrue: [ "Expect another, resizable widget besides me if I have a fixed width." aLayoutFrame hasFixedWidth ifTrue: [right := right - spacing]]. aLayoutFrame topFraction = 0 ifFalse: [top := top + spacing] ifTrue: [ "Expect another, resizable widget besides me if I have a fixed height." aLayoutFrame hasFixedHeight ifTrue: [bottom := bottom - spacing]]. aLayoutFrame topOffset: top; bottomOffset: bottom; leftOffset: left; rightOffset: right]. super addMorph: aMorph fullFrame: aLayoutFrame. self wantsPaneSplitters ifTrue: [self addPaneSplitters].! Item was changed: ----- Method: DialogWindow>>createBody (in category 'initialization') ----- createBody | body | body := Morph new name: 'Body'; changeTableLayout; hResizing: #shrinkWrap; vResizing: #shrinkWrap; + rubberBandCells: true; listDirection: #topToBottom; - cellPositioning: #topCenter; layoutInset: (10@5 corner: 10@10); + cellGap: 5; - cellInset: 5; color: Color transparent; yourself. body addAllMorphs: {self createMessage: ''. self createPane. self createButtonRow. self createFilter}. self addMorphBack: body.! Item was changed: ----- Method: DialogWindow>>createButtonRow (in category 'initialization') ----- createButtonRow ^ buttonRow := Morph new name: 'Buttons'; color: Color transparent; changeTableLayout; vResizing: #shrinkWrap; hResizing: #spaceFill; listDirection: #leftToRight; listCentering: #center; + cellGap: 5; - cellInset: 5; yourself! Item was changed: ----- Method: DialogWindow>>createTitle: (in category 'initialization') ----- createTitle: aString "Mimick behavior of MenuMorph title creation." | box closeButton menuButton | box := Morph new name: #title; changeTableLayout; listDirection: #leftToRight; - listCentering: #justified; yourself. titleMorph := aString asText asMorph lock. closeButton := SystemWindowButton new color: Color transparent; target: self; extent: 12@12; actionSelector: #cancelDialog; balloonText: 'Cancel this dialog' translated; borderWidth: 0; labelGraphic: SystemWindow closeBoxImage; extent: SystemWindow closeBoxImage extent; visible: self class includeCloseButton; yourself. menuButton := SystemWindowButton new color: Color transparent; target: self; actionSelector: #offerDialogMenu; balloonText: 'Dialog menu' translated; borderWidth: 0; labelGraphic: SystemWindow menuBoxImage; extent: SystemWindow menuBoxImage extent; visible: self class includeControlMenu; yourself. box addAllMorphs: {closeButton. titleMorph. menuButton}. self addMorphBack: box. + self setTitleParameters.! - self setTitleParameters. - ! Item was changed: ----- Method: DialogWindow>>getUserResponse (in category 'running') ----- getUserResponse | hand world | self message ifEmpty: [messageMorph delete]. "Do not waste space." + self paneMorph submorphs + ifEmpty: ["Do not waste space and avoid strange button-row wraps." + self paneMorph delete. + self buttonRowMorph wrapDirection: #none]. - self paneMorph submorphs ifEmpty: [self paneMorph delete]. "Do not waste space." hand := self currentHand. world := self currentWorld. self fullBounds. self moveToPreferredPosition. self openInWorld: world. hand showTemporaryCursor: nil. "Since we are out of context, reset the cursor." hand keyboardFocus in: [:priorKeyboardFocus | hand mouseFocus in: [:priorMouseFocus | self exclusive ifTrue: [hand newMouseFocus: self]. hand newKeyboardFocus: self. [self isInWorld] whileTrue:[world doOneSubCycle]. hand newKeyboardFocus: priorKeyboardFocus. hand newMouseFocus: priorMouseFocus]]. ^ result! Item was changed: ----- Method: DialogWindow>>initialize (in category 'initialization') ----- initialize super initialize. self changeTableLayout; listDirection: #topToBottom; hResizing: #shrinkWrap; vResizing: #shrinkWrap; + rubberBandCells: true; setProperty: #indicateKeyboardFocus toValue: #never. self createTitle: 'Dialog'. self createBody. self setDefaultParameters. keyMap := Dictionary new. exclusive := true. autoCancel := false. preferredPosition := ActiveWorld center.! Item was changed: ----- Method: DialogWindow>>moveToPreferredPosition (in category 'initialization') ----- moveToPreferredPosition self center: (preferredPosition isPoint ifTrue: [ preferredPosition ] + ifFalse: [ self center + self currentHand position - preferredPosition center ]). - ifFalse: [ self center + ActiveHand position - preferredPosition center ]). self bounds: (self bounds translatedToBeWithin: self currentWorld bounds)! Item was changed: ----- Method: DialogWindow>>setMessageParameters (in category 'initialization') ----- setMessageParameters messageMorph ifNotNil: [ | fontToUse colorToUse | fontToUse := self userInterfaceTheme font ifNil: [TextStyle defaultFont]. colorToUse := self userInterfaceTheme textColor ifNil: [Color black]. + + messageMorph + hResizing: #shrinkWrap; + vResizing: #shrinkWrap. + - messageMorph contents addAttribute: (TextFontReference toFont: fontToUse); addAttribute: (TextColor color: colorToUse). + messageMorph textColor: colorToUse].! - messageMorph textColor: colorToUse. - messageMorph releaseParagraph; changed].! Item was changed: ----- Method: DialogWindow>>setTitleParameters (in category 'initialization') ----- setTitleParameters (self submorphNamed: #title) ifNotNil: [:title | title fillStyle: (self class gradientDialog ifFalse: [SolidFillStyle color: (self userInterfaceTheme titleColor ifNil: [Color r: 0.658 g: 0.678 b: 0.78])] ifTrue: [self titleGradientFor: title from: (self userInterfaceTheme titleColor ifNil: [Color r: 0.658 g: 0.678 b: 0.78])]); borderStyle: (self userInterfaceTheme titleBorderStyle ifNil: [BorderStyle simple]) copy; borderColor: (self userInterfaceTheme titleBorderColor ifNil: [Color r: 0.6 g: 0.7 b: 1]); borderWidth: (self userInterfaceTheme titleBorderWidth ifNil: [0]); cornerStyle: (self wantsRoundedCorners ifTrue: [#rounded] ifFalse: [#square]); vResizing: #shrinkWrap; hResizing: #spaceFill; + cellGap: 5; - wrapCentering: #center; - cellPositioning: #center; - cellInset: 0; layoutInset: (5@3 corner: 5@ (2+(self wantsRoundedCorners ifFalse: [0] ifTrue: [self cornerRadius])))]. titleMorph ifNotNil: [ | fontToUse colorToUse | fontToUse := self userInterfaceTheme titleFont ifNil: [TextStyle defaultFont]. colorToUse := self userInterfaceTheme titleTextColor ifNil: [Color black]. "Temporary HACK for 64-bit CI build. Can be removed in the future." titleMorph contents isText ifFalse: [^ self]. + + titleMorph + hResizing: #spaceFill; + vResizing: #shrinkWrap. titleMorph contents addAttribute: (TextFontReference toFont: fontToUse); + addAttribute: (TextColor color: colorToUse); + addAttribute: TextAlignment centered].! - addAttribute: (TextColor color: colorToUse). - titleMorph releaseParagraph; changed].! Item was changed: ----- Method: DialogWindow>>updateButtonExtent: (in category 'updating') ----- updateButtonExtent: margin "Update all button extents." (buttonRow submorphs collect: [:ea | ea minimumExtent]) max + margin in: [:preferredExtent | buttonRow submorphsDo: [:ea | ea extent: preferredExtent]]. "See if horizontal button layout would be more appropriate." self flag: #magicNumber. "mt: Remove number with computation, maybe choose button font and 20 characters" (buttonRow submorphs collect: [:ea | ea fullBounds width]) sum > 400 ifTrue: [buttonRow hResizing: #shrinkWrap; listDirection: #topToBottom; + wrapDirection: #none; layoutInset: (buttonRow owner fullBounds width - (buttonRow owner layoutInset left*2) - buttonRow submorphs first fullBounds width // 2@0)] ifFalse: [buttonRow hResizing: #spaceFill; listDirection: #leftToRight; + wrapDirection: #topToBottom; layoutInset: 0].! Item was changed: ----- Method: DockingBarItemMorph>>updateLayoutInDockingBar (in category 'private') ----- updateLayoutInDockingBar owner isVertical ifTrue: [ self hResizing: #spaceFill. self vResizing: #shrinkWrap ] ifFalse: [ self hResizing: #shrinkWrap. + self vResizing: #spaceFill ].! - self vResizing: #spaceFill ]. - self extent: self minWidth @ self minHeight! Item was changed: ----- Method: DockingBarMorph>>initialize (in category 'initialize-release') ----- initialize "initialize the receiver" super initialize. self changeTableLayout. selectedItem := nil. activeSubMenu := nil. fillsOwner := true. avoidVisibleBordersAtEdge := true. autoGradient := MenuMorph gradientMenu. self setDefaultParameters ; + rubberBandCells: true ; beFloating ; beSticky ; layoutInset: 0 ; dropEnabled: true! Item was removed: - ----- Method: DockingBarMorph>>noteNewOwner: (in category 'submorphs-accessing') ----- - noteNewOwner: aMorph - "I have just been added as a submorph of aMorph" - super noteNewOwner: aMorph. - - self submorphs - do: [:each | each adjustLayoutBounds]. - ! Item was removed: - ----- Method: DockingBarMorph>>removedMorph: (in category 'submorphs-add/remove') ----- - removedMorph: aMorph - "If this docking bar accepts dropped morphs, it will grow automatically due to its layout policy. Unfortunately, it will not shrink after the removal of any submorph because of the shrinkWrap-spaceFill combination in the vertical axis. To enforce a proper layout update, we can set the docking-bar's extent to a minimum because it fill automatically grow to fit its current contents. Consider this a workaround until we have a better layout policy." - - self flag: #workaround. - self extent: 1@1.! Item was changed: ----- Method: GradientEditor>>addButtonRow (in category 'initialization') ----- addButtonRow | button button2 buttonRow button3 | buttonRow := RectangleMorph new borderWidth: 0; color: Color transparent; layoutPolicy: TableLayout new; hResizing: #spaceFil; vResizing: #spaceFill; cellPositioning: #center; listCentering: #topLeft; listDirection: #LeftToRight; reverseTableCells: true; + cellGap: 4. - cellInset: 4. button := PluggableButtonMorph on: self getState: nil action: #addHandle label: #addColorButtonLabel. button hResizing: #spaceFill; vResizing: #spaceFill. buttonRow addMorph: button. button2 := PluggableButtonMorph on: self getState: nil action: #deleteHandle label: #removeColorButtonLabel. button2 hResizing: #spaceFill; vResizing: #spaceFill. buttonRow addMorph: button2. button3 := PluggableButtonMorph on: self getState: nil action: #delete label: #closeButtonLabel. button3 hResizing: #spaceFill; vResizing: #spaceFill. buttonRow addMorph: button3. self addMorph: buttonRow! Item was changed: ----- Method: GradientEditor>>myLayout (in category 'initialization') ----- myLayout self color: (Color white darker) ; cornerStyle: #rounded ; borderWidth: 0; layoutPolicy: TableLayout new; hResizing: #shrinkWrap; vResizing: #shrinkWrap; cellPositioning: #center; listCentering: #topLeft; layoutInset: 4; listDirection: #topToBottom; reverseTableCells: true; wrapCentering: #topLeft; + cellGap: 4! - cellInset: 4! Item was changed: ----- Method: HSVAColorSelectorMorph>>initialize (in category 'initialization') ----- initialize "Initialize the receiver." super initialize. self extent: 180@168; changeTableLayout; + cellGap: 4; - cellInset: 4; aMorph: self newAColorMorph; hsvMorph: self newHSVColorMorph; addMorphBack: self hsvMorph; addMorphBack: self aMorph. self aMorph color: self hsvMorph selectedColor! Item was changed: ----- Method: HSVColorSelectorMorph>>initialize (in category 'initialization') ----- initialize "Initialize the receiver." super initialize. self borderWidth: 0; changeTableLayout; + cellGap: 4; - cellInset: 4; listDirection: #leftToRight; cellPositioning: #topLeft; svMorph: self newSVColorMorph; hMorph: self newHColorMorph; addMorphBack: self svMorph; addMorphBack: self hMorph; extent: 192@152; hue: 0.5! Item was removed: - ----- Method: MenuItemMorph>>noteNewOwner: (in category 'submorphs-accessing') ----- - noteNewOwner: aMorph - "I have just been added as a submorph of aMorph" - super noteNewOwner: aMorph. - - self updateLayoutInDockingBar! Item was changed: ----- Method: MenuMorph>>initialize (in category 'initialization') ----- initialize super initialize. - bounds := 0 @ 0 corner: 40 @ 10. - self setDefaultParameters. self changeTableLayout. self listDirection: #topToBottom. self hResizing: #shrinkWrap. self vResizing: #shrinkWrap. defaultTarget := nil. selectedItem := nil. stayUp := false. popUpOwner := nil.! Item was changed: ----- Method: MenuMorph>>setTitleParametersFor: (in category 'initialization') ----- setTitleParametersFor: aMenuTitle aMenuTitle color: (self userInterfaceTheme titleColor ifNil: [Color transparent]); borderStyle: (self userInterfaceTheme titleBorderStyle ifNil: [BorderStyle simple]) copy; borderColor: (self userInterfaceTheme titleBorderColor ifNil: [Color r: 0.6 g: 0.7 b: 1]); borderWidth: (self userInterfaceTheme titleBorderWidth ifNil: [0]); cornerStyle: (self wantsRoundedCorners ifTrue: [#rounded] ifFalse: [#square]); vResizing: #shrinkWrap; wrapCentering: #center; cellPositioning: #center; + cellGap: 5; - cellInset: 5; layoutInset: (5@0 corner: 5@0).! Item was changed: ----- Method: NewColorPickerMorph>>newBottomRow (in category 'initialize-release') ----- newBottomRow ^ Morph new color: Color transparent ; changeTableLayout ; listDirection: #leftToRight ; hResizing: #spaceFill; vResizing: #shrinkWrap ; height: 20 ; + cellGap: 4 ; - cellInset: 4 ; addMorph: (StringMorph contents: 'Current selection:' translated) ; addMorphBack: self newColorPresenterMorph ; addMorphBack: self newCloseButton! Item was changed: ----- Method: NewColorPickerMorph>>setup (in category 'initialize-release') ----- setup self color: (Color white darker) ; cornerStyle: #rounded ; changeTableLayout ; hResizing: #shrinkWrap ; vResizing: #shrinkWrap ; extent: 240@240 ; addMorphBack: hsvaMorph ; addMorphBack: self newColorExpressionMorph ; addMorphBack: self newBottomRow ; layoutInset: 4 ; + cellGap: 2. - cellInset: 2. Preferences menuAppearance3d ifTrue: [self addDropShadow]. ! Item was changed: ----- Method: NewColorPickerMorph>>setupForProperties (in category 'initialize-release') ----- setupForProperties self color: (Color white darker) ; changeTableLayout ; hResizing: #shrinkWrap ; vResizing: #shrinkWrap ; extent: 240@240 ; addMorphBack: hsvaMorph ; layoutInset: 4 ; + cellGap: 2.! - cellInset: 2.! Item was changed: ----- Method: PasteUpMorph>>autoLineLayout: (in category 'options') ----- autoLineLayout: aBoolean "Make the receiver be viewed with auto-line-layout, which means that its submorphs will be laid out left-to-right and then top-to-bottom in the manner of a word processor, or (if aBoolean is false,) cease applying auto-line-layout" aBoolean ifTrue: [self viewingNormally ifTrue: [self saveBoundsOfSubmorphs]]. aBoolean ifTrue:[ self layoutPolicy: TableLayout new. + self layoutInset: 8; cellGap: 4. - self layoutInset: 8; cellInset: 4. self listDirection: #leftToRight; wrapDirection: #topToBottom. ] ifFalse:[ self layoutPolicy: nil. + self layoutInset: 0; cellGap: 0. - self layoutInset: 0; cellInset: 0. ]. ! Item was changed: ----- Method: ScrollBar class>>arrowSamples (in category 'images - samples') ----- arrowSamples "create a set of arrow with different sizes, colors and directions" " ScrollBar arrowSamples. " | column | column := AlignmentMorph newColumn vResizing: #shrinkWrap; hResizing: #shrinkWrap; layoutInset: 1; borderColor: Color black; borderWidth: 0; wrapCentering: #center; cellPositioning: #center; color: Color white; yourself. self sampleSizes do: [:size | | row | row := AlignmentMorph newRow color: Color transparent; vResizing: #shrinkWrap; + cellGap: 2 @ 0; + yourself. - cellInset: 2 @ 0 yourself. self sampleColors do: [:color | #(#top #right #bottom #left ) do: [:direction | row addMorphBack: (ScrollBar arrowOfDirection: direction size: size color: color) asMorph]]. column addMorphBack: row]. column openInHand! Item was changed: ----- Method: ScrollBar class>>boxSamples (in category 'images - samples') ----- boxSamples "create a set of box with different sizes and colors" " ScrollBar boxSamples. " | column | column := AlignmentMorph newColumn vResizing: #shrinkWrap; hResizing: #shrinkWrap; layoutInset: 1; borderColor: Color black; borderWidth: 0; wrapCentering: #center; cellPositioning: #center; color: Color white; yourself. "" self sampleSizes do: [:size | | row | row := AlignmentMorph newRow color: Color transparent; vResizing: #shrinkWrap; + cellGap: 2 @ 0; + yourself. - cellInset: 2 @ 0 yourself. "" self sampleColors do: [:color | row addMorphBack: (ScrollBar boxOfSize: size color: color) asMorph]. "" column addMorphBack: row]. "" "" column openInHand! Item was changed: ----- Method: SystemProgressMorph>>initialize (in category 'initialization') ----- initialize super initialize. activeSlots := 0. bars := Array new: 10. labels := Array new: 10. lock := Semaphore forMutualExclusion. self setDefaultParameters; setProperty: #morphicLayerNumber toValue: self morphicLayerNumber; layoutPolicy: TableLayout new; listDirection: #topToBottom; cellPositioning: #leftCenter; + cellGap: 5; - cellInset: 5; listCentering: #center; hResizing: #shrinkWrap; vResizing: #shrinkWrap; layoutInset: Inset; minWidth: 150! Item was changed: ----- Method: SystemWindow>>initialize (in category 'initialization') ----- initialize "Initialize a system window. Add label, stripes, etc., if desired" super initialize. self layoutPolicy: ProportionalLayout new. self wantsPaneSplitters: true. self layoutInset: ProportionalSplitterMorph gripThickness. + self cellGap: ProportionalSplitterMorph gripThickness. - self cellInset: ProportionalSplitterMorph gripThickness. self initializeLabelArea. self addCornerGrips. self setDefaultParameters. allowReframeHandles := true. isCollapsed := false. paneMorphs := Array new. mustNotClose := false. updatablePanes := Array new. self initializeKeyboardShortcuts.! Item was changed: ----- Method: SystemWindow>>labelHeight (in category 'label') ----- labelHeight "Answer the height for the window label. The standard behavior is at bottom; a hook is provided so that models can stipulate other heights, in support of various less-window-looking demos." | aHeight | (model notNil and: [model respondsTo: #desiredWindowLabelHeightIn:]) ifTrue: [(aHeight := model desiredWindowLabelHeightIn: self) ifNotNil: [^ aHeight]]. ^ label ifNil: [0] ifNotNil: + [(label height + self cellInset + self cellGap + self layoutInset) max: - [(label height + self cellInset + self layoutInset) max: (collapseBox ifNotNil: [collapseBox height] ifNil: [10])]! Item was changed: ----- Method: TransferMorph>>initialize (in category 'initialization') ----- initialize super initialize. self changeTableLayout; listDirection: #leftToRight; hResizing: #shrinkWrap; vResizing: #shrinkWrap; layoutInset: 3; + cellGap: 3; - cellInset: 3; wrapCentering: #center; cellPositioning: #leftCenter; setProperty: #indicateKeyboardFocus toValue: #never. self doMove. self on: #keyStroke send: #keyStroke: to: self. self on: #keyUp send: #updateFromUserInputEvent: to: self. self on: #keyDown send: #updateFromUserInputEvent: to: self. self setDefaultParameters.! Item was changed: + (PackageInfo named: 'Morphic') postscript: '"Convert all cell insets to cell gaps." + TableLayoutProperties allInstancesDo: [:ea | + ea cellInset isZero ifFalse: [ + ea + cellGap: (ea cellInset isRectangle ifTrue: [ea cellInset topLeft] ifFalse: [ea cellInset]); + cellInset: 0]].'! - (PackageInfo named: 'Morphic') postscript: '"Added Git Browser to Tools menu" - TheWorldMainDockingBar updateInstances'! |
Free forum by Nabble | Edit this page |