The Trunk: PreferenceBrowser-mt.72.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.72.mcz

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

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

Name: PreferenceBrowser-mt.72
Author: mt
Time: 13 August 2016, 9:06:15.228008 am
UUID: 2c9a92f3-159d-b54a-abaf-a78af7ea82f5
Ancestors: PreferenceBrowser-mt.71

Account for low-performance platforms such as ARM. In that case, switch some settings to accommodate that and inform the user.

=============== Diff against PreferenceBrowser-mt.71 ===============

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

Item was added:
+ ----- Method: PreferenceWizardMorph>>adjustSettingsForLowPerformance (in category 'actions') -----
+ adjustSettingsForLowPerformance
+
+ self stateGradients "flat look" ifFalse: [self toggleGradients].
+ self stateBlinkingCursor ifTrue: [self toggleBlinkingCursor].
+ self stateFastDrag ifFalse: [self toggleFastDrag].
+
+ self stateSoftShadows ifTrue: [self toggleSoftShadows].
+ self stateHardShadows ifTrue: [self toggleHardShadows].
+
+ self stateRoundedWindowLook ifTrue: [self toggleRoundedWindowLook].
+ self stateRoundedButtonLook ifTrue: [self toggleRoundedButtonLook].
+
+ self stateAttachToolsToMouse ifTrue: [self toggleAttachToolsToMouse].
+ self stateToolAndMenuIcons ifTrue: [self toggleToolAndMenuIcons].
+
+ "Set simple background."
+ ActiveWorld setAsBackground: MorphicProject defaultFill.
+ previewWorld fillStyle: ActiveWorld fillStyle.
+ !

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);
  model: self;
  font: (StrikeFont familyName: 'Darkmap DejaVu Sans' pointSize: 12);
  textColor: self defaultTextColor;
  borderColor: self defaultTextColor;
  instVarNamed: #borderColor put: self defaultTextColor; "HACK!!"
  borderWidth: 2;
+ cornerStyle: (self hasLowPerformance ifTrue: [#square] ifFalse: [#rounded]);
- cornerStyle: #rounded;
  vResizing: #shrinkWrap;
  hResizing: #shrinkWrap;
  layoutInset: (20@10 corner: 20@10);
  yourself!

Item was changed:
  ----- Method: PreferenceWizardMorph>>createLabel:color: (in category 'initialization') -----
  createLabel: aString color: aColor
 
+ ^ self createLabel: aString color: aColor pointSize: 12!
- | 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>>createLabel:color:pointSize: (in category 'initialization') -----
+ createLabel: aString color: aColor pointSize: size
+
+ | 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: size))).
+ lbl lock.
+ ^ lbl!

Item was added:
+ ----- Method: PreferenceWizardMorph>>hasLowPerformance (in category 'testing') -----
+ hasLowPerformance
+ "If the wizard is started on a machine with low performance, the wizard will change some settings automatically on startup."
+
+ ^ Smalltalk platformSubtype beginsWith: 'arm'!

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 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@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;
+ initializeForLowPerformance.
- initializePreviewWorld.
 
  self
  changeProportionalLayout;
  layoutInset: 20;
  cellInset: 10;
  cellPositioning: #center;
+ addAllMorphs: {titleMorph. buttonRowMorph. controlMorph. previewWorld. startButton. skipButton. lowPerformanceMorph}.
- addAllMorphs: {titleMorph. buttonRowMorph. controlMorph. previewWorld. startButton. skipButton}.
 
  self addKeyboardCaptureFilter: self.!

Item was added:
+ ----- Method: PreferenceWizardMorph>>initializeForLowPerformance (in category 'initialization') -----
+ initializeForLowPerformance
+
+ lowPerformanceMorph := ('Settings were adjusted for low performance.' translated asText
+ addAttribute: (TextColor color: (Color gray: 0.7));
+ addAttribute: (TextFontReference toFont: (StrikeFont familyName: 'Darkmap DejaVu Sans' pointSize: 9));
+ yourself) asMorph lock.
+
+ lowPerformanceMorph layoutFrame: (LayoutFrame fractions: (1 @ 1 corner: 1 @ 1) offsets: (lowPerformanceMorph fullBounds width negated @ lowPerformanceMorph fullBounds height negated corner: 20 @ 20 "Into margins")).
+
+ self hasLowPerformance ifTrue: [self adjustSettingsForLowPerformance].!

Item was changed:
  ----- Method: PreferenceWizardMorph>>initializePreviewWorld (in category 'initialization') -----
  initializePreviewWorld
 
  | w1 w2 w3 |
 
  previewWorld := PasteUpMorph new
  hResizing: #spaceFill;
  vResizing: #spaceFill;
  viewBox: (0@0 corner: 500@500);
  layoutFrame: (LayoutFrame fractions: (0.3 @ 0 corner: 1.0 @ 1.0) offsets: (0@ titleMorph height corner: 0 @ buttonRowMorph height negated));
  fillStyle: ActiveWorld fillStyle;
  borderWidth: 2;
  borderColor: Color white;
+ cornerStyle: (self hasLowPerformance ifTrue: [#square] ifFalse: [#rounded]);
- cornerStyle: #rounded;
  yourself.
 
  w1 := ToolBuilder open: (Browser new setClass: Morph selector: #drawOn:).
  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 changed:
  ----- Method: PreferenceWizardMorph>>showPlayfield (in category 'actions') -----
  showPlayfield
 
  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.
  (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>>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.
 
  controlMorph hide.
  previewWorld hide.
  buttonRowMorph hide.
 
  titleMorph show.
  startButton show.
  skipButton show.
+ self hasLowPerformance
+ ifFalse: [lowPerformanceMorph hide]
+ ifTrue: [lowPerformanceMorph show].
 
+ self world fullBounds.
  self refreshWorld.
  !