The Trunk: Graphics-nice.427.mcz

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

The Trunk: Graphics-nice.427.mcz

commits-2
Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.427.mcz

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

Name: Graphics-nice.427
Author: nice
Time: 3 March 2020, 9:47:31.024562 pm
UUID: 3360bf54-2add-4383-befa-e1aa8863d7fe
Ancestors: Graphics-mt.426

Let's initialize all LayoutFrame inst var to zero instead (empty layout).
This will provide the most reasonable default (the least surprising one).

This way we can continue using:
- (Layout offsets: aRectangle), and get an absolute layout.
- (Layout fractions: aRectangle), and get a pure proportional layout.

The goal is to expunge the nil protection out of the LayoutFrame.
Those nils are like additional states (to be or not to be nil...) and are gratuitous complexifications. We Ain't Gonna Need It anymore (the personal form of YAGNI).

=============== Diff against Graphics-mt.426 ===============

Item was added:
+ ----- Method: LayoutFrame>>fixup (in category 'initialize-release') -----
+ fixup
+ "Set-up default value for un-initialized layout frames"
+
+ "LayoutFrame allInstancesDo: [:e | e fixup]."
+
+ leftFraction ifNil: [leftFraction := 0].
+ leftOffset ifNil: [leftOffset := 0].
+ topFraction ifNil: [topFraction := 0].
+ topOffset ifNil: [topOffset := 0].
+ rightFraction ifNil: [rightFraction := 0].
+ rightOffset ifNil: [rightOffset := 0].
+ bottomFraction ifNil: [bottomFraction := 0].
+ bottomOffset ifNil: [bottomOffset := 0].!

Item was added:
+ ----- Method: LayoutFrame>>initialize (in category 'initialize-release') -----
+ initialize
+ "By default, let the frame be empty.
+ This way, we can later define a proportional layout via fractions,
+ or a fixed layout via offsets, or whatever mixture of both."
+
+ leftFraction := leftOffset := topFraction := topOffset := rightFraction := rightOffset := bottomFraction := bottomOffset := 0!

Item was changed:
  (PackageInfo named: 'Graphics') postscript: '
+ "Fix those LayoutFrame with un-initialized instance variable"
+ LayoutFrame allInstancesDo: [:e | e fixup].'!
- "Initialize RGBToName dictionary"
- Color initializeNamesMap.'!