[squeak-dev] The Inbox: Graphics-jr.425.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Mon Jan 6 13:01:24 UTC 2020


Hi Marcel, Welcome back & happy new year! :-)


> IMO, it should be considered a bug that there are LayoutFrame instances with "nil" fractions.

Good point. There are many users of LayoutFrame that do not use any constructor of the class. For example, see SystemWindow closeBoxFrame.
Now we could either define 2**8 constructors for all of them or, what I would find more simple, do what you proposed in
[squeak-dev] The Trunk: Graphics-mt.406.mcz

[Entwurf]
Diese Nachricht wurde nicht gesendet.Gespeichert am: Heute, 13:41 Uhr

> we might want to change all "getters" into lazy initializers? #leftFraction, #rightFraction, ... or at least return "0" on "ifNil"?

I would prefer the second variant, just for backward compatibility.

And should we maybe initialize the offsets in #leftFraction: etc. if they are zero?

leftFraction: aNumber
    ^ self leftFraction: aNumber offset: self leftOffset

leftOffset
    ^ leftOffset ifNil: [0]

Best,
Christoph


________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 6. Januar 2020 13:28:02
An: John Pfersich via Squeak-dev
Betreff: Re: [squeak-dev] The Inbox: Graphics-jr.425.mcz

> What is the advantage of nil fractions compared to zero fractions?

No advantages, I think. Just additional ifNil-checks somewhere else. IMO, it should be considered a bug that there are LayoutFrame instances with "nil" fractions.

Best,
Marcel

Am 30.12.2019 14:15:28 schrieb Thiede, Christoph <christoph.thiede at student.hpi.uni-potsdam.de>:

Ah yes, we had also talked about this in [squeak-dev] LayoutFrame>>#printOn:<http://forum.world.st/LayoutFrame-printOn-tp5104021.html>.


Maybe we should define whether fractions are okay to be nil here. What is the advantage of nil fractions compared to zero fractions?

________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Montag, 30. Dezember 2019 03:11:52
An: squeak-dev at lists.squeakfoundation.org
Betreff: [squeak-dev] The Inbox: Graphics-jr.425.mcz

A new version of Graphics was added to project The Inbox:
http://source.squeak.org/inbox/Graphics-jr.425.mcz

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

Name: Graphics-jr.425
Author: jr
Time: 30 December 2019, 3:11:45.845402 am
UUID: 465fa95d-6a50-a84d-8b73-7e90a2b9d2b5
Ancestors: Graphics-pre.424

Fix message not understood when the right or bottom fraction of a LayoutFrame is nil.

=============== Diff against Graphics-pre.424 ===============

Item was changed:
  ----- Method: LayoutFrame>>printOn: (in category 'printing') -----
  printOn: aStream

         super printOn: aStream.

         aStream nextPutAll: '( '.

         { {'l'. self leftFraction. self leftOffset}. {'t'. self topFraction. self topOffset}. {'r'. self rightFraction. self rightOffset}. {'b'. self bottomFraction. self bottomOffset} } do: [:spec |
                 aStream nextPutAll: spec first; space.

+                (spec second ifNil: [0]) printOn: aStream maxDecimalPlaces: 2.
-                spec second printOn: aStream maxDecimalPlaces: 2.

                 aStream nextPutAll: ((spec third ifNil: [0]) >= 0 ifTrue: ['+'] ifFalse: ['-']).
                 (spec third ifNil: [0]) abs printOn: aStream maxDecimalPlaces: 0]
                         separatedBy: [aStream space].

         aStream nextPutAll: ' )'.!





________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 6. Januar 2020 13:32:44
An: John Pfersich via Squeak-dev
Betreff: Re: [squeak-dev] The Trunk: Graphics-mt.406.mcz

Hmm... we might want to change all "getters" into lazy initializers? #leftFraction, #rightFraction, ... or at least return "0" on "ifNil"?

Best,
Marcel

Am 30.12.2019 00:11:53 schrieb Jakob Reschke <forums.jakob at resfarm.de>:

For some reason I encounter LayoutFrames with nil in the right and bottom variables... of course, these don't understand printOn:maxDecimalPlaces:.

Am Do., 17. Jan. 2019 um 11:19 Uhr schrieb <commits at source.squeak.org<mailto:commits at source.squeak.org>>:
Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-mt.406.mcz

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

Name: Graphics-mt.406
Author: mt
Time: 17 January 2019, 11:18:39.003727 am
UUID: 027d00a7-113d-4b9f-aaec-79e3373339c1
Ancestors: Graphics-mt.405

Adds an informative string representation for LayoutFrame to support layout design and debugging.

=============== Diff against Graphics-mt.405 ===============

Item was added:
+ ----- Method: LayoutFrame>>printOn: (in category 'printing') -----
+ printOn: aStream
+
+       super printOn: aStream.
+
+       aStream nextPutAll: '( '.
+
+       { {'l'. self leftFraction. self leftOffset}. {'t'. self topFraction. self topOffset}. {'r'. self rightFraction. self rightOffset}. {'b'. self bottomFraction. self bottomOffset} } do: [:spec |
+               aStream nextPutAll: spec first; space.
+
+               spec second printOn: aStream maxDecimalPlaces: 2.
+
+               aStream nextPutAll: ((spec third ifNil: [0]) >= 0 ifTrue: ['+'] ifFalse: ['-']).
+               (spec third ifNil: [0]) abs printOn: aStream maxDecimalPlaces: 0]
+                       separatedBy: [aStream space].
+
+       aStream nextPutAll: ' )'.!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200106/7b99138b/attachment.html>


More information about the Squeak-dev mailing list