LayoutOrigin.st
author Claus Gittinger <cg@exept.de>
Sun, 23 Feb 2020 16:01:31 +0100
changeset 4450 c07db2570587
parent 4357 07a48f0f4989
permissions -rw-r--r--
#REFACTORING by exept class: GIFReader comment/format in: #readImage: changed: #fromStream: #writeHeaderFor:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4285
86c48debecd5 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 3923
diff changeset
     1
"{ Encoding: utf8 }"
86c48debecd5 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 3923
diff changeset
     2
88
claus
parents: 83
diff changeset
     3
"
claus
parents: 83
diff changeset
     4
 COPYRIGHT (c) 1995 by Claus Gittinger
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
     5
	      All Rights Reserved
88
claus
parents: 83
diff changeset
     6
claus
parents: 83
diff changeset
     7
 This software is furnished under a license and may be used
claus
parents: 83
diff changeset
     8
 only in accordance with the terms of that license and with the
claus
parents: 83
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
claus
parents: 83
diff changeset
    10
 be provided or otherwise made available to, or used by, any
claus
parents: 83
diff changeset
    11
 other person.  No title to or ownership of the software is
claus
parents: 83
diff changeset
    12
 hereby transferred.
claus
parents: 83
diff changeset
    13
"
1600
ac585461747e computed rectangle is truncated here.
Claus Gittinger <cg@exept.de>
parents: 1039
diff changeset
    14
"{ Package: 'stx:libview2' }"
ac585461747e computed rectangle is truncated here.
Claus Gittinger <cg@exept.de>
parents: 1039
diff changeset
    15
3794
a7ac172485be #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
    16
"{ NameSpace: Smalltalk }"
a7ac172485be #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
    17
77
claus
parents:
diff changeset
    18
Layout subclass:#LayoutOrigin
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    19
	instanceVariableNames:'leftFraction topFraction leftOffset topOffset'
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    20
	classVariableNames:''
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    21
	poolDictionaries:''
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    22
	category:'Graphics-Geometry'
77
claus
parents:
diff changeset
    23
!
claus
parents:
diff changeset
    24
88
claus
parents: 83
diff changeset
    25
!LayoutOrigin class methodsFor:'documentation'!
claus
parents: 83
diff changeset
    26
claus
parents: 83
diff changeset
    27
copyright
claus
parents: 83
diff changeset
    28
"
claus
parents: 83
diff changeset
    29
 COPYRIGHT (c) 1995 by Claus Gittinger
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    30
	      All Rights Reserved
88
claus
parents: 83
diff changeset
    31
claus
parents: 83
diff changeset
    32
 This software is furnished under a license and may be used
claus
parents: 83
diff changeset
    33
 only in accordance with the terms of that license and with the
claus
parents: 83
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
claus
parents: 83
diff changeset
    35
 be provided or otherwise made available to, or used by, any
claus
parents: 83
diff changeset
    36
 other person.  No title to or ownership of the software is
claus
parents: 83
diff changeset
    37
 hereby transferred.
claus
parents: 83
diff changeset
    38
"
claus
parents: 83
diff changeset
    39
!
claus
parents: 83
diff changeset
    40
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    41
documentation
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    42
"
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    43
    This class is provided to make porting of existing ST-80 applications
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    44
    easier. Instances can be used to control the geometry of a subview, within
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    45
    its superview. It provides the same functionality as a relative origin
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    46
    combined with insets.
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    47
    A layoutOrigin controls the origin of a subcomponent, given a fractional
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    48
    component and an offset component.
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    49
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    50
    Notice: 
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    51
        this class was implemented using protocol information
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    52
        from alpha testers - it may not be complete or compatible to
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    53
        the corresponding ST-80 class. 
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    54
        If you encounter any incompatibilities, please forward a note 
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    55
        describing the incompatibility verbal (i.e. no code) to the ST/X team.
219
106b86ca81da documentation
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
    56
106b86ca81da documentation
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
    57
    [author:]
106b86ca81da documentation
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
    58
        Claus Gittinger
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    59
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    60
    [see also:]
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    61
        View
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    62
        LayoutFrame AlignmentOrigin Layout 
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    63
        Rectangle Point
94
8888ddd11323 *** empty log message ***
claus
parents: 93
diff changeset
    64
"
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    65
!
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    66
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    67
examples
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    68
"
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    69
    Although the examples below use a button as component,
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    70
    they work of course with any type of subview ....
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    71
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    72
    using a LayoutOrigin, to arrange for
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    73
    the TOPLEFT of a component be positions
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    74
    at the center (i.e. buttons origin at:0.5 @ 0.5):
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    75
                                                                        [exBegin]
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    76
        |top button|
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    77
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    78
        top := StandardSystemView new.
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    79
        top extent:300@300.
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    80
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    81
        button := Button label:'component'.
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    82
        top add:button in:(LayoutOrigin new
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    83
                                leftFraction:0.5;
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    84
                                topFraction:0.5).
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    85
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    86
        top open
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    87
                                                                        [exEnd]
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    88
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    89
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    90
    like above, but adds an additional offset:
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    91
    (i.e. center of button at:0.5 @ 0.5 OFFSET by 10 @ 20):
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    92
                                                                        [exBegin]
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    93
        |top button|
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    94
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    95
        top := StandardSystemView new.
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    96
        top extent:300@300.
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    97
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    98
        button := Button label:'component'.
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    99
        top add:button in:(LayoutOrigin new
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   100
                                leftFraction:0.5;
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   101
                                topFraction:0.5;
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   102
                                leftOffset:10;
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   103
                                topOffset:20).
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   104
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   105
        top open
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   106
                                                                        [exEnd]
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   107
"
88
claus
parents: 83
diff changeset
   108
! !
claus
parents: 83
diff changeset
   109
77
claus
parents:
diff changeset
   110
!LayoutOrigin class methodsFor:'instance creation'!
claus
parents:
diff changeset
   111
claus
parents:
diff changeset
   112
fractionalFromPoint:aPoint
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   113
    "given a point, create a layoutOrigin representing the same 
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   114
     relative origin."
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   115
83
claus
parents: 77
diff changeset
   116
    ^ (self new) leftFraction:aPoint x topFraction:aPoint y
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   117
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   118
    "
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   119
     LayoutOrigin fractionalFromPoint:0.5@0.5
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   120
    "
77
claus
parents:
diff changeset
   121
!
claus
parents:
diff changeset
   122
claus
parents:
diff changeset
   123
fromPoint:aPoint
1821
5539214ed293 comment
Claus Gittinger <cg@exept.de>
parents: 1601
diff changeset
   124
    "return a new LayoutOrigin from aPoint.
5539214ed293 comment
Claus Gittinger <cg@exept.de>
parents: 1601
diff changeset
   125
     If the coordinates are between 0 and 1, 
5539214ed293 comment
Claus Gittinger <cg@exept.de>
parents: 1601
diff changeset
   126
     take them as fractional parts (relative to superview).
77
claus
parents:
diff changeset
   127
     Otherwise, treat them as absolute offsets."
claus
parents:
diff changeset
   128
claus
parents:
diff changeset
   129
    |x y layout|
claus
parents:
diff changeset
   130
claus
parents:
diff changeset
   131
    x := aPoint x.
claus
parents:
diff changeset
   132
    y := aPoint y.
claus
parents:
diff changeset
   133
    layout := self new.
claus
parents:
diff changeset
   134
    ((x between:0 and:1)
claus
parents:
diff changeset
   135
    and:[y between:0 and:1]) ifTrue:[
1821
5539214ed293 comment
Claus Gittinger <cg@exept.de>
parents: 1601
diff changeset
   136
        layout leftFraction:x topFraction:y
77
claus
parents:
diff changeset
   137
    ] ifFalse:[
1821
5539214ed293 comment
Claus Gittinger <cg@exept.de>
parents: 1601
diff changeset
   138
        layout leftOffset:x topOffset:y
77
claus
parents:
diff changeset
   139
    ].
claus
parents:
diff changeset
   140
    ^ layout
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   141
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   142
    "
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   143
     LayoutOrigin fromPoint:100@100
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   144
     LayoutOrigin fromPoint:0.5@0.5
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   145
     LayoutOrigin fromPoint:0.5@100
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
   146
    "
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   147
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   148
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   149
offsetFromPoint:aPoint
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   150
    "given a point, create a layoutOrigin representing the same 
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   151
     absolute (pixel) origin."
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   152
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   153
    ^ self new leftOffset:aPoint x topOffset:aPoint y
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   154
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   155
    "
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   156
     LayoutOrigin offsetFromPoint:100@100
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   157
    "
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   158
! !
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   159
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   160
!LayoutOrigin methodsFor:'accessing'!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   161
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   162
leftFraction
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   163
    "return leftFraction"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   164
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   165
    ^ leftFraction
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   166
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   167
4357
07a48f0f4989 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4294
diff changeset
   168
leftFraction:aFraction
07a48f0f4989 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4294
diff changeset
   169
    "set leftFraction (0..1)"
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   170
4357
07a48f0f4989 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4294
diff changeset
   171
    leftFraction := aFraction.
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   172
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   173
4357
07a48f0f4989 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4294
diff changeset
   174
leftFraction:aFraction offset:o
07a48f0f4989 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4294
diff changeset
   175
    "set leftFraction (0..1) and offset in pixels"
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   176
4357
07a48f0f4989 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4294
diff changeset
   177
    leftFraction := aFraction.
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   178
    leftOffset := o
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   179
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   180
543
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   181
leftFraction:lF offset:lO topFraction:tF offset:tO 
4357
07a48f0f4989 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4294
diff changeset
   182
    "set leftFraction (0..1), leftOffset, topFraction (0..1) and topOffset"
543
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   183
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   184
    leftFraction := lF. leftOffset := lO.
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   185
    topFraction := tF. topOffset := tO.
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   186
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   187
    "Created: 18.4.1997 / 20:07:15 / cg"
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   188
!
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   189
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   190
leftFraction:newLeft topFraction:newTop 
4357
07a48f0f4989 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4294
diff changeset
   191
    "set leftFraction (0..1) and topFraction (0..1)"
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   192
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   193
    leftFraction := newLeft.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   194
    topFraction := newTop.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   195
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   196
275
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   197
leftInset:pixels
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   198
    "set leftOffset for an inset at the left"
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   199
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   200
    leftOffset := pixels.
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   201
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   202
    "Created: 26.5.1996 / 17:38:55 / cg"
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   203
    "Modified: 26.5.1996 / 17:42:16 / cg"
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   204
!
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   205
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   206
leftOffset
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   207
    "return leftOffset"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   208
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   209
    ^ leftOffset
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   210
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   211
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   212
leftOffset:something
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   213
    "set leftOffset"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   214
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   215
    leftOffset := something.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   216
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   217
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   218
leftOffset:newLeft topOffset:newTop 
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   219
    "set leftOffset and topOffset"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   220
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   221
    leftOffset := newLeft.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   222
    topOffset := newTop.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   223
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   224
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   225
topFraction
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   226
    "return topFraction"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   227
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   228
    ^ topFraction
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   229
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   230
4357
07a48f0f4989 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4294
diff changeset
   231
topFraction:aFraction
07a48f0f4989 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4294
diff changeset
   232
    "set topFraction (0..1)"
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   233
4357
07a48f0f4989 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4294
diff changeset
   234
    topFraction := aFraction.
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   235
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   236
4357
07a48f0f4989 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4294
diff changeset
   237
topFraction:aFraction offset:o
07a48f0f4989 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4294
diff changeset
   238
    "set topFraction (0..1) and offset"
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   239
4357
07a48f0f4989 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4294
diff changeset
   240
    topFraction := aFraction.
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   241
    topOffset := o
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   242
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   243
275
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   244
topInset:pixels
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   245
    "set topOffset for an inset at the top"
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   246
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   247
    topOffset := pixels.
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   248
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   249
    "Created: 26.5.1996 / 17:39:00 / cg"
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   250
    "Modified: 26.5.1996 / 17:42:12 / cg"
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   251
!
d500c08871ab added inset methods
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   252
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   253
topOffset
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   254
    "return topOffset"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   255
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   256
    ^ topOffset
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   257
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   258
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   259
topOffset:something
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   260
    "set topOffset"
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   261
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   262
    topOffset := something.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   263
! !
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   264
3330
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   265
!LayoutOrigin methodsFor:'comparing'!
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   266
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   267
= anObject
3331
443356a56b2f class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3330
diff changeset
   268
    ^ anObject class == self class
3330
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   269
        and:[ anObject leftFraction = leftFraction
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   270
        and:[ anObject topFraction = topFraction
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   271
        and:[ anObject leftOffset = leftOffset
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   272
        and:[ anObject topOffset = topOffset ]]]]
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   273
!
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   274
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   275
hash
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   276
    ^ leftFraction hash + topFraction hash + leftOffset hash + topOffset hash
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   277
! !
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   278
4294
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   279
!LayoutOrigin methodsFor:'computing'!
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   280
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   281
rectangleRelativeTo:superRectangle preferred:prefRectHolder
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   282
    "compute the rectangle represented by the receiver,
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   283
     given the superView's rectangle and the view's preferredExtent."
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   284
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   285
    |x y prefRect|
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   286
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   287
    prefRect := prefRectHolder value.
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   288
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   289
    x := superRectangle left.
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   290
    y := superRectangle top.
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   291
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   292
    leftOffset notNil ifTrue:[
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   293
        x := x + leftOffset value
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   294
    ].
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   295
    topOffset notNil ifTrue:[
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   296
        y := y + topOffset value
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   297
    ].
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   298
    leftFraction notNil ifTrue:[
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   299
        x := x + (superRectangle width * leftFraction value)
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   300
    ].
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   301
    topFraction notNil ifTrue:[
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   302
        y := y + (superRectangle height * topFraction value)
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   303
    ].
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   304
    ^ Rectangle left:x top:y extent:prefRect extent
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   305
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   306
    "
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   307
     |superRect lO|
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   308
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   309
     superRect := 0@0 corner:100@100.
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   310
     lO := (LayoutOrigin new).
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   311
     lO leftFraction:0.5;
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   312
        topFraction:0.5.
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   313
     lO rectangleRelativeTo:superRect preferred:(0@0 corner:30@30)
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   314
    "
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   315
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   316
    "Modified: / 13-08-1998 / 18:39:49 / cg"
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   317
    "Modified (comment): / 17-07-2019 / 10:02:59 / Claus Gittinger"
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   318
! !
95e9a81c2c12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4285
diff changeset
   319
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   320
!LayoutOrigin methodsFor:'converting'!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   321
543
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   322
asAlignmentOrigin
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   323
    "return an equivalent alignmentOrigin"
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   324
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   325
    ^ AlignmentOrigin new
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   326
        leftFraction:leftFraction offset:leftOffset;
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   327
        topFraction:topFraction offset:topOffset;
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   328
        leftAlignmentFraction:0 topAlignmentFraction: 0;
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   329
        yourself
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   330
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   331
    "Created: 18.4.1997 / 20:08:14 / cg"
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   332
!
1e730ed96b0b added conversion to alignmentOrigin and another access method.
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   333
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   334
fromLiteralArrayEncoding:encoding
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   335
    "read my values from an encoding.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   336
     The encoding is supposed to be of the form: 
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   337
	(#LayoutOrigin orgOffsX relOrgX orgOffsY relOrgY)
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   338
     This is the reverse operation to #literalArrayEncoding."
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   339
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   340
    leftOffset := encoding at:2.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   341
    leftFraction := encoding at:3.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   342
    topOffset := encoding at:4.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   343
    topFraction := encoding at:5.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   344
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   345
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   346
    "
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   347
      LayoutOrigin new fromLiteralArrayEncoding:#(#LayoutOrigin 70 0 2 0)
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   348
    "
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   349
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   350
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   351
literalArrayEncoding
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   352
    "encode myself as an array, from which a copy of the receiver
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   353
     can be reconstructed with #decodeAsLiteralArray.
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   354
     The encoding is: 
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   355
        (#LayoutOrigin orgOffsX relOrgX orgOffsY relOrgY)
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   356
    "
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   357
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   358
    ^ Array
2134
0ef95141831c Fix comments.
Stefan Vogel <sv@exept.de>
parents: 1821
diff changeset
   359
        with:self class name
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   360
        with:leftOffset
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   361
        with:leftFraction
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   362
        with:topOffset
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   363
        with:topFraction
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   364
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   365
    "
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   366
      LayoutOrigin new fromLiteralArrayEncoding:#(#LayoutOrigin 70 0 2 0)
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   367
      (LayoutOrigin new leftOffset:10; leftFraction:0.2;
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   368
                       topOffset:20; topFraction:0.4) literalArrayEncoding 
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   369
    "
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   370
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   371
    "Modified: 1.9.1995 / 02:43:48 / claus"
191
cb2815b77100 commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   372
    "Modified: 22.4.1996 / 13:00:21 / cg"
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   373
! !
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   374
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   375
!LayoutOrigin methodsFor:'initialization'!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   376
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   377
initialize
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   378
    leftOffset := topOffset := 0.
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   379
    leftFraction := topFraction := 0.
3865
e6f90d1cf89b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   380
e6f90d1cf89b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   381
    "Modified: / 08-02-2017 / 00:44:18 / cg"
77
claus
parents:
diff changeset
   382
! !
claus
parents:
diff changeset
   383
83
claus
parents: 77
diff changeset
   384
!LayoutOrigin methodsFor:'printing & storing'!
claus
parents: 77
diff changeset
   385
3016
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   386
displayOn:aGCOrStream
700
67f1dccb8333 comments
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
   387
    "return a printed representation of the receiver for displaying"
67f1dccb8333 comments
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
   388
3016
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   389
    "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
3923
35437a72496b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 3865
diff changeset
   390
    "/ old ST80 means: draw-yourself on a GC.
3016
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   391
    (aGCOrStream isStream) ifFalse:[
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   392
        ^ super displayOn:aGCOrStream
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   393
    ].
700
67f1dccb8333 comments
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
   394
3016
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   395
    aGCOrStream 
4285
86c48debecd5 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 3923
diff changeset
   396
        nextPutAll:self className;
3016
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   397
        nextPutAll:'(l: '.
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   398
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   399
    leftFraction displayOn:aGCOrStream.
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   400
    aGCOrStream nextPut:$+. 
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   401
    leftOffset displayOn:aGCOrStream.
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   402
    aGCOrStream nextPutAll:' t: '.
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   403
    topFraction displayOn:aGCOrStream.
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   404
    aGCOrStream nextPut:$+. 
e2374dddc45f Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 2134
diff changeset
   405
    topOffset displayOn:aGCOrStream.
3923
35437a72496b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 3865
diff changeset
   406
    aGCOrStream nextPut:$).
35437a72496b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 3865
diff changeset
   407
35437a72496b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 3865
diff changeset
   408
    "Modified (comment): / 22-02-2017 / 16:49:31 / cg"
4285
86c48debecd5 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 3923
diff changeset
   409
    "Modified: / 28-06-2019 / 09:04:01 / Claus Gittinger"
83
claus
parents: 77
diff changeset
   410
! !
claus
parents: 77
diff changeset
   411
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   412
!LayoutOrigin methodsFor:'queries'!
77
claus
parents:
diff changeset
   413
415
5d1bf4dffbf5 *** empty log message ***
ca
parents: 275
diff changeset
   414
isLayoutOrigin
5d1bf4dffbf5 *** empty log message ***
ca
parents: 275
diff changeset
   415
    "return true, if this is a layoutOrigin"
5d1bf4dffbf5 *** empty log message ***
ca
parents: 275
diff changeset
   416
5d1bf4dffbf5 *** empty log message ***
ca
parents: 275
diff changeset
   417
    ^ true
5d1bf4dffbf5 *** empty log message ***
ca
parents: 275
diff changeset
   418
5d1bf4dffbf5 *** empty log message ***
ca
parents: 275
diff changeset
   419
!
5d1bf4dffbf5 *** empty log message ***
ca
parents: 275
diff changeset
   420
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   421
origin
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   422
    ^ leftFraction asFloat @ topFraction asFloat
77
claus
parents:
diff changeset
   423
! !
100
claus
parents: 96
diff changeset
   424
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   425
!LayoutOrigin class methodsFor:'documentation'!
100
claus
parents: 96
diff changeset
   426
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   427
version
3794
a7ac172485be #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   428
    ^ '$Header$'
3331
443356a56b2f class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3330
diff changeset
   429
!
443356a56b2f class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3330
diff changeset
   430
443356a56b2f class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3330
diff changeset
   431
version_CVS
3794
a7ac172485be #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   432
    ^ '$Header$'
100
claus
parents: 96
diff changeset
   433
! !
3330
f7b69891827b class: LayoutOrigin
Claus Gittinger <cg@exept.de>
parents: 3016
diff changeset
   434