The Trunk: PreferenceBrowser-mt.70.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: PreferenceBrowser-mt.70.mcz

commits-2
Marcel Taeumel uploaded a new version of PreferenceBrowser to project The Trunk:
http://source.squeak.org/trunk/PreferenceBrowser-mt.70.mcz

==================== Summary ====================

Name: PreferenceBrowser-mt.70
Author: mt
Time: 12 August 2016, 11:58:31.556343 am
UUID: 6d579f33-f1fb-4b48-a851-8b396a061ec0
Ancestors: PreferenceBrowser-mt.69

Make preference wizard not so alien and more easily dismiss-able.

=============== Diff against PreferenceBrowser-mt.69 ===============

Item was changed:
  Morph subclass: #PreferenceWizardMorph
+ instanceVariableNames: 'previewWorld titleMorph buttonRowMorph controlMorph startButton previousButton nextButton pages currentPageIndex pagesLabel skipButton isFullScreen'
- instanceVariableNames: 'previewWorld titleMorph buttonRowMorph controlMorph startButton previousButton nextButton pages currentPageIndex pagesLabel skipButton'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'PreferenceBrowser'!

Item was changed:
  ----- Method: PreferenceWizardMorph>>createButton (in category 'initialization') -----
  createButton
 
  ^ PluggableButtonMorphPlus new
  setProperty: #noUserInterfaceTheme toValue: true;
+ offColor: (self defaultColor adjustBrightness: 0.2);
+ feedbackColor: (self defaultColor adjustBrightness: 0.4);
- offColor: (Color gray: 0.2);
- feedbackColor: (Color gray: 0.5);
  model: self;
  font: (StrikeFont familyName: 'Darkmap DejaVu Sans' pointSize: 12);
+ textColor: self defaultTextColor;
+ borderColor: self defaultTextColor;
+ instVarNamed: #borderColor put: self defaultTextColor; "HACK!!"
- textColor: Color white;
- borderColor: Color white;
- instVarNamed: #borderColor put: Color white; "HACK!!"
  borderWidth: 2;
  cornerStyle: #rounded;
  vResizing: #shrinkWrap;
  hResizing: #shrinkWrap;
  layoutInset: (20@10 corner: 20@10);
  yourself!

Item was changed:
  ----- Method: PreferenceWizardMorph>>createCheckbox:for: (in category 'initialization') -----
  createCheckbox: label for: selector
 
  | box lbl btn |
 
  btn := self createButton
  label: ' ';
+ onColor: Color white offColor: (self defaultColor adjustBrightness: 0.3);
- onColor: Color white offColor: (Color gray: 0.2);
  vResizing: #rigid;
  hResizing: #rigid;
  action: ('toggle', selector) asSymbol;
  getStateSelector: ('state', selector) asSymbol;
  extent: 25@25.
 
+ lbl := self createLabel: label color: self defaultTextColor.
- lbl := self createLabel: label color: Color white.
 
  box := Morph new
  color: Color transparent;
  changeTableLayout;
  listDirection: #leftToRight;
  cellPositioning: #topLeft;
  hResizing: #spaceFill;
  vResizing: #shrinkWrap;
  cellInset: 10;
  yourself.
 
  box addAllMorphs: {btn. lbl}.
  ^ box!

Item was changed:
  ----- Method: PreferenceWizardMorph>>createLabel: (in category 'initialization') -----
  createLabel: aString
 
+ ^ self createLabel: aString color: (self defaultTextColor adjustBrightness: -0.1)!
- ^ self createLabel: aString color: (Color gray: 0.8)!

Item was changed:
  ----- Method: PreferenceWizardMorph>>createLabel:color: (in category 'initialization') -----
  createLabel: aString color: aColor
 
  | lbl |
  lbl := TextMorph new hResizing: #spaceFill; vResizing: #shrinkWrap.
  lbl newContents:aString.
  lbl text
  addAttribute: (TextColor color: aColor);
  addAttribute: (TextFontReference toFont: ((StrikeFont familyName: 'Darkmap DejaVu Sans' pointSize: 12))).
+ lbl lock.
  ^ lbl!

Item was added:
+ ----- Method: PreferenceWizardMorph>>defaultColor (in category 'initialization') -----
+ defaultColor
+
+ ^ Color black!

Item was added:
+ ----- Method: PreferenceWizardMorph>>defaultTextColor (in category 'initialization') -----
+ defaultTextColor
+
+ ^ Color white!

Item was changed:
  ----- Method: PreferenceWizardMorph>>initialize (in category 'initialization') -----
  initialize
 
  super initialize.
 
+ isFullScreen := false.
+
+ self color: (self defaultColor alpha: 0.75).
- self color: Color black.
  self setProperty: #indicateKeyboardFocus toValue: #never.
 
  Preferences enable: #systemWindowEmbedOK.
 
  titleMorph := ('Welcome to Squeak' translated asText
+ addAttribute: (TextColor color: self defaultTextColor);
- addAttribute: (TextColor color: Color white);
  addAttribute: (TextFontReference toFont: (StrikeFont familyName: 'Darkmap DejaVu Sans' pointSize: 20));
+ yourself) asMorph lock.
- yourself) asMorph.
  titleMorph margins: (10@0 corner: 10@10).
  titleMorph layoutFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 0) offsets: (0@ 0 corner: 0 @ titleMorph height)).
 
  self
  initializePages;
  initializeButtons;
  initializeControlMorph;
  initializePreviewWorld.
 
  self
  changeProportionalLayout;
  layoutInset: 20;
  cellInset: 10;
+ cellPositioning: #center;
  addAllMorphs: {titleMorph. buttonRowMorph. controlMorph. previewWorld. startButton. skipButton}.
 
  self addKeyboardCaptureFilter: self.!

Item was changed:
  ----- Method: PreferenceWizardMorph>>initializeButtons (in category 'initialization') -----
  initializeButtons
 
  buttonRowMorph := Morph new
  color: Color transparent;
  changeTableLayout;
  listDirection: #leftToRight;
  cellInset: 10;
  layoutInset: (0@20 corner: 0@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@0 corner: 20@0); fullBounds; yourself.
  nextButton := self createButton action: #next; label: 'Next' translated.
  self createHorizontalSpacer.
  self createButton action: #showSqueak; label: 'Done' translated}.
 
 
  buttonRowMorph fullBounds.
  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))].!
- startButton := (self createButton action: #showPlayfield; label: 'Continue' translated).
- startButton layoutFrame: (LayoutFrame fractions: (0 @ 0.5 corner: 1 @ 0.5) offsets: (0@ 0 corner: 0 @ (titleMorph height * 4))).
- skipButton := (self createButton action: #showSqueak; label: 'Skip' translated; borderWidth: 0; color: Color black).
- skipButton layoutFrame: (LayoutFrame fractions: (1@1 corner: 1@1) offsets: (skipButton fullBounds width negated @ skipButton fullBounds height negated corner: 0@0)).
- !

Item was changed:
  ----- Method: PreferenceWizardMorph>>intoWorld: (in category 'initialization') -----
  intoWorld: world
 
  super intoWorld: world.
 
  self bounds: world bounds.
 
  self fullBounds.
  self updateWindowBounds.
 
+ world activeHand
+ newKeyboardFocus: self;
+ newMouseFocus: self.
+
- world activeHand newKeyboardFocus: self.
-
  self showWelcome.!

Item was added:
+ ----- Method: PreferenceWizardMorph>>mouseDown: (in category 'event handling') -----
+ mouseDown: evt
+
+ (self containsPoint: evt position)
+ ifFalse: [^ self delete].!

Item was added:
+ ----- Method: PreferenceWizardMorph>>mouseUp: (in category 'event handling') -----
+ mouseUp: evt
+
+ evt hand newMouseFocus: self.!

Item was added:
+ ----- Method: PreferenceWizardMorph>>processFocusEvent:using: (in category 'event handling') -----
+ processFocusEvent: evt using: dispatcher
+
+ ^ dispatcher dispatchFocusEventFully: evt with: self!

Item was changed:
  ----- Method: PreferenceWizardMorph>>showPlayfield (in category 'actions') -----
  showPlayfield
 
  startButton hide.
  skipButton hide.
+ isFullScreen := true.
+ self step.
- self refreshWorld.
- (Delay forMilliseconds: 1000) wait.
 
-
  titleMorph layoutFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 0) offsets: (0@ 0 corner: 0 @ titleMorph height)).
  self refreshWorld.
  (Delay forMilliseconds: 1000) wait.
 
 
  controlMorph show.
  self refreshWorld.
  (Delay forMilliseconds: 1000) wait.
 
  previewWorld show.
  self refreshWorld.
  (Delay forMilliseconds: 1000) wait.
 
  buttonRowMorph show.
  self next.
  self refreshWorld.
 
  !

Item was changed:
  ----- Method: PreferenceWizardMorph>>showSqueak (in category 'actions') -----
  showSqueak
 
+ self isInWelcome ifTrue: [^ self delete].
- self isInWelcome ifTrue: [
- startButton hide.
- skipButton hide.
- self refreshWorld.
- (Delay forMilliseconds: 1000) wait.
- titleMorph hide.
- self refreshWorld.
- (Delay forMilliseconds: 1000) wait.
- ^ self delete].
 
  buttonRowMorph hide.
  self refreshWorld.
  (Delay forMilliseconds: 1000) wait.
 
  controlMorph hide.
  self refreshWorld.
  (Delay forMilliseconds: 1000) wait.
 
  previewWorld hide.
  self refreshWorld.
  (Delay forMilliseconds: 1000) wait.
 
 
  titleMorph layoutFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 1)).
  self refreshWorld.
  (Delay forMilliseconds: 1000) wait.
  self delete.!

Item was changed:
  ----- Method: PreferenceWizardMorph>>showWelcome (in category 'actions') -----
  showWelcome
 
+ titleMorph layoutFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 0.65) offsets: (0 @0 corner: 0@0)).
+ isFullScreen := false.
+ self height: titleMorph fullBounds height * 4.
+ self step.
+ self fullBounds.
+ self step.
- titleMorph layoutFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 1)).
 
  controlMorph hide.
  previewWorld hide.
  buttonRowMorph hide.
- titleMorph hide.
- startButton hide.
- skipButton hide.
 
- self refreshWorld.
-
- (Delay forMilliseconds: 1000) wait.
  titleMorph show.
- self refreshWorld.
-
-
- (Delay forMilliseconds: 1000) wait.
  startButton show.
  skipButton show.
+
  self refreshWorld.
  !

Item was changed:
  ----- Method: PreferenceWizardMorph>>step (in category 'stepping and presenter') -----
  step
 
+ | oldWidth oldBounds |
- | oldBounds |
  "self comeToFront."
 
+ isFullScreen == true
+ ifTrue: [
+ oldBounds := self bounds.
+ self bounds: self world bounds.
+ self bounds = oldBounds ifFalse: [
+ self updateWindowBounds]]
+ ifFalse: [
+ oldWidth := self width.
+ self width: self world width.
+ self center: self world center.
+ self width = oldWidth ifFalse: [
+ self updateWindowBounds]].!
- oldBounds := self bounds.
- self bounds: self world bounds.
- self bounds = oldBounds ifFalse: [
- self updateWindowBounds].!

Item was changed:
  ----- Method: PreferenceWizardMorph>>updateWindowBounds (in category 'layout') -----
  updateWindowBounds
 
  | windows offset |
+ isFullScreen == false ifTrue: [^ self].
+
+ self fullBounds.
+
  windows := previewWorld submorphs.
  offset := 50@50.
 
  windows reversed do: [:ea |
  ea
  topLeft: previewWorld topLeft + offset;
  extent: previewWorld extent // 3 * 2.
  offset := offset + (50@50)].!