The Trunk: Morphic-mt.817.mcz

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

The Trunk: Morphic-mt.817.mcz

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

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

Name: Morphic-mt.817
Author: mt
Time: 3 April 2015, 6:38:01.265 pm
UUID: c2a1e4c5-1ee5-0445-956f-8951e2fbb8fa
Ancestors: Morphic-mt.816

Color handling in system windows cleaned-up and fixed. #adoptPaneColor: will now be sent to all panes on activate/passivate to give them a chance to also "look inactive".

=============== Diff against Morphic-mt.816 ===============

Item was changed:
  ----- Method: SystemWindow class>>labelled: (in category 'instance creation') -----
  labelled: labelString
+
+ ^ self basicNew
+ initializeWithLabel: labelString;
+ yourself!
- ^ (self basicNew setLabel: labelString) initialize!

Item was changed:
  ----- Method: SystemWindow>>activateWindow (in category 'top window') -----
  activateWindow
  "Bring me to the front and make me able to respond to mouse and keyboard.
  Was #activate (sw 5/18/2001 23:20)"
 
  | oldTop outerMorph sketchEditor pal |
  outerMorph := self topRendererOrSelf.
  outerMorph owner ifNil: [^ self "avoid spurious activate when drop in trash"].
  oldTop := TopWindow.
  oldTop = self ifTrue: [^self].
  TopWindow := self.
  oldTop ifNotNil: [oldTop passivate].
  outerMorph owner firstSubmorph == outerMorph
  ifFalse: ["Bring me (with any flex) to the top if not already"
  outerMorph owner addMorphFront: outerMorph].
  self submorphsDo: [:m | m unlock].
 
  label ifNotNil: [label color: Color black].
 
  self undimWindowButtons.
+ labelArea ifNotNil: [labelArea submorphsDo: [:m | m unlock; show]].
+ self
+ setStripeColorsFrom: self paneColorToUse;
+ adoptPaneColor: self paneColorToUse.
+
- labelArea ifNotNil:
- [labelArea submorphsDo: [:m | m unlock; show].
- self setStripeColorsFrom: self paneColorToUse].
  self isCollapsed ifFalse:
  [model modelWakeUpIn: self.
  self positionSubmorphs.
  labelArea ifNil: [self adjustBorderUponActivationWhenLabeless]].
 
  (sketchEditor := self extantSketchEditor) ifNotNil:
  [sketchEditor comeToFront.
  (pal := self world findA: PaintBoxMorph) ifNotNil:
  [pal comeToFront]].
+
+ self updatePaneColors.!
- !

Item was changed:
  ----- Method: SystemWindow>>defaultBorderColor (in category 'initialization') -----
  defaultBorderColor
  "answer the default border color/fill style for the receiver"
+ ^ self defaultColor muchDarker!
- ^ #raised.!

Item was changed:
  ----- Method: SystemWindow>>defaultBorderWidth (in category 'initialization') -----
  defaultBorderWidth
  "answer the default border width for the receiver"
+ ^ 1!
- ^ 2.!

Item was added:
+ ----- Method: SystemWindow>>defaultBounds (in category 'initialization') -----
+ defaultBounds
+
+ ^ 0@0 corner: 300@200!

Item was changed:
  ----- Method: SystemWindow>>defaultColor (in category 'initialization') -----
  defaultColor
  "answer the default color/fill style for the receiver"
+ ^ Preferences uniformWindowColor!
- ^ Color white.!

Item was changed:
+ ----- Method: SystemWindow>>existingPaneColor (in category 'colors handling') -----
- ----- Method: SystemWindow>>existingPaneColor (in category 'panes') -----
  existingPaneColor
  "Answer the existing pane color for the window, obtaining it from the first paneMorph if any, and fall back on using the second stripe color if necessary."
 
  | aColor |
  aColor := self valueOfProperty: #paneColor.
  aColor ifNil: [self setProperty: #paneColor toValue: (aColor := self paneColor)].
  ^aColor.!

Item was changed:
+ ----- Method: SystemWindow>>gradientWithColor: (in category 'colors handling') -----
- ----- Method: SystemWindow>>gradientWithColor: (in category 'initialization') -----
  gradientWithColor: aColor
 
  | gradient |
  gradient := GradientFillStyle ramp: {
  0.0 -> Color white.
  0.2 -> (aColor mixed: 0.5 with: (Color gray: 0.9)) lighter.
  1.0 -> aColor.
  }.
  gradient origin: self topLeft.
  gradient direction: 0 @ self labelHeight.
  ^gradient!

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 initializeLabelArea.
+ self addCornerGrips.
+
+ Preferences menuAppearance3d ifTrue: [
+ self
+ addDropShadow;
+ shadowColor: (TranslucentColor r: 0.0 g: 0.0 b: 0.0 alpha: 0.333);
+ shadowOffset: 1@1].
+
  allowReframeHandles := true.
- labelString ifNil: [labelString := 'Untitled Window'].
  isCollapsed := false.
  activeOnlyOnTop := true.
  paneMorphs := Array new.
- borderColor := Color lightGray.
- borderWidth := 1.
- self color: Color veryVeryLightGray muchLighter.
- self layoutPolicy: ProportionalLayout new.
-
- self initializeLabelArea.
-
- self addCornerGrips.
-
- self extent: 300 @ 200.
  mustNotClose := false.
+ updatablePanes := Array new.!
- updatablePanes := Array new.
-
- Preferences menuAppearance3d
- ifTrue: [
- self
- addDropShadow;
- shadowColor: (TranslucentColor r: 0.0 g: 0.0 b: 0.0 alpha: 0.333);
- shadowOffset: 1@1.
- ].
- !

Item was changed:
  ----- Method: SystemWindow>>initializeLabelArea (in category 'initialization') -----
  initializeLabelArea
  "Initialize the label area (titlebar) for the window."
+
+ labelString ifNil: [labelString := 'Untitled Window'].
  label := StringMorph new contents: labelString;
  font: Preferences windowTitleFont emphasis: 0.
  "Add collapse box so #labelHeight will work"
  collapseBox := self createCollapseBox.
  stripes := Array
  with: (RectangleMorph newBounds: bounds)
  with: (RectangleMorph newBounds: bounds).
  "see extent:"
  self addLabelArea.
  self setLabelWidgetAllowance.
  self addCloseBox.
  self class moveMenuButtonRight
  ifTrue: [self addLabel. self addMenuControl]
  ifFalse: [self addMenuControl. self addLabel].
  self addExpandBox.
  labelArea addMorphBack: collapseBox.
  self setFramesForLabelArea.
  Preferences noviceMode
  ifTrue: [closeBox
  ifNotNil: [closeBox setBalloonText: 'close window'].
  menuBox
  ifNotNil: [menuBox setBalloonText: 'window menu'].
  collapseBox
  ifNotNil: [collapseBox setBalloonText: 'collapse/expand window']].
  !

Item was added:
+ ----- Method: SystemWindow>>initializeWithLabel: (in category 'initialization') -----
+ initializeWithLabel: aString
+
+ labelString := aString.
+ self initialize.!

Item was changed:
+ ----- Method: SystemWindow>>paneColor (in category 'colors handling') -----
- ----- Method: SystemWindow>>paneColor (in category 'colors') -----
  paneColor
  | cc |
  (cc := self valueOfProperty: #paneColor) ifNotNil: [^cc].
  Display depth > 2
  ifTrue:
  [model ifNotNil:
  [model isInMemory
  ifTrue:
  [cc := Color colorFrom: model defaultBackgroundColor]].
  cc ifNil: [cc := paneMorphs isEmptyOrNil ifFalse: [paneMorphs first color]]].
  cc ifNil: [cc := self defaultBackgroundColor].
  self paneColor: cc.
  ^cc!

Item was changed:
+ ----- Method: SystemWindow>>paneColor: (in category 'colors handling') -----
- ----- Method: SystemWindow>>paneColor: (in category 'panes') -----
  paneColor: aColor
  self setProperty: #paneColor toValue: aColor.
 
  self adoptPaneColor: aColor.!

Item was changed:
+ ----- Method: SystemWindow>>paneColorToUse (in category 'colors handling') -----
- ----- Method: SystemWindow>>paneColorToUse (in category 'panes') -----
  paneColorToUse
  ^ Display depth <= 2
  ifTrue:
  [Color white]
  ifFalse:
  [self paneColor]!

Item was changed:
  ----- Method: SystemWindow>>passivate (in category 'top window') -----
  passivate
  "Make me unable to respond to mouse and keyboard"
 
  label ifNotNil: [label color: Color darkGray].
+
+ (SystemWindow gradientWindow
+ ifTrue: [self paneColorToUse duller darker]
+ ifFalse: [self paneColorToUse darker]) in: [:c |
+ self
+ setStripeColorsFrom: c;
+ adoptPaneColor: c].
+
- self setStripeColorsFrom: self paneColorToUse.
  model modelSleep.
 
  self lockInactivePortions
  !

Item was changed:
+ ----- Method: SystemWindow>>raisedColor (in category 'colors handling') -----
- ----- Method: SystemWindow>>raisedColor (in category 'drawing') -----
  raisedColor
  ^self paneColor raisedColor!

Item was changed:
+ ----- Method: SystemWindow>>refreshWindowColor (in category 'colors handling') -----
- ----- Method: SystemWindow>>refreshWindowColor (in category 'initialization') -----
  refreshWindowColor
  "For changing the underlying model's default window color"
  self paneColor: nil.
  self setWindowColor: self paneColor.!

Item was changed:
+ ----- Method: SystemWindow>>restoreDefaultPaneColor (in category 'colors handling') -----
- ----- Method: SystemWindow>>restoreDefaultPaneColor (in category 'panes') -----
  restoreDefaultPaneColor
  "Useful when changing from monochrome to color display"
 
  self setStripeColorsFrom: self paneColor.!

Item was removed:
- ----- Method: SystemWindow>>scrollBarColor (in category 'drawing') -----
- scrollBarColor
- ^self paneColor!

Item was changed:
+ ----- Method: SystemWindow>>setStripeColorsFrom: (in category 'colors handling') -----
- ----- Method: SystemWindow>>setStripeColorsFrom: (in category 'label') -----
  setStripeColorsFrom: paneColor
  "Set the stripe color based on the given paneColor"
 
  labelArea ifNotNil: [labelArea color: Color transparent].
+ self updateBoxesColor: paneColor.
- self updateBoxesColor: (self isActive
- ifTrue: [paneColor]
- ifFalse: [paneColor muchDarker]).
  stripes ifNil: [^self].
 
+ self borderColor: paneColor muchDarker.
+
  SystemWindow gradientWindow
+ ifTrue: [self fillStyle: (self gradientWithColor: paneColor)]
+ ifFalse: [self color: paneColor].!
- ifTrue: [
- self fillStyle: (self isActive
- ifTrue: [self gradientWithColor: paneColor duller "lighter lighter lighter"]
- ifFalse: [self gradientWithColor: paneColor duller darker])]
- ifFalse: [
- self color: (self isActive
- ifTrue: [paneColor]
- ifFalse: [paneColor duller])].!

Item was changed:
+ ----- Method: SystemWindow>>setWindowColor: (in category 'colors handling') -----
- ----- Method: SystemWindow>>setWindowColor: (in category 'menu') -----
  setWindowColor: incomingColor
  | existingColor aColor |
  incomingColor ifNil: [^ self].  "it happens"
  aColor := incomingColor asNontranslucentColor.
  (aColor = ColorPickerMorph perniciousBorderColor
  or: [aColor = Color black]) ifTrue: [^ self].
  existingColor := self paneColorToUse.
  existingColor ifNil: [^ Beeper beep].
  self paneColor: aColor.
  self setStripeColorsFrom: aColor.
  self changed.!

Item was changed:
+ ----- Method: SystemWindow>>updatePaneColors (in category 'colors handling') -----
- ----- Method: SystemWindow>>updatePaneColors (in category 'panes') -----
  updatePaneColors
  "Useful when changing from monochrome to color display"
 
  self setStripeColorsFrom: self paneColorToUse.!