Scroller.st
author Claus Gittinger <cg@exept.de>
Tue, 16 Mar 1999 18:42:33 +0100
changeset 1801 92c6052b2d53
parent 1800 e3e987087c46
child 1808 097b86f1473e
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
5
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
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
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    13
View subclass:#Scroller
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    14
	instanceVariableNames:'thumbOrigin thumbHeight thumbColor thumbFrameColor scrollAction
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    15
		orientation thumbFrame thumbLevel scrolling pressOffset
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    16
		synchronousOperation shadowForm lightForm inset thumbShadowColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    17
		thumbLightColor thumbEdgeStyle thumbHalfShadowColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    18
		thumbHalfLightColor thumbEnteredColor thumbFrameSizeDifference
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    19
		tallyLevel tallyMarks fixThumbHeight frameBeforeMove ghostColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    20
		ghostFrameColor ghostLevel rangeStart rangeEnd rangeStep entered
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
    21
		thumbActiveLevel originBeforeMove thumbImage enabled
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    22
		enableChannel keyboardStep autoRepeat repeatBlock
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
    23
		initialRepeatDelay repeatDelay'
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    24
	classVariableNames:'HandleShadowForm HandleLightForm DefaultViewBackground
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    25
		DefaultShadowColor DefaultLightColor DefaultThumbColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    26
		DefaultThumbShadowColor DefaultThumbLightColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    27
		DefaultThumbHalfShadowColor DefaultThumbHalfLightColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    28
		DefaultHalfShadowColor DefaultHalfLightColor DefaultTallyMarks
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    29
		DefaultTallyLevel DefaultLevel DefaultBorderWidth
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    30
		DefaultThumbLevel DefaultInset DefaultThumbFrameColor
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    31
		DefaultGhostColor DefaultGhostFrameColor DefaultGhostLevel
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    32
		DefaultFixThumbHeight DefaultEdgeStyle DefaultFullViewBackground
1301
1fbe38b283e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
    33
		DefaultThumbEnteredColor DefaultThumbActiveLevel SnapBackDistance
1531
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
    34
		DefaultMiddleButtonJump NewCursors DefaultThumbImage HandleImage'
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    35
	poolDictionaries:''
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
    36
	category:'Views-Interactors'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    37
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    38
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
    39
!Scroller class methodsFor:'documentation'!
3
claus
parents: 0
diff changeset
    40
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    41
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    42
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    43
 COPYRIGHT (c) 1989 by Claus Gittinger
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
    44
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    45
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    46
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    47
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    48
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    49
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    50
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    51
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    52
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    53
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    54
3
claus
parents: 0
diff changeset
    55
documentation
claus
parents: 0
diff changeset
    56
"
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    57
    this class implements the scroller for scrollbars.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    58
    it can also be used by itself for scrollbars without step-buttons.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    59
    When moved, either a predefined action is performed (scrollAction),
119
claus
parents: 117
diff changeset
    60
    or a model is informed via the changeMsg (which is #value: by default).
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    61
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    62
    The scroller can work synchronous (i.e. every move leads to an immediate evaluation
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    63
    of the action, or asynchronous (i.e. perform action on end-of move).
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    64
    By default, scrollers are synchronous. Asynchronous operation makes sense, 
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    65
    if the scroll operation (redraw) is expensive and takes a long time.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    66
127
claus
parents: 120
diff changeset
    67
    This class is used both for concrete instances (vertical scrollers)
claus
parents: 120
diff changeset
    68
    and as an abstract superclass for horizontalScrollers, sliders and
claus
parents: 120
diff changeset
    69
    miniScrollers.
claus
parents: 120
diff changeset
    70
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    71
  range:
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    72
    the value passed to the model or via the action blocks is scaled according
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    73
    to the min/maxRange instance variables.
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    74
    These default to 0..100 for percentage values.
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    75
    It does not make sense to change the range for scrollbar-scrollers,
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    76
    but may be useful with Sliders or in special applications.
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    77
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    78
  style stuff:
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    79
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    80
    Beside the obvious 3D rectangle, a scroller may draw a know-form
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    81
    (as in NeXT) or little tally marks (as on SGI) in itself.
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    82
    These are controlled by the shadowForm, lightForm, tallyLevel and tallyMarks
1302
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
    83
    instance variables. All of this is initialized from the styleSheet.
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
    84
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
    85
  [Instance variables:]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    86
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    87
    thumbOrigin                 <Number>        origin of thumb (in percent)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    88
    thumbHeight                 <Number>        height of thumb (in percent)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    89
    thumbColor                  <Color>         color of thumb
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    90
    thumbFrameColor             <Color>         color of the frame around the thumb
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    91
    scrollAction                <Block>         1 arg block to be evaluated when scrolled
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
    92
						(arg is position in percent)
119
claus
parents: 117
diff changeset
    93
    orientation                 <Symbol>        #horizontal or #vertical
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    94
    thumbFrame                  <Rectangle>     frame of thumb in pixels (cached)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    95
    thumbLevel                  <Number>        level of thumb if 3d
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    96
    scrolling                   <Boolean>       true during scroll
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    97
    pressOffset                 <Number>        temporary (offset into frame when move started)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    98
    synchronousOperation        <Boolean>       true if synchronous (i.e. dont wait till release
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
    99
						to perform action)
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   100
    shadowForm                  <Form>          bitmap of knob if any (shadow part)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   101
    lightForm                   <Form>          bitmap of knob if any (light part)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   102
    inset                       <Integer>       number of pixels to inset thumb from view borders
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   103
    thumbShadowColor            <Color>         color do draw dark parts of thumb
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   104
    thumblightColor             <Color>         color to draw light parts of thumb
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   105
    thumbEdgeStyle              <SymbolOrNil>   #soft or nil
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   106
    thumbHalfShadowColor        <Color>         used to draw smooth edges
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   107
    thumbHalfLightColor         <Color>         used to draw smooth edges
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   108
    thumbFrameSizeDifference    <Integer>       number of pixels the thumb is larger than 
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   109
						it should be (can be negative for mswin-style)
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   110
    tallyLevel                  <Integer>       if not zero, specifies if tally-marks should
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   111
						go into or out of the display (actually only <0/>0 is checked)
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   112
						I dont know of a better word for these ...
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   113
    tallyMarks                  <Integer>       number of tally marks
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   114
    fixThumbHeight              <Boolean>       perform 'wrong' height computation a la mswindows
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   115
    rangeStart                  <Number>        the range of the scroller
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   116
    rangeEnd                                    (defaults to 0..100)
119
claus
parents: 117
diff changeset
   117
    rangeStep                                   not currently implemented
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   118
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
   119
  [style settings:]
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   120
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   121
    scrollerLevel               <Integer>       the level of the scroller w.r.t. its enclosing view
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   122
    scrollerBorderWidth         <Integer>       the borderWidth (ignored for 3D styles)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   123
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   124
    scrollerViewBackground      <Color>         the viewBackground (color or image)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   125
    scrollerShadowColor         <Color>         the color of 3D shadowed edges (ignored in 2D styles)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   126
    scrollerLightColor          <Color>         the color of 3D lighted edges (ignored in 2D styles)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   127
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   128
    scrollerThumbColor          <Color>         the thumbs color (color or image)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   129
    scrollerThumbShadowColor    <Color>         the color of the thumbs shadowed edges (ignored in 2D styles)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   130
    scrollerThumbLightColor     <Color>         the color of the thumbs shadowed edges (ignored in 2D styles)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   131
    scrollerThumbEdgeStyle      <Symbol>        the edge style for the thumb (#soft or nil)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   132
    scrollerThumbLevel          <Integer>       the 3D height of the thumb
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   133
    scrollerThumbHalfShadowColor<Color>         the halfShadow for soft edged thumbs
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   134
    scrollerThumbHalfLightColor <Color>         the halfLight for soft edged thumbs
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   135
    scrollerThumbFrameColor     <Color>         if non-nil, a rectangle is drawn around the thumb is this color
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   136
    scrollerThumbInset          <Integer>       inset of thumb from the scrollers boundary
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   137
    scrollerThumbFixHeight      <Boolean>       if true, use a fix thumb height (as in mswindows)
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   138
    scrollerGhostColor          <Color>         the color in which a ghost-rectangle is drawn
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   139
    scrollerGhostFrameColor     <Color>         if non-nil, a rectangle is drawn around the ghost is this color
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   140
    scrollerGhostLevel          <Color>         the 3D level of the ghost rectangle
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   141
    scrollerNTallyMarks         <Integer>       number of tally-marks to draw on the thumb
1302
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   142
    scrollerTallyLevel          <Integer>       the 3D level of any tally marks
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   143
    scrollerSnapBack            <Boolean>       win95 behavior: snap back to original position if scrollers view
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   144
						is left by mouse (with some distance)
1302
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   145
    scrollerMiddleButtonJump    <Boolean>       xterm behavior: middle button has shift-click behavior
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   146
						(positions absolute to click position)
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   147
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   148
    notice: for mswindows style, we force a WRONG thumb-frame
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   149
    computation, to make the thumb have constant size; 
1302
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   150
    if you dont like that (I do not :-), 
Claus Gittinger <cg@exept.de>
parents: 1301
diff changeset
   151
    set scrollerThumbFixHeight to false (in the StyleSheet).
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
   152
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
   153
    [author:]
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   154
	Claus Gittinger
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
   155
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
   156
    [see also:]
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   157
	ScrollBar
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   158
	ScrollableView HVScrollableView
3
claus
parents: 0
diff changeset
   159
"
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   160
!
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   161
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   162
examples
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   163
"
133
claus
parents: 132
diff changeset
   164
    basic scroller setup:
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   165
									[exBegin]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   166
	|top s|
133
claus
parents: 132
diff changeset
   167
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   168
	top := StandardSystemView new extent:200@200.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   169
	s := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   170
	s origin:(0.0@0.0) corner:(20@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   171
	s thumbHeight:10.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   172
	top open
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   173
									[exEnd]
133
claus
parents: 132
diff changeset
   174
claus
parents: 132
diff changeset
   175
    setting its thumb-height:
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   176
									[exBegin]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   177
	|top s|
133
claus
parents: 132
diff changeset
   178
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   179
	top := StandardSystemView new extent:200@200.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   180
	s := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   181
	s origin:(0.0@0.0) corner:(20@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   182
	s thumbHeight:50.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   183
	top open
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   184
									[exEnd]
133
claus
parents: 132
diff changeset
   185
claus
parents: 132
diff changeset
   186
    setting its thumb-origin:
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   187
									[exBegin]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   188
	|top s|
133
claus
parents: 132
diff changeset
   189
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   190
	top := StandardSystemView new extent:200@200.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   191
	s := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   192
	s origin:(0.0@0.0) corner:(20@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   193
	s thumbHeight:10.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   194
	s thumbOrigin:30.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   195
	top open
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   196
									[exEnd]
133
claus
parents: 132
diff changeset
   197
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   198
    a scroller with action block (ST/X style):
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   199
									[exBegin]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   200
	|top s|
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   201
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   202
	top := StandardSystemView new extent:200@200.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   203
	s := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   204
	s origin:(0.0@0.0) corner:(20@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   205
	s thumbHeight:10.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   206
	s scrollAction:[:percent | Transcript show:'moved to: '; showCR:percent asFloat].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   207
	top open
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   208
									[exEnd]
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   209
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   210
    setting its range:
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   211
									[exBegin]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   212
	|top s|
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   213
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   214
	top := StandardSystemView new extent:200@200.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   215
	s := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   216
	s origin:(0.0@0.0) corner:(20@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   217
	s thumbHeight:10.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   218
	s scrollAction:[:percent | Transcript show:'moved to: '; showCR:percent asFloat].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   219
	s start:0 stop:1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   220
	top open
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   221
									[exEnd]
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   222
130
claus
parents: 128
diff changeset
   223
    create a scroller in its default extent and have it positioned
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   224
    at the side; beside another view:
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   225
									[exBegin]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   226
	|top s v|
130
claus
parents: 128
diff changeset
   227
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   228
	top := StandardSystemView new extent:200@200.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   229
	s := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   230
	s origin:(0.0@0.0) corner:(0.0@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   231
	s rightInset:(s preferredExtent x negated).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   232
	s thumbHeight:10.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   233
	s level:1.
130
claus
parents: 128
diff changeset
   234
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   235
	v := View in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   236
	v origin:0.0@0.0 corner:1.0@1.0.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   237
	v leftInset:(s preferredExtent x).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   238
	v viewBackground:Color red.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   239
	v level:2.
130
claus
parents: 128
diff changeset
   240
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   241
	top open
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   242
									[exEnd]
130
claus
parents: 128
diff changeset
   243
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   244
    using a model (ST-80 style):
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   245
									[exBegin]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   246
	|top s m|
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   247
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   248
	m := 0 asValue.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   249
	InspectorView openOn:m monitor:'value'.  'look at value'.
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   250
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   251
	top := StandardSystemView new extent:200@200.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   252
	s := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   253
	s origin:(0.0@0.0) corner:(20@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   254
	s thumbHeight:10.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   255
	s model:m.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   256
	top open
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   257
									[exEnd]
119
claus
parents: 117
diff changeset
   258
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   259
    using a different changeSelector:
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   260
									[exBegin]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   261
	|top s1 s2 m|
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   262
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   263
	m := Plug new.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   264
	m respondTo:#value1: with:[:v | Transcript show:'scroller 1 moved to: '; showCR:v].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   265
	m respondTo:#value2: with:[:v | Transcript show:'scroller 2 moved to: '; showCR:v].
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   266
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   267
	top := StandardSystemView new extent:200@200.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   268
	s1 := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   269
	s1 origin:(0.0@0.0) corner:(20@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   270
	s1 thumbHeight:10.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   271
	s1 model:m; change:#value1:.
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   272
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   273
	s2 := Scroller in:top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   274
	s2 origin:(30@0.0) corner:(50@1.0).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   275
	s2 thumbHeight:10.  'percent'.     
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   276
	s2 model:m; change:#value2:.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   277
	top open
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   278
									[exEnd]
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   279
"
3
claus
parents: 0
diff changeset
   280
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   281
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   282
!Scroller class methodsFor:'defaults'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   283
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   284
handleLightFormOn:aDisplay
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   285
    "answer the form used for the handles light area;
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   286
     cache the one for Display for the next round"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   287
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   288
    |f|
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   289
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   290
    ((aDisplay == Display) and:[HandleLightForm notNil]) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   291
	^ HandleLightForm
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   292
    ].
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   293
    f := Image fromFile:'bitmaps/HandleLight.xbm' resolution:100 on:aDisplay.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   294
    f isNil ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   295
	f := Form width:8 height:8 fromArray:#[2r00000000
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   296
					       2r00000010
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   297
					       2r00000011
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   298
					       2r00000011
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   299
					       2r00000011
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   300
					       2r00000011
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   301
					       2r00000110
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   302
					       2r00111100]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   303
					      on:aDisplay
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   304
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   305
    (aDisplay == Display) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   306
	HandleLightForm := f
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   307
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   308
    ^ f
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   309
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   310
    "Modified: 23.10.2031 / 01:00:00 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   311
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   312
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   313
handleShadowFormOn:aDisplay
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   314
    "answer the form used for the handles shadow area;
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   315
     cache the one for Display for the next round"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   316
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   317
    |f|
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   318
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   319
    ((aDisplay == Display) and:[HandleShadowForm notNil]) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   320
	^ HandleShadowForm
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   321
    ].
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   322
    f := Image fromFile:'bitmaps/HandleShadow.xbm' resolution:100 on:aDisplay.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   323
    f isNil ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   324
	f := Form width:8 height:8 fromArray:#[2r00111100
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   325
					       2r01100000
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   326
					       2r11000000
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   327
					       2r11000000
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   328
					       2r11000000
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   329
					       2r11000000
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   330
					       2r01000000
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   331
					       2r00000000]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   332
					   on:aDisplay
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   333
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   334
    (aDisplay == Display) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   335
	HandleShadowForm := f
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   336
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   337
    ^ f
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   338
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
   339
    "Modified: 19.12.1996 / 01:00:00 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   340
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   341
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   342
updateStyleCache
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   343
    "extract values from the styleSheet and cache them in class variables"
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   344
1347
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   345
    <resource: #style (#'scroller.viewBackground' #'scroller.fullViewBackground'
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   346
		       #'scroller.thumbColor' 
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   347
		       #'scroller.shadowColor' #'scroller.lightColor'
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   348
		       #'scroller.thumbShadowColor' #'scroller.thumbLightColor'
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   349
		       #'scroller.thumbHalfShadowColor' #'scroller.thumbHalfLightColor'
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   350
		       #'scroller.thumbFrameColor' #'scroller.ghostColor'
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   351
		       #'scroller.ghostLevel' #'scroller.ghostFrameColor'
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   352
		       #'scroller.NTallyMarks' #'scroller.tallyLevel'
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   353
		       #'scroller.level' #'scroller.borderWidth'
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   354
		       #'scroller.thumbLevel' #'scroller.thumbInset'
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   355
		       #'scroller.thumbFixHeight' #'scroller.thumbEdgeStyle'
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   356
		       #'scroller.thumbEnteredColor' #'scroller.thumbActiveLevel'
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   357
		       #'scroller.middleButtonJump' 
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   358
		       #'scroller.newCursors')>
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   359
1347
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   360
    DefaultViewBackground := StyleSheet colorAt:'scroller.viewBackground'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   361
    DefaultFullViewBackground := StyleSheet colorAt:'scroller.fullViewBackground'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   362
    DefaultThumbColor := StyleSheet colorAt:'scroller.thumbColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   363
    DefaultThumbEnteredColor := StyleSheet colorAt:'scroller.thumbEnteredColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   364
    DefaultShadowColor := StyleSheet colorAt:'scroller.shadowColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   365
    DefaultLightColor := StyleSheet colorAt:'scroller.lightColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   366
    DefaultThumbShadowColor := StyleSheet colorAt:'scroller.thumbShadowColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   367
    DefaultThumbLightColor := StyleSheet colorAt:'scroller.thumbLightColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   368
    DefaultThumbHalfShadowColor := StyleSheet colorAt:'scroller.thumbHalfShadowColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   369
    DefaultThumbHalfLightColor := StyleSheet colorAt:'scroller.thumbHalfLightColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   370
    DefaultThumbFrameColor := StyleSheet colorAt:'scroller.thumbFrameColor'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   371
    DefaultGhostColor := StyleSheet colorAt:'scroller.ghostColor' default:nil.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   372
    DefaultGhostFrameColor := StyleSheet colorAt:'scroller.ghostFrameColor' default:nil.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   373
    DefaultGhostLevel := StyleSheet at:'scroller.ghostLevel' default:0.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   374
    DefaultTallyMarks := StyleSheet at:'scroller.NTallyMarks' default:0.
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   375
    DefaultTallyLevel := 0.
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   376
    DefaultTallyMarks ~~ 0 ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   377
	DefaultTallyLevel := StyleSheet at:'scroller.tallyLevel' default:1.
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   378
    ].
1347
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   379
    DefaultLevel := StyleSheet at:'scroller.level' default:0.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   380
    DefaultBorderWidth := StyleSheet at:'scroller.borderWidth' default:(StyleSheet at:'borderWidth').
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   381
    DefaultThumbLevel := StyleSheet at:'scroller.thumbLevel' default:0.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   382
    DefaultThumbActiveLevel := StyleSheet at:'scroller.thumbActiveLevel' default:DefaultThumbLevel.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   383
    DefaultInset := StyleSheet at:'scroller.thumbInset' default:0.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   384
    DefaultFixThumbHeight := StyleSheet at:'scroller.thumbFixHeight' default:false.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   385
    DefaultEdgeStyle := StyleSheet at:'scroller.thumbEdgeStyle'.
dc1bf0e46865 new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   386
    DefaultMiddleButtonJump := StyleSheet at:'scroller.middleButtonJump' default:false.
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
   387
    NewCursors := StyleSheet at:'scroller.newCursors' default:true.
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   388
    DefaultThumbImage := StyleSheet at:'scroller.thumbImage'.
1531
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   389
    HandleImage := StyleSheet at:'scroller.handleImage'.
130
claus
parents: 128
diff changeset
   390
claus
parents: 128
diff changeset
   391
    StyleSheet fileReadFailed ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   392
	DefaultViewBackground := Grey.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   393
	DefaultThumbColor := White.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   394
	DefaultThumbFrameColor := Black.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   395
	DefaultInset := 1.
1203
c25ad158d812 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1189
diff changeset
   396
    ].
c25ad158d812 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1189
diff changeset
   397
c25ad158d812 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1189
diff changeset
   398
    SnapBackDistance := 30.
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   399
1121
dccc1c729fd3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
   400
    "
dccc1c729fd3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
   401
     self updateStyleCache
dccc1c729fd3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
   402
    "
dccc1c729fd3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
   403
1531
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   404
    "Modified: / 19.5.1998 / 16:24:02 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   405
! !
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   406
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   407
!Scroller methodsFor:'accessing'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   408
1737
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   409
keyboardStep
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   410
    "return the scrollers keyboard step. If non-nil,
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   411
     thats the stepping value used with cursorUp/cursorDown keys.
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   412
     (not used with Scrollers, but provided for subclasses)"
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   413
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   414
    ^ keyboardStep
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   415
!
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   416
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   417
keyboardStep:aNumber
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   418
    "set the scrollers keyboard step. If non-nil,
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   419
     thats the stepping value used with cursorUp/cursorDown keys.
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   420
     (not used with Scrollers, but provided for subclasses)"
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   421
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   422
    keyboardStep := aNumber
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   423
!
1b57cb702892 preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents: 1731
diff changeset
   424
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   425
start 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   426
    "return the scrollers range min.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   427
     (not used with Scrollers, but provided for subclasses)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   428
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   429
    ^ rangeStart
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   430
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   431
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   432
start:start
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   433
    "set the scrollers range min.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   434
     (not used with Scrollers, but provided for subclasses)"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   435
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   436
    self start:start stop:rangeEnd.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   437
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   438
    "Modified: 25.5.1996 / 11:28:22 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   439
!
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   440
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   441
start:start stop:stop
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   442
    "set the range.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   443
     (not used with Scrollers, but provided for subclasses)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   444
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   445
    |org|
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   446
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   447
    org := self thumbOrigin.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   448
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   449
    rangeStart := start.
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   450
    rangeEnd := stop.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   451
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   452
    rangeStart = rangeEnd ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   453
	self halt:'invalud slider range (start = stop)'.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   454
	rangeStep isNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   455
	    rangeEnd := rangeStart + 1
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   456
	] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   457
	    rangeEnd := rangeStart + rangeStep.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   458
	]
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   459
    ].
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   460
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   461
    org < rangeStart ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   462
	org := rangeStart
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   463
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   464
	org > rangeEnd ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   465
	    org := rangeEnd
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   466
	]
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   467
    ].
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   468
    self thumbOrigin:org.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   469
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   470
    "Modified: / 21.1.1998 / 19:22:07 / cg"
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   471
!
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   472
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   473
start:start stop:stop step:step
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   474
    "set the range.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   475
     (not used with Scrollers, but provided for subclasses)"
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   476
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   477
    self start:start stop:stop.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   478
    rangeStep := step.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   479
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   480
    "Created: 25.5.1996 / 11:24:09 / cg"
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   481
    "Modified: 25.5.1996 / 11:27:43 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   482
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   483
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   484
step
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   485
    "return the scrollers range step.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   486
     (not used with Scrollers, but provided for subclasses)"
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   487
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   488
    ^ rangeStep
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   489
!
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   490
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   491
step:step
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   492
    "set the scrollers range step.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   493
     (not used with Scrollers, but provided for subclasses)"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   494
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   495
    rangeStep := step
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   496
!
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   497
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   498
stop
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   499
    "return the scrollers range max.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   500
     (not used with Scrollers, but provided for subclasses)"
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   501
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   502
    ^ rangeEnd
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   503
!
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   504
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   505
stop:stop
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   506
    "set the scrollers range max.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   507
     (not used with Scrollers, but provided for subclasses)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   508
679
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   509
    self start:rangeStart stop:stop.
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   510
c702b3d82f01 recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   511
    "Modified: 25.5.1996 / 11:28:35 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   512
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   513
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   514
thumbFrame
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   515
    "return the area used by the thumbFrame (in device coordinates).
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   516
     Allows access to the thumbs physical screen position, for
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   517
     example to position a label below (see Slider-Examples)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   518
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   519
    thumbFrame isNil ifTrue:[ self computeThumbFrame].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   520
    ^ thumbFrame
119
claus
parents: 117
diff changeset
   521
!
claus
parents: 117
diff changeset
   522
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   523
thumbHeight
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   524
    "answer the thumbs height (in percent by default)"
119
claus
parents: 117
diff changeset
   525
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   526
    ^ thumbHeight * (rangeEnd - rangeStart) abs / 100
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   527
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   528
    "Modified: / 21.1.1998 / 19:25:33 / cg"
119
claus
parents: 117
diff changeset
   529
!
claus
parents: 117
diff changeset
   530
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   531
thumbHeight:aNumber 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   532
    "set the thumbs height (in percent by default)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   533
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   534
    |newHeight realNewHeight oldFrame nBg|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   535
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   536
    newHeight := aNumber / ((rangeEnd - rangeStart) abs / 100).
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   537
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   538
    (newHeight > 100) ifTrue:[
1709
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   539
        realNewHeight := 100
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   540
    ] ifFalse:[
1709
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   541
        realNewHeight := newHeight
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   542
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   543
    ((realNewHeight ~= thumbHeight) or:[thumbFrame isNil]) ifTrue:[
1709
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   544
        thumbHeight := realNewHeight.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   545
1709
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   546
        (DefaultFullViewBackground notNil
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   547
        and:[DefaultViewBackground notNil
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   548
        and:[DefaultFullViewBackground ~~ DefaultViewBackground]]) ifTrue:[
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   549
            realNewHeight >= 100 ifTrue:[
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   550
                nBg := DefaultFullViewBackground.
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   551
            ] ifFalse:[
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   552
                nBg := DefaultViewBackground
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   553
            ].
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   554
            nBg := nBg on:device.
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   555
            nBg ~~ viewBackground ifTrue:[
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   556
                self viewBackground:nBg.
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   557
                shown ifTrue:[self clear].
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   558
            ]
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   559
        ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   560
1709
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   561
        shown ifTrue:[
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   562
            "/ thumbFrame := nil.
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   563
            oldFrame := thumbFrame.
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   564
            self computeThumbFrame.
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   565
            oldFrame ~= thumbFrame ifTrue:[
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   566
                self invalidate.
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   567
            ]
1189
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   568
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   569
"/            self computeThumbFrame.
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   570
"/            (fixThumbHeight or:[oldFrame ~= thumbFrame]) ifTrue:[
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   571
"/                oldFrame notNil ifTrue:[
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   572
"/                    self drawThumbBackgroundInX:(oldFrame left)
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   573
"/                                              y:(oldFrame top) 
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   574
"/                                          width:(oldFrame width) 
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   575
"/                                         height:(oldFrame height).
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   576
"/                ].
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   577
"/                self drawThumb
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   578
"/            ]
1709
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   579
        ] ifFalse:[
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   580
            thumbFrame := nil
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   581
        ]
119
claus
parents: 117
diff changeset
   582
    ]
1127
e55aa76e226d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
   583
1709
0b30d58a5484 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   584
    "Modified: / 21.10.1998 / 22:35:31 / cg"
119
claus
parents: 117
diff changeset
   585
!
claus
parents: 117
diff changeset
   586
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   587
thumbOrigin
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   588
    "answer the thumbs origin (in percent by default)"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   589
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   590
    |org|
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   591
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   592
    org := thumbOrigin * (rangeEnd - rangeStart) / 100 + rangeStart.
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   593
    rangeStep notNil ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   594
	org := org roundTo:rangeStep.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   595
	rangeStep isInteger ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   596
	    org := org asInteger
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   597
	]
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   598
    ].
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   599
    ^ org
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   600
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   601
    "Modified: / 21.1.1998 / 19:13:48 / cg"
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   602
!
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   603
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   604
thumbOrigin:aNumber 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   605
    "set the thumbs origin (in percent by default)"
448
e23465aad9e8 use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents: 446
diff changeset
   606
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   607
    |org newOrigin realNewOrigin 
119
claus
parents: 117
diff changeset
   608
     oldFrame oldTop oldBot oldLeft oldRight
claus
parents: 117
diff changeset
   609
     thumbTop thumbBot thumbLeft thumbRight
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   610
     tH "{ Class: SmallInteger }"
119
claus
parents: 117
diff changeset
   611
     tW 
132
claus
parents: 131
diff changeset
   612
     delta needFullDraw 
119
claus
parents: 117
diff changeset
   613
     bgLeft bgTop bgWidth bgHeight|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   614
1250
5e4f96c330de handle a nil thumbOrigin argument (uninitialized model)
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   615
    aNumber isNil ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   616
	newOrigin := 0
1250
5e4f96c330de handle a nil thumbOrigin argument (uninitialized model)
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   617
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   618
	org := aNumber.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   619
	rangeStep notNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   620
	    org := org roundTo:rangeStep.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   621
	    rangeStep isInteger ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   622
		org := org asInteger
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   623
	    ]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   624
	].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   625
	newOrigin := (org - rangeStart) asFloat / (rangeEnd - rangeStart / 100).
1250
5e4f96c330de handle a nil thumbOrigin argument (uninitialized model)
Claus Gittinger <cg@exept.de>
parents: 1203
diff changeset
   626
    ].
117
53cbfeaa9c9a *** empty log message ***
claus
parents: 106
diff changeset
   627
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   628
    ((newOrigin + thumbHeight) > 100) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   629
	realNewOrigin := 100 - thumbHeight
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   630
    ] ifFalse: [
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   631
	realNewOrigin := newOrigin
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   632
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   633
    (realNewOrigin > 100) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   634
	realNewOrigin := 100
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   635
    ] ifFalse: [
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   636
	(realNewOrigin < 0) ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   637
	    realNewOrigin := 0
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   638
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   639
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   640
    ((realNewOrigin ~= thumbOrigin) or:[thumbFrame isNil]) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   641
	thumbOrigin := realNewOrigin.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   642
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   643
	shown ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   644
	    oldFrame := thumbFrame.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   645
	    self computeThumbFrame.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   646
	    (thumbHeight = 100) ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   647
		"/ full: don't draw
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   648
		^ self
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   649
	    ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   650
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   651
	    (thumbFrame ~= oldFrame) ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   652
		oldFrame isNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   653
		    self invalidate.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   654
		    "/ self drawThumb.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   655
		    ^ self
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   656
		].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   657
		tH := thumbFrame height.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   658
		tW := thumbFrame width.
119
claus
parents: 117
diff changeset
   659
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   660
		oldTop := oldFrame top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   661
		oldBot := oldTop + tH.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   662
		oldLeft := oldFrame left.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   663
		oldRight := oldLeft + tW.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   664
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   665
		thumbTop := thumbFrame top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   666
		thumbBot := thumbTop + tH.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   667
		thumbLeft := thumbFrame left.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   668
		thumbRight := thumbLeft + tW.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   669
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   670
		needFullDraw := self exposeEventPending
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   671
				or:[((orientation == #vertical) and:[oldBot >= height])
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   672
				or:[((orientation ~~ #vertical) and:[oldRight >= width])]].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   673
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   674
		needFullDraw ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   675
		    "
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   676
		     cannot copy since thumb was below the end
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   677
		     or may be not available for the copy
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   678
		    "
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   679
		    self invalidate.
1189
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   680
"/                    (orientation == #vertical) ifTrue:[
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   681
"/                        self drawThumbBackgroundInX:thumbLeft y:oldTop
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   682
"/                                              width:tW height:(height - oldTop).
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   683
"/                    ] ifFalse:[
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   684
"/                        self drawThumbBackgroundInX:oldLeft y:thumbTop
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   685
"/                                              width:(width - oldLeft) height:tH.
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   686
"/                    ].
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   687
"/                    self drawThumb.
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   688
		    ^ self
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   689
		].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   690
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   691
		self catchExpose.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   692
		"
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   693
		 copy the thumbs pixels
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   694
		"
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   695
		(orientation == #vertical) ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   696
		    self 
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   697
			copyFrom:self 
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   698
			x:thumbLeft y:oldTop
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   699
			toX:thumbLeft y:thumbTop
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   700
			width:tW height:tH
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   701
			async:true.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   702
		] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   703
		    self 
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   704
			copyFrom:self 
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   705
			x:oldLeft y:thumbTop
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   706
			toX:thumbLeft y:thumbTop
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   707
			width:tW height:tH
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   708
			async:true.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   709
		].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   710
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   711
		"
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   712
		 clear some of the previous thumbs area to background
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   713
		"
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   714
		(orientation == #vertical) ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   715
		    bgLeft := thumbLeft.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   716
		    bgWidth := tW.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   717
		    oldTop > thumbTop ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   718
			delta := oldTop - thumbTop.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   719
			oldTop > thumbBot ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   720
			    bgTop := oldTop.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   721
			    bgHeight := tH + 1
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   722
			] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   723
			    bgTop := thumbBot.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   724
			    bgHeight := delta
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   725
			]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   726
		    ] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   727
			delta := thumbTop - oldTop.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   728
			oldBot < thumbTop ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   729
			    bgTop := oldTop.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   730
			    bgHeight := tH + 1
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   731
			] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   732
			    bgTop := oldTop.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   733
			    bgHeight := delta
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   734
			]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   735
		    ].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   736
		] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   737
		    bgTop := thumbTop.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   738
		    bgHeight := tH.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   739
		    oldLeft > thumbLeft ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   740
			delta := oldLeft - thumbLeft.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   741
			oldLeft > thumbRight ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   742
			    bgLeft := oldLeft.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   743
			    bgWidth := tW + 1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   744
			] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   745
			    bgLeft := thumbRight.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   746
			    bgWidth := delta.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   747
			]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   748
		    ] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   749
			delta := thumbLeft - oldLeft.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   750
			oldRight < thumbLeft ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   751
			    bgLeft := oldLeft.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   752
			    bgWidth := tW + 1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   753
			] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   754
			    bgLeft := oldLeft.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   755
			    bgWidth := delta.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   756
			]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   757
		    ].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   758
		].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   759
		self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   760
		self waitForExpose
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   761
	    ]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   762
	] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   763
	    thumbFrame := nil
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   764
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   765
    ]
983
05f8d4097a60 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 958
diff changeset
   766
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   767
    "Modified: / 21.1.1998 / 19:16:32 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   768
!
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
   769
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   770
thumbOrigin:originNumber thumbHeight:heightNumber
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   771
    "set both thumbs height and origin (in percent by default)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   772
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   773
    |newHeight newOrigin realNewOrigin realNewHeight old new changed 
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   774
     nBg range|
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   775
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   776
    range := rangeEnd - rangeStart.
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   777
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   778
    newOrigin := originNumber - rangeStart / (range / 100).
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   779
    newHeight := heightNumber / (range abs / 100).
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   780
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   781
    (newHeight > 100) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   782
	realNewHeight := 100
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   783
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   784
	realNewHeight := newHeight
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   785
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   786
    ((newOrigin + realNewHeight) > 100) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   787
	realNewOrigin := 100 - realNewHeight
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   788
    ] ifFalse: [
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   789
	realNewOrigin := newOrigin
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   790
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   791
    (realNewOrigin < 0) ifTrue: [
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   792
	realNewOrigin := 0
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   793
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   794
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   795
    changed := (realNewHeight ~= thumbHeight) or:[realNewOrigin ~= thumbOrigin].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   796
    (changed or:[thumbFrame isNil]) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   797
	old := self absFromPercent:thumbOrigin.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   798
	new := self absFromPercent:realNewOrigin.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   799
	changed := old ~~ new.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   800
	changed ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   801
	    old := self absFromPercent:thumbHeight.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   802
	    new := self absFromPercent:realNewHeight.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   803
	    changed := (old ~~ new)
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   804
	].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   805
	(changed or:[thumbFrame isNil]) ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   806
	    thumbOrigin := realNewOrigin.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   807
	    thumbHeight := realNewHeight.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   808
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   809
	    (DefaultFullViewBackground notNil
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   810
	    and:[DefaultViewBackground notNil
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   811
	    and:[DefaultFullViewBackground ~~ DefaultViewBackground]]) ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   812
		realNewHeight >= 100 ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   813
		    nBg := DefaultFullViewBackground.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   814
		] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   815
		    nBg := DefaultViewBackground
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   816
		].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   817
		nBg := nBg on:device.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   818
		nBg ~~ viewBackground ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   819
		    self viewBackground:nBg.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   820
		    shown ifTrue:[self clear].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   821
		]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   822
	    ].
128
claus
parents: 127
diff changeset
   823
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   824
	    shown ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   825
		thumbFrame := nil.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   826
		self invalidate.
1189
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   827
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   828
"/                thumbFrame notNil ifTrue:[
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   829
"/                    self drawThumbBackgroundInX:(thumbFrame left)
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   830
"/                                              y:(thumbFrame top) 
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   831
"/                                          width:(thumbFrame width) 
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   832
"/                                         height:(thumbFrame height).
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   833
"/                ].
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   834
"/                self computeThumbFrame.
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   835
"/                self drawThumb
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   836
	    ] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   837
		thumbFrame := nil
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   838
	    ]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   839
	]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   840
    ]
1189
909fd985eb2c use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents: 1167
diff changeset
   841
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
   842
    "Modified: / 21.1.1998 / 19:32:41 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   843
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
   844
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   845
!Scroller methodsFor:'accessing-behavior'!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   846
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   847
action:aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   848
    "for protocol compatibility; same as scrollAction:"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   849
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   850
    self scrollAction:aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   851
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   852
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   853
asynchronousOperation
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   854
    "set scroll-mode to be asynchronous - scroll action is performed after
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   855
     scrolling, when mouse-button is finally released"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   856
     
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   857
    synchronousOperation := false
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   858
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   859
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   860
disable
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   861
    "disable the scoller"
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   862
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   863
    enabled ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   864
	enabled := false.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   865
	self updateBackground.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   866
	self cursor: Cursor normal
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   867
    ]
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   868
!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   869
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   870
enable
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   871
    "enable the scroller"
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   872
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   873
    enabled ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   874
	enabled := true.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   875
	self updateBackground.
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   876
    ]
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   877
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   878
!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   879
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   880
scrollAction
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   881
    "answer the scroll action block"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   882
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   883
    ^ scrollAction
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   884
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   885
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   886
scrollAction:aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   887
    "set the scroll action, aBlock which is evaluated when scrolled"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   888
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   889
    scrollAction := aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   890
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   891
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   892
scrollDownAction:aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   893
    "ignored -
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   894
     but implemented, so that scroller can be used in place of a scrollbar"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   895
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   896
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   897
scrollUpAction:aBlock
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   898
    "ignored -
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   899
     but implemented, so that scroller can be used in place of a scrollbar"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   900
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   901
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   902
synchronousOperation
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   903
    "set scroll-mode to be synchronous - scroll action is performed for 
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   904
     every movement of thumb"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   905
     
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   906
    synchronousOperation := true
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   907
! !
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   908
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   909
!Scroller methodsFor:'accessing-bg & border'!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   910
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   911
allViewBackground:something
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   912
    "ignore here"
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   913
! !
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   914
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   915
!Scroller methodsFor:'accessing-channels'!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   916
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   917
enableChannel 
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   918
    "return a valueHolder for enable/disable"
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   919
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   920
    ^ enableChannel
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   921
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   922
!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   923
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   924
enableChannel:aValueHolder 
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   925
    "set the valueHolder, which holds the enable boolean value"
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   926
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   927
    |prev|
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   928
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   929
    prev := enableChannel.      
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   930
    enableChannel := aValueHolder.
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   931
    self setupChannel:aValueHolder for:nil withOld:prev
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   932
! !
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
   933
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   934
!Scroller methodsFor:'accessing-look'!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   935
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   936
is3D
958
b75025112346 commentary
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
   937
    "return true, if I use a 3D style"
b75025112346 commentary
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
   938
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   939
    <resource: #style (#name)>
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   940
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   941
    styleSheet name = #mswindows ifTrue:[^ true].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   942
    ^ super is3D
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   943
958
b75025112346 commentary
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
   944
    "Modified: 17.1.1997 / 23:21:42 / cg"
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   945
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   946
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   947
orientation 
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   948
    "return the scrollers orientation (#vertical or #horizontal)"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   949
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   950
    ^ orientation
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   951
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   952
1167
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   953
orientation:aSymbol 
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   954
    "set the scrollers orientation (#vertical or #horizontal)"
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   955
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   956
    |oldFrame|
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   957
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   958
    orientation := aSymbol.
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   959
    preferredExtent := nil.
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   960
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   961
    shown ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   962
	oldFrame := thumbFrame.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   963
	self computeThumbFrame.
1167
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   964
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   965
	oldFrame ~= thumbFrame ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   966
	    self invalidate.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   967
	]
1167
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   968
    ]
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   969
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   970
    "Created: 1.4.1997 / 12:18:32 / cg"
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   971
    "Modified: 1.4.1997 / 12:20:46 / cg"
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   972
!
90104d2f94d6 allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   973
689
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   974
thumb
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   975
    "for compatibility with scrollBars, return the receiver"
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   976
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   977
    ^ self
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   978
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   979
    "Created: 26.5.1996 / 12:21:12 / cg"
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   980
!
1f0e278ce283 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   981
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   982
thumbColor
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   983
    "return the thumbs color"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   984
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   985
    ^ thumbColor
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   986
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   987
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   988
thumbColor:aColor
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   989
    "change the color of the thumb"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   990
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   991
    <resource: #style (#name)>
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
   992
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   993
    thumbColor := aColor on:device.
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   994
    (styleSheet name ~~ #normal) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   995
	thumbShadowColor := aColor darkened on:device.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   996
	thumbLightColor := aColor lightened on:device.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   997
	thumbHalfShadowColor := thumbShadowColor darkened on:device.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   998
	thumbHalfLightColor := thumbLightColor lightened on:device.
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   999
    ].
993
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  1000
    self invalidate
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1001
993
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  1002
    "Modified: 8.2.1997 / 15:15:58 / cg"
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1003
! !
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1004
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1005
!Scroller methodsFor:'autoRepeat'!
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1006
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1007
repeatPageDown
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1008
    self pageDown.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1009
    Processor addTimedBlock:repeatBlock afterSeconds:repeatDelay
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1010
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1011
!
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1012
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1013
repeatPageUp
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1014
    self pageUp.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1015
    Processor addTimedBlock:repeatBlock afterSeconds:repeatDelay
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1016
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1017
! !
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1018
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1019
!Scroller methodsFor:'drawing'!
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1020
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1021
drawHandleFormAtX:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1022
    thumbShadowColor := thumbShadowColor on:device.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1023
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1024
    self paint:thumbShadowColor.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1025
    self displayForm:shadowForm x:x y:y.
1531
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1026
    lightForm notNil ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1027
	thumbLightColor := thumbLightColor on:device.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1028
	self paint:thumbLightColor.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1029
	self displayForm:lightForm x:x y:y.
1531
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1030
    ].
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1031
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1032
    "Modified: / 19.5.1998 / 16:26:49 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1033
!
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1034
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1035
drawThumb
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1036
    "draw the thumb"
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1037
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1038
    |handleX handleY l t lvl
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1039
     w "{ Class: SmallInteger }"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1040
     h "{ Class: SmallInteger }"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1041
     x "{ Class: SmallInteger }"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1042
     y "{ Class: SmallInteger }"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1043
     mm xL xR yT yB color1 color2|
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1044
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1045
    (thumbHeight >= 100) ifTrue:[^ self].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1046
    orientation == #vertical ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1047
	thumbFrame height >= height ifTrue:[^ self].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1048
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1049
	thumbFrame width >= width ifTrue:[^ self].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1050
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1051
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1052
    l := thumbFrame left.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1053
    t := thumbFrame top.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1054
    w := thumbFrame width.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1055
    h := thumbFrame height.
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1056
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1057
    self paint:(entered ifTrue:[thumbEnteredColor] ifFalse:[thumbColor]).
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1058
    self fillRectangleX:l y:t width:w-1 height:h.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1059
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1060
    lvl := thumbLevel.
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1061
    scrolling ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1062
	lvl := thumbActiveLevel
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1063
    ].
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1064
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1065
    lvl == 0 ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1066
	thumbFrameColor notNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1067
	    self paint:thumbFrameColor.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1068
	    self displayRectangle:thumbFrame.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1069
	].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1070
	thumbImage notNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1071
	    thumbImage displayOn:self x:l y:t
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1072
	].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1073
	^ self
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1074
    ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
  1075
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1076
    self drawEdgesForX:l y:t width:w height:h level:lvl
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1077
		shadow:thumbShadowColor light:thumbLightColor
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1078
		halfShadow:thumbHalfShadowColor halfLight:thumbHalfLightColor
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1079
		style:thumbEdgeStyle.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1080
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1081
    thumbFrameColor notNil ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1082
	self paint:thumbFrameColor.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1083
	orientation == #vertical ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1084
	    self displayRectangleX:l y:t width:w"-1" height:h.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1085
	] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1086
	    self displayRectangleX:l y:t width:w height:h"-1".
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1087
	]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1088
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1089
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1090
    thumbImage notNil ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1091
	thumbImage displayOn:self x:l y:t
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1092
    ].
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1093
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1094
    (tallyLevel == 0 or:[tallyMarks == 0]) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1095
	shadowForm notNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1096
	    handleX := l + ((w - 8) // 2).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1097
	    handleY := t + ((h - 8) // 2).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1098
	    self drawHandleFormAtX:handleX y:handleY
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1099
	].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1100
	^ self
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1101
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1102
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1103
    "iris style - draw tallys"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1104
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1105
    tallyLevel > 0 ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1106
	color1 := thumbLightColor.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1107
	color2 := thumbShadowColor.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1108
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1109
	color1 := thumbShadowColor.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1110
	color2 := thumbLightColor.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1111
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1112
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1113
    "draw tally marks"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1114
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1115
    (orientation == #vertical) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1116
	self paint:color1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1117
	y := t + (h // 2) - 1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1118
	xL := l + lvl - 1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1119
	xR := l + w - lvl "+ 1".
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1120
	self displayLineFromX:xL y:y toX:xR y:y.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1121
	y := y + 1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1122
	self paint:color2.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1123
	self displayLineFromX:xL y:y toX:xR y:y.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1124
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1125
	tallyMarks > 1 ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1126
	    "dont draw other marks if there is not enough space"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1127
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1128
	    mm := device verticalPixelPerMillimeter rounded.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1129
	    h > (mm * (tallyMarks * 2)) ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1130
		y := y - 1 - mm.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1131
		self paint:color1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1132
		self displayLineFromX:xL y:y toX:xR y:y.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1133
		y := y + 1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1134
		self paint:color2.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1135
		self displayLineFromX:xL y:y toX:xR y:y.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1136
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1137
		y := y - 1 + mm + mm.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1138
		self paint:color1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1139
		self displayLineFromX:xL y:y toX:xR y:y.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1140
		y := y + 1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1141
		self paint:color2.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1142
		self displayLineFromX:xL y:y toX:xR y:y
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1143
	    ]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1144
	]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1145
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1146
	x := l + (w // 2) - 1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1147
	yT := t + lvl - 1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1148
	yB := t + h - lvl "+ 1".
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1149
	self paint:color1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1150
	self displayLineFromX:x y:yT toX:x y:yB.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1151
	self paint:color2.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1152
	x := x + 1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1153
	self displayLineFromX:x y:yT toX:x y:yB.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1154
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1155
	tallyMarks > 1 ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1156
	    "dont draw other marks if there is not enough space"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1157
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1158
	    mm := device horizontalPixelPerMillimeter rounded.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1159
	    w > (mm * (tallyMarks * 2)) ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1160
		x := x - 1 - mm.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1161
		self paint:color1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1162
		self displayLineFromX:x y:yT toX:x y:yB.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1163
		x := x + 1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1164
		self paint:color2.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1165
		self displayLineFromX:x y:yT toX:x y:yB.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1166
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1167
		x := x - 1 + mm + mm.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1168
		self paint:color1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1169
		self displayLineFromX:x y:yT toX:x y:yB.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1170
		x := x + 1.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1171
		self paint:color2.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1172
		self displayLineFromX:x y:yT toX:x y:yB
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1173
	    ]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1174
	]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1175
    ]
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1176
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1177
    "Modified: / 12.5.1998 / 20:39:52 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1178
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1179
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1180
drawThumbBackgroundInX:x y:y width:w height:h
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1181
    "draw part of the thumbs background; defined as a separate
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1182
     method, to allow drawing of arbitrary patterns under thumb 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1183
     (see ColorSlider)."
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1184
699
6b464bf0ced8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
  1185
    |oldClip gX gY gW gH|
6b464bf0ced8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
  1186
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1187
    shown ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1188
	self clearRectangleX:x y:y width:w height:h.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1189
	frameBeforeMove notNil ifTrue:[
1009
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1190
	    (frameBeforeMove intersects:(x@y extent:w@h)) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1191
		oldClip := self clippingRectangleOrNil.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1192
		self clippingRectangle:(Rectangle left:x top:y width:w height:h).
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1193
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1194
		gX := frameBeforeMove left.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1195
		gY := frameBeforeMove top.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1196
		gW := frameBeforeMove width.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1197
		gH := frameBeforeMove height.
699
6b464bf0ced8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
  1198
            
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1199
		ghostColor notNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1200
		    self paint:ghostColor.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1201
		    self fillRectangle:frameBeforeMove.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1202
		].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1203
		(ghostLevel ~~ 0) ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1204
		    self drawEdgesForX:gX y:gY width:gW height:gH level:ghostLevel
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1205
		].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1206
		ghostFrameColor notNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1207
		    self paint:ghostFrameColor.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1208
		    self displayRectangleX:gX y:gY width:gW height:gH
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1209
		].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1210
		self clippingRectangle:oldClip
1009
ae6be1f683fe dont draw frameBeforeMove, if we dont have to
Claus Gittinger <cg@exept.de>
parents: 999
diff changeset
  1211
	    ]
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1212
	]
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1213
    ]
695
1c52a7c0166d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
  1214
699
6b464bf0ced8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
  1215
    "Modified: 28.5.1996 / 19:53:40 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1216
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1217
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1218
!Scroller methodsFor:'event handling'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1219
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1220
buttonMotion:state x:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1221
    "mouse-button was moved while pressed;
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1222
     redraw thumb at its new position and, if scroll-mode is asynchronous, 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1223
     the scroll action is performed"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1224
1800
e3e987087c46 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  1225
    <resource: #style (#name 
e3e987087c46 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  1226
                       #'scroller.snapBack')>
e3e987087c46 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  1227
1279
4cb391ed6fbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  1228
    |pos curr limit prevOrigin newOrigin snap|
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1229
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1230
    enabled ifFalse:[^ self].
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1231
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1232
    scrolling ifFalse: [
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1233
        self highlightThumbForPointerX:x y:y.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1234
        ^ self              
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1235
    ].              
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1236
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1237
    entered := true.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1238
    frameBeforeMove isNil ifTrue:[
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1239
        self startMove.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1240
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1241
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1242
    (orientation == #vertical) ifTrue:[
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1243
        curr := y.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1244
        limit := height.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1245
        snap := (x < SnapBackDistance negated) or:[x > (width + SnapBackDistance)].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1246
    ] ifFalse:[
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1247
        curr := x.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1248
        limit := width.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1249
        snap := (y < SnapBackDistance negated) or:[y > (height + SnapBackDistance)].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1250
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1251
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1252
    (curr < 0) ifTrue:[                        "check against limits"
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1253
        pos := 0
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1254
    ] ifFalse:[
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1255
        (curr > limit) ifTrue:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1256
            pos := limit
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1257
        ] ifFalse:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1258
            pos := curr
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1259
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1260
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1261
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1262
    prevOrigin := self thumbOrigin.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1263
    newOrigin := self percentFromAbs:(pos - pressOffset).
1133
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1264
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1265
    snap ifTrue:[
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1266
        (styleSheet at:#'scroller.snapBack' default:false) ifTrue:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1267
            newOrigin := originBeforeMove.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1268
        ]
1133
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1269
    ].
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1270
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1271
    prevOrigin ~= newOrigin ifTrue:[
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1272
        self thumbOrigin:newOrigin.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1273
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1274
        synchronousOperation ifTrue: [
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1275
            self tellOthers.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1276
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1277
    ]
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1278
1485
5716db1ccb4e care for nil thumbFrame (race condition)
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
  1279
    "Modified: / 14.4.1998 / 18:37:34 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1280
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1281
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1282
buttonMultiPress:button x:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1283
    ^ self buttonPress:button x:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1284
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1285
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1286
buttonPress:button x:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1287
    "button was pressed - if above thumb, page up; if below thumb, page down;
1301
1fbe38b283e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1288
     otherwise start scrolling.
1fbe38b283e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1289
     If either shift is pressed, or the 'scrollerMiddleButtonJump' styleSheet
1fbe38b283e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1290
     value is true and its the middle button, do a jump to the clicked position."
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1291
1514
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1292
    |curr limit1 limit2 sensor|
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1293
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1294
    enabled ifFalse:[^ self].
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1295
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1296
    shown ifFalse:[^ self].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1297
1420
e9999993396f ignore other button press/release while scrolling
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
  1298
    scrolling ifTrue:[^ self].
e9999993396f ignore other button press/release while scrolling
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
  1299
1514
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1300
    sensor := self sensor.
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1301
    (((sensor notNil and:[sensor shiftDown]))
1301
1fbe38b283e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  1302
    or:[DefaultMiddleButtonJump and:[button == 2]]) ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1303
        ^ self buttonShiftPress:button x:x y:y
811
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1304
    ].
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1305
    button ~~ 1 ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1306
        ^ self
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1307
    ].
811
7271a0746af6 Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
  1308
1295
dd5ba64ae8a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
  1309
    thumbFrame isNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1310
        self computeThumbFrame.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1311
        thumbFrame isNil ifTrue:[^ self].
1295
dd5ba64ae8a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
  1312
    ].
dd5ba64ae8a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
  1313
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1314
    (orientation == #vertical) ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1315
        curr := y.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1316
        limit1 := thumbFrame top.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1317
        limit2 := thumbFrame bottom
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1318
    ] ifFalse:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1319
        curr := x.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1320
        limit1 := thumbFrame left.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1321
        limit2 := thumbFrame right
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1322
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1323
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1324
    self highlightThumbForPointerX:x y:y.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1325
    self changeCursorFor:(x@y).
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1326
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1327
    (curr < limit1) ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1328
        "page up/left"
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1329
        self pageUp.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1330
        autoRepeat ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1331
            repeatBlock notNil ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1332
                Processor removeTimedBlock:repeatBlock.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1333
            ].
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1334
            repeatBlock := [self repeatPageUp].
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1335
            Processor addTimedBlock:repeatBlock afterSeconds:initialRepeatDelay
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1336
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1337
    ] ifFalse:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1338
        (curr > limit2) ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1339
            "page down/right"
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1340
            self pageDown.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1341
            autoRepeat ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1342
                repeatBlock notNil ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1343
                    Processor removeTimedBlock:repeatBlock.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1344
                ].
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1345
                repeatBlock := [self repeatPageDown].
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1346
                Processor addTimedBlock:repeatBlock afterSeconds:initialRepeatDelay
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1347
            ]
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1348
        ] ifFalse:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1349
            pressOffset := curr - limit1.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1350
            scrolling := true
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1351
        ]
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1352
    ].
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1353
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1354
    "Modified: / 2.2.1998 / 23:30:26 / stefan"
1514
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1355
    "Modified: / 7.5.1998 / 02:05:41 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1356
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1357
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1358
buttonRelease:button x:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1359
    "mouse-button was released - if scroll-mode is asynchronous, the scroll
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1360
     action is now performed"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1361
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1362
    |rect mustDrawThumb|
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1363
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1364
    repeatBlock notNil ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1365
        Processor removeTimedBlock:repeatBlock.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1366
        repeatBlock := nil
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1367
    ].
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1368
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1369
    (button == 1 or:[DefaultMiddleButtonJump and:[button == 2]])
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1370
    ifFalse:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1371
        ^ super buttonRelease:button x:x y:y
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1372
    ].
1420
e9999993396f ignore other button press/release while scrolling
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
  1373
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1374
    scrolling ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1375
        scrolling := false.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1376
        thumbFrame notNil ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1377
            mustDrawThumb := false.
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1378
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1379
            frameBeforeMove notNil ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1380
                rect := frameBeforeMove.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1381
                frameBeforeMove := nil.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1382
                self drawThumbBackgroundInX:rect left
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1383
                                          y:rect top
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1384
                                      width:rect width 
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1385
                                     height:rect height.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1386
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1387
                (rect intersects:thumbFrame) ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1388
                    mustDrawThumb := true.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1389
                ]
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1390
            ].
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1391
            thumbLevel ~~ thumbActiveLevel ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1392
                mustDrawThumb := true
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1393
            ].
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1394
            mustDrawThumb ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1395
                self drawThumb
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1396
            ].    
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1397
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1398
"/            scrolling := false.
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1399
            synchronousOperation ifFalse: [
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1400
                self tellOthers.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1401
            ]
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1402
        ]
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1403
    ].
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1404
    self changeCursorFor:(x@y)
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1405
1420
e9999993396f ignore other button press/release while scrolling
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
  1406
    "Modified: / 19.1.1998 / 13:45:59 / cg"
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1407
    "Modified: / 2.2.1998 / 23:37:27 / stefan"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1408
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1409
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1410
buttonShiftPress:button x:x y:y
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1411
    "mouse-click with shift - jump to position"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1412
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1413
    |pos curr curr2 limit1 limit2|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1414
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1415
    (orientation == #vertical) ifTrue:[
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1416
        curr := y.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1417
        curr2 := y - (thumbFrame height // 2).
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1418
        limit1 := height.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1419
        limit2 := thumbFrame top
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1420
    ] ifFalse:[
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1421
        curr := x.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1422
        curr2 := x - (thumbFrame width // 2).
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1423
        limit1 := width.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1424
        limit2 := thumbFrame left
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1425
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1426
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1427
    (curr2 < 0) ifTrue:[                        "check against limits"
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1428
        pos := 0
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1429
    ] ifFalse:[
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1430
        (curr2 > limit1) ifTrue:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1431
            pos := limit1
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1432
        ] ifFalse:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1433
            pos := curr2
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1434
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1435
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1436
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1437
    self startMove.
1432
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  1438
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  1439
    self thumbOrigin:(self percentFromAbs:pos).
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  1440
    self tellOthers.
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  1441
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1442
    (orientation == #vertical) ifTrue:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1443
        limit2 := thumbFrame top
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1444
    ] ifFalse:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1445
        limit2 := thumbFrame left
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1446
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1447
    pressOffset := curr - limit2.
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1448
    scrolling := true.
1133
4395bae7e94e added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
  1449
1801
92c6052b2d53 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  1450
    self changeCursorFor:(x@y).
92c6052b2d53 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  1451
92c6052b2d53 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  1452
1441
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1453
    "Modified: / 19.3.1997 / 11:29:08 / cg"
fdb91f9d5360 Correct behavior for button 2.
Stefan Vogel <sv@exept.de>
parents: 1432
diff changeset
  1454
    "Modified: / 2.2.1998 / 23:35:18 / stefan"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1455
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1456
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1457
changeCursorFor:p
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1458
    "update the mouse cursor"
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1459
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1460
    |crsr frm sensor which|
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1461
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1462
    enabled ifFalse:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1463
        self cursor:Cursor normal.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1464
        ^ self
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1465
    ].
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1466
    NewCursors ifFalse:[^ self].
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1467
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1468
    frm := self thumbFrame.
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1469
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1470
    thumbHeight = 100 ifTrue:[
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1471
        which := #normal.
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1472
    ] ifFalse:[
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1473
        sensor := self sensor.
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1474
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1475
        (((frm containsPoint:p) and:[sensor notNil and:[sensor leftButtonPressed]])
1801
92c6052b2d53 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  1476
         "or:[sensor notNil and:[sensor shiftDown]]") ifTrue:[ 
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1477
            orientation == #horizontal ifTrue:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1478
                which := #xMarker
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1479
            ] ifFalse:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1480
                which := #marker
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1481
            ].
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1482
        ] ifFalse:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1483
            orientation == #horizontal ifTrue:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1484
                p x > frm right ifTrue:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1485
                    which := #right
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1486
                ] ifFalse:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1487
                    p x < frm left ifTrue:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1488
                        which := #left
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1489
                    ] ifFalse:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1490
                        which := #hand
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1491
                    ]
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1492
                ]
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1493
            ] ifFalse:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1494
                p y > frm bottom ifTrue:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1495
                    which := #down
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1496
                ] ifFalse:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1497
                    p y < frm top ifTrue:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1498
                        which := #up
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1499
                    ] ifFalse:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1500
                        which := #hand
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1501
                    ]
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1502
                ]
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1503
            ]
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1504
        ]
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1505
    ].
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1506
    self cursor:(Cursor perform:which).
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1507
1514
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1508
    "Created: / 23.10.1997 / 03:55:24 / cg"
b819aca5ab4b care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1507
diff changeset
  1509
    "Modified: / 7.5.1998 / 02:06:10 / cg"
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1510
!
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1511
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1512
enableStateChange
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1513
    enableChannel value ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1514
	self enable
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1515
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1516
	self disable
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1517
    ].
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1518
!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1519
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1520
highlightThumbForPointerX:x y:y
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1521
    "if x/y is within the thumb frame, highlight it"
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1522
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1523
    |frm in crsr|
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1524
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1525
    in := (frm := self thumbFrame) containsPoint:(x@y).
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1526
    (in ~~ entered 
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1527
    or:[thumbLevel ~~ thumbActiveLevel]) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1528
	entered := in.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1529
	(thumbColor ~~ thumbEnteredColor 
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1530
	or:[thumbLevel ~~ thumbActiveLevel]) ifTrue: [
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1531
	    self drawThumb
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1532
	].
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1533
    ].
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1534
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1535
    self changeCursorFor:(x@y)
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1536
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1537
    "Created: 6.3.1996 / 17:35:07 / cg"
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1538
    "Modified: 23.10.1997 / 03:56:31 / cg"
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1539
!
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1540
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1541
keyPress:key x:x y:y
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1542
    "/ stupid - due to delegation, this is never invoked ...
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1543
    enabled ifFalse:[^ self].
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1544
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1545
    self changeCursorFor:(x@y).
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1546
    super keyPress:key x:x y:y
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1547
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1548
    "Created: 23.10.1997 / 03:57:34 / cg"
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1549
!
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1550
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1551
keyRelease:key x:x y:y
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  1552
    "/ stupid - due to delegation, this is never invoked ...
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1553
    self changeCursorFor:(x@y).
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1554
    super keyRelease:key x:x y:y
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1555
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1556
    "Created: 23.10.1997 / 03:58:25 / cg"
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1557
!
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1558
1706
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1559
pointerEnter:state x:x y:y
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1560
    "mouse-button left view
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1561
     redraw thumb if enteredColor ~~ thumbColor"
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1562
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1563
    scrolling ifTrue:[
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1564
        (state bitAnd:(device anyButtonMotionMask)) == 0 ifTrue: [
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1565
            self buttonRelease:1 x:x y:y
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1566
        ].
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1567
    ].
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1568
    super pointerEnter:state x:x y:y
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1569
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1570
    "Modified: / 14.10.1998 / 15:40:51 / cg"
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1571
!
eb2f9e689f5e when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  1572
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1573
pointerLeave:state
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1574
    "mouse-button left view
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1575
     redraw thumb if enteredColor ~~ thumbColor"
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1576
759
9defb0b4883a oops - ignore caps-lock/scroll-lock etc. in pointerLeave
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  1577
    (entered and:[(state bitAnd:(device anyButtonMotionMask)) == 0]) ifTrue: [
1673
ff43258f2224 only redraw in pointerLeave, if thumbColor will change
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
  1578
        entered := false.
ff43258f2224 only redraw in pointerLeave, if thumbColor will change
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
  1579
        thumbEnteredColor ~= thumbColor ifTrue:[
ff43258f2224 only redraw in pointerLeave, if thumbColor will change
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
  1580
            self invalidate.
ff43258f2224 only redraw in pointerLeave, if thumbColor will change
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
  1581
            "/ self drawThumb
ff43258f2224 only redraw in pointerLeave, if thumbColor will change
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
  1582
        ]
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1583
    ].
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1584
1673
ff43258f2224 only redraw in pointerLeave, if thumbColor will change
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
  1585
    "Created: / 6.3.1996 / 17:31:16 / cg"
ff43258f2224 only redraw in pointerLeave, if thumbColor will change
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
  1586
    "Modified: / 11.9.1998 / 00:13:53 / cg"
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1587
!
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1588
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1589
redraw
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1590
    "redraw"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1591
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1592
    self redrawX:0 y:0 width:width height:height.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1593
    self redrawEdges
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1594
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1595
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1596
redrawX:x y:y width:w height:h
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1597
    shown ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1598
	thumbFrame isNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1599
	    self computeThumbFrame
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1600
	].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1601
	self drawThumbBackgroundInX:x y:y width:w height:h.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1602
	thumbFrame isNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1603
	    "/ thumb hidden
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1604
	    ^ self 
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1605
	].
767
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1606
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1607
	orientation == #vertical ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1608
	    (y > thumbFrame bottom) ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1609
		^ self
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1610
	    ].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1611
	    ((y + h) < thumbFrame top) ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1612
		^ self
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1613
	    ].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1614
	] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1615
	    (x > thumbFrame right) ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1616
		^ self
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1617
	    ].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1618
	    ((x + w) < thumbFrame left) ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1619
		^ self
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1620
	    ].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1621
	].
767
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1622
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1623
	self drawThumb
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1624
    ]
767
c96a1130b833 oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents: 764
diff changeset
  1625
1366
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1626
    "Modified: / 29.10.1997 / 15:48:48 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1627
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1628
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1629
sizeChanged:how
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1630
    "size of scroller changed - recompute thumbs frame and redraw it"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1631
1718
a472f4a57562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  1632
    |oldThumbFrame|
a472f4a57562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  1633
a472f4a57562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  1634
    oldThumbFrame := thumbFrame.
1444
eff7016070f8 no need for invalidate on sizeChange (will get expose event anyway)
Claus Gittinger <cg@exept.de>
parents: 1441
diff changeset
  1635
    thumbFrame := nil.
1507
c712eb1a247e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1636
    shown ifTrue:[
1718
a472f4a57562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  1637
        oldThumbFrame notNil ifTrue:[
a472f4a57562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  1638
            self computeThumbFrame.
a472f4a57562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  1639
            "/ any change ?
a472f4a57562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  1640
            thumbFrame = oldThumbFrame ifTrue:[
a472f4a57562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  1641
                ^ self
a472f4a57562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  1642
            ].
a472f4a57562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  1643
        ].
a472f4a57562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  1644
        "/ self clear.
a472f4a57562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  1645
        self invalidate
1507
c712eb1a247e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
  1646
    ].
1127
e55aa76e226d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1122
diff changeset
  1647
1718
a472f4a57562 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  1648
    "Modified: / 7.11.1998 / 14:45:08 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1649
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1650
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1651
update:something with:aParameter from:changedObject
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1652
    "handle update from a model (if any)"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1653
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1654
    (changedObject == model 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1655
    "and:[something == aspectMsg]") ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1656
	self thumbOrigin:(model value).
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1657
	^ self
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1658
    ].
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1659
    changedObject == enableChannel ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1660
	self enableStateChange.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1661
	^ self
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1662
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1663
    super update:something with:aParameter from:changedObject
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1664
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1665
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1666
!Scroller methodsFor:'forced scroll'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1667
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1668
pageDown
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1669
    "page down/right"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1670
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1671
    self thumbOrigin:(thumbOrigin + thumbHeight).
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1672
    self tellOthers
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1673
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1674
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1675
pageUp
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1676
    "page up/left"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1677
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1678
    self thumbOrigin:(thumbOrigin - thumbHeight).
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1679
    self tellOthers
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1680
!
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1681
1493
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1682
scrollStep:delta
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1683
    "step by some delta"
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1684
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1685
    |oldOrg newOrg|
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1686
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1687
    oldOrg := self thumbOrigin.
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1688
    newOrg := ((oldOrg + delta) max:rangeStart) min:rangeEnd.
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1689
    oldOrg ~= newOrg ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1690
	self thumbOrigin:newOrg.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1691
	self tellOthers.
1493
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1692
    ]
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1693
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1694
    "Created: / 21.4.1998 / 20:51:57 / cg"
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1695
    "Modified: / 21.4.1998 / 20:52:22 / cg"
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1696
!
3b76c81608e5 moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  1697
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1698
scrollToBeginning
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1699
    "scroll to the beginning"
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1700
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1701
    self thumbOrigin:rangeStart.
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1702
    self tellOthers
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1703
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1704
    "Created: 6.3.1996 / 17:55:13 / cg"
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1705
!
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1706
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1707
scrollToEnd
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1708
    "scroll to the end"
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1709
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1710
    self thumbOrigin:rangeEnd.
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1711
    self tellOthers
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1712
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1713
    "Created: 6.3.1996 / 17:55:25 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1714
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1715
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1716
!Scroller methodsFor:'forwarding changed origin'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1717
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1718
tellOthers
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1719
    |org|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1720
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1721
    org := self thumbOrigin.
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1722
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1723
    "
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1724
     the ST-80 way of notifying scrolls
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1725
    "
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1726
    self sendChangeMessageWith:org.
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1727
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1728
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1729
     the ST/X way of notifying scrolls
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1730
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1731
    scrollAction notNil ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1732
	scrollAction value:org 
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1733
    ].
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1734
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1735
    "/
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1736
    "/ this will vanish - the scroller should share
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1737
    "/ a valueHolder with the scrolledView.
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1738
    "/
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1739
    self changed:#scrollerPosition.
1011
71ae1d5c633d commentary
Claus Gittinger <cg@exept.de>
parents: 1009
diff changeset
  1740
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  1741
    "Modified: / 21.1.1998 / 19:12:55 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1742
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1743
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1744
!Scroller methodsFor:'initialization'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1745
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1746
defaultExtent
571
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  1747
    "compute my extent from sub-components"
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  1748
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1749
    ^ self preferredExtent
571
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  1750
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 556
diff changeset
  1751
    "Modified: 22.4.1996 / 23:37:53 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1752
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1753
930
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1754
fetchDeviceResources
931
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 930
diff changeset
  1755
    "fetch device colors, to avoid reallocation at redraw time"
930
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1756
931
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 930
diff changeset
  1757
    super fetchDeviceResources.
930
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1758
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1759
    thumbShadowColor notNil ifTrue:[thumbShadowColor := thumbShadowColor on:device].
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1760
    thumbLightColor notNil ifTrue:[thumbLightColor := thumbLightColor on:device].
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1761
    thumbHalfShadowColor notNil ifTrue:[thumbHalfShadowColor := thumbHalfShadowColor on:device].
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1762
    thumbHalfLightColor notNil ifTrue:[thumbHalfLightColor := thumbHalfLightColor on:device].
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1763
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1764
    thumbEnteredColor notNil ifTrue:[thumbEnteredColor := thumbEnteredColor on:device].
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1765
    ghostColor notNil ifTrue:[ghostColor := ghostColor on:device].
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1766
    ghostFrameColor notNil ifTrue:[ghostFrameColor := ghostFrameColor on:device].
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1767
931
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 930
diff changeset
  1768
    "Modified: 13.1.1997 / 21:56:38 / cg"
930
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1769
!
0232b8f7ff39 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  1770
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1771
initCursor
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1772
    "set the cursor - a hand"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1773
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1774
    cursor := Cursor hand
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1775
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1776
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1777
initStyle
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1778
    "initialize style dep. stuff"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1779
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1780
    <resource: #style (#name 
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1781
                       #'scroller.autoRepeat'
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1782
                       #'scroller.initialRepeatDelay'
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1783
                       #'scroller.repeatDelay')>
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1784
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1785
    |nm|
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1786
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1787
    super initStyle.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1788
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1789
    DefaultViewBackground notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1790
        viewBackground := DefaultViewBackground onDevice:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1791
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1792
    DefaultShadowColor notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1793
        shadowColor := DefaultShadowColor onDevice:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1794
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1795
    DefaultLightColor notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1796
        lightColor := DefaultLightColor onDevice:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1797
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1798
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1799
    tallyMarks := DefaultTallyMarks.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1800
    tallyLevel := DefaultTallyLevel.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1801
    DefaultLevel ~~ level ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1802
        self level:DefaultLevel.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1803
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1804
    DefaultBorderWidth ~~ borderWidth ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1805
        self borderWidth:DefaultBorderWidth.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1806
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1807
    thumbLevel := DefaultThumbLevel.
505
e13ee348dcc4 added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents: 483
diff changeset
  1808
    thumbActiveLevel := DefaultThumbActiveLevel.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1809
    inset := DefaultInset.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1810
    fixThumbHeight := DefaultFixThumbHeight.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1811
    thumbEdgeStyle := DefaultEdgeStyle.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1812
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1813
    DefaultGhostColor notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1814
        ghostColor := DefaultGhostColor onDevice:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1815
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1816
    DefaultGhostFrameColor notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1817
        ghostFrameColor := DefaultGhostFrameColor onDevice:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1818
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1819
    ghostLevel := DefaultGhostLevel.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1820
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1821
    DefaultThumbFrameColor notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1822
        thumbFrameColor := DefaultThumbFrameColor onDevice:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1823
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1824
    DefaultThumbShadowColor notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1825
        thumbShadowColor := DefaultThumbShadowColor
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1826
    ] ifFalse:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1827
        thumbShadowColor := shadowColor.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1828
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1829
    DefaultThumbLightColor notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1830
        thumbLightColor := DefaultThumbLightColor
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1831
    ] ifFalse:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1832
        thumbLightColor := lightColor.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1833
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1834
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1835
    thumbEdgeStyle notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1836
        DefaultThumbHalfShadowColor notNil ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1837
            thumbHalfShadowColor := DefaultThumbHalfShadowColor
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1838
        ].
1121
dccc1c729fd3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
  1839
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1840
        DefaultThumbHalfLightColor notNil ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1841
            thumbHalfLightColor := DefaultThumbHalfLightColor
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1842
        ].
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1843
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1844
764
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1845
    nm := styleSheet name.
cf2d400da579 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1846
709
a738bd76ace4 grey vs. gray
Claus Gittinger <cg@exept.de>
parents: 705
diff changeset
  1847
    device hasGrayscales ifFalse:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1848
        thumbEdgeStyle notNil ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1849
            thumbHalfShadowColor := Color darkGray.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1850
            thumbHalfLightColor := White
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1851
        ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1852
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1853
        thumbShadowColor := Black.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1854
"/        thumbLightColor := White.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1855
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1856
        nm = #motif ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1857
            DefaultThumbColor isNil ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1858
                thumbColor := White .
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1859
            ].
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1860
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1861
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1862
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1863
    DefaultThumbColor notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1864
        thumbColor := DefaultThumbColor onDevice:device
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1865
    ] ifFalse:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1866
        thumbColor := White.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1867
        nm ~= #normal ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1868
            device hasGrayscales ifFalse:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1869
                thumbColor := Color grey
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1870
            ].
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1871
        ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1872
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1873
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1874
    thumbColor := thumbColor on:device.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1875
    thumbShadowColor notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1876
        thumbShadowColor := thumbShadowColor onDevice:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1877
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1878
    thumbLightColor notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1879
        thumbLightColor := thumbLightColor onDevice:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1880
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1881
    thumbHalfShadowColor notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1882
        thumbHalfShadowColor := thumbHalfShadowColor onDevice:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1883
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1884
    thumbHalfLightColor notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1885
        thumbHalfLightColor := thumbHalfLightColor onDevice:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1886
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1887
    thumbEdgeStyle notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1888
        thumbHalfShadowColor isNil ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1889
            thumbHalfShadowColor := thumbShadowColor lightened onDevice:device
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1890
        ]
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1891
    ].
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1892
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1893
    DefaultThumbEnteredColor notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1894
        thumbEnteredColor := DefaultThumbEnteredColor onDevice:device.
1366
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1895
    ] ifFalse:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1896
        thumbEnteredColor := thumbColor.
1366
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1897
    ].
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1898
652634d99bfe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1899
    (DefaultThumbEnteredColor notNil or:[NewCursors]) ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1900
        self enableMotionEvents.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1901
        self enableEnterLeaveEvents.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1902
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1903
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1904
    DefaultThumbImage notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1905
        thumbImage := DefaultThumbImage onDevice:device.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1906
        fixThumbHeight := true.
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1907
    ].
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1908
1531
c5f2cfee9998 allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1909
    HandleImage notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1910
        shadowForm := HandleImage onDevice:device.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1911
    ] ifFalse:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1912
        nm = #next ifTrue:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1913
            shadowForm := self class handleShadowFormOn:device.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1914
            lightForm := self class handleLightFormOn:device
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1915
        ] ifFalse:[
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1916
            shadowForm := lightForm := nil
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1917
        ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1918
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1919
    drawableId notNil ifTrue:[
1794
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1920
        self computeThumbFrame
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1921
    ].
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1922
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1923
    autoRepeat := styleSheet at:#'scroller.autoRepeat' default:true.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1924
    initialRepeatDelay := styleSheet at:#'scroller.initialRepeatDelay' default:0.2.
f3dd5bcc9876 added autoRepeat
Claus Gittinger <cg@exept.de>
parents: 1768
diff changeset
  1925
    repeatDelay := styleSheet at:#'scroller.repeatDelay' default:0.1.
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1926
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1927
    "Modified: / 5.9.1998 / 20:21:41 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1928
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1929
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1930
initialize
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1931
    "initialize - setup instvars from defaults"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1932
1768
32eb81e67be1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  1933
    orientation isNil ifTrue:[orientation := #vertical].
453
dc035dd8b9eb oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1934
1768
32eb81e67be1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  1935
    super initialize.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1936
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1937
    scrolling := entered              := false.
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  1938
    enabled   := synchronousOperation := true.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1939
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1940
    thumbOrigin := 0.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1941
    thumbHeight := 100.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1942
    thumbFrameSizeDifference := 0.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1943
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1944
    rangeStart := 0.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1945
    rangeEnd := 100.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1946
    rangeStep := nil.   "/ meaning: arbitrary precision
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1947
"/    inset := 1.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1948
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1949
"/    self computeThumbFrame
483
368b5f8862b1 added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents: 454
diff changeset
  1950
1768
32eb81e67be1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  1951
    "Modified: / 7.3.1999 / 00:07:32 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1952
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1953
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1954
realize
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1955
    super realize.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1956
    model notNil ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1957
	self thumbOrigin:(model value).
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1958
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1959
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1960
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1961
!Scroller methodsFor:'private'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1962
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1963
absFromPercent:percent
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1964
    "given a percentage, compute number of pixels"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1965
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1966
    |fullSize|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1967
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1968
    (orientation == #vertical) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1969
	fullSize := height 
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1970
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1971
	fullSize := width
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1972
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1973
1115
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  1974
    "/ avoid hitting the boundary if no frame and no level (i.e. st80 style)
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  1975
    (thumbLevel == 0 and:[thumbFrameColor isNil]) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  1976
	fullSize := fullSize - 1
1115
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  1977
    ].
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  1978
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  1979
    ^ ((percent * (fullSize - thumbFrameSizeDifference - (margin * 2))) / 100) rounded
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  1980
6b7ba45f83a9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
  1981
    "Modified: 7.3.1997 / 16:05:57 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1982
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1983
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1984
computeThumbFrame
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1985
    "compute the thumbs frame (a rectangle) whenever thumb is moved, 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1986
     changed height or the scrollers size has changed.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1987
     We take care, that the thumb will not become too small (i.e.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1988
     invisible or uncatchable).
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1989
     Also, for mswindows style, its height/width is constant."
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1990
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1991
    |newPos1 newPos2 newSize1 newSize2 nh nw ny nx 
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1992
     computedSize minSz sz1 sz2|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1993
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1994
    "compute position & size"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1995
    newPos1 := (self absFromPercent:thumbOrigin) + margin.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1996
    newSize1 := computedSize := self absFromPercent:thumbHeight.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  1997
    (orientation == #vertical) ifTrue:[
1662
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  1998
        sz1 := height.
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  1999
        sz2 := width
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2000
    ] ifFalse:[
1662
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2001
        sz1 := width.
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2002
        sz2 := height
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2003
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2004
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2005
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2006
     do we have to adjust the computed size ?
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2007
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2008
    newPos2 := margin + inset.     
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2009
    newSize2 := sz2 - (2 * newPos2).
1662
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2010
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2011
"/    (style ~~ #normal) ifTrue:[
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2012
    thumbLevel ~~ 0 ifTrue:[
1662
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2013
        "
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2014
         do not make thumb too small (for handle & to be catchable)
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2015
        "
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2016
        minSz := 10 + (2 * thumbLevel)
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2017
    ] ifFalse:[
1662
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2018
        "
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2019
         do not make thumb too small (uncatchable)
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2020
        "
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2021
        minSz := 4
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2022
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2023
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2024
    (newSize1 < minSz) ifTrue:[
1662
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2025
        newSize1 := minSz.
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2026
        thumbFrameSizeDifference := newSize1 - computedSize
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2027
    ] ifFalse:[
1662
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2028
        thumbFrameSizeDifference := 0.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2029
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2030
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2031
    fixThumbHeight ifTrue:[
1662
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2032
        "have a fix-size thumb (i.e. mswindows style)"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2033
1662
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2034
        newSize1 := sz2 - (2 * inset).   "make it square"
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2035
        thumbImage notNil ifTrue:[
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2036
            newSize1 := (newSize1 max:(thumbImage height)) max:(thumbImage width)
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2037
        ].
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2038
        thumbFrameSizeDifference := newSize1 - computedSize.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2039
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2040
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2041
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2042
     oops - if height does not relect real visibible area, we have to adjust the origin
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2043
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2044
    (thumbFrameSizeDifference == 0) ifFalse:[
1662
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2045
        newPos1 := (self absFromPercent:thumbOrigin) + margin.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2046
"/        newPos1 := ((thumbOrigin * (sz1 - thumbFrameSizeDifference - (margin * 2))) / 100) rounded + margin
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2047
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2048
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2049
    (orientation == #vertical) ifTrue:[
1662
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2050
        ny := newPos1.
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2051
        nx := newPos2.
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2052
        nh := newSize1.
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2053
        nw := newSize2 max:2.
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2054
        ny + nh + margin > height ifTrue:[
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2055
            ny := height - margin - nh
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2056
        ].
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2057
        (nx+nw) >= width ifTrue:[
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2058
            nx := ((width - nw) // 2) max:0.
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2059
        ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2060
    ] ifFalse:[
1662
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2061
        nx := newPos1.
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2062
        ny := newPos2.
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2063
        nw := newSize1.
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2064
        nh := newSize2 max:2.
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2065
        nx + nw + margin > width ifTrue:[
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2066
            nx := width - margin - nw
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2067
        ].
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2068
        (ny+nh) >= height ifTrue:[
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2069
            ny := ((height - nh) // 2) max:0.
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2070
        ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2071
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2072
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2073
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2074
     do not create new Rectangle if its the same anyway
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2075
    "
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2076
    thumbFrame notNil ifTrue:[
1662
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2077
        (ny == thumbFrame top) ifTrue:[
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2078
          (nx == thumbFrame left) ifTrue:[
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2079
            (nh == thumbFrame height) ifTrue:[
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2080
              (nw == thumbFrame width) ifTrue:[ ^ self]
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2081
            ]
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2082
          ]
1b1401869566 make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents: 1657
diff changeset
  2083
        ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2084
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2085
    thumbFrame := Rectangle left:nx top:ny width:nw height:nh
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2086
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2087
    "Modified: / 12.5.1998 / 20:58:51 / cg"
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2088
!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2089
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2090
percentFromAbs:absValue
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2091
    "given a number of pixels, compute percentage"
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2092
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2093
    |fullSize val t|
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2094
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2095
    (orientation == #vertical) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2096
	fullSize := height
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2097
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2098
	fullSize := width
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2099
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2100
1283
1d1a04076471 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1279
diff changeset
  2101
    absValue < 0 ifTrue:[^ rangeStart].
1d1a04076471 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1279
diff changeset
  2102
    absValue > fullSize ifTrue:[^ rangeEnd].
1d1a04076471 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1279
diff changeset
  2103
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2104
    t := fullSize - thumbFrameSizeDifference - (margin * 2).
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2105
    t = 0 ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2106
	"/ in rare cases, this happens ...
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2107
	val := 0
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2108
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2109
	val := absValue / t * (rangeEnd - rangeStart).
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2110
    ].
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2111
    val := val + rangeStart.
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2112
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2113
    rangeStart < rangeEnd ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2114
	val < rangeStart ifTrue:[^ rangeStart].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2115
	val > rangeEnd ifTrue:[^ rangeEnd].
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2116
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2117
	val > rangeStart ifTrue:[^ rangeStart].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2118
	val < rangeEnd ifTrue:[^ rangeEnd].
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2119
    ].
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2120
    ^ val
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2121
1424
e90680159109 handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents: 1420
diff changeset
  2122
    "Modified: / 21.1.1998 / 19:31:15 / cg"
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2123
!
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2124
1799
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2125
startMove
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2126
    originBeforeMove := self thumbOrigin.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2127
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2128
    (ghostColor notNil 
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2129
    or:[ghostFrameColor notNil
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2130
    or:[ghostLevel ~~ 0]]) ifTrue:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2131
        thumbFrame isNil ifTrue:[
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2132
            self computeThumbFrame.
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2133
        ].
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2134
        frameBeforeMove := thumbFrame insetBy:1@1
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2135
    ].
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2136
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2137
!
7d3daeab6afe fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents: 1794
diff changeset
  2138
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2139
updateBackground
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2140
    "make my background grey, whenever either readOnly or disable"
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2141
1731
5f8ceeb41e93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  2142
    |bg|
5f8ceeb41e93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  2143
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2144
    enabled ifFalse:[
1731
5f8ceeb41e93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  2145
        bg := View defaultViewBackgroundColor.
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2146
    ] ifTrue:[
1731
5f8ceeb41e93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  2147
        bg := DefaultViewBackground.
1652
3c8983776c9e enableChannel added
tz
parents: 1531
diff changeset
  2148
    ].
1731
5f8ceeb41e93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  2149
5f8ceeb41e93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  2150
    bg ~= viewBackground ifTrue:[
5f8ceeb41e93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  2151
        self backgroundColor:bg.
5f8ceeb41e93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  2152
        self invalidate
5f8ceeb41e93 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  2153
    ]
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2154
! !
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2155
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2156
!Scroller methodsFor:'private scrollbar & scrollview interface'!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2157
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2158
setThumbFor:aView
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2159
    "get contents and size info from aView and adjust thumb"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2160
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2161
    |percentSize percentOrigin contentsSize contentsPosition viewsSize|
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2162
1432
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2163
    scrolling ifTrue:[self invalidate].
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2164
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2165
    "
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2166
     get the content's size
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2167
    "
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2168
    aView isNil ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2169
	contentsSize := 0
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2170
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2171
	orientation == #vertical ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2172
	    contentsSize := aView heightOfContents.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2173
	    aView transformation notNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2174
		contentsSize := aView transformation applyScaleY:contentsSize.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2175
	    ].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2176
	] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2177
	    contentsSize := aView widthOfContents.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2178
	    aView transformation notNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2179
		contentsSize := aView transformation applyScaleX:contentsSize.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2180
	    ].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2181
	]
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2182
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2183
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2184
    (contentsSize = 0) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2185
	percentSize := 100.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2186
	percentOrigin := 100
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2187
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2188
	(orientation == #vertical) ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2189
	    viewsSize := aView innerHeight.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2190
	    contentsPosition := aView yOriginOfContents.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2191
	] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2192
	    viewsSize := aView innerWidth.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2193
	    contentsPosition := aView xOriginOfContents
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2194
	].
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2195
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2196
	percentSize := viewsSize * 100.0 / contentsSize.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2197
	percentOrigin := contentsPosition * 100.0 / contentsSize.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2198
	percentOrigin + percentSize > 100.0 ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2199
	    "actually showing stuff below contents of view"
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2200
"
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2201
	    contentsSize := contentsPosition + aView innerHeight.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2202
	    percentSize := viewsSize * 100.0 / contentsSize.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2203
	    percentOrigin := contentsPosition * 100.0 / contentsSize
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2204
"
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2205
	]
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2206
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2207
    (percentSize = thumbHeight) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2208
	self thumbOrigin:percentOrigin
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2209
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2210
	(percentOrigin = thumbOrigin) ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2211
	    self thumbHeight:percentSize
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2212
	] ifFalse:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2213
	    self thumbOrigin:percentOrigin thumbHeight:percentSize
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2214
	]
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2215
    ]
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2216
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2217
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2218
setThumbHeightFor:aView
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2219
    "get contents and size info from aView and adjust thumb height"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2220
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2221
    |percent total viewsSize|
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2222
1432
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2223
    scrolling ifTrue:[self invalidate].
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2224
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2225
    (orientation == #vertical) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2226
	total := aView heightOfContents.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2227
	aView transformation notNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2228
	    total := aView transformation applyScaleY:total.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2229
	].
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2230
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2231
	total := aView widthOfContents.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2232
	aView transformation notNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2233
	    total := aView transformation applyScaleX:total.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2234
	].
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2235
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2236
    (total = 0) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2237
	percent := 100
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2238
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2239
	viewsSize := (orientation == #vertical) ifTrue:[aView innerHeight]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2240
					   ifFalse:[aView innerWidth].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2241
	percent := viewsSize * 100.0 / total
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2242
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2243
    self thumbHeight:percent
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2244
!
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2245
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2246
setThumbOriginFor:aView
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2247
    "get contents and size info from aView and adjust thumb origin"
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2248
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2249
    |percent total contentsPosition|
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2250
1432
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2251
    scrolling ifTrue:[self invalidate].
12b827160a7b care for changing thumbOrigin/height while scrolling
dq
parents: 1424
diff changeset
  2252
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2253
    (orientation == #vertical) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2254
	total := aView heightOfContents.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2255
	aView transformation notNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2256
	    total := aView transformation applyScaleY:total.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2257
	].
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2258
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2259
	total := aView widthOfContents.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2260
	aView transformation notNil ifTrue:[
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2261
	    total := aView transformation applyScaleX:total.
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2262
	].
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2263
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2264
    (total = 0) ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2265
	percent := 100
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2266
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2267
	contentsPosition := (orientation == #vertical) ifTrue:[aView yOriginOfContents]
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2268
						  ifFalse:[aView xOriginOfContents].
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2269
	percent := contentsPosition * 100.0 / total
454
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2270
    ].
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2271
    self thumbOrigin:percent
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2272
! !
0bfffd88f611 method organization
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2273
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2274
!Scroller methodsFor:'queries'!
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2275
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2276
preferredExtent
572
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2277
    "return my preferredExtent"
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2278
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2279
    |defExt w h|
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2280
797
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2281
    "/ If I have an explicit preferredExtent ..
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 786
diff changeset
  2282
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2283
    preferredExtent notNil ifTrue:[
1768
32eb81e67be1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2284
        ^ preferredExtent
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2285
    ].
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2286
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2287
    defExt := self class defaultExtent.
452
f255470106c4 oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents: 448
diff changeset
  2288
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2289
    orientation == #vertical ifTrue:[
1768
32eb81e67be1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2290
        h := defExt y.
32eb81e67be1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2291
        w := (device horizontalPixelPerMillimeter asFloat * 5) rounded.
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2292
    ] ifFalse:[
1768
32eb81e67be1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2293
        w := defExt x.
32eb81e67be1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2294
        h := (device verticalPixelPerMillimeter asFloat * 5) rounded.
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2295
    ].
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2296
786
8b301af1cdcc remember and do not recompute the preferredExtent;
Claus Gittinger <cg@exept.de>
parents: 767
diff changeset
  2297
    preferredExtent := w @ h.
8b301af1cdcc remember and do not recompute the preferredExtent;
Claus Gittinger <cg@exept.de>
parents: 767
diff changeset
  2298
    ^ preferredExtent.
538
b747ea31b972 use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
  2299
1768
32eb81e67be1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2300
    "Modified: / 7.3.1999 / 00:08:10 / cg"
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2301
!
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2302
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2303
thumbVisible
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2304
    "return true, if the thumb is usable i.e. its visible & movable.
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2305
     Can be used by the scrollBar to decide if it should hide the scroller."
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2306
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2307
    |m2|
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2308
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2309
    (thumbHeight >= 100) ifTrue:[^ false].
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2310
    self computeThumbFrame.
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2311
    thumbFrame isNil ifTrue:[^ false].
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2312
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2313
    m2 := margin * 2.
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2314
    orientation == #vertical ifTrue:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2315
	thumbFrame height >= (height - m2) ifTrue:[^ false].
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2316
    ] ifFalse:[
1657
4ae7bf80d51a use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
  2317
	thumbFrame width >= (width - m2) ifTrue:[^ false].
1122
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2318
    ].
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2319
    ^ true
c289c1e01525 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  2320
1518
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2321
    "Created: / 7.3.1997 / 21:10:23 / cg"
6d8e1461f119 removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  2322
    "Modified: / 12.5.1998 / 20:21:00 / cg"
446
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2323
! !
98f38de97099 category organization
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  2324
897
d87c43b66d97 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  2325
!Scroller class methodsFor:'documentation'!
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
  2326
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  2327
version
1801
92c6052b2d53 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  2328
    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.119 1999-03-16 17:42:33 cg Exp $'
105
3d064ba4a0cc *** empty log message ***
claus
parents: 103
diff changeset
  2329
! !