ObjectView.st
author Claus Gittinger <cg@exept.de>
Thu, 25 Mar 1999 15:33:52 +0100
changeset 1820 4069e1ed5d3f
parent 1752 f1e400f163ad
child 1824 03630b3be319
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
5
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
     3
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
121
claus
parents: 119
diff changeset
    13
View subclass:#ObjectView
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    14
	instanceVariableNames:'contents sorted lastButt pressAction releaseAction
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    15
		shiftPressAction doublePressAction motionAction keyPressAction
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    16
		selection gridShown gridPixmap scaleMetric dragObject
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    17
		leftHandCursor oldCursor movedObject moveStartPoint moveDelta
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    18
		documentFormat canDragOutOfView rootMotion rootView aligning
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    19
		gridAlign aligningMove'
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    20
	classVariableNames:''
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    21
	poolDictionaries:''
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    22
	category:'Views-Basic'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    23
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    24
961
1b65b39c5079 aligningMove was undefined.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
    25
!ObjectView class methodsFor:'documentation'!
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    26
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    27
copyright
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    28
"
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    29
 COPYRIGHT (c) 1989 by Claus Gittinger
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    30
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    31
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    32
 This software is furnished under a license and may be used
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    33
 only in accordance with the terms of that license and with the
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    35
 be provided or otherwise made available to, or used by, any
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    36
 other person.  No title to or ownership of the software is
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    37
 hereby transferred.
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    38
"
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    39
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    40
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    41
documentation
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    42
"
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    43
    a View which can hold DisplayObjects, can make selections, move them around etc.
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    44
    this is an abstract class providing common mechanisms - actual instances are
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    45
    DrawView, DirectoryView, LogicView or DocumentView.
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    46
584
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    47
    [Instance variables:]
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    48
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    49
        contents        <Collection>            the objects. The order in which
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    50
                                                these are in that collection defines
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    51
                                                their appearance in the z-plane:
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    52
                                                an object located after another one
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    53
                                                here will be drawn ABOVE the other.
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    54
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    55
        sorted          <Boolean>               if set, redraw and picking methods
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    56
                                                assume that the objects are sorted by 
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    57
                                                >= y-coordinates. These operations are
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    58
                                                a bit faster then, since a binary search
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    59
                                                can be done. (use with care).
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    60
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    61
        lastButt        <Point>                 last pointer press position
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    62
                                                (internal)
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    63
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    64
        pressAction     <Block>                 action to perform when mouse pointer
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    65
                                                is pressed. Can be set to something like
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    66
                                                [self startCreate], [self startSelectOrMove]
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    67
                                                etc.
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    68
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    69
        releaseAction   <Block>                 action to perform when mouse pointer is
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    70
                                                released. Typically set in one of the
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    71
                                                startXXX methods.
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    72
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    73
        shiftPressAction        <Block>         like pressAction, if shift key is
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    74
                                                pressed.
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    75
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    76
        doublePressAction       <Block>         same for double-clicks
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    77
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    78
        motionAction            <Block>         action to perform on mouse-pointer
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    79
                                                motion.
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    80
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    81
        keyPressAction          <Block>         action for keyboard events
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    82
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    83
        selection               <any>           the current selection; either a single
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    84
                                                object or a collection of objects.
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    85
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    86
        gridShown               <Boolean>       internal
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    87
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    88
        gridPixmap              <Form>          internal
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    89
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    90
        scaleMetric             <Symbol>        either #mm or #inch; used to
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    91
                                                decide how the grid is defined
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    92
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    93
        dragObject                              internal
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    94
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    95
        leftHandCursor                          cursor shown while dragging a rectangle
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    96
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    97
        oldCursor                               saved original cursor while dragging a rectangle
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    98
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
    99
        movedObject                             internal
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   100
        moveStartPoint                          internal
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   101
        moveDelta                               internal
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   102
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   103
        documentFormat          <Symbol>        defines the size and layout of the
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   104
                                                document. Can be any of
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   105
                                                #letter, #a4, #a3 etc.
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   106
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   107
        canDragOutOfView        <Boolean>       if true, objects can be dragged out of the
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   108
                                                view. If false, dragging is restricted to within
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   109
                                                this view.
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   110
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   111
        rootMotion                              internal
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   112
        rootView                                internal
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   113
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   114
        aligning                <Boolean>       if true, pointer positions are
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   115
                                                aligned (snapped) to the point
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   116
                                                specified in gridAlign
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   117
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   118
        gridAlign               <Point>         if aligning is true, this point
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   119
                                                defines the snapping. For example,
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   120
                                                12@12 defines snap to the nearest
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   121
                                                12-point grid.
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   122
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   123
    written spring/summer 89 by claus
584
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   124
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   125
    [author:]
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   126
        Claus Gittinger
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   127
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   128
    [see also:]
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   129
        DrawTool LogicTool
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   130
        DrawObject
e3b11115fc18 documentation
Claus Gittinger <cg@exept.de>
parents: 531
diff changeset
   131
        DisplayObject
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   132
"
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   133
!
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   134
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   135
examples
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   136
"
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   137
    typically, ObjectViews are not used on their own, but instead
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   138
    subclassed and thereby provide the common functionality for
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   139
    views which show (possibly overlapping) objects.
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   140
    The methods here provide all mechanisms to handle redraws, picking
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   141
    (i.e. finding an object by position), gridding, moving objects with
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   142
    minimum redraw etc.
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   143
    Also, zooming and scrolling is handled.
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   144
    All objects which respond to the DisplayObject protocol can be handled
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   145
    by ObjectView - therefore, you can add almost any object and have it
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   146
    displayed and handled here. (as an example, try to copy a LogicGate
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   147
    from a LogicView and paste it into a DrawTool - it will work).
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   148
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   149
    Reminder: ObjectViews are not to be used as below, but instead to be
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   150
    subclassed. Therefore, the examples below are somewhat untypical.
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   151
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   152
    simple example:
592
ace25772463d examples
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   153
                                                                        [exBegin]
531
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   154
        |v o|
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   155
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   156
        v := ObjectView new.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   157
        v extent:200@200.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   158
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   159
        o := DrawRectangle new.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   160
        o origin:10@10 corner:100@100.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   161
        v add:o.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   162
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   163
        o := DrawText new.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   164
        o text:'hello there'; origin:50@50; foreground:Color red.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   165
        v add:o.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   166
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   167
        v open
592
ace25772463d examples
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   168
                                                                        [exEnd]
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   169
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   170
    add scrolling:
592
ace25772463d examples
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   171
                                                                        [exBegin]
531
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   172
        |v top o|
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   173
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   174
        top := HVScrollableView for:ObjectView.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   175
        top extent:200@200.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   176
        v := top scrolledView.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   177
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   178
        o := DrawRectangle new.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   179
        o origin:10@10 corner:100@100.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   180
        v add:o.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   181
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   182
        o := DrawText new.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   183
        o text:'hello there'; origin:50@50; foreground:Color red.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   184
        v add:o.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   185
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   186
        top open
592
ace25772463d examples
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   187
                                                                        [exEnd]
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   188
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   189
    or, using miniscrollers:
592
ace25772463d examples
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   190
                                                                        [exBegin]
531
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   191
        |v top o|
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   192
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   193
        top := HVScrollableView for:ObjectView 
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   194
                                miniScrollerH:true miniScrollerV:true.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   195
        top extent:200@200.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   196
        v := top scrolledView.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   197
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   198
        o := DrawRectangle new.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   199
        o origin:10@10 corner:100@100.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   200
        v add:o.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   201
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   202
        o := DrawText new.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   203
        o text:'hello there'; origin:50@50; foreground:Color red.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   204
        v add:o.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   205
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   206
        top open
592
ace25772463d examples
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   207
                                                                        [exEnd]
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   208
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   209
    grid:
592
ace25772463d examples
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   210
                                                                        [exBegin]
531
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   211
        |v top o|
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   212
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   213
        top := HVScrollableView for:ObjectView 
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   214
                                miniScrollerH:true miniScrollerV:true.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   215
        top extent:200@200.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   216
        v := top scrolledView.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   217
        v showGrid.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   218
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   219
        o := DrawRectangle new.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   220
        o origin:10@10 corner:100@100.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   221
        v add:o.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   222
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   223
        o := DrawText new.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   224
        o text:'hello there'; origin:50@50; foreground:Color red.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   225
        v add:o.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   226
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   227
        top open
592
ace25772463d examples
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   228
                                                                        [exEnd]
531
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   229
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   230
    zoom:
592
ace25772463d examples
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   231
                                                                        [exBegin]
531
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   232
        |v top o|
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   233
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   234
        top := HVScrollableView for:ObjectView 
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   235
                                miniScrollerH:true miniScrollerV:true.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   236
        top extent:200@200.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   237
        v := top scrolledView.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   238
        v showGrid.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   239
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   240
        o := DrawRectangle new.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   241
        o origin:10@10 corner:100@100.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   242
        v add:o.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   243
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   244
        o := DrawText new.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   245
        o text:'hello there'; origin:50@50; foreground:Color red.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   246
        v add:o.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   247
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   248
        top open.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   249
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   250
        Delay waitForSeconds:5.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   251
        v zoom:2.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   252
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   253
        Delay waitForSeconds:5.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   254
        v zoom:0.35.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   255
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   256
        Delay waitForSeconds:5.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   257
        v zoom:1.
592
ace25772463d examples
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   258
                                                                        [exEnd]
531
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   259
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   260
   private benchmark: display 10000 objects ...
592
ace25772463d examples
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   261
                                                                        [exBegin]
531
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   262
        |v top o rnd|
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   263
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   264
        top := HVScrollableView for:ObjectView 
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   265
                                miniScrollerH:true miniScrollerV:true.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   266
        top extent:200@200.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   267
        v := top scrolledView.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   268
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   269
        rnd := Random new.
1164
5cf2b5fcb5f1 example
Claus Gittinger <cg@exept.de>
parents: 1002
diff changeset
   270
        10000 timesRepeat:[
531
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   271
            o := DrawLine new.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   272
            o origin:(rnd nextIntegerBetween:0 and:700) @ (rnd nextIntegerBetween:0 and:700)
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   273
              corner:(rnd nextIntegerBetween:0 and:700) @ (rnd nextIntegerBetween:0 and:700).
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   274
            v add:o.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   275
        ].
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   276
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   277
        top openAndWait.
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   278
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 619
diff changeset
   279
        Transcript showCR:(
531
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   280
            Time millisecondsToRun:[
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   281
                v redraw              
a2ceb2c8e853 commentary
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   282
            ])
592
ace25772463d examples
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   283
                                                                        [exEnd]
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   284
"
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   285
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   286
961
1b65b39c5079 aligningMove was undefined.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   287
!ObjectView class methodsFor:'defaults'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   288
1752
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
   289
handleSize
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
   290
    "size of blob drawn for handles"
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
   291
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
   292
    ^ (Display horizontalPixelPerMillimeter * 1.2) rounded asInteger
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
   293
!
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
   294
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   295
hitDelta
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   296
    "when clicking an object, allow for hitDelta pixels around object;
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   297
     0 is exact; 1*pixelPerMillimeter is good for draw programs"
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   298
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   299
    ^ 0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   300
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   301
996
c4d8f29f3567 *** empty log message ***
ca
parents: 984
diff changeset
   302
!ObjectView methodsFor:'accessing'!
c4d8f29f3567 *** empty log message ***
ca
parents: 984
diff changeset
   303
c4d8f29f3567 *** empty log message ***
ca
parents: 984
diff changeset
   304
gridShown
c4d8f29f3567 *** empty log message ***
ca
parents: 984
diff changeset
   305
    ^ gridShown
c4d8f29f3567 *** empty log message ***
ca
parents: 984
diff changeset
   306
! !
c4d8f29f3567 *** empty log message ***
ca
parents: 984
diff changeset
   307
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   308
!ObjectView methodsFor:'adding / removing'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   309
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   310
add:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   311
    "add something, anObject or a collection of objects to the contents
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   312
     with redraw"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   313
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   314
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   315
	self addObject:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   316
    ]
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   317
!
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   318
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   319
addObject:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   320
    "add the argument, anObject to the contents - with redraw"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   321
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   322
    anObject notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   323
	contents addLast:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   324
	"its on top - only draw this one"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   325
	shown "realized" ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   326
	    self showUnselected:anObject
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   327
	]
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   328
    ]
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   329
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   330
1741
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   331
addObjectFirst:anObject
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   332
    "add the argument, anObject to the beginning of the contents - with redraw"
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   333
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   334
    anObject notNil ifTrue:[
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   335
        contents addFirst:anObject.
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   336
        "its on top - only draw this one"
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   337
        shown "realized" ifTrue:[
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   338
            self showUnselected:anObject
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   339
        ]
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   340
    ]
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   341
!
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   342
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   343
addObjectFirstWithoutRedraw:anObject
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   344
    "add the argument, anObject to the start of the contents - no redraw"
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   345
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   346
    anObject notNil ifTrue:[
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   347
        contents addFirst:anObject
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   348
    ]
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   349
!
082f3849e5af + #addObjectFirst:
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   350
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   351
addObjectWithoutRedraw:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   352
    "add the argument, anObject to the contents - no redraw"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   353
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   354
    anObject notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   355
	contents addLast:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   356
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   357
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   358
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   359
addSelected:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   360
    "add something, anObject or a collection of objects to the contents
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   361
     and select it"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   362
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   363
    self add:something.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   364
    self select:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   365
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   366
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   367
addWithoutRedraw:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   368
    "add something, anObject or a collection of objects to the contents
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   369
     do not redraw"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   370
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   371
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   372
	self addObjectWithoutRedraw:anObject
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   373
    ]
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   374
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   375
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   376
remove:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   377
    "remove something, anObject or a collection of objects from the contents
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   378
     do redraw"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   379
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   380
    something size > (contents size / 4) ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   381
        "
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   382
         better to remove first, then redraw rest
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   383
        "
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   384
        self forEach:something do:[:anObject |
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   385
            self removeFromSelection:anObject.
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   386
            contents remove:anObject.
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   387
        ].
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   388
        self invalidate.
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   389
        ^ self
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   390
    ].
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   391
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   392
    self forEach:something do:[:anObject |
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   393
        self removeObject:anObject
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   394
    ]
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   395
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   396
    "Modified: 29.5.1996 / 16:20:24 / cg"
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   397
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   398
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   399
removeAll
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   400
    "remove all - redraw"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   401
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   402
    self removeAllWithoutRedraw.
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   403
    self invalidate
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   404
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
   405
    "Modified: 29.5.1996 / 16:20:28 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   406
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   407
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   408
removeAllWithoutRedraw
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   409
    "remove all - no redraw"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   410
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   411
    selection := nil.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   412
    contents := OrderedCollection new
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   413
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   414
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   415
removeObject:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   416
    "remove the argument, anObject from the contents - no redraw"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   417
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   418
    anObject notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   419
	self removeFromSelection:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   420
	contents remove:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   421
	shown "realized" ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   422
	    self redrawObjectsIn:(anObject frame)
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   423
	]
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   424
    ]
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   425
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   426
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   427
removeObjectWithoutRedraw:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   428
    "remove the argument, anObject from the contents - no redraw"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   429
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   430
    anObject notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   431
	self removeFromSelection:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   432
	contents remove:anObject
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   433
    ]
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   434
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   435
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   436
removeWithoutRedraw:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   437
    "remove something, anObject or a collection of objects from the contents
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   438
     do not redraw"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   439
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   440
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   441
	self removeObjectWithoutRedraw:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   442
    ]
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   443
! !
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   444
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   445
!ObjectView methodsFor:'cut & paste '!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   446
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   447
convertForPaste:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   448
    "return a converted version of anObject to be pasted, or nil if
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   449
     the object is not compatible with me.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   450
     Return nil here; concrete subclasses should try to convert.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   451
     Notice: anObject may be a collection of to-be-pasted objects."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   452
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   453
    "in concrete subclasses, you can use:"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   454
"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   455
    |s|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   456
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   457
    (anObject respondsTo:#asDisplayObject) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   458
	^ anObject asDisplayObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   459
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   460
    (anObject isString or:[anObject isMemberOf:Text]) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   461
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   462
    anObject size > 0 ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   463
	(anObject inject:true into:[:okSoFar :element |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   464
	    okSoFar and:[element respondsTo:#asDisplayObject]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   465
	]) ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   466
	    self warn:'selection not convertable to DisplayObject'.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   467
	    ^ nil
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   468
	].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   469
	^ anObject collect:[:element | element asDisplayObject].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   470
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   471
"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   472
    ^ nil.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   473
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   474
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   475
copySelection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   476
    "copy the selection into the cut&paste-buffer"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   477
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   478
    |tmp|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   479
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   480
    tmp := OrderedCollection new.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   481
    self selectionDo:[:object |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   482
	tmp add:(object copy)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   483
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   484
"/    self forEach:tmp do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   485
"/        anObject moveTo:(anObject origin + (8 @ 8))
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   486
"/    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   487
    self setSelection:tmp
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   488
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   489
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   490
deleteSelection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   491
    "delete the selection into the cut&paste buffer"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   492
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   493
    |tmp|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   494
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   495
    tmp := selection.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   496
    self unselect.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   497
    self remove:tmp.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   498
    self setSelection:tmp
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   499
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   500
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   501
paste:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   502
    "add the objects in the cut&paste-buffer"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   503
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   504
    |s|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   505
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   506
    s := self convertForPaste:something .
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   507
    s isNil ifTrue:[
1186
56b5d99d0265 checkin from browser
ah
parents: 1164
diff changeset
   508
        self warn:'selection not convertable'.
56b5d99d0265 checkin from browser
ah
parents: 1164
diff changeset
   509
        ^ self
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   510
    ].
1186
56b5d99d0265 checkin from browser
ah
parents: 1164
diff changeset
   511
    self unselect.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   512
    self addSelected:s 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   513
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   514
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   515
pasteBuffer
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   516
    "add the objects in the paste-buffer"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   517
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   518
    |sel|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   519
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   520
    sel := self getSelection.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   521
    (device getSelectionOwnerOf:(device atomIDOf:'PRIMARY')) == drawableId
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   522
    ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   523
	"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   524
	 a local selection - paste with some offset
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   525
	"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   526
	sel size > 0 ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   527
	    sel := sel collect:[:element |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   528
		element copy moveTo:(element origin + (8 @ 8))
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   529
	    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   530
	] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   531
	    sel := sel copy moveTo:(sel origin + (8 @ 8))
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   532
	]
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   533
    ].
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   534
    self paste:sel
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   535
! !
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   536
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   537
!ObjectView methodsFor:'dragging line'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   538
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   539
doLineDrag:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   540
    "do drag a line"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   541
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   542
    self invertDragLine.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   543
    dragObject corner:aPoint.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   544
    self invertDragLine.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   545
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   546
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   547
endLineDrag
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   548
    "cleanup after line drag; select them. Find the origin and destination
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   549
     views and relative offsets, then dispatch to one of the endLineDrag methods.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   550
     These can be redefined in subclasses to allow connect between views."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   551
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   552
    |rootPoint viewId offs 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   553
     lastViewId destinationId destinationView destinationPoint inMySelf|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   554
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   555
    self invertDragLine.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   556
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   557
    self cursor:oldCursor.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   558
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   559
    "check if line drag is into another view"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   560
    rootMotion ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   561
	rootPoint := lastButt.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   562
	"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   563
	 get device coordinates
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   564
	"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   565
	transformation notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   566
	    rootPoint := transformation applyTo:rootPoint.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   567
	].
696
584d66ed8305 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   568
	viewId := rootView id.
584d66ed8305 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   569
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   570
	"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   571
	 translate to screen
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   572
	"
696
584d66ed8305 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   573
	offs := device translatePoint:0@0 from:(self id) to:viewId.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   574
	rootPoint := rootPoint + offs.
696
584d66ed8305 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   575
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   576
	"search view the drop is in"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   577
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   578
	[viewId notNil] whileTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   579
	    destinationId := device viewIdFromPoint:rootPoint in:viewId.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   580
	    lastViewId := viewId.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   581
	    viewId := destinationId
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   582
	].
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   583
	destinationView := device viewFromId:lastViewId.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   584
	destinationId := lastViewId.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   585
	inMySelf := (destinationView == self).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   586
	rootMotion := false
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   587
    ] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   588
	inMySelf := true
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   589
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   590
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   591
    inMySelf ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   592
	"a simple line within myself"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   593
	self lineDragFrom:dragObject origin to:dragObject corner
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   594
    ] ifFalse:[
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   595
	"into another one"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   596
	destinationView notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   597
	    destinationPoint := device translatePoint:rootPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   598
						 from:(rootView id) 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   599
						   to:(destinationView id).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   600
	    destinationView transformation notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   601
		destinationPoint := destinationView transformation applyInverseTo:destinationPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   602
	    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   603
	    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   604
	     move into another smalltalk view
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   605
	    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   606
	    self lineDragFrom:dragObject origin to:destinationPoint in:destinationView
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   607
	] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   608
	    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   609
	     not one of my views
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   610
	    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   611
	    self lineDragFrom:dragObject origin
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   612
			   to:destinationPoint 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   613
			   inAlienViewId:destinationId
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   614
	] 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   615
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   616
    self setDefaultActions.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   617
    dragObject := nil
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   618
!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   619
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   620
invertDragLine
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   621
    "helper for line dragging - invert the dragged line.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   622
     Extracted for easier redefinition in subclasses
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   623
     (different line width etc.)"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   624
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   625
    |dragger offs p1 p2|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   626
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   627
    p1 := dragObject origin.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   628
    p2 := dragObject corner.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   629
    rootMotion ifTrue:[
262
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   630
        dragger := rootView.
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   631
        "
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   632
         get device coordinates
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   633
        "
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   634
        transformation notNil ifTrue:[
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   635
            p1 := transformation applyTo:p1.
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   636
            p2 := transformation applyTo:p2.
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   637
        ].
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   638
        "
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   639
         translate to screen
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   640
        "
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   641
        offs := device translatePoint:0@0 from:(self id) to:(rootView id).
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   642
        p1 := p1 + offs.
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   643
        p2 := p2 + offs.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   644
    ] ifFalse:[
262
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   645
        dragger := self.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   646
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   647
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   648
    dragger xoring:[
262
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   649
        dragger lineWidth:0. 
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   650
        dragger displayLineFrom:p1 to:p2.
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   651
        dragger flush
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   652
    ].
262
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   653
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   654
    "Modified: 16.12.1995 / 17:32:56 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   655
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   656
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   657
lineDragFrom:startPoint to:endPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   658
    "this is called after a line-drag. Nothing is done here.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   659
     - should be redefined in subclasses"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   660
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   661
    ^ self
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   662
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   663
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   664
lineDragFrom:startPoint to:endPoint in:destinationView
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   665
    "this is called after a line-drag crossing view boundaries.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   666
     - should be redefined in subclasses"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   667
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   668
    ^ self notify:'dont know how to connect to external views'
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   669
!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   670
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   671
lineDragFrom:startPoint to:endPoint inAlienViewId:destinationId
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   672
    "this is called after a line-drag with rootmotion set
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   673
     to true, IFF the endpoint is in an alien view
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   674
     - should be redefined in subclasses"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   675
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   676
    self notify:'cannot connect object in alien view'
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   677
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   678
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   679
setLineDragActions
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   680
    "setup to drag a line. Call this (for example) from your buttonPress
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   681
     method, to make the view start to drag a line.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   682
     See startLineDrag and startRootLineDrag."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   683
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   684
    motionAction := [:movePoint | self doLineDrag:movePoint].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   685
    releaseAction := [self endLineDrag]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   686
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   687
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   688
startLineDrag:startPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   689
    "start a line drag within the view"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   690
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   691
    self setLineDragActions.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   692
    dragObject := Rectangle origin:startPoint corner:startPoint.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   693
    self invertDragLine.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   694
    oldCursor := cursor.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   695
    self cursor:leftHandCursor
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   696
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   697
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   698
startRootLineDrag:startPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   699
    "start a line drag possibly crossing my view boundaries"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   700
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   701
    self setLineDragActions.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   702
    rootMotion := true.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   703
    dragObject := Rectangle origin:startPoint corner:startPoint.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   704
    self invertDragLine.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   705
    oldCursor := cursor.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   706
    self cursor:leftHandCursor
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   707
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   708
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   709
!ObjectView methodsFor:'dragging object move'!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   710
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   711
doObjectMove:aPoint
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   712
    "do an object move - this is called for every motion
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   713
     when moving objects."
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   714
102
f600526404e6 *** empty log message ***
claus
parents: 95
diff changeset
   715
    |d org nOrg|
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   716
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   717
    movedObject isNil ifTrue:[
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   718
	movedObject := selection.
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   719
	"
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   720
	 draw first outline
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   721
	"
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   722
	movedObject notNil ifTrue:[
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   723
	    moveDelta := 0@0.
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   724
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   725
	    "tricky, the moved object may not currently be aligned.
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   726
	     if so, simulate a frame move of the delta"
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   727
105
3d064ba4a0cc *** empty log message ***
claus
parents: 102
diff changeset
   728
	    aligningMove ifTrue:[
102
f600526404e6 *** empty log message ***
claus
parents: 95
diff changeset
   729
		org := movedObject origin.
f600526404e6 *** empty log message ***
claus
parents: 95
diff changeset
   730
		d := org - (self alignToGrid:(org)).
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   731
		moveDelta := d negated.
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   732
	    ].
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   733
	    self invertDragObject:movedObject delta:moveDelta    
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   734
	]
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   735
    ].
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   736
    movedObject notNil ifTrue:[
83
ea4c971c3423 fix drop
claus
parents: 77
diff changeset
   737
	d := aPoint - moveStartPoint.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 102
diff changeset
   738
	aligningMove ifTrue:[
102
f600526404e6 *** empty log message ***
claus
parents: 95
diff changeset
   739
	    org := movedObject origin.
f600526404e6 *** empty log message ***
claus
parents: 95
diff changeset
   740
	    nOrg := org + d.
f600526404e6 *** empty log message ***
claus
parents: 95
diff changeset
   741
	    d :=  (self alignToGrid:(nOrg)) - org.
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   742
	].
83
ea4c971c3423 fix drop
claus
parents: 77
diff changeset
   743
	d ~= moveDelta ifTrue:[
ea4c971c3423 fix drop
claus
parents: 77
diff changeset
   744
	    "
ea4c971c3423 fix drop
claus
parents: 77
diff changeset
   745
	     clear prev outline,
ea4c971c3423 fix drop
claus
parents: 77
diff changeset
   746
	     draw new outline
ea4c971c3423 fix drop
claus
parents: 77
diff changeset
   747
	    "
ea4c971c3423 fix drop
claus
parents: 77
diff changeset
   748
	    self invertDragObject:movedObject delta:moveDelta.    
ea4c971c3423 fix drop
claus
parents: 77
diff changeset
   749
	    moveDelta :=  d.
ea4c971c3423 fix drop
claus
parents: 77
diff changeset
   750
	    self invertDragObject:movedObject delta:moveDelta    
ea4c971c3423 fix drop
claus
parents: 77
diff changeset
   751
	]
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   752
    ]
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   753
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   754
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   755
endObjectMove
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   756
    "cleanup after object move - called when the object move ends.
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   757
     Find the destination view and position and dispatch to
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   758
     one of the moveObjectXXX-methods which should do the real move. 
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   759
     These can be redefined in subclasses."
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   760
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   761
    |inMySelf rootPoint destinationPoint p
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   762
     viewId destinationView destinationId lastViewId|
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   763
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   764
    movedObject notNil ifTrue:[
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   765
	self invertDragObject:movedObject delta:moveDelta.    
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   766
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   767
	"check if object is to be put into another view"
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   768
	rootMotion ifTrue:[
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   769
	    p := lastButt.
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   770
	    "
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   771
	     get device coordinates
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   772
	    "
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   773
	    transformation notNil ifTrue:[
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   774
		p := transformation applyTo:p.
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   775
	    ].
696
584d66ed8305 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   776
	    viewId := rootView id.
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   777
	    "
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   778
	     translate to screen
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   779
	    "
696
584d66ed8305 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   780
	    rootPoint := p + (device translatePoint:0@0 from:(self id) to:viewId).
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   781
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   782
	    "search view the drop is in"
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   783
	    [viewId notNil] whileTrue:[
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   784
		destinationId := device viewIdFromPoint:rootPoint in:viewId.
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   785
		lastViewId := viewId.
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   786
		viewId := destinationId
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   787
	    ].
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   788
	    destinationView := device viewFromId:lastViewId.
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   789
	    destinationId := lastViewId.
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   790
	    inMySelf := (destinationView == self).
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   791
	    rootMotion := false
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   792
	] ifFalse:[
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   793
	    inMySelf := true
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   794
	].
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   795
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   796
	inMySelf ifTrue:[
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   797
	    "simple move"
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   798
	    self move:movedObject by:moveDelta
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   799
	] ifFalse:[
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   800
	    destinationPoint := device translatePoint:rootPoint
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   801
						 from:(rootView id) 
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   802
						   to:destinationId.
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   803
	    destinationView notNil ifTrue:[
83
ea4c971c3423 fix drop
claus
parents: 77
diff changeset
   804
		destinationView transformation notNil ifTrue:[
ea4c971c3423 fix drop
claus
parents: 77
diff changeset
   805
		    destinationPoint := destinationView transformation applyInverseTo:destinationPoint
ea4c971c3423 fix drop
claus
parents: 77
diff changeset
   806
		].
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   807
		"
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   808
		 move into another smalltalk view
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   809
		"
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   810
		self move:movedObject to:destinationPoint in:destinationView
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   811
	    ] ifFalse:[
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   812
		"
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   813
		 not one of my views
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   814
		"
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   815
		self move:movedObject to:destinationPoint inAlienViewId:destinationId
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   816
	    ] 
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   817
	].
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   818
	self setDefaultActions.
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   819
	movedObject := nil
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   820
    ]
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   821
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   822
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   823
invertDragObject:movedObject delta:moveDelta
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   824
    "draw inverting for an object move"
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   825
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   826
    |dragger offs p d scale oldTrans|
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   827
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   828
    rootMotion ifTrue:[
262
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   829
        p := movedObject origin + moveDelta.
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   830
        dragger := rootView.
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   831
        "
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   832
         get device coordinates
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   833
        "
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   834
"/ 'logical ' print. p printNL.
262
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   835
        transformation notNil ifTrue:[
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   836
            scale := transformation scale.
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   837
            p := transformation applyTo:p.
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   838
"/ 'device ' print. p printNL.
262
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   839
        ].
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   840
        "
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   841
         translate to screen
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   842
        "
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   843
        offs := device translatePoint:0@0 from:(self id) to:(rootView id).
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   844
"/ 'offs' print. offs printNL.
262
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   845
        p := p + offs.
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   846
"/ 'screen ' print. p printNL.
262
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   847
        "
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   848
         p is where we want it ...
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   849
         have to adust slightly, since showDragging shows the object
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   850
         at its origin plus some offset; here we want it to be drawn
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   851
         at absolute p.
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   852
         To do so, we set the draggers translation to p and
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   853
         draw the object scaled at 0@0 (by setting offset to its negative org)
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   854
        "
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   855
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   856
        oldTrans := dragger transformation.
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   857
        dragger transformation:(WindowingTransformation 
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   858
                                        scale:scale
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   859
                                        translation:p).
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   860
        d := movedObject origin negated.
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   861
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   862
        dragger xoring:[
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   863
            self showDragging:movedObject offset:d.
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   864
        ].
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   865
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   866
        dragger transformation:oldTrans.
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   867
        dragger flush.
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   868
    ] ifFalse:[
262
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   869
        self xoring:[
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   870
            self showDragging:movedObject offset:moveDelta.
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   871
        ].
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   872
        self flush
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
   873
    ].
262
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   874
d2c946b6a5b4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 256
diff changeset
   875
    "Modified: 16.12.1995 / 17:33:04 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   876
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   877
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   878
setMoveActions
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   879
    "setup to drag an object. Call this (for example) from your buttonPress
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   880
     method, to make the view start to drag some object.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   881
     See startObjectMove and startRootObjectMove."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   882
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   883
    motionAction := [:movePoint | self doObjectMove:movePoint].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   884
    releaseAction := [self endObjectMove]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   885
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   886
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   887
startObjectMove:something at:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   888
    "start an object move"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   889
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   890
    self startObjectMove:something at:aPoint inRoot:canDragOutOfView 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   891
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   892
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   893
startObjectMove:something at:aPoint inRoot:inRoot
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   894
    "start an object move; if inRoot is true, view
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   895
     boundaries may be crossed."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   896
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   897
    something notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   898
	self select:something.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   899
	(self canMove:something) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   900
	    self setMoveActions.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   901
	    moveStartPoint := aPoint.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   902
	    rootMotion := inRoot.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   903
	] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   904
	    self setDefaultActions
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   905
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   906
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   907
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   908
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   909
startRootObjectMove:something at:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   910
    "start an object move, possibly crossing view boundaries"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   911
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   912
    self startObjectMove:something at:aPoint inRoot:true 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   913
! !
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   914
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   915
!ObjectView methodsFor:'dragging rectangle'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   916
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   917
doRectangleDrag:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   918
    "do drag a rectangle"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   919
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   920
    self invertDragRectangle.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   921
    dragObject corner:aPoint.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   922
    self invertDragRectangle.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   923
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   924
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   925
endRectangleDrag
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   926
    "cleanup after rectangle drag; select them"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   927
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   928
    self invertDragRectangle.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   929
    self cursor:oldCursor.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   930
    self selectAllIn:dragObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   931
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   932
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   933
invertDragRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   934
    "helper for rectangle drag - invert the dragRectangle.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   935
     Extracted into a separate method to allow easier redefinition
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   936
     (different lineWidth etc)"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   937
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
   938
    self xoring:[
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
   939
        self lineWidth:0. 
743
c2aafc876d49 dashed rectangle drag does not work on some Xservers
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
   940
"/        self lineStyle:#dashed.
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
   941
        self displayRectangle:dragObject.
743
c2aafc876d49 dashed rectangle drag does not work on some Xservers
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
   942
"/        self lineStyle:#solid.
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
   943
    ].
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
   944
743
c2aafc876d49 dashed rectangle drag does not work on some Xservers
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
   945
    "Modified: 3.6.1996 / 10:02:22 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   946
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   947
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   948
setRectangleDragActions
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   949
    "setup to drag a rectangle. Call this (for example) from your buttonPress
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   950
     method, to make the view start the drag.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   951
     See startRectangleDrag:."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   952
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   953
    motionAction := [:movePoint | self doRectangleDrag:movePoint].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   954
    releaseAction := [self endRectangleDrag]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   955
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   956
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   957
startRectangleDrag:startPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   958
    "start a rectangle drag"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   959
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   960
    self setRectangleDragActions.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   961
    dragObject := Rectangle origin:startPoint corner:startPoint.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   962
    self invertDragRectangle.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   963
    oldCursor := cursor.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   964
    self cursor:leftHandCursor
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   965
! !
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   966
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   967
!ObjectView methodsFor:'drawing'!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   968
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   969
redraw
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   970
    "redraw complete View"
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   971
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   972
    shown ifTrue:[
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   973
	self clear.
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   974
	self redrawObjects
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   975
    ]
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   976
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   977
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   978
redrawObjects
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   979
    "redraw all objects"
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   980
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   981
    self redrawObjectsOn:self
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   982
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   983
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   984
redrawObjectsAbove:anObject in:aRectangle
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   985
    "redraw all objects which have part of themselfes in aRectangle
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   986
     and are above (in front of) anObject.
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   987
     draw only in (i.e. clip output to) aRectangle"
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   988
700
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   989
    |vis oldClip|
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   990
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
   991
    shown ifTrue:[
700
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   992
        vis := aRectangle.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   993
        clipRect notNil ifTrue:[
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   994
            vis := vis intersect:clipRect
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   995
        ].
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   996
        oldClip := clipRect.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   997
        self clippingRectangle:vis.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   998
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   999
        self redrawObjectsAbove:anObject intersecting:vis.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1000
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1001
        self clippingRectangle:oldClip
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1002
    ]
700
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1003
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1004
    "Modified: 28.5.1996 / 19:57:06 / cg"
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1005
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1006
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1007
redrawObjectsAbove:anObject inVisible:aRectangle
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1008
    "redraw all objects which have part of themselfes in a vis rectangle
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1009
     and are above (in front of) anObject.
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1010
     draw only in (i.e. clip output to) aRectangle"
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1011
700
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1012
    |vis oldClip|
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1013
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1014
    shown ifTrue:[
700
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1015
        vis := aRectangle.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1016
        clipRect notNil ifTrue:[
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1017
            vis := vis intersect:clipRect
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1018
        ].
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1019
        oldClip := clipRect.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1020
        self clippingRectangle:vis.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1021
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1022
        self redrawObjectsAbove:anObject intersectingVisible:vis.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1023
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1024
        self clippingRectangle:oldClip
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1025
    ]
700
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1026
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1027
    "Modified: 28.5.1996 / 19:56:44 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1028
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1029
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1030
redrawObjectsAbove:anObject intersecting:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1031
    "redraw all objects which have part of themself in aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1032
     and are above (in front of) anObject"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1033
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1034
    self objectsAbove:anObject intersecting:aRectangle do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1035
	self show:theObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1036
    ]
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1037
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1038
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1039
redrawObjectsAbove:anObject intersectingVisible:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1040
    "redraw all objects which have part of themself in a vis rectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1041
     and are above (in front of) anObject"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1042
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1043
    self objectsAbove:anObject intersectingVisible:aRectangle do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1044
	self show:theObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1045
    ]
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1046
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1047
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1048
redrawObjectsIn:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1049
    "redraw all objects which have part of themselfes in aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1050
     draw only in (i.e. clip output to) aRectangle"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1051
700
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1052
    |visRect oldClip|
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1053
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1054
    shown ifTrue:[
700
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1055
        visRect := Rectangle origin:(aRectangle origin)
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1056
                             extent:(aRectangle extent).
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1057
"/        transformation notNil ifTrue:[
700
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1058
            visRect := visRect origin truncated
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1059
                       corner:(visRect corner + (1@1)) truncated.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1060
"/        ].
700
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1061
        clipRect notNil ifTrue:[
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1062
            visRect := visRect intersect:clipRect
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1063
        ].
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1064
        oldClip := clipRect.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1065
        self clippingRectangle:visRect.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1066
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1067
        self clearRectangle:visRect.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1068
        self redrawObjectsIntersecting:visRect.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1069
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1070
        self clippingRectangle:oldClip
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1071
    ]
700
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1072
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1073
    "Modified: 28.5.1996 / 19:56:20 / cg"
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1074
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1075
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1076
redrawObjectsInVisible:visRect
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1077
    "redraw all objects which have part of themselfes in a vis rectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1078
     draw only in (i.e. clip output to) aRectangle"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1079
700
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1080
    |vis oldClip|
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1081
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1082
    shown ifTrue:[
700
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1083
        vis := visRect.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1084
        clipRect notNil ifTrue:[
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1085
            vis := vis intersect:clipRect
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1086
        ].
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1087
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1088
        transformation notNil ifTrue:[
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1089
"/            transformation scale ~~ 1 ifTrue:[
700
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1090
                vis := vis origin truncated
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1091
                           corner:(vis corner + (1@1)) truncated.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1092
"/            ]
700
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1093
        ].
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1094
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1095
        oldClip := clipRect.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1096
        self clippingRectangle:vis.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1097
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1098
        self clearRectangle:vis.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1099
        self redrawObjectsIntersecting:vis.
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1100
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1101
        self clippingRectangle:oldClip
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1102
    ]
700
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1103
962bcd86ac8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
  1104
    "Modified: 28.5.1996 / 19:55:47 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1105
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1106
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1107
redrawObjectsIntersecting:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1108
    "redraw all objects which have part of themself in aRectangle"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1109
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1110
    self objectsIntersecting:aRectangle do:[:theObject |
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1111
	self show:theObject
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1112
    ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1113
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1114
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1115
redrawObjectsIntersectingVisible:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1116
    "redraw all objects which have part of themself in a vis rectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1117
     This is a leftOver from times when scrolling was not transparent.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1118
     Please use redrawObjectsIntersecting:, since this will vanish."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1119
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1120
    self redrawObjectsIntersecting:aRectangle
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1121
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1122
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1123
redrawObjectsOn:aGC
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1124
    "redraw all objects on a graphic context"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1125
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1126
    |vFrame|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1127
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1128
    (aGC == self) ifTrue:[
619
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1129
        shown ifFalse:[^ self].
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1130
        vFrame := Rectangle left:0 top:0 width:width height:height.
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1131
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1132
        transformation notNil ifTrue:[
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1133
            vFrame := transformation applyInverseTo:vFrame.
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1134
        ].
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1135
        self redrawObjectsIntersecting:vFrame
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1136
    ] ifFalse:[
619
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1137
        "should loop over pages"
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1138
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1139
        vFrame := Rectangle left:0 top:0 width:9999 height:9999.
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1140
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1141
        self objectsIntersecting:vFrame do:[:theObject |
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1142
            theObject drawIn:aGC
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1143
        ]
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1144
    ]
619
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1145
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1146
    "Modified: 8.5.1996 / 21:01:27 / cg"
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1147
!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1148
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1149
redrawScale
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1150
    "redraw the scales"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1151
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1152
    self redrawHorizontalScale.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1153
    self redrawVerticalScale
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1154
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1155
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1156
show:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1157
    "show the object, either selected or not"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1158
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1159
    (self isSelected:anObject) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1160
	self showSelected:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1161
    ] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1162
	self showUnselected:anObject
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1163
    ]
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1164
!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1165
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1166
showDragging:something offset:anOffset
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1167
    "show an object while dragging"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1168
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1169
    |drawer|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1170
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1171
    rootMotion ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1172
	"drag in root-window"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1173
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1174
	drawer := rootView
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1175
    ] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1176
	drawer := self
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1177
    ].
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1178
    self forEach:something do:[:anObject |
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1179
	anObject drawDragIn:drawer offset:anOffset
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1180
    ]
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1181
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1182
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1183
showSelected:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1184
    "show an object as selected"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1185
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1186
    anObject drawSelectedIn:self
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1187
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1188
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1189
showUnselected:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1190
    "show an object as unselected"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1191
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1192
    anObject drawIn:self
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1193
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1194
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1195
!ObjectView methodsFor:'event handling'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1196
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1197
buttonMotion:buttonMask x:buttX y:buttY
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1198
    "user moved mouse while button pressed"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1199
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1200
    |xpos ypos movePoint limitW limitH|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1201
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1202
    "is it the select or 1-button ?"
1622
50dd1ee1604a use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1203
    self sensor leftButtonPressed ifFalse:[^ self].
50dd1ee1604a use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1204
"/    (device buttonMotionMask:buttonMask includesButton:#select) ifFalse:[
50dd1ee1604a use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1205
"/        (device buttonMotionMask:buttonMask includesButton:1) ifFalse:[
50dd1ee1604a use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1206
"/            ^ self
50dd1ee1604a use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1207
"/        ].
50dd1ee1604a use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1208
"/    ].
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1209
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1210
    lastButt notNil ifTrue:[
732
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1211
        xpos := buttX.
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1212
        ypos := buttY.
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1213
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1214
        "check against visible limits if move outside is not allowed"
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1215
        rootMotion ifFalse:[
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1216
            limitW := width.
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1217
            limitH := height.
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1218
            transformation notNil ifTrue:[
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1219
                limitW := transformation applyInverseToX:width.
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1220
                limitH := transformation applyInverseToY:height.
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1221
            ].
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1222
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1223
            (xpos < 0) ifTrue:[                    
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1224
                xpos := 0
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1225
            ] ifFalse: [
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1226
                (xpos > limitW) ifTrue:[xpos := limitW]
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1227
            ].
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1228
            (ypos < 0) ifTrue:[                    
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1229
                ypos := 0
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1230
            ] ifFalse: [
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1231
                (ypos > limitH) ifTrue:[ypos := limitH]
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1232
            ]
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1233
        ].
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1234
        movePoint := xpos @ ypos.
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1235
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1236
        (xpos == (lastButt x)) ifTrue:[
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1237
            (ypos == (lastButt y)) ifTrue:[
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1238
                ^ self                          "no move"
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1239
            ]
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1240
        ].
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1241
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1242
        motionAction notNil ifTrue:[
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1243
            motionAction value:movePoint.
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1244
            lastButt := movePoint.
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1245
            ^ self
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1246
        ].
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1247
        lastButt := movePoint
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1248
    ].
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1249
    super buttonMotion:buttonMask x:buttX y:buttY
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1250
1622
50dd1ee1604a use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1251
    "Modified: / 28.7.1998 / 16:01:31 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1252
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1253
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1254
buttonMultiPress:button x:x y:y
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1255
    "user pressed left button twice (or more)"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1256
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1257
    ((button == 1) or:[button == #select]) ifTrue:[
732
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1258
        doublePressAction notNil ifTrue:[
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1259
            doublePressAction value:(x @ y).
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1260
            ^ self
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1261
        ]
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1262
    ].
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1263
    super buttonMultiPress:button x:x y:y
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1264
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1265
    "Modified: 30.5.1996 / 17:57:36 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1266
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1267
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1268
buttonPress:button x:x y:y
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1269
    "user pressed left button"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1270
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1271
    ((button == 1) or:[button == #select]) ifTrue:[
815
38082a0ff5c9 more on buttonShiftPress
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
  1272
        self sensor shiftDown ifTrue:[
38082a0ff5c9 more on buttonShiftPress
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
  1273
            ^ self buttonShiftPress:button x:x y:y
38082a0ff5c9 more on buttonShiftPress
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
  1274
        ].
38082a0ff5c9 more on buttonShiftPress
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
  1275
732
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1276
        pressAction notNil ifTrue:[
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1277
            lastButt := x @ y.
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1278
            pressAction value:lastButt.
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1279
            ^ self
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1280
        ]
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1281
    ].
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1282
    super buttonPress:button x:x y:y
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1283
815
38082a0ff5c9 more on buttonShiftPress
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
  1284
    "Modified: 1.8.1996 / 19:13:01 / cg"
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1285
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1286
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1287
buttonRelease:button x:x y:y
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1288
    ((button == 1) or:[button == #select]) ifTrue:[
732
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1289
        releaseAction notNil ifTrue:[
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1290
            releaseAction value.
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1291
            ^ self
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1292
        ]
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1293
    ].
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1294
    super buttonRelease:button x:x y:y
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1295
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1296
    "Modified: 30.5.1996 / 17:57:13 / cg"
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1297
!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1298
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1299
buttonShiftPress:button x:x y:y
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1300
    "user pressed left button with shift"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1301
815
38082a0ff5c9 more on buttonShiftPress
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
  1302
    shiftPressAction notNil ifTrue:[
38082a0ff5c9 more on buttonShiftPress
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
  1303
        lastButt := x @ y.
38082a0ff5c9 more on buttonShiftPress
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
  1304
        shiftPressAction value:lastButt.
38082a0ff5c9 more on buttonShiftPress
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
  1305
        ^ self
38082a0ff5c9 more on buttonShiftPress
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
  1306
    ]
38082a0ff5c9 more on buttonShiftPress
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
  1307
38082a0ff5c9 more on buttonShiftPress
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
  1308
    "Modified: 1.8.1996 / 19:13:19 / cg"
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1309
!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1310
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1311
keyPress:key x:x y:y
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1312
    keyPressAction notNil ifTrue:[
732
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1313
        selection notNil ifTrue:[
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1314
            self selectionDo: [:obj |
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1315
                obj keyInput:key .
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1316
            ]
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1317
        ].
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1318
        ^ self.
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1319
    ].
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1320
    super keyPress:key x:x y:y
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1321
1b1520ba6c56 perform default event actions, if no corresponding action was set (keyPress/release; buttonPress/release)
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1322
    "Modified: 30.5.1996 / 17:57:54 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1323
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1324
1820
4069e1ed5d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1325
pointerEnter:state x:x y:y
4069e1ed5d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1326
    "mouse pointer entered - request the keyboard focus"
4069e1ed5d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1327
4069e1ed5d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1328
    self requestFocus.
4069e1ed5d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1329
    super pointerEnter:state x:x y:y
4069e1ed5d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1330
4069e1ed5d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1331
4069e1ed5d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1332
4069e1ed5d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1333
!
4069e1ed5d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1334
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1335
redrawX:x y:y width:w height:h
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1336
    |redrawFrame |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1337
749
19b1792b9506 clear area before doing a redraw
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
  1338
    redrawFrame := Rectangle left:x top:y width:w height:h.
19b1792b9506 clear area before doing a redraw
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
  1339
    self clearRectangle:redrawFrame.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1340
    ((contents size ~~ 0) or:[gridShown]) ifTrue:[
619
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1341
        self redrawObjectsInVisible:redrawFrame
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1342
    ]
619
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1343
749
19b1792b9506 clear area before doing a redraw
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
  1344
    "Modified: 5.6.1996 / 10:42:19 / cg"
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1345
! !
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1346
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1347
!ObjectView methodsFor:'grid manipulation'!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1348
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1349
alignOff
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1350
    "do no align point to grid"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1351
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1352
    aligning := false
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1353
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1354
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1355
alignOn
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1356
    "align points to grid"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1357
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1358
    aligning := true.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1359
    self getAlignParameters
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1360
!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1361
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1362
defineGrid
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  1363
    "define the grid pattern - this creates the gridPixmap, which is
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  1364
     used as viewBackground when a grid is to be shown.
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  1365
     The grid is specified by the value returned from gridParameters,
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  1366
     which can be redefined in subclasses. See the comment there on how
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  1367
     the numbers are interpreted."
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1368
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1369
    |mmH mmV params showDocumentBoundary gridW gridH 
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1370
     bigStepH bigStepV littleStepH littleStepV hires|
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1371
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1372
    mmH := self horizontalPixelPerMillimeter.
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1373
    mmV := self verticalPixelPerMillimeter.
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1374
    hires := self horizontalPixelPerInch > 120.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1375
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1376
    params := self gridParameters.
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1377
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1378
    bigStepH := params at:1.
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1379
    bigStepV := params at:2.
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1380
    littleStepH := params at:3.
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1381
    littleStepV := params at:4.
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1382
    showDocumentBoundary := params at:7.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1383
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1384
    transformation notNil ifTrue:[
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1385
        mmH := mmH * transformation scale x.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1386
        mmV := mmV * transformation scale y.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1387
        bigStepH := bigStepH * transformation scale x.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1388
        bigStepV := bigStepV * transformation scale y.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1389
        littleStepH notNil ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1390
            littleStepH := littleStepH * transformation scale x.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1391
        ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1392
        littleStepV notNil ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1393
            littleStepV := littleStepV * transformation scale y.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1394
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1395
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1396
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1397
    bigStepH isNil ifTrue:[^ self].
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1398
1490
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1399
    gridW := (self widthOfContentsInMM * mmH).
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1400
    gridH := (self heightOfContentsInMM * mmV).
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1401
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1402
    self withWaitCursorDo:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1403
        |xp yp y x|
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1404
1490
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1405
        ((bigStepH isInteger and:[littleStepH isNil or:[littleStepH isInteger]])
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1406
        and:[(bigStepV isInteger and:[littleStepV isNil or:[littleStepV isInteger]])]) ifTrue:[
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1407
            gridW := bigStepH.
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1408
            littleStepH notNil ifTrue:[gridW := gridW max:littleStepH].
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1409
            gridH := bigStepV.
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1410
            littleStepV notNil ifTrue:[gridH := gridH max:littleStepV].
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1411
        ] ifFalse:[
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1412
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1413
            "
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1414
             up to next full unit
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1415
            "
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1416
            gridW := ((gridW // bigStepH) + 1 * bigStepH) asInteger.
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1417
            gridH := ((gridH // bigStepV) + 1 * bigStepV) asInteger.
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1418
        ].
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1419
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1420
        gridPixmap := Form width:gridW height:gridH depth:1.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1421
        gridPixmap colorMap:(Array with:White with:Black).
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1422
        gridPixmap clear.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1423
        gridPixmap paint:(Color colorId:1).
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1424
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1425
        "draw first row point-by-point"
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1426
        yp := 0.0.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1427
        xp := 0.0.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1428
        y := yp asInteger.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1429
        [xp <= gridW] whileTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1430
            x := xp rounded.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1431
            hires ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1432
                gridPixmap displayPointX:(x + 1) y:y.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1433
                gridPixmap displayPointX:(x + 2) y:y
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1434
            ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1435
            gridPixmap displayPointX:x y:y.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1436
            littleStepH notNil ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1437
                xp := xp + littleStepH
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1438
            ] ifFalse:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1439
                xp := xp + bigStepH
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1440
            ]
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1441
        ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1442
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1443
        "copy rest from what has been drawn already"
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1444
        yp := yp + bigStepV.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1445
        [yp <= gridH] whileTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1446
            y := yp rounded.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1447
            hires ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1448
                gridPixmap copyFrom:gridPixmap x:0 y:0 
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1449
                                             toX:0 y:(y + 1)
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1450
                                           width:gridW height:1.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1451
                gridPixmap copyFrom:gridPixmap x:0 y:0 
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1452
                                             toX:0 y:(y + 2)
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1453
                                           width:gridW height:1
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1454
            ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1455
            gridPixmap copyFrom:gridPixmap x:0 y:0 
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1456
                                         toX:0 y:y
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1457
                                       width:gridW height:1.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1458
            yp := yp + bigStepV
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1459
        ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1460
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1461
        "draw first col point-by-point"
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1462
        xp := 0.0.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1463
        yp := 0.0.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1464
        x := xp asInteger.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1465
        [yp <= gridH] whileTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1466
            y := yp rounded.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1467
            hires ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1468
                gridPixmap displayPointX:x y:(y + 1).
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1469
                gridPixmap displayPointX:x y:(y + 2)
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1470
            ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1471
            gridPixmap displayPointX:x y:y.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1472
            littleStepV notNil ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1473
                yp := yp + littleStepV
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1474
            ] ifFalse:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1475
                yp := yp + bigStepV
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1476
            ]
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1477
        ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1478
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1479
        "copy rest from what has been drawn already"
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1480
        xp := xp + bigStepH.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1481
        [xp <= gridW] whileTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1482
            x := xp rounded.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1483
            hires ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1484
                gridPixmap copyFrom:gridPixmap x:0 y:0 
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1485
                                             toX:(x + 1) y:0
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1486
                                           width:1 height:gridH.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1487
                gridPixmap copyFrom:gridPixmap x:0 y:0 
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1488
                                             toX:(x + 2) y:0
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1489
                                           width:1 height:gridH
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1490
            ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1491
            gridPixmap copyFrom:gridPixmap x:0 y:0 
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1492
                                         toX:x y:0
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1493
                                       width:1 height:gridH.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1494
            xp := xp + bigStepH
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1495
        ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1496
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1497
        showDocumentBoundary ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1498
             "
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1499
             mark the right-end and bottom of the document
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1500
            "
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1501
            gridPixmap displayLineFromX:gridW-1 y:0 toX:gridW-1 y:gridH-1.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1502
            gridPixmap displayLineFromX:0 y:gridH-1 toX:gridW-1 y:gridH-1.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1503
        ].
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1504
    ]
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1505
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1506
    "Modified: 14.12.1995 / 20:59:38 / cg"
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1507
!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1508
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1509
getAlignParameters
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1510
    |params|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1511
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1512
    params := self gridParameters.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1513
    gridAlign := (params at:5) @ (params at:6)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1514
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1515
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1516
gridParameters
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1517
    "used by defineGrid, and in a separate method for
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1518
     easier redefinition in subclasses. 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1519
     Returns the grid parameters in an array of 7 elements,
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1520
     which control the appearance of the grid-pattern.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1521
     the elements are:
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1522
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1523
	bigStepH        number of pixels horizontally between 2 major steps
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1524
	bigStepV        number of pixels vertically between 2 major steps
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1525
	littleStepH     number of pixels horizontally between 2 minor steps
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1526
	littleStepV     number of pixels vertically between 2 minor steps
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1527
	gridAlignH      number of pixels for horizontal grid align (pointer snap)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1528
	gridAlignV      number of pixels for vertical grid align (pointer snap)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1529
	docBounds       true, if document boundary should be shown
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1530
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1531
     if littleStepH/V are nil, only bigSteps are drawn.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1532
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1533
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1534
    |mmH mmV bigStepH bigStepV littleStepH littleStepV arr|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1535
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1536
    "example: 12grid & 12snapIn"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1537
"/    ^ #(12 12 nil nil 12 12 false).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1538
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1539
    "example: 12grid & 24snapIn"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1540
"/    ^ #(12 12 nil nil 24 24 false).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1541
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1542
    "default: cm/mm grid & mm snapIn for metric,
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1543
     1inch , 1/8inch grid & 1/8 inch snapIn"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1544
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1545
    mmH := self horizontalPixelPerMillimeter.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1546
    mmV := self verticalPixelPerMillimeter.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1547
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1548
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1549
     metric grid: small steps every millimeter, big step every
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1550
     centimeter. If the transformation is shrinking, turn off little
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1551
     steps.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1552
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1553
    (scaleMetric == #mm) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1554
	"dots every mm; lines every cm"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1555
	bigStepH := mmH * 10.0.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1556
	bigStepV := mmV * 10.0.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1557
	(transformation notNil
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1558
	and:[transformation scale <= 0.5]) ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1559
	    littleStepH := mmH.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1560
	    littleStepV := mmV
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1561
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1562
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1563
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1564
     inch grid: small steps every 1/8th inch, big step every half inch
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1565
     If the transformation is shrinking, change little steps to 1/th inch
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1566
     or even turn them off completely.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1567
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1568
    (scaleMetric == #inch) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1569
	"dots every eights inch; lines every half inch"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1570
	bigStepH := mmH * (25.4 / 2).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1571
	bigStepV := mmV * (25.4 / 2).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1572
	(transformation notNil
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1573
	and:[transformation scale <= 0.5]) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1574
	    transformation scale > 0.2 ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1575
		littleStepH := mmH * (25.4 / 4).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1576
		littleStepV := mmV * (25.4 / 4)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1577
	    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1578
	] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1579
	    littleStepH := mmH * (25.4 / 8).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1580
	    littleStepV := mmV * (25.4 / 8)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1581
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1582
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1583
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1584
    arr := Array new:8.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1585
    arr at:1 put:bigStepH.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1586
    arr at:2 put:bigStepV.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1587
    arr at:3 put:littleStepH.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1588
    arr at:4 put:littleStepV.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1589
    arr at:5 put:littleStepH.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1590
    arr at:6 put:littleStepV.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1591
    arr at:7 put:false.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1592
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1593
    ^ arr
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1594
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1595
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1596
hideGrid
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1597
    "hide the grid"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1598
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1599
    gridShown := false.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1600
    self newGrid
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1601
!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1602
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1603
newGrid
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1604
    "define a new grid - this is a private helper which has to be
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1605
     called after any change in the grid. It (re)creates the gridPixmap,
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1606
     clears the view and redraws all visible objects."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1607
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1608
    gridPixmap := nil.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1609
    shown ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  1610
        self viewBackground:White.
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  1611
        self clear.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1612
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1613
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1614
    gridShown ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  1615
        self defineGrid.
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  1616
        self viewBackground:gridPixmap.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1617
    ].
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  1618
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  1619
    self invalidate
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  1620
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  1621
    "Modified: 29.5.1996 / 16:20:11 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1622
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1623
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1624
showGrid
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1625
    "show the grid. The grid is defined by the return value of
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1626
     gridParameters, which can be redefined in concrete subclasses."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1627
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1628
    gridShown := true.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1629
    self newGrid
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1630
! !
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1631
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1632
!ObjectView methodsFor:'initialization'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1633
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1634
initEvents
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1635
"/    self backingStore:true.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1636
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1637
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1638
initialize
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1639
    super initialize.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1640
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1641
    viewBackground := White.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1642
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1643
    bitGravity := #NorthWest.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1644
    contents := OrderedCollection new.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1645
    gridShown := false.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1646
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1647
    canDragOutOfView := false.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1648
    rootView := DisplayRootView new.
1220
9bc6add9aa54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1186
diff changeset
  1649
    rootView clippedByChildren:false.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1650
    rootMotion := false.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1651
    self setInitialDocumentFormat.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1652
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1653
    leftHandCursor := Cursor leftHand.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1654
    sorted := false.
961
1b65b39c5079 aligningMove was undefined.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
  1655
    aligning := false.
1b65b39c5079 aligningMove was undefined.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
  1656
    aligningMove := false.
1b65b39c5079 aligningMove was undefined.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
  1657
1b65b39c5079 aligningMove was undefined.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
  1658
    "Modified: 20.1.1997 / 20:41:10 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1659
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1660
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1661
setInitialDocumentFormat
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1662
    (Smalltalk language == #english) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1663
	documentFormat := 'letter'.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1664
	scaleMetric := #inch
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1665
    ] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1666
	documentFormat := 'a4'.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1667
	scaleMetric := #mm
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1668
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1669
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1670
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1671
!ObjectView methodsFor:'layout manipulation'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1672
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1673
alignBottom:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1674
    |botMost|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1675
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1676
    botMost := -999999.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1677
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1678
	botMost := botMost max:(anObject frame bottom)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1679
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1680
    self withSelectionHiddenDo:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1681
	self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1682
	    self moveObject:anObject to:(anObject frame left)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1683
					@
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1684
					(botMost - (anObject frame height))
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1685
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1686
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1687
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1688
747
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1689
alignHorizontal:something
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1690
    "align selection along their center horizontally"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1691
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1692
    |topMost bottomMost h|
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1693
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1694
    topMost := 999999.
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1695
    bottomMost := -999999.
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1696
    self forEach:something do:[:anObject |
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1697
        |f|
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1698
        f := anObject frame.
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1699
        topMost := topMost min:(f top).
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1700
        bottomMost := bottomMost max:(f bottom).
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1701
    ].
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1702
    h := bottomMost - topMost.
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1703
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1704
    self withSelectionHiddenDo:[
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1705
        self forEach:something do:[:anObject |
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1706
            self moveObject:anObject 
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1707
                         to:(anObject frame left)
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1708
                            @
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1709
                            (topMost + ((h - anObject frame height) // 2))
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1710
        ]
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1711
    ]
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1712
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1713
    "Created: 4.6.1996 / 20:01:19 / cg"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1714
    "Modified: 4.6.1996 / 21:19:48 / cg"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1715
!
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1716
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1717
alignLeft:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1718
    |leftMost|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1719
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1720
    leftMost := 999999.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1721
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1722
	leftMost := leftMost min:(anObject frame left)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1723
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1724
    self withSelectionHiddenDo:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1725
	self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1726
	    self moveObject:anObject to:(leftMost @ (anObject frame top))
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1727
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1728
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1729
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1730
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1731
alignRight:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1732
    |rightMost|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1733
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1734
    rightMost := -999999.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1735
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1736
	rightMost := rightMost max:(anObject frame right)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1737
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1738
    self withSelectionHiddenDo:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1739
	self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1740
	    self moveObject:anObject to:(rightMost - (anObject frame width))
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1741
					 @ (anObject frame top)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1742
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1743
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1744
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1745
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1746
alignTop:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1747
    |topMost|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1748
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1749
    topMost := 999999.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1750
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1751
	topMost := topMost min:(anObject frame top)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1752
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1753
    self withSelectionHiddenDo:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1754
	self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1755
	    self moveObject:anObject to:((anObject frame left) @ topMost)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1756
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1757
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1758
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1759
747
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1760
alignVertical:something
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1761
    "align selection along their center vertically"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1762
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1763
    |leftMost rightMost w|
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1764
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1765
    leftMost := 999999.
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1766
    rightMost := -999999.
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1767
    self forEach:something do:[:anObject |
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1768
        |f|
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1769
        f := anObject frame.
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1770
        rightMost := rightMost max:(f right).
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1771
        leftMost := leftMost min:(f left).
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1772
    ].
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1773
    w := rightMost - leftMost.
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1774
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1775
    self withSelectionHiddenDo:[
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1776
        self forEach:something do:[:anObject |
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1777
            self moveObject:anObject 
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1778
                         to:(leftMost + ((w - anObject frame width) // 2))
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1779
                            @
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1780
                            (anObject frame top)
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1781
        ]
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1782
    ]
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1783
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1784
    "Created: 4.6.1996 / 19:59:16 / cg"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1785
    "Modified: 4.6.1996 / 21:19:58 / cg"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1786
!
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1787
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1788
move:something by:delta
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1789
    "change the position of something, an Object or Collection 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1790
     by delta, aPoint"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1791
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1792
    (delta x == 0) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1793
	(delta y == 0) ifTrue:[^ self]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1794
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1795
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1796
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1797
	self moveObject:anObject by:delta
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1798
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1799
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1800
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1801
move:something to:aPoint in:aView
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1802
    "can only happen when dragOutOfView is true
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1803
     - should be redefined in subclasses"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1804
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1805
    self notify:'cannot move object(s) out of view'
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1806
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1807
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1808
move:something to:aPoint inAlienViewId:aViewId
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1809
    "can only happen when dragOutOfView is true
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1810
     - should be redefined in subclasses"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1811
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1812
    self notify:'cannot move object(s) to alien views'
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  1813
!
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  1814
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1815
moveObject:anObject by:delta
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1816
    "change the position of anObject by delta, aPoint"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1817
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1818
    self moveObject:anObject to:(anObject origin + delta)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1819
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1820
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1821
moveObject:anObject to:newOrigin
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1822
    "move anObject to newOrigin, aPoint"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1823
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1824
    |oldOrigin oldFrame newFrame 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1825
     objectsIntersectingOldFrame objectsIntersectingNewFrame 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1826
     wasObscured isObscured intersects
701
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1827
     oldLeft oldTop w h newLeft newTop griddedNewOrigin clip|
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1828
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1829
    anObject isNil ifTrue:[^ self].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1830
    anObject canBeMoved ifFalse:[^ self].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1831
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1832
    griddedNewOrigin := self alignToGrid:newOrigin.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1833
    oldOrigin := anObject origin.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1834
    (oldOrigin = griddedNewOrigin) ifTrue:[^ self].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1835
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1836
    oldFrame := self frameOf:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1837
    objectsIntersectingOldFrame := self objectsIntersecting:oldFrame.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1838
    wasObscured := self isObscured:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1839
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1840
    anObject moveTo:griddedNewOrigin.
782
f963155637e3 dont redraw in moveObject: when not visible
ca
parents: 749
diff changeset
  1841
    shown ifFalse:[^ self].
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1842
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1843
    newFrame := self frameOf:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1844
    objectsIntersectingNewFrame := self objectsIntersecting:newFrame.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1845
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1846
    "try to redraw the minimum possible"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1847
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1848
    "if no other object intersects both frames we can do a copy:"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1849
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1850
    intersects := oldFrame intersects:newFrame.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1851
    intersects ifFalse:[
701
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1852
        gridShown ifFalse:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1853
            transformation isNil ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1854
                (objectsIntersectingOldFrame size == 1) ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1855
                    (objectsIntersectingNewFrame size == 1) ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1856
                        clip := self clippingRectangleOrNil.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1857
                        (clip isNil or:[oldFrame isContainedIn:clip]) ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1858
                            oldLeft := oldFrame left.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1859
                            oldTop := oldFrame top.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1860
                            newLeft := newFrame left.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1861
                            newTop := newFrame top.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1862
                            w := oldFrame width.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1863
                            h := oldFrame height.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1864
                            ((newLeft < width) and:[newTop < height]) ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1865
                                ((newLeft >= 0) and:[newTop >= 0]) ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1866
                                    self catchExpose.
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  1867
                                    self 
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  1868
                                        copyFrom:self 
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  1869
                                        x:oldLeft y:oldTop
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  1870
                                        toX:newLeft y:newTop
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  1871
                                        width:w height:h
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  1872
                                        async:true.
701
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1873
                                    self waitForExpose
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1874
                                ]
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1875
                            ].
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1876
                            ((oldLeft < width) and:[oldTop < height]) ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1877
                                ((oldLeft >= 0) and:[oldTop >= 0]) ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1878
                                  self clearRectangleX:oldLeft y:oldTop width:w height:h.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1879
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1880
"/                                self fillRectangleX:oldLeft y:oldTop width:w height:h
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1881
"/                                               with:viewBackground
701
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1882
                                ]
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1883
                            ].
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1884
                            ^ self
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1885
                        ]
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1886
                    ]
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1887
                ]
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1888
            ]
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1889
        ]
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1890
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1891
    isObscured := self isObscured:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1892
    (oldFrame intersects:newFrame) ifTrue:[
701
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1893
        isObscured ifFalse:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1894
            self redrawObjectsIn:oldFrame.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1895
            self show: anObject
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1896
        ] ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1897
            self redrawObjectsIn:(oldFrame merge:newFrame)
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1898
        ]
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1899
    ] ifFalse:[
701
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1900
        self redrawObjectsIn:oldFrame.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1901
        isObscured ifFalse:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1902
            self show: anObject
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1903
        ] ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1904
            self redrawObjectsIn:newFrame
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1905
        ]
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1906
    ]
701
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1907
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  1908
    "Modified: 29.1.1997 / 13:07:07 / cg"
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
  1909
!
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
  1910
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1911
objectToBack:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1912
    "bring the argument, anObject to back"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1913
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1914
    anObject notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1915
	contents remove:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1916
	contents addFirst:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1917
	(self isObscured:anObject) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1918
	    self redrawObjectsIn:(anObject frame)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1919
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1920
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1921
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1922
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1923
objectToFront:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1924
    "bring the argument, anObject to front"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1925
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1926
    |wasObscured|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1927
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1928
    anObject notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1929
	wasObscured := self isObscured:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1930
	contents remove:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1931
	contents addLast:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1932
	wasObscured ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1933
"old:
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1934
	    self redrawObjectsIn:(anObject frame)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1935
"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1936
	    self hideSelection.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1937
	    self show:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1938
	    self showSelection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1939
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1940
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1941
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1942
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1943
selectionAlignBottom
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1944
    "align selected objects at bottom"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1945
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1946
    self alignBottom:selection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1947
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1948
747
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1949
selectionAlignHorizontal
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1950
    "align selected objects horizontally"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1951
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1952
    self alignHorizontal:selection
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1953
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1954
    "Created: 4.6.1996 / 19:58:46 / cg"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1955
    "Modified: 4.6.1996 / 19:59:10 / cg"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1956
!
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1957
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1958
selectionAlignLeft
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1959
    "align selected objects left"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1960
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1961
    self alignLeft:selection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1962
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1963
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1964
selectionAlignRight
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1965
    "align selected objects right"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1966
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1967
    self alignRight:selection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1968
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1969
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1970
selectionAlignTop
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1971
    "align selected objects at top"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1972
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1973
    self alignTop:selection
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
  1974
!
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
  1975
747
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1976
selectionAlignVertical
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1977
    "align selected objects vertically"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1978
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1979
    self alignVertical:selection
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1980
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1981
    "Created: 4.6.1996 / 19:59:00 / cg"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1982
!
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1983
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1984
selectionToBack
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1985
    "bring the selection to back"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1986
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1987
    self toBack:selection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1988
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1989
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1990
selectionToFront
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1991
    "bring the selection to front"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1992
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1993
    self toFront:selection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1994
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1995
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1996
toBack:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1997
    "bring the argument, anObject or a collection of objects to back"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1998
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1999
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2000
	self objectToBack:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2001
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2002
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2003
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2004
toFront:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2005
    "bring the argument, anObject or a collection of objects to front"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2006
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2007
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2008
	self objectToFront:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2009
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2010
! !
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2011
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2012
!ObjectView methodsFor:'misc'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2013
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2014
documentFormat:aFormatString
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2015
    "set the document format (mostly used by scrollbars).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2016
     The argument should be a string such as 'a4', 'a5'
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2017
     or 'letter'. 
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2018
     See the UnitConverter class for supported formats."
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2019
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2020
    aFormatString ~= documentFormat ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2021
        documentFormat := aFormatString.
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2022
        self contentsChanged.
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2023
        self defineGrid.
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2024
        gridShown ifTrue:[
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2025
            self invalidate "/ clear; redraw
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2026
        ]
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2027
    ]
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2028
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2029
    "Modified: 31.5.1996 / 19:44:08 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2030
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2031
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2032
forEach:aCollection do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2033
    "apply block to every object in a collectioni;
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2034
     (adds a check for non-collection)"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2035
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2036
    aCollection isNil ifTrue:[^self].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2037
    aCollection isCollection ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2038
	aCollection do:[:object |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2039
	    object notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2040
		aBlock value:object
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2041
	    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2042
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2043
    ] ifFalse: [
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2044
	aBlock value:aCollection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2045
    ]
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
  2046
!
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
  2047
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2048
hitDelta
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2049
    "when clicking an object, allow for hitDelta pixels around object.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2050
     We compensate for any scaling here, to get a constant physical
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2051
     hitDelta (i.e. the value returned here is inverse scaled)."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2052
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2053
    |delta|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2054
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2055
    delta := self class hitDelta.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2056
    transformation notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2057
	delta := delta / transformation scale x
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2058
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2059
    ^ delta
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2060
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2061
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2062
numberOfObjectsIntersecting:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2063
    "answer the number of objects intersecting the argument, aRectangle"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2064
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2065
    |tally|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2066
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2067
    tally := 0.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2068
    contents do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2069
	(theObject frame intersects:aRectangle) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2070
	    tally := tally + 1
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2071
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2072
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2073
    ^ tally
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2074
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2075
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2076
numberOfObjectsIntersectingVisible:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2077
    "answer the number of objects intersecting the argument, aRectangle.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2078
     This is a leftOver from times when scrolling was not transparent.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2079
     Please use numberOfObjectsIntersecting:, since this will vanish."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2080
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2081
    ^ self numberOfObjectsIntersecting:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2082
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2083
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2084
objectsAbove:objectToBeTested do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2085
    "do something to every object above objectToBeTested
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2086
     (does not mean obscured - simply above in hierarchy)"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2087
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2088
    |startIndex|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2089
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2090
    startIndex := contents identityIndexOf:objectToBeTested
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2091
				  ifAbsent:[self error].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2092
    contents from:startIndex to:(contents size) do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2093
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2094
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2095
objectsAbove:anObject intersecting:aRectangle do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2096
    "do something to every object above objectToBeTested
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2097
     and intersecting aRectangle"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2098
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2099
    self objectsAbove:anObject do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2100
	(theObject frame intersects:aRectangle) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2101
	    aBlock value:theObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2102
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2103
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2104
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2105
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2106
objectsBelow:objectToBeTested do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2107
    "do something to every object below objectToBeTested
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2108
     (does not mean obscured by - simply below in hierarchy)"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2109
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2110
    |endIndex|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2111
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2112
    endIndex := contents identityIndexOf:objectToBeTested ifAbsent:[self error].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2113
    contents from:1 to:(endIndex - 1) do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2114
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2115
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2116
objectsIn:aRectangle do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2117
    "do something to every object which is completely in a rectangle"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2118
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2119
    |bot|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2120
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2121
    sorted ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2122
	bot := aRectangle bottom.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2123
	contents do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2124
	    (theObject isContainedIn:aRectangle) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2125
		aBlock value:theObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2126
	    ] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2127
		theObject frame top > bot ifTrue:[^ self]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2128
	    ]
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2129
	].
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2130
	^ self
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2131
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2132
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2133
    contents do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2134
	(theObject isContainedIn:aRectangle) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2135
	    aBlock value:theObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2136
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2137
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2138
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2139
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2140
objectsInVisible:aRectangle do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2141
    "do something to every object which is completely in a 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2142
     visible rectangle.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2143
     This is a leftOver from times when scrolling was not transparent.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2144
     Please use objectsIn:do:, since this will vanish."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2145
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2146
    self objectsIn:aRectangle do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2147
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2148
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2149
objectsIntersecting:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2150
    "answer a Collection of objects intersecting the argument, aRectangle"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2151
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2152
    |newCollection|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2153
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2154
    newCollection := OrderedCollection new.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2155
    self objectsIntersecting:aRectangle do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2156
	newCollection add:theObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2157
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2158
    (newCollection size == 0) ifTrue:[^ nil].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2159
    ^ newCollection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2160
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2161
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2162
objectsIntersecting:aRectangle do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2163
    "do something to every object which intersects a rectangle"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2164
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2165
    |f top bot
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2166
     firstIndex "{ Class: SmallInteger }"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2167
     delta      "{ Class: SmallInteger }"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2168
     theObject 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2169
     nObjects   "{ Class: SmallInteger }"|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2170
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2171
    nObjects := contents size.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2172
    (nObjects == 0) ifTrue:[^ self].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2173
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2174
    sorted ifFalse:[
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2175
	"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2176
	 have to check every object
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2177
	"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2178
	contents do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2179
	    (theObject frame intersects:aRectangle) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2180
		aBlock value:theObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2181
	    ]
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  2182
	].
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2183
	^ self
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2184
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2185
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2186
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2187
     contents is sorted by y; can do a fast (binary) search for the first
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2188
     object which intersects aRectangle and 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2189
     break from the draw loop, when the 1st object below aRectangle is reached.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2190
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2191
    bot := aRectangle bottom.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2192
    top := aRectangle top.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2193
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2194
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2195
     binary search for an object in aRectangle ...
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2196
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2197
    delta := nObjects // 2.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2198
    firstIndex := delta.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2199
    (firstIndex == 0) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2200
       firstIndex := 1
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2201
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2202
    theObject := contents at:firstIndex.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2203
    (theObject frame bottom < top) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2204
	[theObject frame bottom < top and:[delta > 1]] whileTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2205
	    delta := delta // 2.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2206
	    firstIndex := firstIndex + delta.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2207
	    theObject := contents at:firstIndex
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2208
	]
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  2209
    ] ifFalse:[
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2210
	[theObject frame top > bot and:[delta > 1]] whileTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2211
	    delta := delta // 2.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2212
	    firstIndex := firstIndex - delta.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2213
	    theObject := contents at:firstIndex
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2214
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2215
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2217
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2218
     now, theObject at:firstIndex is in aRectangle; go backward to the object
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2219
     following first non-visible
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2220
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2221
    [theObject frame bottom > top and:[firstIndex > 1]] whileTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2222
	firstIndex := firstIndex - 1.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2223
	theObject := contents at:firstIndex
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  2224
    ].
87
2c6ab478466a *** empty log message ***
claus
parents: 83
diff changeset
  2225
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2226
    firstIndex to:nObjects do:[:index |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2227
	theObject := contents at:index.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2228
	f := theObject frame.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2229
	(f intersects:aRectangle) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2230
	    aBlock value:theObject
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  2231
	] ifFalse:[
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2232
	    (f top > bot) ifTrue:[^ self]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2233
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2234
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2235
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2236
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2237
objectsIntersectingVisible:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2238
    "answer a Collection of objects intersecting a visible aRectangle.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2239
     This is a leftOver from times when scrolling was not transparent.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2240
     Please use objectsIntersecting:, since this will vanish."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2241
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2242
    ^ self objectsIntersecting:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2243
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2244
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2245
objectsIntersectingVisible:aRectangle do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2246
    "do something to every object which intersects a visible rectangle.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2247
     This is a leftOver from times when scrolling was not transparent.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2248
     Please use objectsIntersecting:do:, since this will vanish."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2249
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2250
    self objectsIntersecting:aRectangle do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2251
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2252
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2253
rectangleForScroll
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2254
    "find the area occupied by visible objects"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2255
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2256
    |left right top bottom frame oLeft oRight oTop oBottom|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2257
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2258
    left := 9999.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2259
    right := 0.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2260
    top := 9999.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2261
    bottom := 0.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2262
    self visibleObjectsDo:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2263
	frame := anObject frame.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2264
	oLeft := frame left.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2265
	oRight := frame right.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2266
	oTop := frame top.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2267
	oBottom := frame bottom.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2268
	(oLeft < left) ifTrue:[left := oLeft].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2269
	(oRight > right) ifTrue:[right := oRight].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2270
	(oTop < top) ifTrue:[top := oTop].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2271
	(oBottom > bottom) ifTrue:[bottom := oBottom]
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  2272
    ].
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2273
    (left < margin) ifTrue:[left := margin].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2274
    (top < margin) ifTrue:[top := margin].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2275
    (right > (width - margin)) ifTrue:[right := width - margin].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2276
    (bottom > (height - margin)) ifTrue:[bottom := height - margin].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2277
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2278
    ((left > right) or:[top > bottom]) ifTrue:[^ nil].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2279
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2280
    ^ Rectangle left:left right:right top:top bottom:bottom
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2281
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2282
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2283
setDefaultActions
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2284
    motionAction := [:movePoint | nil].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2285
    releaseAction := [nil]
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  2286
!
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  2287
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2288
visibleObjectsDo:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2289
    "do something to every visible object"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2290
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2291
    |absRect|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2292
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2293
    absRect := Rectangle left:0 top:0 width:width height:height.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2294
    self objectsIntersecting:absRect do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2295
! !
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2296
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2297
!ObjectView methodsFor:'queries'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2298
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2299
heightOfContents
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2300
    "answer the height of the document in pixels"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2301
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2302
    |h|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2303
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2304
    h := self heightOfContentsInMM * (self verticalPixelPerMillimeter:1).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2305
    ^ h rounded
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2306
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2307
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2308
heightOfContentsInMM
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2309
    "answer the height of the document in millimeters"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2310
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2311
    |unit value|
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2312
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2313
    "landscape"
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2314
    unit := (documentFormat , 'H') asSymbolIfInterned.
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2315
    unit isNil ifTrue:[
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2316
        "/ certainly unknown
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2317
    ] ifFalse:[
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2318
        value := UnitConverter convert:1 from:unit to:#millimeter
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2319
    ].
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2320
    value isNil ifTrue:[
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2321
        "/ assuming window size is document size
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2322
        value := (height / self verticalPixelPerMillimeter:1) asInteger
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2323
    ].
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2324
    ^ value
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2325
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2326
    "Modified: 31.5.1996 / 19:38:51 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2327
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2328
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2329
widthOfContents
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2330
    "answer the width of the document in pixels"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2331
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2332
    |w|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2333
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2334
    w := self widthOfContentsInMM * (self horizontalPixelPerMillimeter:1).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2335
    ^ w rounded
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2336
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2337
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2338
widthOfContentsInMM
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2339
    "answer the width of the document in millimeters"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2340
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2341
    |unit value|
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2342
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2343
    "landscape"
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2344
    unit := (documentFormat , 'W') asSymbolIfInterned.
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2345
    unit isNil ifTrue:[
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2346
        "/ certainly unknown
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2347
    ] ifFalse:[
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2348
        value := UnitConverter convert:1 from:unit to:#millimeter
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2349
    ].
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2350
    value isNil ifTrue:[
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2351
        "/ assuming window size is document size
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2352
        value := (width / self horizontalPixelPerMillimeter:1) asInteger
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2353
    ].
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2354
    ^ value
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2355
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2356
    "Modified: 31.5.1996 / 19:38:22 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2357
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2358
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2359
!ObjectView methodsFor:'saving / restoring'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2360
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2361
fileInContentsFrom:aStream
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
  2362
    "remove all objects, load new contents from aStream and redraw"
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
  2363
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2364
    self fileInContentsFrom:aStream redraw:true new:true binary:false
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  2365
!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  2366
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  2367
fileInContentsFrom:aStream redraw:redraw
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  2368
    "remove all objects, load new contents from aStream 
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  2369
     and redraw if the redraw argument is true"
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  2370
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2371
    self fileInContentsFrom:aStream redraw:redraw new:true binary:false
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2372
!
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2373
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2374
fileInContentsFrom:aStream redraw:redraw new:new 
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2375
    "remove all objects, load new contents from aStream 
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2376
     and redraw if the redraw argument is true"
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2377
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2378
    self fileInContentsFrom:aStream redraw:redraw new:new binary:false
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2379
!
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2380
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2381
fileInContentsFrom:aStream redraw:redraw new:new binary:binary
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2382
    "if the new argument is true, remove all objects.
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2383
     Then load objects from aStream. If redraw is false, no redraw
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2384
     is done
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2385
     (allows fileIn of multiple files doing a single redraw at the end)."
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2386
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2387
    binary ifTrue:[
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2388
        aStream binary
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2389
    ].
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2390
    self topView withReadCursorDo:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2391
        |newObject chunk individualRedraw|
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2392
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2393
        self unselect.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2394
        individualRedraw := redraw.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2395
        new ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2396
            self removeAll.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2397
            individualRedraw := false.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2398
        ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2399
        [aStream atEnd] whileFalse:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2400
            binary ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2401
                newObject := Object readBinaryFrom:aStream
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2402
            ] ifFalse:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2403
                chunk := aStream nextChunk.
1746
bd570389f315 (notNil and:[isEmpty not]) -> (size > 0)
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  2404
                (chunk size > 0) ifTrue:[
1435
56de6db05972 dont compile expressions, when reading an ObjectView tree.
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
  2405
                    newObject := Compiler evaluate:chunk compile:false.
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2406
                ] ifFalse:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2407
                    newObject := nil
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2408
                ]
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2409
            ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2410
            newObject notNil ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2411
                self initializeFileInObject:newObject.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2412
                individualRedraw ifFalse:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2413
                    self addObjectWithoutRedraw:newObject
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2414
                ] ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2415
                    self addObject:newObject
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2416
                ]
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2417
            ]
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2418
        ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2419
        (new and:[redraw]) ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2420
            self invalidate
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2421
        ]
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2422
    ]
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2423
1435
56de6db05972 dont compile expressions, when reading an ObjectView tree.
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
  2424
    "Modified: / 30.1.1998 / 01:02:16 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2425
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2426
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2427
initializeFileInObject:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2428
    "each object may be processed here after its being filed-in
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2429
     - subclasses may do whatever they want here ...
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2430
     (see LogicView for example)"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2431
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2432
    ^ self
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2433
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2434
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2435
storeBinaryContentsOn:aStream
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2436
    "store the contents in binary representation on aStream."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2437
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2438
    aStream binary.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2439
    self topView withCursor:Cursor write do:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2440
	self forEach:contents do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2441
	    theObject storeBinaryOn:aStream.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2442
	].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2443
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2444
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2445
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2446
storeContentsOn:aStream
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2447
    "store the contents in textual representation on aStream.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2448
     Notice, that for huge objects (such as DrawImages) this ascii output
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2449
     can become quite large, and the time to save and reload can become
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2450
     long."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2451
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2452
    |excla|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2453
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2454
    self topView withCursor:Cursor write do:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2455
	excla := aStream class chunkSeparator.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2456
	self forEach:contents do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2457
	    theObject storeOn:aStream.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2458
	    aStream nextPut:excla.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2459
	    aStream cr
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2460
	].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2461
	aStream nextPut:excla
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2462
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2463
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2464
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2465
withoutRedrawFileInContentsFrom:aStream
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2466
    "remove all objects, load new contents from aStream without any redraw"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2467
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2468
    self fileInContentsFrom:aStream redraw:false new:true binary:false
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2469
! !
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2470
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2471
!ObjectView methodsFor:'scrolling'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2472
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2473
horizontalScrollStep
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2474
    "return the amount to scroll when stepping left/right.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2475
     Redefined to scroll by inches or centimeters."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2476
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2477
    scaleMetric == #inch ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2478
	^ (device horizontalPixelPerInch * (1/2)) asInteger
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2479
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2480
    ^ (device horizontalPixelPerMillimeter * 20) asInteger
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2481
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2482
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2483
verticalScrollStep
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2484
    "return the amount to scroll when stepping left/right.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2485
     Redefined to scroll by inches or centimeters."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2486
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2487
    scaleMetric == #inch ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2488
	^ (device verticalPixelPerInch * (1/2)) asInteger
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2489
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2490
    ^ (device verticalPixelPerMillimeter * 20) asInteger
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2491
! !
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2492
1752
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2493
!ObjectView methodsFor:'selection & handles'!
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2494
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2495
drawHandle:aPoint
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2496
    |hsize halfSize|
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2497
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2498
    hsize := self handleSize.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2499
    halfSize := hsize // 2.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2500
    self fillRectangleX:(aPoint x - halfSize)
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2501
		      y:(aPoint y - halfSize)
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2502
		  width:hsize 
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2503
		 height:hsize
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2504
!
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2505
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2506
drawHandlesFor:anObject
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2507
    |hsize halfSize|
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2508
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2509
    hsize := self handleSize.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2510
    halfSize := hsize // 2.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2511
    anObject handlesDo:[:point |
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2512
	self fillRectangleX:(point x - halfSize)
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2513
			  y:(point y - halfSize)
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2514
		      width:hsize 
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2515
		     height:hsize
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2516
    ]
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2517
!
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2518
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2519
findObjectHandleAt:aPoint
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2520
    |objectFound|
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2521
    contents do:[:object |
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2522
	(self object:object hasHandle:aPoint) ifTrue:[
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2523
	    objectFound := object
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2524
	]
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2525
    ].
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2526
    ^ objectFound
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2527
!
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2528
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2529
handle:handlePoint isHitBy:aPoint
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2530
    ^ (self handleFor:handlePoint) containsPoint:aPoint
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2531
!
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2532
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2533
handleFor:aPoint
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2534
    "return the handle-rectangle for a handle at aPoint"
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2535
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2536
    |hsize centerX centerY|
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2537
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2538
    hsize := self handleSize.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2539
    centerX := aPoint x.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2540
    centerY := aPoint y.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2541
    ^ Rectangle left:(centerX - hsize)
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2542
		 top:(centerY - hsize)
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2543
	       right:(centerX + hsize)
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2544
	      bottom:(centerY + hsize)
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2545
!
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2546
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2547
handleSize
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2548
    "return the size of the handles - sincc handles should be
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2549
     the same size regardless of scaling, inverse-scale from
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2550
     what the default is."
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2551
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2552
    |hs|
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2553
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2554
    hs := self class handleSize.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2555
    transformation notNil ifTrue:[
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2556
	^ transformation applyInverseScaleX:hs
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2557
    ].
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2558
    ^ hs
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2559
!
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2560
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2561
invertHandle:aHandle
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2562
    self xoring:[self drawHandle:aHandle]
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2563
!
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2564
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2565
invertHandlesOf:aSelection
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2566
    aSelection notNil ifTrue:[
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2567
	self xoring:[
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2568
	    self forEach:aSelection do:[:anObject |
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2569
		(anObject respondsTo:#handlesDo:) ifTrue:[
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2570
		    self drawHandlesFor:anObject
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2571
		] ifFalse:[
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2572
		    anObject drawOutlineIn:self
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2573
		]
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2574
	    ]
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2575
	]
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2576
    ]
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2577
!
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2578
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2579
object:anObject hasHandleAt:aPoint
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2580
    |found|
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2581
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2582
    found := false.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2583
    anObject handlesDo:[:handlePoint |
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2584
	(self handle:handlePoint isHitBy:aPoint) ifTrue:[
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2585
	    found := true
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2586
	]
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2587
    ].
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2588
    ^ found
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2589
!
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2590
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2591
selectionHandlesDo:aBlock
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2592
    self forEach:selection do:[:theObject |
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2593
	(theObject respondsTo:#handlesDo:) ifTrue:[
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2594
	    theObject handlesDo:[:theHandle |
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2595
		aBlock value:theObject value:theHandle
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2596
	    ]
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2597
	]
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2598
    ]
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2599
! !
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2600
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2601
!ObjectView methodsFor:'selections'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2602
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2603
addToSelection:anObject
839
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2604
    "add anObject to the selection; redraw it selected"
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2605
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2606
    selection isCollection ifFalse:[
1002
62b2636d0923 care for nil selection
ca
parents: 996
diff changeset
  2607
        selection isNil ifTrue:[
62b2636d0923 care for nil selection
ca
parents: 996
diff changeset
  2608
            ^ self select:anObject
62b2636d0923 care for nil selection
ca
parents: 996
diff changeset
  2609
        ].
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2610
        selection := OrderedCollection with:selection
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2611
    ].
839
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2612
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2613
    (selection includes:anObject) ifFalse:[
839
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2614
        (self frameIncludesSelectionHandlesOn:anObject) ifFalse:[
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2615
            self hideSelection.
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2616
            selection add:anObject.
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2617
            self showSelection
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2618
        ] ifTrue:[
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2619
            self showSelected:anObject
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2620
        ]
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2621
    ].
839
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2622
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2623
    "Modified: 1.10.1996 / 12:12:59 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2624
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2625
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2626
hideSelection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2627
    "hide the selection - undraw hilights - whatever that is"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2628
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2629
    self selectionDo:[:object |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2630
	self showUnselected:object
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2631
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2632
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2633
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2634
removeFromSelection:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2635
    "remove anObject from the selection"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2636
839
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2637
    |wasSelected didHide|
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2638
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2639
    didHide := false.
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2640
    wasSelected := true.
839
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2641
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2642
    (self frameIncludesSelectionHandlesOn:anObject) ifFalse:[
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2643
        "/ must hide any selection-handles first
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2644
        self hideSelection.
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2645
        didHide := true.
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2646
    ].
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2647
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2648
    selection isCollection ifTrue:[
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2649
        (selection remove:anObject ifAbsent:[nil]) isNil ifTrue:[
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2650
            wasSelected := false
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2651
        ].
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2652
        (selection size == 1) ifTrue:[
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2653
            selection := selection first
1002
62b2636d0923 care for nil selection
ca
parents: 996
diff changeset
  2654
        ] ifFalse:[
62b2636d0923 care for nil selection
ca
parents: 996
diff changeset
  2655
            selection isEmpty ifTrue:[
62b2636d0923 care for nil selection
ca
parents: 996
diff changeset
  2656
                selection := nil
62b2636d0923 care for nil selection
ca
parents: 996
diff changeset
  2657
            ]
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2658
        ]
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2659
    ] ifFalse:[
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2660
        (selection == anObject) ifTrue:[
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2661
            selection := nil
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2662
        ] ifFalse:[
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2663
            wasSelected := false
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2664
        ]
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2665
    ].
839
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2666
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2667
    didHide ifTrue:[
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2668
        self showSelection.
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2669
    ] ifFalse:[
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2670
        wasSelected ifTrue:[
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2671
            self showUnselected:anObject
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2672
        ].
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2673
    ]
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2674
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2675
    "Modified: 1.10.1996 / 12:10:17 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2676
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2677
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2678
select:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2679
    "select something - hide previouse selection, set to something and hilight"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2680
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2681
    (selection == something) ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2682
	self hideSelection.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2683
	selection := something.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2684
	self showSelection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2685
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2686
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2687
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2688
selectAll
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2689
    "select all objects"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2690
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2691
    self hideSelection.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2692
    selection := contents copy.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2693
    self showSelection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2694
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2695
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2696
selectAllIn:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2697
    "select all objects fully in aRectangle"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2698
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2699
    self hideSelection.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2700
    selection := OrderedCollection new.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2701
    self objectsIn:aRectangle do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2702
	selection add:theObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2703
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2704
    (selection size == 0) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2705
	selection := nil
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2706
    ] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2707
	(selection size == 1) ifTrue:[selection := selection first]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2708
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2709
    self showSelection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2710
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2711
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2712
selectAllIntersecting:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2713
    "select all objects touched by aRectangle"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2714
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2715
    self hideSelection.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2716
    selection := OrderedCollection new.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2717
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2718
    self objectsIntersecting:aRectangle do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2719
	selection add:theObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2720
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2721
    (selection size == 0) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2722
	selection := nil
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2723
    ] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2724
	(selection size == 1) ifTrue:[selection := selection first]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2725
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2726
    self showSelection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2727
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2728
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2729
selectionDo:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2730
    "apply block to every object in selection"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2731
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2732
    self forEach:selection do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2733
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2734
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2735
showSelection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2736
    "show the selection - draw hilights - whatever that is"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2737
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2738
    self selectionDo:[:object |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2739
	self showSelected:object
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2740
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2741
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2742
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2743
unselect
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2744
    "unselect - hide selection; clear selection"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2745
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2746
    self hideSelection.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2747
    selection := nil
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2748
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2749
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2750
withSelectionHiddenDo:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2751
    "evaluate aBlock while selection is hidden"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2752
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2753
    |sel|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2754
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2755
    sel := selection.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2756
    sel notNil ifTrue:[self unselect].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2757
    aBlock value.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2758
    sel notNil ifTrue:[self select:sel]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2759
! !
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2760
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2761
!ObjectView methodsFor:'testing objects'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2762
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2763
canMove:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2764
    "return true, if the argument, anObject or a collection can be moved"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2765
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2766
    something isCollection ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2767
	self forEach:something do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2768
	    (theObject canBeMoved) ifFalse:[^ false]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2769
	].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2770
	^ true
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2771
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2772
    ^ something canBeMoved
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2773
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2774
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2775
findObjectAt:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2776
    "find the last object (by looking from back to front) which is hit by
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2777
     the argument, aPoint - this is the topmost object hit"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2778
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2779
    |hdelta|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2780
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2781
    hdelta := self hitDelta.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2782
    contents reverseDo:[:object |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2783
	(object isHitBy:aPoint withDelta:hdelta) ifTrue:[^ object]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2784
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2785
    ^ nil
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2786
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2787
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2788
findObjectAt:aPoint suchThat:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2789
    "find the last object (back to front ) which is hit by
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2790
     the argument, aPoint and for which the testBlock, aBlock evaluates to
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2791
     true"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2792
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2793
    |hdelta|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2794
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2795
    hdelta := self hitDelta.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2796
    contents reverseDo:[:object |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2797
	(object isHitBy:aPoint withDelta:hdelta) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2798
	    (aBlock value:object) ifTrue:[^ object]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2799
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2800
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2801
    ^ nil
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2802
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2803
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2804
findObjectAtVisible:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2805
    "find the last object (by looking from back to front) which is hit by
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2806
     a visible point - this is the topmost object hit.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2807
     This is a leftOver from times when scrolling was not transparent.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2808
     Please use findObjectAt:, since this will vanish."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2809
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2810
    ^ self findObjectAt:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2811
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2812
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2813
findObjectAtVisible:aPoint suchThat:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2814
    "find the last object (back to front ) which is hit by
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2815
     the argument, aPoint and for which the testBlock, aBlock evaluates to
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2816
     true.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2817
     This is a leftOver from times when scrolling was not transparent.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2818
     Please use findObjectAt:suchThat:, since this will vanish."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2819
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2820
    ^ self findObjectAt:aPoint suchThat:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2821
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2822
839
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2823
frameIncludesSelectionHandlesOn:anObject
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2824
    "return true, if anObjects frame includes any selection
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2825
     handles, false if not or if we do not know.
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2826
     This can be used to optimize the redraw, in removeObjectFromSelection.
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2827
     Subclasses which know how selections are highlighted may redefine this."
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2828
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2829
    ^ false     "/ i.e. dont know.
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2830
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2831
    "Created: 1.10.1996 / 12:06:51 / cg"
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2832
!
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2833
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2834
frameOf:anObjectOrCollection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2835
    "answer the maximum extent defined by the argument, anObject or a
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2836
     collection of objects"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2837
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2838
    |first frameAll|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2839
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2840
    anObjectOrCollection isNil ifTrue:[^ nil ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2841
    first := true.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2842
    self forEach:anObjectOrCollection do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2843
	first ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2844
	    frameAll := theObject frame.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2845
	    first := false
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2846
	] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2847
	    frameAll := frameAll merge:(theObject frame)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2848
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2849
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2850
    ^ frameAll
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2851
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2852
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2853
isObscured:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2854
    "return true, if the argument something, anObject or a collection of
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2855
     objects is obscured (partially or whole) by any other object"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2856
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2857
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2858
	(self objectIsObscured:anObject) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2859
	    ^ true
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2860
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2861
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2862
    ^ false
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2863
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2864
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2865
isSelected:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2866
    "return true, if the argument, anObject is in the selection"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2867
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2868
    selection isNil ifTrue:[^ false].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2869
    (selection == anObject) ifTrue:[^ true].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2870
    selection isCollection ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2871
	^ (selection identityIndexOf:anObject startingAt:1) ~~ 0
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2872
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2873
    ^ false
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2874
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2875
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2876
objectIsObscured:objectToBeTested
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2877
    "return true, if the argument, anObject is obscured (partially or whole)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2878
     by any other object"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2879
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2880
    |frameToBeTested frameleft frameright frametop framebot
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2881
     objectsFrame startIndex|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2882
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2883
    (objectToBeTested == (contents last)) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2884
	"quick return if object is on top"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2885
	^ false
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2886
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2887
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2888
    frameToBeTested := self frameOf:objectToBeTested.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2889
    frameleft := frameToBeTested left.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2890
    frameright := frameToBeTested right.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2891
    frametop := frameToBeTested top.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2892
    framebot := frameToBeTested bottom.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2893
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2894
    "check objects after the one to check"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2895
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2896
    startIndex := contents identityIndexOf:objectToBeTested ifAbsent:[self error].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2897
    contents from:(startIndex + 1) to:(contents size) do:[:object |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2898
	objectsFrame := self frameOf:object.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2899
	(objectsFrame right < frameleft) ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2900
	    (objectsFrame left > frameright) ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2901
		(objectsFrame bottom < frametop) ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2902
		    (objectsFrame top > framebot) ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2903
			^ true
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2904
		    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2905
		]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2906
	    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2907
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2908
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2909
    ^ false
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2910
! !
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2911
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2912
!ObjectView methodsFor:'user interface'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2913
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2914
alignToGrid:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2915
    "round aPoint to the next nearest point on the grid"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2916
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2917
    aligning ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2918
	^ aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2919
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2920
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2921
    ^ (aPoint grid:gridAlign) rounded
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2922
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2923
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2924
selectMore:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2925
    "add/remove an object from the selection"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2926
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2927
    |anObject|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2928
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2929
    anObject := self findObjectAt:aPoint.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2930
    anObject notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2931
	(self isSelected:anObject) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2932
	    "remove from selection"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2933
	    self removeFromSelection:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2934
	] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2935
	    "add to selection"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2936
	    self addToSelection:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2937
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2938
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2939
    ^ self
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2940
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2941
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2942
startSelectMoreOrMove:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2943
    "add/remove object hit by aPoint, then start a rectangleDrag or move 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2944
     - if aPoint hits an object, a move is started, otherwise a rectangleDrag.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2945
     This is typically the button shiftPressAction."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2946
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2947
    |anObject|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2948
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2949
    anObject := self findObjectAt:aPoint.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2950
    anObject notNil ifTrue:[
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2951
        (self isSelected:anObject) ifTrue:[
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2952
            "remove from selection"
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2953
            self removeFromSelection:anObject
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2954
        ] ifFalse:[
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2955
            "add to selection"
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2956
            self addToSelection:anObject
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2957
        ].
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2958
        self startObjectMove:selection at:aPoint.
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2959
        ^ self
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2960
    ].
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2961
"/    self unselect.
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2962
"/    self startRectangleDrag:aPoint
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2963
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2964
    "Modified: 30.5.1996 / 18:45:54 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2965
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2966
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2967
startSelectOrMove:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2968
    "start a rectangleDrag or objectMove - if aPoint hits an object,
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2969
     an object move is started, otherwise a rectangleDrag.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2970
     This is typically the button pressAction."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2971
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2972
    |anObject|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2973
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2974
    anObject := self findObjectAt:aPoint.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2975
    anObject notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2976
	(self isSelected:anObject) ifFalse:[self unselect].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2977
	self startObjectMove:anObject at:aPoint.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2978
	^ self
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2979
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2980
    "nothing was hit by this click - this starts a group select"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2981
    self unselect.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2982
    self startRectangleDrag:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2983
! !
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2984
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2985
!ObjectView methodsFor:'view manipulation'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2986
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2987
inchMetric
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2988
    (scaleMetric ~~ #inch) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2989
	scaleMetric := #inch.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2990
	self newGrid
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2991
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2992
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2993
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2994
millimeterMetric
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2995
    (scaleMetric ~~ #mm) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2996
	scaleMetric := #mm.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2997
	self newGrid
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2998
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2999
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3000
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3001
zoom:factor
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3002
    "set a zoom factor; nil or 1 is identity; 2 is magnify by 2;
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3003
     0.5 is shrink by 2"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3004
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3005
    |current|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3006
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3007
    transformation isNil ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3008
        current := 1@1
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3009
    ] ifFalse:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3010
        current := transformation scale
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3011
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3012
    factor asPoint = current asPoint ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3013
        ^ self
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3014
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3015
    current := factor.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3016
    current isNil ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3017
        current := 1
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3018
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3019
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3020
    (current = 1) ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3021
        transformation := nil
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3022
    ] ifFalse:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3023
        transformation := WindowingTransformation scale:current translation:0.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3024
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3025
    self contentsChanged.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3026
    self setInnerClip.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3027
    gridShown ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3028
        self newGrid
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3029
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3030
    shown ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3031
        self invalidate "/ clear; redraw
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3032
    ].
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3033
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3034
    "Modified: 29.5.1996 / 16:20:41 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3035
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3036
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3037
zoomIn
588
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3038
    self zoomIn:2
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3039
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3040
    "Modified: 27.4.1996 / 10:08:50 / cg"
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3041
!
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3042
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3043
zoomIn:factor
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3044
    transformation isNil ifTrue:[
588
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3045
        transformation := WindowingTransformation scale:1 translation:0
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3046
    ].
588
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3047
    transformation := WindowingTransformation 
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3048
                                scale:(transformation scale / factor)
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3049
                                translation:0.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3050
    self contentsChanged.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3051
    self setInnerClip.
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3052
    self invalidate.
588
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3053
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3054
    "Created: 27.4.1996 / 10:08:39 / cg"
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3055
    "Modified: 29.5.1996 / 16:20:46 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3056
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3057
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3058
zoomOut
588
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3059
    self zoomOut:2
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3060
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3061
    "Modified: 27.4.1996 / 10:09:27 / cg"
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3062
!
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3063
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3064
zoomOut:factor
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3065
    transformation isNil ifTrue:[
588
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3066
        transformation := WindowingTransformation scale:1 translation:0
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3067
    ].
588
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3068
    transformation := WindowingTransformation 
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3069
                        scale:(transformation scale * factor)
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3070
                        translation:0.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3071
    self contentsChanged.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3072
    self setInnerClip.
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3073
    self invalidate
588
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3074
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3075
    "Created: 27.4.1996 / 10:09:19 / cg"
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3076
    "Modified: 29.5.1996 / 16:20:49 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3077
! !
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3078
961
1b65b39c5079 aligningMove was undefined.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
  3079
!ObjectView class methodsFor:'documentation'!
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3080
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3081
version
1820
4069e1ed5d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  3082
    ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.65 1999-03-25 14:33:52 cg Exp $'
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3083
! !