ObjectView.st
author Claus Gittinger <cg@exept.de>
Sat, 20 Feb 1999 18:36:31 +0100
changeset 1752 f1e400f163ad
parent 1746 bd570389f315
child 1820 4069e1ed5d3f
permissions -rw-r--r--
moved some handle stuff from DrawView to here, to provide more framework for subclasses.
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
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1325
redrawX:x y:y width:w height:h
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1326
    |redrawFrame |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1327
749
19b1792b9506 clear area before doing a redraw
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
  1328
    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
  1329
    self clearRectangle:redrawFrame.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1330
    ((contents size ~~ 0) or:[gridShown]) ifTrue:[
619
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1331
        self redrawObjectsInVisible:redrawFrame
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1332
    ]
619
ea9172634006 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 592
diff changeset
  1333
749
19b1792b9506 clear area before doing a redraw
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
  1334
    "Modified: 5.6.1996 / 10:42:19 / cg"
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1335
! !
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1336
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1337
!ObjectView methodsFor:'grid manipulation'!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1338
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1339
alignOff
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1340
    "do no align point to grid"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1341
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1342
    aligning := false
71
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1343
!
9fd1c36af7a8 last version before big scrolling change
claus
parents: 70
diff changeset
  1344
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1345
alignOn
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1346
    "align points to grid"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1347
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1348
    aligning := true.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1349
    self getAlignParameters
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1350
!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1351
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1352
defineGrid
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  1353
    "define the grid pattern - this creates the gridPixmap, which is
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  1354
     used as viewBackground when a grid is to be shown.
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  1355
     The grid is specified by the value returned from gridParameters,
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  1356
     which can be redefined in subclasses. See the comment there on how
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  1357
     the numbers are interpreted."
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1358
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1359
    |mmH mmV params showDocumentBoundary gridW gridH 
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1360
     bigStepH bigStepV littleStepH littleStepV hires|
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1361
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1362
    mmH := self horizontalPixelPerMillimeter.
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1363
    mmV := self verticalPixelPerMillimeter.
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1364
    hires := self horizontalPixelPerInch > 120.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1365
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1366
    params := self gridParameters.
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1367
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1368
    bigStepH := params at:1.
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1369
    bigStepV := params at:2.
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1370
    littleStepH := params at:3.
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1371
    littleStepV := params at:4.
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1372
    showDocumentBoundary := params at:7.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1373
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1374
    transformation notNil ifTrue:[
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1375
        mmH := mmH * transformation scale x.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1376
        mmV := mmV * transformation scale y.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1377
        bigStepH := bigStepH * transformation scale x.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1378
        bigStepV := bigStepV * transformation scale y.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1379
        littleStepH notNil ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1380
            littleStepH := littleStepH * transformation scale x.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1381
        ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1382
        littleStepV notNil ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1383
            littleStepV := littleStepV * transformation scale y.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1384
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1385
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1386
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1387
    bigStepH isNil ifTrue:[^ self].
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1388
1490
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1389
    gridW := (self widthOfContentsInMM * mmH).
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1390
    gridH := (self heightOfContentsInMM * mmV).
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1391
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1392
    self withWaitCursorDo:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1393
        |xp yp y x|
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1394
1490
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1395
        ((bigStepH isInteger and:[littleStepH isNil or:[littleStepH isInteger]])
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1396
        and:[(bigStepV isInteger and:[littleStepV isNil or:[littleStepV isInteger]])]) ifTrue:[
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1397
            gridW := bigStepH.
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1398
            littleStepH notNil ifTrue:[gridW := gridW max:littleStepH].
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1399
            gridH := bigStepV.
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1400
            littleStepV notNil ifTrue:[gridH := gridH max:littleStepV].
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1401
        ] ifFalse:[
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1402
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1403
            "
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1404
             up to next full unit
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1405
            "
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1406
            gridW := ((gridW // bigStepH) + 1 * bigStepH) asInteger.
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1407
            gridH := ((gridH // bigStepV) + 1 * bigStepV) asInteger.
757c7f49de8e tuned for small integer-sized grid-backgrounds
tz
parents: 1435
diff changeset
  1408
        ].
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1409
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1410
        gridPixmap := Form width:gridW height:gridH depth:1.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1411
        gridPixmap colorMap:(Array with:White with:Black).
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1412
        gridPixmap clear.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1413
        gridPixmap paint:(Color colorId:1).
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1414
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1415
        "draw first row point-by-point"
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1416
        yp := 0.0.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1417
        xp := 0.0.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1418
        y := yp asInteger.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1419
        [xp <= gridW] whileTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1420
            x := xp rounded.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1421
            hires ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1422
                gridPixmap displayPointX:(x + 1) y:y.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1423
                gridPixmap displayPointX:(x + 2) y:y
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
            gridPixmap displayPointX:x y:y.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1426
            littleStepH notNil ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1427
                xp := xp + littleStepH
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1428
            ] ifFalse:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1429
                xp := xp + bigStepH
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1430
            ]
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1431
        ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1432
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1433
        "copy rest from what has been drawn already"
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1434
        yp := yp + bigStepV.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1435
        [yp <= gridH] whileTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1436
            y := yp rounded.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1437
            hires ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1438
                gridPixmap copyFrom:gridPixmap x:0 y:0 
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1439
                                             toX:0 y:(y + 1)
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1440
                                           width:gridW height:1.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1441
                gridPixmap copyFrom:gridPixmap x:0 y:0 
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1442
                                             toX:0 y:(y + 2)
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1443
                                           width:gridW height:1
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1444
            ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1445
            gridPixmap copyFrom:gridPixmap x:0 y:0 
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1446
                                         toX:0 y:y
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1447
                                       width:gridW height:1.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1448
            yp := yp + bigStepV
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1449
        ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1450
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1451
        "draw first col point-by-point"
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1452
        xp := 0.0.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1453
        yp := 0.0.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1454
        x := xp asInteger.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1455
        [yp <= gridH] whileTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1456
            y := yp rounded.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1457
            hires ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1458
                gridPixmap displayPointX:x y:(y + 1).
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1459
                gridPixmap displayPointX:x y:(y + 2)
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
            gridPixmap displayPointX:x y:y.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1462
            littleStepV notNil ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1463
                yp := yp + littleStepV
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1464
            ] ifFalse:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1465
                yp := yp + bigStepV
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1466
            ]
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1467
        ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1468
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1469
        "copy rest from what has been drawn already"
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1470
        xp := xp + bigStepH.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1471
        [xp <= gridW] whileTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1472
            x := xp rounded.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1473
            hires ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1474
                gridPixmap copyFrom:gridPixmap x:0 y:0 
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1475
                                             toX:(x + 1) y:0
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1476
                                           width:1 height:gridH.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1477
                gridPixmap copyFrom:gridPixmap x:0 y:0 
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1478
                                             toX:(x + 2) y:0
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1479
                                           width:1 height:gridH
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1480
            ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1481
            gridPixmap copyFrom:gridPixmap x:0 y:0 
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1482
                                         toX:x y:0
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1483
                                       width:1 height:gridH.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1484
            xp := xp + bigStepH
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1485
        ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1486
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1487
        showDocumentBoundary ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1488
             "
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1489
             mark the right-end and bottom of the document
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 displayLineFromX:gridW-1 y:0 toX:gridW-1 y:gridH-1.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  1492
            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
  1493
        ].
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1494
    ]
256
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
    "Modified: 14.12.1995 / 20:59:38 / cg"
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1497
!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1498
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1499
getAlignParameters
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1500
    |params|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1501
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1502
    params := self gridParameters.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1503
    gridAlign := (params at:5) @ (params at:6)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1504
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1505
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1506
gridParameters
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1507
    "used by defineGrid, and in a separate method for
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1508
     easier redefinition in subclasses. 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1509
     Returns the grid parameters in an array of 7 elements,
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1510
     which control the appearance of the grid-pattern.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1511
     the elements are:
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1512
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1513
	bigStepH        number of pixels horizontally between 2 major steps
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1514
	bigStepV        number of pixels vertically between 2 major steps
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1515
	littleStepH     number of pixels horizontally between 2 minor steps
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1516
	littleStepV     number of pixels vertically between 2 minor steps
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1517
	gridAlignH      number of pixels for horizontal grid align (pointer snap)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1518
	gridAlignV      number of pixels for vertical grid align (pointer snap)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1519
	docBounds       true, if document boundary should be shown
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1520
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1521
     if littleStepH/V are nil, only bigSteps are drawn.
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
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1524
    |mmH mmV bigStepH bigStepV littleStepH littleStepV arr|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1525
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1526
    "example: 12grid & 12snapIn"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1527
"/    ^ #(12 12 nil nil 12 12 false).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1528
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1529
    "example: 12grid & 24snapIn"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1530
"/    ^ #(12 12 nil nil 24 24 false).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1531
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1532
    "default: cm/mm grid & mm snapIn for metric,
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1533
     1inch , 1/8inch grid & 1/8 inch snapIn"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1534
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1535
    mmH := self horizontalPixelPerMillimeter.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1536
    mmV := self verticalPixelPerMillimeter.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1537
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
     metric grid: small steps every millimeter, big step every
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1540
     centimeter. If the transformation is shrinking, turn off little
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1541
     steps.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1542
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1543
    (scaleMetric == #mm) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1544
	"dots every mm; lines every cm"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1545
	bigStepH := mmH * 10.0.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1546
	bigStepV := mmV * 10.0.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1547
	(transformation notNil
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1548
	and:[transformation scale <= 0.5]) ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1549
	    littleStepH := mmH.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1550
	    littleStepV := mmV
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1551
	]
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
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1554
     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
  1555
     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
  1556
     or even turn them off completely.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1557
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1558
    (scaleMetric == #inch) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1559
	"dots every eights inch; lines every half inch"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1560
	bigStepH := mmH * (25.4 / 2).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1561
	bigStepV := mmV * (25.4 / 2).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1562
	(transformation notNil
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1563
	and:[transformation scale <= 0.5]) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1564
	    transformation scale > 0.2 ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1565
		littleStepH := mmH * (25.4 / 4).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1566
		littleStepV := mmV * (25.4 / 4)
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
	] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1569
	    littleStepH := mmH * (25.4 / 8).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1570
	    littleStepV := mmV * (25.4 / 8)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1571
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1572
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1573
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1574
    arr := Array new:8.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1575
    arr at:1 put:bigStepH.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1576
    arr at:2 put:bigStepV.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1577
    arr at:3 put:littleStepH.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1578
    arr at:4 put:littleStepV.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1579
    arr at:5 put:littleStepH.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1580
    arr at:6 put:littleStepV.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1581
    arr at:7 put:false.
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
    ^ arr
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1584
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1585
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1586
hideGrid
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1587
    "hide the grid"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1588
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1589
    gridShown := false.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1590
    self newGrid
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1591
!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  1592
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1593
newGrid
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1594
    "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
  1595
     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
  1596
     clears the view and redraws all visible objects."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1597
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1598
    gridPixmap := nil.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1599
    shown ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  1600
        self viewBackground:White.
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  1601
        self clear.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1602
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1603
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1604
    gridShown ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  1605
        self defineGrid.
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  1606
        self viewBackground:gridPixmap.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1607
    ].
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  1608
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  1609
    self invalidate
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  1610
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  1611
    "Modified: 29.5.1996 / 16:20:11 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1612
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1613
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1614
showGrid
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1615
    "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
  1616
     gridParameters, which can be redefined in concrete subclasses."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1617
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1618
    gridShown := true.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1619
    self newGrid
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1620
! !
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1621
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1622
!ObjectView methodsFor:'initialization'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1623
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1624
initEvents
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1625
"/    self backingStore:true.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1626
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1627
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1628
initialize
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1629
    super initialize.
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
    viewBackground := White.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1632
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1633
    bitGravity := #NorthWest.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1634
    contents := OrderedCollection new.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1635
    gridShown := false.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1636
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1637
    canDragOutOfView := false.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1638
    rootView := DisplayRootView new.
1220
9bc6add9aa54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1186
diff changeset
  1639
    rootView clippedByChildren:false.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1640
    rootMotion := false.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1641
    self setInitialDocumentFormat.
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
    leftHandCursor := Cursor leftHand.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1644
    sorted := false.
961
1b65b39c5079 aligningMove was undefined.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
  1645
    aligning := false.
1b65b39c5079 aligningMove was undefined.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
  1646
    aligningMove := false.
1b65b39c5079 aligningMove was undefined.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
  1647
1b65b39c5079 aligningMove was undefined.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
  1648
    "Modified: 20.1.1997 / 20:41:10 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1649
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1650
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1651
setInitialDocumentFormat
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1652
    (Smalltalk language == #english) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1653
	documentFormat := 'letter'.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1654
	scaleMetric := #inch
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1655
    ] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1656
	documentFormat := 'a4'.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1657
	scaleMetric := #mm
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1658
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1659
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1660
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1661
!ObjectView methodsFor:'layout manipulation'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1662
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1663
alignBottom:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1664
    |botMost|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1665
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1666
    botMost := -999999.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1667
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1668
	botMost := botMost max:(anObject frame bottom)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1669
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1670
    self withSelectionHiddenDo:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1671
	self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1672
	    self moveObject:anObject to:(anObject frame left)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1673
					@
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1674
					(botMost - (anObject frame height))
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
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1677
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1678
747
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1679
alignHorizontal:something
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1680
    "align selection along their center horizontally"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1681
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1682
    |topMost bottomMost h|
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1683
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1684
    topMost := 999999.
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1685
    bottomMost := -999999.
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1686
    self forEach:something do:[:anObject |
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1687
        |f|
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1688
        f := anObject frame.
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1689
        topMost := topMost min:(f top).
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1690
        bottomMost := bottomMost max:(f bottom).
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
    h := bottomMost - topMost.
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
    self withSelectionHiddenDo:[
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1695
        self forEach:something do:[:anObject |
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1696
            self moveObject:anObject 
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1697
                         to:(anObject frame left)
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1698
                            @
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1699
                            (topMost + ((h - anObject frame height) // 2))
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1700
        ]
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
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1703
    "Created: 4.6.1996 / 20:01:19 / cg"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1704
    "Modified: 4.6.1996 / 21:19:48 / cg"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1705
!
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1706
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1707
alignLeft:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1708
    |leftMost|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1709
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1710
    leftMost := 999999.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1711
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1712
	leftMost := leftMost min:(anObject frame left)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1713
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1714
    self withSelectionHiddenDo:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1715
	self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1716
	    self moveObject:anObject to:(leftMost @ (anObject frame top))
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1717
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1718
    ]
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
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1721
alignRight:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1722
    |rightMost|
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
    rightMost := -999999.
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
	rightMost := rightMost max:(anObject frame right)
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
    self withSelectionHiddenDo:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1729
	self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1730
	    self moveObject:anObject to:(rightMost - (anObject frame width))
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1731
					 @ (anObject frame top)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1732
	]
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
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1735
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1736
alignTop:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1737
    |topMost|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1738
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1739
    topMost := 999999.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1740
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1741
	topMost := topMost min:(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
    self withSelectionHiddenDo:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1744
	self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1745
	    self moveObject:anObject to:((anObject frame left) @ topMost)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1746
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1747
    ]
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
747
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1750
alignVertical:something
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1751
    "align selection along their center vertically"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1752
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1753
    |leftMost rightMost w|
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1754
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1755
    leftMost := 999999.
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1756
    rightMost := -999999.
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1757
    self forEach:something do:[:anObject |
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1758
        |f|
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1759
        f := anObject frame.
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1760
        rightMost := rightMost max:(f right).
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1761
        leftMost := leftMost min:(f left).
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
    w := rightMost - leftMost.
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
    self withSelectionHiddenDo:[
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1766
        self forEach:something do:[:anObject |
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1767
            self moveObject:anObject 
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1768
                         to:(leftMost + ((w - anObject frame width) // 2))
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1769
                            @
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1770
                            (anObject frame top)
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1771
        ]
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
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1774
    "Created: 4.6.1996 / 19:59:16 / cg"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1775
    "Modified: 4.6.1996 / 21:19:58 / cg"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1776
!
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1777
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1778
move:something by:delta
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1779
    "change the position of something, an Object or Collection 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1780
     by delta, aPoint"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1781
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1782
    (delta x == 0) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1783
	(delta y == 0) ifTrue:[^ self]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1784
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1785
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1786
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1787
	self moveObject:anObject by:delta
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1788
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1789
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1790
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1791
move:something to:aPoint in:aView
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1792
    "can only happen when dragOutOfView is true
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1793
     - should be redefined in subclasses"
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
    self notify:'cannot move object(s) out of view'
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1796
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1797
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1798
move:something to:aPoint inAlienViewId:aViewId
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1799
    "can only happen when dragOutOfView is true
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1800
     - should be redefined in subclasses"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1801
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1802
    self notify:'cannot move object(s) to alien views'
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  1803
!
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  1804
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1805
moveObject:anObject by:delta
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1806
    "change the position of anObject by delta, aPoint"
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
    self moveObject:anObject to:(anObject origin + delta)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1809
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1810
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1811
moveObject:anObject to:newOrigin
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1812
    "move anObject to newOrigin, aPoint"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1813
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1814
    |oldOrigin oldFrame newFrame 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1815
     objectsIntersectingOldFrame objectsIntersectingNewFrame 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1816
     wasObscured isObscured intersects
701
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1817
     oldLeft oldTop w h newLeft newTop griddedNewOrigin clip|
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1818
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1819
    anObject isNil ifTrue:[^ self].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1820
    anObject canBeMoved ifFalse:[^ self].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1821
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1822
    griddedNewOrigin := self alignToGrid:newOrigin.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1823
    oldOrigin := anObject origin.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1824
    (oldOrigin = griddedNewOrigin) ifTrue:[^ self].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1825
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1826
    oldFrame := self frameOf:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1827
    objectsIntersectingOldFrame := self objectsIntersecting:oldFrame.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1828
    wasObscured := self isObscured:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1829
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1830
    anObject moveTo:griddedNewOrigin.
782
f963155637e3 dont redraw in moveObject: when not visible
ca
parents: 749
diff changeset
  1831
    shown ifFalse:[^ self].
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1832
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1833
    newFrame := self frameOf:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1834
    objectsIntersectingNewFrame := self objectsIntersecting:newFrame.
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
    "try to redraw the minimum possible"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1837
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1838
    "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
  1839
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1840
    intersects := oldFrame intersects:newFrame.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1841
    intersects ifFalse:[
701
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1842
        gridShown ifFalse:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1843
            transformation isNil ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1844
                (objectsIntersectingOldFrame size == 1) ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1845
                    (objectsIntersectingNewFrame size == 1) ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1846
                        clip := self clippingRectangleOrNil.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1847
                        (clip isNil or:[oldFrame isContainedIn:clip]) ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1848
                            oldLeft := oldFrame left.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1849
                            oldTop := oldFrame top.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1850
                            newLeft := newFrame left.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1851
                            newTop := newFrame top.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1852
                            w := oldFrame width.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1853
                            h := oldFrame height.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1854
                            ((newLeft < width) and:[newTop < height]) ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1855
                                ((newLeft >= 0) and:[newTop >= 0]) ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1856
                                    self catchExpose.
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  1857
                                    self 
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  1858
                                        copyFrom:self 
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  1859
                                        x:oldLeft y:oldTop
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  1860
                                        toX:newLeft y:newTop
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  1861
                                        width:w height:h
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  1862
                                        async:true.
701
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1863
                                    self waitForExpose
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1864
                                ]
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1865
                            ].
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1866
                            ((oldLeft < width) and:[oldTop < height]) ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1867
                                ((oldLeft >= 0) and:[oldTop >= 0]) ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1868
                                  self clearRectangleX:oldLeft y:oldTop width:w height:h.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1869
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1870
"/                                self fillRectangleX:oldLeft y:oldTop width:w height:h
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1871
"/                                               with:viewBackground
701
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1872
                                ]
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1873
                            ].
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1874
                            ^ self
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
                    ]
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1877
                ]
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1878
            ]
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1879
        ]
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1880
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1881
    isObscured := self isObscured:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1882
    (oldFrame intersects:newFrame) ifTrue:[
701
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1883
        isObscured ifFalse:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1884
            self redrawObjectsIn:oldFrame.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1885
            self show: anObject
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1886
        ] ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1887
            self redrawObjectsIn:(oldFrame merge:newFrame)
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1888
        ]
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1889
    ] ifFalse:[
701
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1890
        self redrawObjectsIn:oldFrame.
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1891
        isObscured ifFalse:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1892
            self show: anObject
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1893
        ] ifTrue:[
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1894
            self redrawObjectsIn:newFrame
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1895
        ]
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1896
    ]
701
8079d5ac8637 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 700
diff changeset
  1897
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 961
diff changeset
  1898
    "Modified: 29.1.1997 / 13:07:07 / cg"
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
  1899
!
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
  1900
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1901
objectToBack:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1902
    "bring the argument, anObject to back"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1903
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1904
    anObject notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1905
	contents remove:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1906
	contents addFirst:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1907
	(self isObscured:anObject) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1908
	    self redrawObjectsIn:(anObject frame)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1909
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1910
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1911
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1912
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1913
objectToFront:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1914
    "bring the argument, anObject to front"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1915
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1916
    |wasObscured|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1917
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1918
    anObject notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1919
	wasObscured := self isObscured:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1920
	contents remove:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1921
	contents addLast:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1922
	wasObscured ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1923
"old:
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1924
	    self redrawObjectsIn:(anObject frame)
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
	    self hideSelection.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1927
	    self show:anObject.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1928
	    self showSelection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1929
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1930
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1931
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1932
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1933
selectionAlignBottom
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1934
    "align selected objects at bottom"
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 alignBottom:selection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1937
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1938
747
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1939
selectionAlignHorizontal
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1940
    "align selected objects horizontally"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1941
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1942
    self alignHorizontal:selection
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1943
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1944
    "Created: 4.6.1996 / 19:58:46 / cg"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1945
    "Modified: 4.6.1996 / 19:59:10 / cg"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1946
!
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1947
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1948
selectionAlignLeft
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1949
    "align selected objects left"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1950
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1951
    self alignLeft:selection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1952
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1953
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1954
selectionAlignRight
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1955
    "align selected objects right"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1956
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1957
    self alignRight:selection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1958
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1959
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1960
selectionAlignTop
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1961
    "align selected objects at top"
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
    self alignTop:selection
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
  1964
!
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
  1965
747
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1966
selectionAlignVertical
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1967
    "align selected objects vertically"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1968
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1969
    self alignVertical:selection
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1970
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1971
    "Created: 4.6.1996 / 19:59:00 / cg"
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1972
!
54cd4d5f9e66 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1973
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1974
selectionToBack
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1975
    "bring the selection to back"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1976
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1977
    self toBack:selection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1978
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1979
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1980
selectionToFront
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1981
    "bring the selection to front"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1982
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1983
    self toFront:selection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1984
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1985
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1986
toBack:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1987
    "bring the argument, anObject or a collection of objects to back"
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
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1990
	self objectToBack:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1991
    ]
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
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1994
toFront:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1995
    "bring the argument, anObject or a collection of objects to front"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1996
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1997
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1998
	self objectToFront:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  1999
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2000
! !
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
!ObjectView methodsFor:'misc'!
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
documentFormat:aFormatString
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2005
    "set the document format (mostly used by scrollbars).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2006
     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
  2007
     or 'letter'. 
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2008
     See the UnitConverter class for supported formats."
216
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
    aFormatString ~= documentFormat ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2011
        documentFormat := aFormatString.
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2012
        self contentsChanged.
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2013
        self defineGrid.
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2014
        gridShown ifTrue:[
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2015
            self invalidate "/ clear; redraw
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2016
        ]
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2017
    ]
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2018
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2019
    "Modified: 31.5.1996 / 19:44:08 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2020
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2021
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2022
forEach:aCollection do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2023
    "apply block to every object in a collectioni;
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2024
     (adds a check for non-collection)"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2025
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2026
    aCollection isNil ifTrue:[^self].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2027
    aCollection isCollection ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2028
	aCollection do:[:object |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2029
	    object notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2030
		aBlock value:object
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
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2033
    ] ifFalse: [
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2034
	aBlock value:aCollection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2035
    ]
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
  2036
!
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
  2037
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2038
hitDelta
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2039
    "when clicking an object, allow for hitDelta pixels around object.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2040
     We compensate for any scaling here, to get a constant physical
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2041
     hitDelta (i.e. the value returned here is inverse scaled)."
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
    |delta|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2044
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2045
    delta := self class hitDelta.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2046
    transformation notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2047
	delta := delta / transformation scale x
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2048
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2049
    ^ delta
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2050
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2051
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2052
numberOfObjectsIntersecting:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2053
    "answer the number of objects intersecting the argument, aRectangle"
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
    |tally|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2056
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2057
    tally := 0.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2058
    contents do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2059
	(theObject frame intersects:aRectangle) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2060
	    tally := tally + 1
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
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2063
    ^ tally
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
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2066
numberOfObjectsIntersectingVisible:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2067
    "answer the number of objects intersecting the argument, aRectangle.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2068
     This is a leftOver from times when scrolling was not transparent.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2069
     Please use numberOfObjectsIntersecting:, since this will vanish."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2070
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2071
    ^ self numberOfObjectsIntersecting:aRectangle
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
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2074
objectsAbove:objectToBeTested do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2075
    "do something to every object above objectToBeTested
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2076
     (does not mean obscured - simply above in hierarchy)"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2077
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2078
    |startIndex|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2079
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2080
    startIndex := contents identityIndexOf:objectToBeTested
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2081
				  ifAbsent:[self error].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2082
    contents from:startIndex to:(contents size) do:aBlock
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
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2085
objectsAbove:anObject intersecting:aRectangle do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2086
    "do something to every object above objectToBeTested
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2087
     and intersecting aRectangle"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2088
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2089
    self objectsAbove:anObject do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2090
	(theObject frame intersects:aRectangle) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2091
	    aBlock value:theObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2092
	]
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
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2096
objectsBelow:objectToBeTested do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2097
    "do something to every object below objectToBeTested
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2098
     (does not mean obscured by - simply below in hierarchy)"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2099
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2100
    |endIndex|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2101
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2102
    endIndex := contents identityIndexOf:objectToBeTested ifAbsent:[self error].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2103
    contents from:1 to:(endIndex - 1) do:aBlock
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
objectsIn:aRectangle do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2107
    "do something to every object which is completely in a rectangle"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2108
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2109
    |bot|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2110
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2111
    sorted ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2112
	bot := aRectangle bottom.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2113
	contents do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2114
	    (theObject isContainedIn:aRectangle) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2115
		aBlock value:theObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2116
	    ] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2117
		theObject frame top > bot ifTrue:[^ self]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2118
	    ]
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2119
	].
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2120
	^ self
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2121
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2122
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
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2127
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2128
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2129
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2130
objectsInVisible:aRectangle do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2131
    "do something to every object which is completely in a 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2132
     visible rectangle.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2133
     This is a leftOver from times when scrolling was not transparent.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2134
     Please use objectsIn:do:, since this will vanish."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2135
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2136
    self objectsIn:aRectangle do:aBlock
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
objectsIntersecting:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2140
    "answer a Collection of objects intersecting the argument, aRectangle"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2141
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2142
    |newCollection|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2143
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2144
    newCollection := OrderedCollection new.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2145
    self objectsIntersecting:aRectangle do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2146
	newCollection add:theObject
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
    (newCollection size == 0) ifTrue:[^ nil].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2149
    ^ newCollection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2150
!
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
objectsIntersecting:aRectangle do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2153
    "do something to every object which intersects a rectangle"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2154
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2155
    |f top bot
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2156
     firstIndex "{ Class: SmallInteger }"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2157
     delta      "{ Class: SmallInteger }"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2158
     theObject 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2159
     nObjects   "{ Class: SmallInteger }"|
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
    nObjects := contents size.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2162
    (nObjects == 0) ifTrue:[^ self].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2163
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2164
    sorted ifFalse:[
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2165
	"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2166
	 have to check every object
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2167
	"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2168
	contents do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2169
	    (theObject frame intersects:aRectangle) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2170
		aBlock value:theObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2171
	    ]
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  2172
	].
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2173
	^ self
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2174
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2175
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2176
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2177
     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
  2178
     object which intersects aRectangle and 
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2179
     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
  2180
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2181
    bot := aRectangle bottom.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2182
    top := aRectangle top.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2183
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
     binary search for an object in aRectangle ...
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
    delta := nObjects // 2.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2188
    firstIndex := delta.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2189
    (firstIndex == 0) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2190
       firstIndex := 1
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2191
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2192
    theObject := contents at:firstIndex.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2193
    (theObject frame bottom < top) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2194
	[theObject frame bottom < top and:[delta > 1]] whileTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2195
	    delta := delta // 2.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2196
	    firstIndex := firstIndex + delta.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2197
	    theObject := contents at:firstIndex
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2198
	]
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  2199
    ] ifFalse:[
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2200
	[theObject frame top > bot and:[delta > 1]] whileTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2201
	    delta := delta // 2.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2202
	    firstIndex := firstIndex - delta.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2203
	    theObject := contents at:firstIndex
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2204
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2205
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2206
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2207
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2208
     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
  2209
     following first non-visible
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2210
    "
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2211
    [theObject frame bottom > top and:[firstIndex > 1]] whileTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2212
	firstIndex := firstIndex - 1.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2213
	theObject := contents at:firstIndex
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  2214
    ].
87
2c6ab478466a *** empty log message ***
claus
parents: 83
diff changeset
  2215
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2216
    firstIndex to:nObjects do:[:index |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2217
	theObject := contents at:index.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2218
	f := theObject frame.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2219
	(f intersects:aRectangle) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2220
	    aBlock value:theObject
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  2221
	] ifFalse:[
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2222
	    (f top > bot) ifTrue:[^ self]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2223
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2224
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2225
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2226
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2227
objectsIntersectingVisible:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2228
    "answer a Collection of objects intersecting a visible aRectangle.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2229
     This is a leftOver from times when scrolling was not transparent.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2230
     Please use objectsIntersecting:, since this will vanish."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2231
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2232
    ^ self objectsIntersecting:aRectangle
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
objectsIntersectingVisible:aRectangle do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2236
    "do something to every object which intersects a visible rectangle.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2237
     This is a leftOver from times when scrolling was not transparent.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2238
     Please use objectsIntersecting:do:, since this will vanish."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2239
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2240
    self objectsIntersecting:aRectangle do:aBlock
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
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2243
rectangleForScroll
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2244
    "find the area occupied by visible objects"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2245
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2246
    |left right top bottom frame oLeft oRight oTop oBottom|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2247
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2248
    left := 9999.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2249
    right := 0.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2250
    top := 9999.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2251
    bottom := 0.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2252
    self visibleObjectsDo:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2253
	frame := anObject frame.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2254
	oLeft := frame left.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2255
	oRight := frame right.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2256
	oTop := frame top.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2257
	oBottom := frame bottom.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2258
	(oLeft < left) ifTrue:[left := oLeft].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2259
	(oRight > right) ifTrue:[right := oRight].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2260
	(oTop < top) ifTrue:[top := oTop].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2261
	(oBottom > bottom) ifTrue:[bottom := oBottom]
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  2262
    ].
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2263
    (left < margin) ifTrue:[left := margin].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2264
    (top < margin) ifTrue:[top := margin].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2265
    (right > (width - margin)) ifTrue:[right := width - margin].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2266
    (bottom > (height - margin)) ifTrue:[bottom := height - margin].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2267
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2268
    ((left > right) or:[top > bottom]) ifTrue:[^ nil].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2269
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2270
    ^ Rectangle left:left right:right top:top bottom:bottom
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2271
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2272
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2273
setDefaultActions
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2274
    motionAction := [:movePoint | nil].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2275
    releaseAction := [nil]
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  2276
!
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
  2277
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2278
visibleObjectsDo:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2279
    "do something to every visible object"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2280
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2281
    |absRect|
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
    absRect := Rectangle left:0 top:0 width:width height:height.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2284
    self objectsIntersecting:absRect do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2285
! !
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2286
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2287
!ObjectView methodsFor:'queries'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2288
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2289
heightOfContents
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2290
    "answer the height of the document in pixels"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2291
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2292
    |h|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2293
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2294
    h := self heightOfContentsInMM * (self verticalPixelPerMillimeter:1).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2295
    ^ h rounded
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2296
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2297
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2298
heightOfContentsInMM
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2299
    "answer the height of the document in millimeters"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2300
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2301
    |unit value|
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2302
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2303
    "landscape"
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2304
    unit := (documentFormat , 'H') asSymbolIfInterned.
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2305
    unit isNil ifTrue:[
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2306
        "/ certainly unknown
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2307
    ] ifFalse:[
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2308
        value := UnitConverter convert:1 from:unit to:#millimeter
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2309
    ].
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2310
    value isNil ifTrue:[
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2311
        "/ assuming window size is document size
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2312
        value := (height / self verticalPixelPerMillimeter:1) asInteger
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2313
    ].
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2314
    ^ value
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2315
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2316
    "Modified: 31.5.1996 / 19:38:51 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2317
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2318
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2319
widthOfContents
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2320
    "answer the width of the document in pixels"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2321
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2322
    |w|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2323
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2324
    w := self widthOfContentsInMM * (self horizontalPixelPerMillimeter:1).
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2325
    ^ w rounded
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2326
!
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
widthOfContentsInMM
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2329
    "answer the width of the document in millimeters"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2330
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2331
    |unit value|
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2332
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2333
    "landscape"
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2334
    unit := (documentFormat , 'W') asSymbolIfInterned.
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2335
    unit isNil ifTrue:[
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2336
        "/ certainly unknown
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2337
    ] ifFalse:[
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2338
        value := UnitConverter convert:1 from:unit to:#millimeter
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2339
    ].
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2340
    value isNil ifTrue:[
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2341
        "/ assuming window size is document size
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2342
        value := (width / self horizontalPixelPerMillimeter:1) asInteger
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2343
    ].
736
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2344
    ^ value
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2345
53d23f1eb6af use UnitConverter for page sizes
Claus Gittinger <cg@exept.de>
parents: 733
diff changeset
  2346
    "Modified: 31.5.1996 / 19:38:22 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2347
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2348
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2349
!ObjectView methodsFor:'saving / restoring'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2350
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2351
fileInContentsFrom:aStream
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
  2352
    "remove all objects, load new contents from aStream and redraw"
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
  2353
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2354
    self fileInContentsFrom:aStream redraw:true new:true binary:false
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  2355
!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  2356
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  2357
fileInContentsFrom:aStream redraw:redraw
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  2358
    "remove all objects, load new contents from aStream 
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  2359
     and redraw if the redraw argument is true"
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  2360
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2361
    self fileInContentsFrom:aStream redraw:redraw new:true binary:false
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2362
!
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2363
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2364
fileInContentsFrom:aStream redraw:redraw new:new 
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2365
    "remove all objects, load new contents from aStream 
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2366
     and redraw if the redraw argument is true"
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2367
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2368
    self fileInContentsFrom:aStream redraw:redraw new:new binary:false
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2369
!
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2370
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2371
fileInContentsFrom:aStream redraw:redraw new:new binary:binary
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2372
    "if the new argument is true, remove all objects.
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2373
     Then load objects from aStream. If redraw is false, no redraw
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2374
     is done
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2375
     (allows fileIn of multiple files doing a single redraw at the end)."
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2376
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2377
    binary ifTrue:[
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2378
        aStream binary
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2379
    ].
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2380
    self topView withReadCursorDo:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2381
        |newObject chunk individualRedraw|
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2382
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2383
        self unselect.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2384
        individualRedraw := redraw.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2385
        new ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2386
            self removeAll.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2387
            individualRedraw := false.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2388
        ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2389
        [aStream atEnd] whileFalse:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2390
            binary ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2391
                newObject := Object readBinaryFrom:aStream
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2392
            ] ifFalse:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2393
                chunk := aStream nextChunk.
1746
bd570389f315 (notNil and:[isEmpty not]) -> (size > 0)
Claus Gittinger <cg@exept.de>
parents: 1741
diff changeset
  2394
                (chunk size > 0) ifTrue:[
1435
56de6db05972 dont compile expressions, when reading an ObjectView tree.
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
  2395
                    newObject := Compiler evaluate:chunk compile:false.
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2396
                ] ifFalse:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2397
                    newObject := nil
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
            ].
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2400
            newObject notNil ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2401
                self initializeFileInObject:newObject.
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2402
                individualRedraw ifFalse:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2403
                    self addObjectWithoutRedraw:newObject
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2404
                ] ifTrue:[
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2405
                    self addObject:newObject
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2406
                ]
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2407
            ]
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
        (new and:[redraw]) ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2410
            self invalidate
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2411
        ]
77
565b052f5277 *** empty log message ***
claus
parents: 71
diff changeset
  2412
    ]
256
c55a4f8d8a70 use withWaitCursorDo: / withReadCursorDo:
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
  2413
1435
56de6db05972 dont compile expressions, when reading an ObjectView tree.
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
  2414
    "Modified: / 30.1.1998 / 01:02:16 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2415
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2416
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2417
initializeFileInObject:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2418
    "each object may be processed here after its being filed-in
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2419
     - subclasses may do whatever they want here ...
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2420
     (see LogicView for example)"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2421
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2422
    ^ self
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2423
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2424
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2425
storeBinaryContentsOn:aStream
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2426
    "store the contents in binary representation on aStream."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2427
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2428
    aStream binary.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2429
    self topView withCursor:Cursor write do:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2430
	self forEach:contents do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2431
	    theObject storeBinaryOn:aStream.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2432
	].
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
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2436
storeContentsOn:aStream
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2437
    "store the contents in textual representation on aStream.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2438
     Notice, that for huge objects (such as DrawImages) this ascii output
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2439
     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
  2440
     long."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2441
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2442
    |excla|
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
    self topView withCursor:Cursor write do:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2445
	excla := aStream class chunkSeparator.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2446
	self forEach:contents do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2447
	    theObject storeOn:aStream.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2448
	    aStream nextPut:excla.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2449
	    aStream cr
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2450
	].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2451
	aStream nextPut:excla
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2452
    ]
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
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2455
withoutRedrawFileInContentsFrom:aStream
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2456
    "remove all objects, load new contents from aStream without any redraw"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2457
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2458
    self fileInContentsFrom:aStream redraw:false new:true binary:false
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2459
! !
216
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
!ObjectView methodsFor:'scrolling'!
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
horizontalScrollStep
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2464
    "return the amount to scroll when stepping left/right.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2465
     Redefined to scroll by inches or centimeters."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2466
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2467
    scaleMetric == #inch ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2468
	^ (device horizontalPixelPerInch * (1/2)) asInteger
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2469
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2470
    ^ (device horizontalPixelPerMillimeter * 20) asInteger
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2471
!
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
verticalScrollStep
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 verticalPixelPerInch * (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 verticalPixelPerMillimeter * 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
1752
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2483
!ObjectView methodsFor:'selection & handles'!
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2484
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2485
drawHandle:aPoint
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2486
    |hsize halfSize|
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2487
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2488
    hsize := self handleSize.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2489
    halfSize := hsize // 2.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2490
    self fillRectangleX:(aPoint x - halfSize)
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2491
		      y:(aPoint y - halfSize)
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2492
		  width:hsize 
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2493
		 height:hsize
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
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2496
drawHandlesFor:anObject
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2497
    |hsize halfSize|
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2498
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2499
    hsize := self handleSize.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2500
    halfSize := hsize // 2.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2501
    anObject handlesDo:[:point |
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2502
	self fillRectangleX:(point x - halfSize)
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2503
			  y:(point y - halfSize)
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2504
		      width:hsize 
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2505
		     height:hsize
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2506
    ]
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2507
!
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
findObjectHandleAt:aPoint
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2510
    |objectFound|
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2511
    contents do:[:object |
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2512
	(self object:object hasHandle:aPoint) ifTrue:[
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2513
	    objectFound := object
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2514
	]
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2515
    ].
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2516
    ^ objectFound
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
handle:handlePoint isHitBy:aPoint
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2520
    ^ (self handleFor:handlePoint) containsPoint:aPoint
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2521
!
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2522
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2523
handleFor:aPoint
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2524
    "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
  2525
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2526
    |hsize centerX centerY|
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
    hsize := self handleSize.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2529
    centerX := aPoint x.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2530
    centerY := aPoint y.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2531
    ^ Rectangle left:(centerX - hsize)
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2532
		 top:(centerY - hsize)
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2533
	       right:(centerX + hsize)
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2534
	      bottom:(centerY + hsize)
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
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2537
handleSize
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2538
    "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
  2539
     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
  2540
     what the default is."
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2541
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2542
    |hs|
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2543
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2544
    hs := self class handleSize.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2545
    transformation notNil ifTrue:[
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2546
	^ transformation applyInverseScaleX:hs
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2547
    ].
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2548
    ^ hs
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2549
!
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2550
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2551
invertHandle:aHandle
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2552
    self xoring:[self drawHandle:aHandle]
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
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2555
invertHandlesOf:aSelection
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2556
    aSelection notNil ifTrue:[
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2557
	self xoring:[
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2558
	    self forEach:aSelection do:[:anObject |
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2559
		(anObject respondsTo:#handlesDo:) ifTrue:[
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2560
		    self drawHandlesFor:anObject
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2561
		] ifFalse:[
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2562
		    anObject drawOutlineIn:self
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
	]
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2566
    ]
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2567
!
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2568
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2569
object:anObject hasHandleAt:aPoint
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2570
    |found|
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2571
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2572
    found := false.
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2573
    anObject handlesDo:[:handlePoint |
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2574
	(self handle:handlePoint isHitBy:aPoint) ifTrue:[
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2575
	    found := true
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
    ^ found
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2579
!
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2580
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2581
selectionHandlesDo:aBlock
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2582
    self forEach:selection do:[:theObject |
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2583
	(theObject respondsTo:#handlesDo:) ifTrue:[
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2584
	    theObject handlesDo:[:theHandle |
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  2585
		aBlock value:theObject value:theHandle
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
    ]
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
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2591
!ObjectView methodsFor:'selections'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2592
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2593
addToSelection:anObject
839
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2594
    "add anObject to the selection; redraw it selected"
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2595
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2596
    selection isCollection ifFalse:[
1002
62b2636d0923 care for nil selection
ca
parents: 996
diff changeset
  2597
        selection isNil ifTrue:[
62b2636d0923 care for nil selection
ca
parents: 996
diff changeset
  2598
            ^ self select:anObject
62b2636d0923 care for nil selection
ca
parents: 996
diff changeset
  2599
        ].
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2600
        selection := OrderedCollection with:selection
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2601
    ].
839
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2602
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2603
    (selection includes:anObject) ifFalse:[
839
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2604
        (self frameIncludesSelectionHandlesOn:anObject) ifFalse:[
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2605
            self hideSelection.
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2606
            selection add:anObject.
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2607
            self showSelection
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2608
        ] ifTrue:[
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2609
            self showSelected:anObject
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2610
        ]
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2611
    ].
839
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2612
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2613
    "Modified: 1.10.1996 / 12:12:59 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2614
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2615
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2616
hideSelection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2617
    "hide the selection - undraw hilights - whatever that is"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2618
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2619
    self selectionDo:[:object |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2620
	self showUnselected:object
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2621
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2622
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2623
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2624
removeFromSelection:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2625
    "remove anObject from the selection"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2626
839
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2627
    |wasSelected didHide|
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2628
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2629
    didHide := false.
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2630
    wasSelected := true.
839
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2631
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2632
    (self frameIncludesSelectionHandlesOn:anObject) ifFalse:[
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2633
        "/ must hide any selection-handles first
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2634
        self hideSelection.
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2635
        didHide := true.
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2636
    ].
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2637
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2638
    selection isCollection ifTrue:[
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2639
        (selection remove:anObject ifAbsent:[nil]) isNil ifTrue:[
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2640
            wasSelected := false
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2641
        ].
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2642
        (selection size == 1) ifTrue:[
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2643
            selection := selection first
1002
62b2636d0923 care for nil selection
ca
parents: 996
diff changeset
  2644
        ] ifFalse:[
62b2636d0923 care for nil selection
ca
parents: 996
diff changeset
  2645
            selection isEmpty ifTrue:[
62b2636d0923 care for nil selection
ca
parents: 996
diff changeset
  2646
                selection := nil
62b2636d0923 care for nil selection
ca
parents: 996
diff changeset
  2647
            ]
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2648
        ]
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2649
    ] ifFalse:[
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2650
        (selection == anObject) ifTrue:[
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2651
            selection := nil
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2652
        ] ifFalse:[
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2653
            wasSelected := false
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2654
        ]
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2655
    ].
839
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2656
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2657
    didHide ifTrue:[
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2658
        self showSelection.
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2659
    ] ifFalse:[
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2660
        wasSelected ifTrue:[
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2661
            self showUnselected:anObject
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2662
        ].
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2663
    ]
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2664
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2665
    "Modified: 1.10.1996 / 12:10:17 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2666
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2667
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2668
select:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2669
    "select something - hide previouse selection, set to something and hilight"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2670
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2671
    (selection == something) ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2672
	self hideSelection.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2673
	selection := something.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2674
	self showSelection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2675
    ]
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
selectAll
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2679
    "select all objects"
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
    self hideSelection.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2682
    selection := contents copy.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2683
    self showSelection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2684
!
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
selectAllIn:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2687
    "select all objects fully in aRectangle"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2688
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2689
    self hideSelection.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2690
    selection := OrderedCollection new.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2691
    self objectsIn:aRectangle do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2692
	selection add:theObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2693
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2694
    (selection size == 0) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2695
	selection := nil
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2696
    ] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2697
	(selection size == 1) ifTrue:[selection := selection first]
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 showSelection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2700
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2701
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2702
selectAllIntersecting:aRectangle
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2703
    "select all objects touched by aRectangle"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2704
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2705
    self hideSelection.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2706
    selection := OrderedCollection new.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2707
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2708
    self objectsIntersecting:aRectangle do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2709
	selection add:theObject
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
    (selection size == 0) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2712
	selection := nil
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2713
    ] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2714
	(selection size == 1) ifTrue:[selection := selection first]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2715
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2716
    self showSelection
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
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2719
selectionDo:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2720
    "apply block to every object in selection"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2721
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2722
    self forEach:selection do:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2723
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2724
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2725
showSelection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2726
    "show the selection - draw hilights - whatever that is"
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
    self selectionDo:[:object |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2729
	self showSelected:object
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2730
    ]
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
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2733
unselect
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2734
    "unselect - hide selection; clear selection"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2735
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2736
    self hideSelection.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2737
    selection := nil
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2738
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2739
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2740
withSelectionHiddenDo:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2741
    "evaluate aBlock while selection is hidden"
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
    |sel|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2744
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2745
    sel := selection.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2746
    sel notNil ifTrue:[self unselect].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2747
    aBlock value.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2748
    sel notNil ifTrue:[self select:sel]
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
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2751
!ObjectView methodsFor:'testing objects'!
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
canMove:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2754
    "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
  2755
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2756
    something isCollection ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2757
	self forEach:something do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2758
	    (theObject canBeMoved) ifFalse:[^ false]
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
	^ true
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2761
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2762
    ^ something canBeMoved
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2763
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2764
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2765
findObjectAt:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2766
    "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
  2767
     the argument, aPoint - this is the topmost object hit"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2768
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2769
    |hdelta|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2770
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2771
    hdelta := self hitDelta.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2772
    contents reverseDo:[:object |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2773
	(object isHitBy:aPoint withDelta:hdelta) ifTrue:[^ object]
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
    ^ nil
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2776
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2777
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2778
findObjectAt:aPoint suchThat:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2779
    "find the last object (back to front ) which is hit by
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2780
     the argument, aPoint and for which the testBlock, aBlock evaluates to
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2781
     true"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2782
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2783
    |hdelta|
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
    hdelta := self hitDelta.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2786
    contents reverseDo:[:object |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2787
	(object isHitBy:aPoint withDelta:hdelta) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2788
	    (aBlock value:object) ifTrue:[^ object]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2789
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2790
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2791
    ^ nil
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
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2794
findObjectAtVisible:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2795
    "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
  2796
     a visible point - this is the topmost object hit.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2797
     This is a leftOver from times when scrolling was not transparent.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2798
     Please use findObjectAt:, since this will vanish."
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
    ^ self findObjectAt:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2801
!
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
findObjectAtVisible:aPoint suchThat:aBlock
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2804
    "find the last object (back to front ) which is hit by
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2805
     the argument, aPoint and for which the testBlock, aBlock evaluates to
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2806
     true.
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:suchThat:, 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 suchThat:aBlock
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
839
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2813
frameIncludesSelectionHandlesOn:anObject
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2814
    "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
  2815
     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
  2816
     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
  2817
     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
  2818
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2819
    ^ false     "/ i.e. dont know.
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2820
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2821
    "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
  2822
!
53a5344288e6 redrawing when removing/adding from/to the selection
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
  2823
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2824
frameOf:anObjectOrCollection
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2825
    "answer the maximum extent defined by the argument, anObject or a
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2826
     collection of objects"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2827
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2828
    |first frameAll|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2829
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2830
    anObjectOrCollection isNil ifTrue:[^ nil ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2831
    first := true.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2832
    self forEach:anObjectOrCollection do:[:theObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2833
	first ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2834
	    frameAll := theObject frame.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2835
	    first := false
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2836
	] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2837
	    frameAll := frameAll merge:(theObject frame)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2838
	]
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
    ^ frameAll
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2841
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2842
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2843
isObscured:something
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2844
    "return true, if the argument something, anObject or a collection of
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2845
     objects is obscured (partially or whole) by any other object"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2846
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2847
    self forEach:something do:[:anObject |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2848
	(self objectIsObscured:anObject) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2849
	    ^ true
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2850
	]
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
    ^ false
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2853
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2854
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2855
isSelected:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2856
    "return true, if the argument, anObject is in the selection"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2857
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2858
    selection isNil ifTrue:[^ false].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2859
    (selection == anObject) ifTrue:[^ true].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2860
    selection isCollection ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2861
	^ (selection identityIndexOf:anObject startingAt:1) ~~ 0
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2862
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2863
    ^ false
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
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2866
objectIsObscured:objectToBeTested
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2867
    "return true, if the argument, anObject is obscured (partially or whole)
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2868
     by any other object"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2869
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2870
    |frameToBeTested frameleft frameright frametop framebot
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2871
     objectsFrame startIndex|
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
    (objectToBeTested == (contents last)) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2874
	"quick return if object is on top"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2875
	^ false
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2876
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2877
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2878
    frameToBeTested := self frameOf:objectToBeTested.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2879
    frameleft := frameToBeTested left.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2880
    frameright := frameToBeTested right.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2881
    frametop := frameToBeTested top.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2882
    framebot := frameToBeTested bottom.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2883
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2884
    "check objects after the one to check"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2885
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2886
    startIndex := contents identityIndexOf:objectToBeTested ifAbsent:[self error].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2887
    contents from:(startIndex + 1) to:(contents size) do:[:object |
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2888
	objectsFrame := self frameOf:object.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2889
	(objectsFrame right < frameleft) ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2890
	    (objectsFrame left > frameright) ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2891
		(objectsFrame bottom < frametop) ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2892
		    (objectsFrame top > framebot) ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2893
			^ true
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2894
		    ]
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
	    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2897
	]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2898
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2899
    ^ false
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2900
! !
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2901
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2902
!ObjectView methodsFor:'user interface'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2903
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2904
alignToGrid:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2905
    "round aPoint to the next nearest point on the grid"
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
    aligning ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2908
	^ aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2909
    ].
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
    ^ (aPoint grid:gridAlign) rounded
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2912
!
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
selectMore:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2915
    "add/remove an object from the selection"
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
    |anObject|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2918
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2919
    anObject := self findObjectAt:aPoint.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2920
    anObject notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2921
	(self isSelected:anObject) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2922
	    "remove from selection"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2923
	    self removeFromSelection:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2924
	] ifFalse:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2925
	    "add to selection"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2926
	    self addToSelection:anObject
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2927
	]
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
    ^ self
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2930
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2931
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2932
startSelectMoreOrMove:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2933
    "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
  2934
     - 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
  2935
     This is typically the button shiftPressAction."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2936
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2937
    |anObject|
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
    anObject := self findObjectAt:aPoint.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2940
    anObject notNil ifTrue:[
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2941
        (self isSelected:anObject) ifTrue:[
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2942
            "remove from selection"
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2943
            self removeFromSelection:anObject
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2944
        ] ifFalse:[
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2945
            "add to selection"
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2946
            self addToSelection:anObject
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2947
        ].
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2948
        self startObjectMove:selection at:aPoint.
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2949
        ^ self
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2950
    ].
733
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2951
"/    self unselect.
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2952
"/    self startRectangleDrag:aPoint
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2953
f67b1c728316 fixed shift-select & move
Claus Gittinger <cg@exept.de>
parents: 732
diff changeset
  2954
    "Modified: 30.5.1996 / 18:45:54 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2955
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2956
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2957
startSelectOrMove:aPoint
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2958
    "start a rectangleDrag or objectMove - if aPoint hits an object,
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2959
     an object move is started, otherwise a rectangleDrag.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2960
     This is typically the button pressAction."
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2961
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2962
    |anObject|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2963
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2964
    anObject := self findObjectAt:aPoint.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2965
    anObject notNil ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2966
	(self isSelected:anObject) ifFalse:[self unselect].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2967
	self startObjectMove:anObject at:aPoint.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2968
	^ self
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2969
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2970
    "nothing was hit by this click - this starts a group select"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2971
    self unselect.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2972
    self startRectangleDrag:aPoint
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
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2975
!ObjectView methodsFor:'view manipulation'!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2976
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2977
inchMetric
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2978
    (scaleMetric ~~ #inch) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2979
	scaleMetric := #inch.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2980
	self newGrid
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2981
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2982
!
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
millimeterMetric
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2985
    (scaleMetric ~~ #mm) ifTrue:[
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2986
	scaleMetric := #mm.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2987
	self newGrid
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2988
    ]
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2989
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2990
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2991
zoom:factor
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2992
    "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
  2993
     0.5 is shrink by 2"
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2994
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2995
    |current|
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2996
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2997
    transformation isNil ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  2998
        current := 1@1
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  2999
    ] ifFalse:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3000
        current := transformation scale
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3001
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3002
    factor asPoint = current asPoint ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3003
        ^ self
216
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 := factor.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3006
    current isNil ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3007
        current := 1
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3008
    ].
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3009
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3010
    (current = 1) ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3011
        transformation := nil
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3012
    ] ifFalse:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3013
        transformation := WindowingTransformation scale:current translation:0.
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
    self contentsChanged.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3016
    self setInnerClip.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3017
    gridShown ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3018
        self newGrid
216
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
    shown ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3021
        self invalidate "/ clear; redraw
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3022
    ].
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3023
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3024
    "Modified: 29.5.1996 / 16:20:41 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3025
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3026
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3027
zoomIn
588
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3028
    self zoomIn:2
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3029
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3030
    "Modified: 27.4.1996 / 10:08:50 / cg"
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3031
!
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3032
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3033
zoomIn:factor
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3034
    transformation isNil ifTrue:[
588
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3035
        transformation := WindowingTransformation scale:1 translation:0
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3036
    ].
588
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3037
    transformation := WindowingTransformation 
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3038
                                scale:(transformation scale / factor)
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3039
                                translation:0.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3040
    self contentsChanged.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3041
    self setInnerClip.
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3042
    self invalidate.
588
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3043
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3044
    "Created: 27.4.1996 / 10:08:39 / cg"
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3045
    "Modified: 29.5.1996 / 16:20:46 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3046
!
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3047
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3048
zoomOut
588
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3049
    self zoomOut:2
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3050
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3051
    "Modified: 27.4.1996 / 10:09:27 / cg"
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3052
!
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
zoomOut:factor
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3055
    transformation isNil ifTrue:[
588
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3056
        transformation := WindowingTransformation scale:1 translation:0
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3057
    ].
588
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3058
    transformation := WindowingTransformation 
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3059
                        scale:(transformation scale * factor)
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3060
                        translation:0.
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3061
    self contentsChanged.
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3062
    self setInnerClip.
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3063
    self invalidate
588
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3064
2d6fc80017df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 584
diff changeset
  3065
    "Created: 27.4.1996 / 10:09:19 / cg"
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 701
diff changeset
  3066
    "Modified: 29.5.1996 / 16:20:49 / cg"
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3067
! !
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3068
961
1b65b39c5079 aligningMove was undefined.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
  3069
!ObjectView class methodsFor:'documentation'!
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3070
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3071
version
1752
f1e400f163ad moved some handle stuff from DrawView to here,
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
  3072
    ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.64 1999-02-20 17:36:31 cg Exp $'
216
d35b116e03a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
  3073
! !