[squeak-dev] The Trunk: PreferenceBrowser-mt.109.mcz

Fabio Niephaus lists at fniephaus.com
Mon Jan 4 14:53:26 UTC 2021


Thank you, Marcel! This is great!

Fabio

On Mon, Jan 4, 2021 at 1:16 PM <commits at source.squeak.org> wrote:
>
> Marcel Taeumel uploaded a new version of PreferenceBrowser to project The Trunk:
> http://source.squeak.org/trunk/PreferenceBrowser-mt.109.mcz
>
> ==================== Summary ====================
>
> Name: PreferenceBrowser-mt.109
> Author: mt
> Time: 4 January 2021, 1:15:55.86444 pm
> UUID: 42f005a2-2686-4bda-8d58-486b6881ae54
> Ancestors: PreferenceBrowser-mt.108
>
> Speed up preference wizard open about 10x
>
> =============== Diff against PreferenceBrowser-mt.108 ===============
>
> Item was changed:
>   ----- Method: PreferenceWizardMorph>>initialize (in category 'initialization') -----
>   initialize
>
>         super initialize.
>
>         isFullScreen := false.
>
>         self hasLowPerformance
>                 ifTrue: [self color: self defaultColor]
>                 ifFalse: [self color: (self defaultColor alpha: 0.75)].
>
>         self setProperty: #indicateKeyboardFocus toValue: #never.
>
> -       Preferences enable: #systemWindowEmbedOK.
> -
> -       titleMorph := ('Welcome to Squeak' translated asText
> -               addAttribute: (TextColor color: self defaultTextColor);
> -               addAttribute: (TextFontReference toFont: (StrikeFont familyName: 'Darkmap DejaVu Sans' pointSize: 20));
> -               yourself) asMorph lock.
> -       titleMorph margins: (10 at 0 corner: 10 at 10).
> -       titleMorph layoutFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 0) offsets: (0@ 0 corner: 0 @ titleMorph height)).
> -
>         self
> -               initializePages;
> -               initializeButtons;
> -               initializeControlMorph;
> -               initializePreviewWorld;
> -               initializeForLowPerformance.
> -
> -       self
>                 changeProportionalLayout;
>                 layoutInset: 20;
>                 cellGap: 10;
> +               cellPositioning: #center.
> +
> -               cellPositioning: #center;
> -               addAllMorphs: {titleMorph. buttonRowMorph. controlMorph. previewWorld. startButton. skipButton. lowPerformanceMorph}.
> -
>         self addKeyboardCaptureFilter: self.!
>
> Item was changed:
> + ----- Method: PreferenceWizardMorph>>initializeButtons (in category 'initialization - playfield') -----
> - ----- Method: PreferenceWizardMorph>>initializeButtons (in category 'initialization') -----
>   initializeButtons
>
>         buttonRowMorph := Morph new
>                 color: Color transparent;
>                 changeTableLayout;
>                 listDirection: #leftToRight;
>                 cellGap: 10;
>                 layoutInset: (0 at 20 corner: 0 at 0);
>                 vResizing: #shrinkWrap;
>                 hResizing: #spaceFill;
>                 yourself.
>
>         buttonRowMorph addAllMorphs: {
>                 previousButton := self createButton action: #previous; label: 'Previous' translated.
>                 pagesLabel := (self createLabel: '0 / 0') hResizing: #shrinkWrap; margins: (20 at 0 corner: 20 at 0); fullBounds; yourself.
>                 nextButton := self createButton action: #next; label: 'Next' translated.
>                 self createHorizontalSpacer.
>                 self createButton action: #accept; label: 'Done' translated}.
>
> -
>         buttonRowMorph fullBounds.
> +       buttonRowMorph layoutFrame: (LayoutFrame fractions: (0 @ 1 corner: 1 @ 1) offsets: (0@ buttonRowMorph height negated corner: 0 @ 0)).!
> -       buttonRowMorph layoutFrame: (LayoutFrame fractions: (0 @ 1 corner: 1 @ 1) offsets: (0@ buttonRowMorph height negated corner: 0 @ 0)).
> -
> -
> -
> -       startButton := (self createButton action: #showPlayfield; label: 'Configure' translated).
> -       skipButton := (self createButton action: #showSqueak; label: 'Skip' translated).
> -
> -       (startButton width max: skipButton width) in: [:w |
> -               startButton hResizing: #rigid; width: w.
> -               skipButton hResizing: #rigid; width: w.
> -
> -               startButton layoutFrame: (LayoutFrame fractions: (0.5 @ 0.6 corner: 0.5 @ 0.6) offsets: (2*w negated @ 0 corner: 0 @ 0)).
> -               skipButton layoutFrame: (LayoutFrame fractions: (0.5 @ 0.6 corner: 0.5 @ 0.6) offsets: (0@ 0 corner: 2*w @ 0))].!
>
> Item was changed:
> + ----- Method: PreferenceWizardMorph>>initializeControlMorph (in category 'initialization - playfield') -----
> - ----- Method: PreferenceWizardMorph>>initializeControlMorph (in category 'initialization') -----
>   initializeControlMorph
>
>         controlMorph := Morph new
>                 color: Color transparent;
>                 changeTableLayout;
>                 listDirection: #topToBottom;
>                 hResizing: #spaceFill;
>                 vResizing: #spaceFill;
>                 layoutInset: (0 at 0 corner: 10 at 0);
>                 layoutFrame: (LayoutFrame fractions: (0.0 @ 0 corner: 0.3 @ 1.0) offsets: (0@ titleMorph height corner: 0 @ buttonRowMorph height negated));
>                 yourself.
>
>         controlMorph addMorph: (self createLabel: 'Please take a few minutes and configure the look-and-feel of the environment. You can always adjust these settings later. You can see the effects of these settings in the live and editable windows to the right.' translated).!
>
> Item was removed:
> - ----- Method: PreferenceWizardMorph>>initializeForLowPerformance (in category 'initialization') -----
> - initializeForLowPerformance
> -
> -       lowPerformanceMorph := TextMorph new lock.!
>
> Item was changed:
> + ----- Method: PreferenceWizardMorph>>initializePages (in category 'initialization - playfield') -----
> - ----- Method: PreferenceWizardMorph>>initializePages (in category 'initialization') -----
>   initializePages
>
>         pages := OrderedCollection new.
>         currentPageIndex := 0.
>
>         self
>                 initializePage01Themes;
>                 initializePage02Visuals;
>                 initializePage02bVisualsMore;
>                 initializePage03Interaction;
>                 initializePage04InteractionMore;
>                 initializePage05Tools.!
>
> Item was added:
> + ----- Method: PreferenceWizardMorph>>initializePlayfield (in category 'initialization') -----
> + initializePlayfield
> +
> +       self
> +               initializePages;
> +               initializeButtons;
> +               initializeControlMorph;
> +               initializePreviewWorld.
> +
> +       self
> +               addAllMorphs: {titleMorph. buttonRowMorph. controlMorph. previewWorld. startButton. skipButton. lowPerformanceMorph}.!
>
> Item was changed:
> + ----- Method: PreferenceWizardMorph>>initializePreviewWorld (in category 'initialization - playfield') -----
> - ----- Method: PreferenceWizardMorph>>initializePreviewWorld (in category 'initialization') -----
>   initializePreviewWorld
>
>         | w1 w2 w3 |
> +       Preferences enable: #systemWindowEmbedOK.
>
>         previewWorld := PasteUpMorph new
>                 hResizing: #spaceFill;
>                 vResizing: #spaceFill;
>                 viewBox: (0 at 0 corner: 500 at 500);
>                 layoutFrame: (LayoutFrame fractions: (0.3 @ 0 corner: 1.0 @ 1.0) offsets: (0@ titleMorph height corner: 0 @ buttonRowMorph height negated));
>                 fillStyle: Project current world fillStyle;
>                 borderWidth: 2;
>                 borderColor: Color white;
>                 cornerStyle: (self hasLowPerformance ifTrue: [#square] ifFalse: [#rounded]);
>                 yourself.
>
>         w1 := (ToolSet browse: Morph selector: #drawOn:) dependents detect: [:ea | ea isSystemWindow].
>         w2 := ToolSet browseMessageSet: (SystemNavigation default allCallsOn: #negated) name: 'Senders' translated autoSelect: 'negated'.
>         w3 := (Workspace new contents: '3+4 "Select and hit [CMD]+[P]."') openLabel: 'Workspace'.
>
>         {w1. w2. w3} do: [:ea |
>                 ea makeUnclosable.
>                 previewWorld addMorph: ea].
>
>         self updateWindowBounds.!
>
> Item was added:
> + ----- Method: PreferenceWizardMorph>>initializeWelcome (in category 'initialization') -----
> + initializeWelcome
> +
> +       titleMorph := ('Welcome to Squeak' translated asText
> +               addAttribute: (TextColor color: self defaultTextColor);
> +               addAttribute: (TextFontReference toFont: (StrikeFont familyName: 'Darkmap DejaVu Sans' pointSize: 20));
> +               yourself) asMorph lock.
> +       titleMorph margins: (10 at 0 corner: 10 at 10).
> +       titleMorph layoutFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 0) offsets: (0@ 0 corner: 0 @ titleMorph height)).
> +
> +       startButton := (self createButton action: #showPlayfield; label: 'Configure' translated).
> +       skipButton := (self createButton action: #showSqueak; label: 'Skip' translated).
> +
> +       (startButton width max: skipButton width) in: [:w |
> +               startButton hResizing: #rigid; width: w.
> +               skipButton hResizing: #rigid; width: w.
> +
> +               startButton layoutFrame: (LayoutFrame fractions: (0.5 @ 0.6 corner: 0.5 @ 0.6) offsets: (2*w negated @ 0 corner: 0 @ 0)).
> +               skipButton layoutFrame: (LayoutFrame fractions: (0.5 @ 0.6 corner: 0.5 @ 0.6) offsets: (0@ 0 corner: 2*w @ 0))].
> +
> +       lowPerformanceMorph := TextMorph new lock.
> +
> +       self addAllMorphs: {titleMorph. startButton. skipButton. lowPerformanceMorph}.!
>
> Item was changed:
>   ----- Method: PreferenceWizardMorph>>isInPlayfield (in category 'testing') -----
>   isInPlayfield
>
> +       ^ previewWorld notNil and: [previewWorld visible]!
> -       ^ previewWorld visible!
>
> Item was changed:
>   ----- Method: PreferenceWizardMorph>>showPlayfield (in category 'actions') -----
>   showPlayfield
>
> +       previewWorld ifNil: [self initializePlayfield].
> +
>         startButton hide.
>         skipButton hide.
>         lowPerformanceMorph hide.
>         isFullScreen := true.
>         self step.
>
>         titleMorph layoutFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 0) offsets: (0@ 0 corner: 0 @ titleMorph height)).
>
>         self refreshWorld.
>         500 milliSeconds wait.
>
>         controlMorph show.
>         previewWorld show.
>         buttonRowMorph show.
>
>         self next.
>         self refreshWorld.
>
>         !
>
> Item was changed:
>   ----- Method: PreferenceWizardMorph>>showWelcome (in category 'actions') -----
>   showWelcome
>
> +       self isInPlayfield ifTrue: [^ self "Not possible to go back due to fast-init strategy."].
> +       titleMorph ifNil: [self initializeWelcome].
> +
>         titleMorph layoutFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 0.65) offsets: (0 @0 corner: 0 at 0)).
>         isFullScreen := false.
>         self height: titleMorph fullBounds height * 4.
>
> -       controlMorph hide.
> -       previewWorld hide.
> -       buttonRowMorph hide.
> -
> -       titleMorph show.
> -       startButton show.
> -       skipButton show.
>         self hasLowPerformance
>                 ifFalse: [lowPerformanceMorph hide]
>                 ifTrue: [lowPerformanceMorph show].
>
>         self hasLowPerformance
>                 ifTrue: [Cursor wait showWhile: [self adjustSettingsForLowPerformance]].
>
>         self refreshWorld.
>         !
>
> Item was changed:
>   ----- Method: PreferenceWizardMorph>>updateWindowBounds (in category 'layout') -----
>   updateWindowBounds
>
>         | windows offset margin extentToUse pointsToUse |
>         isFullScreen == false ifTrue: [^ self].
> +       previewWorld ifNil: [^ self].
>
>         self fullBounds.
>
>         margin := 20 at 20.
>         extentToUse := (previewWorld extent - (margin * 2)) // 3 * (1.8 @ 1.5).
>         pointsToUse := {
>                 previewWorld center - (previewWorld extent // (5.5 @ 4.5)).
>                 previewWorld center + (previewWorld width // 5.5 @ 0).
>                 previewWorld center + (0 @ (previewWorld width // 5))}.
>
>         windows := previewWorld submorphs.
>         offset := 50 at 50.
>
>         windows reversed withIndexDo: [:ea :i |
>                 ea
>                         extent: extentToUse;
>                         center: (pointsToUse atWrap: i).
>                 offset := offset + (50 at 50)].!
>
>


More information about the Squeak-dev mailing list