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