NoteBookView.st
author Claus Gittinger <cg@exept.de>
Wed, 24 Oct 2001 00:12:16 +0200
changeset 2036 6f3927ad36fc
parent 2035 6cc4d73f17e1
child 2139 8034a4186235
permissions -rw-r--r--
oops - strange side effect
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
     1
"
365d33b8e942 so far so good
ca
parents: 355
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
     3
              All Rights Reserved
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
     4
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
     5
 This software is furnished under a license and may be used
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
     6
 only in accordance with the terms of that license and with the
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
     9
 other person.  No title to or ownership of the software is
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    10
 hereby transferred.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    11
"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    12
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    13
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
    14
"{ Package: 'stx:libwidg2' }"
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
    15
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    16
View subclass:#NoteBookView
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    17
	instanceVariableNames:'list listHolder foregroundColor selection enabled action useIndex
1802
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
    18
		direction numberOfLines selectConditionBlock tabMenuActionBlock
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
    19
		accessTabMenuAction expandSelection canvas canvasInset
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
    20
		canvasFrameLevel canvasHolder halfLightColor halfShadowColor
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
    21
		fitLastRow tabModus lastComputedExtent keepCanvas tabMargin
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
    22
		activeForegroundColor drawLightColor edgeStyle tabBgColor
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
    23
		activeTabBgColor disabledForegroundColor tabLevel'
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
    24
	classVariableNames:'DefaultForegroundColor DefaultActiveForegroundColor
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
    25
		DefaultShadowColor DefaultHalfShadowColor DefaultLightColor
1700
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
    26
		DefaultHalfLightColor DefaultEdgeStyle DisabledForegroundColor'
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    27
	poolDictionaries:''
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    28
	category:'Views-Layout'
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    29
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    30
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    31
Object subclass:#Tab
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
    32
	instanceVariableNames:'label model printableLabel disabledLabel lineNr layout extent
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
    33
		accessCharacter'
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    34
	classVariableNames:''
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    35
	poolDictionaries:''
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    36
	privateIn:NoteBookView
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    37
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    38
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    39
!NoteBookView class methodsFor:'documentation'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    40
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    41
copyright
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    42
"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    43
 COPYRIGHT (c) 1997 by eXept Software AG
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    44
              All Rights Reserved
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    45
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    46
 This software is furnished under a license and may be used
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    47
 only in accordance with the terms of that license and with the
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    48
 inclusion of the above copyright notice.   This software may not
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    49
 be provided or otherwise made available to, or used by, any
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    50
 other person.  No title to or ownership of the software is
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    51
 hereby transferred.
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    52
"
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    53
355
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
!
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
documentation
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
"
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    58
    implements the noteBook.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    59
    May also be used on its own (without a surrounding noteBook).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    60
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    61
    [author:]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    62
        Claus Atzkern
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    63
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    64
    [see also:]
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    65
        TabView
355
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
"
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    67
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    68
!
355
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    70
examples
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    71
"
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    72
    tabs at top ( default )
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    73
                                                                                [exBegin]                                      
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    74
    |top tab|
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    75
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    76
    top  := StandardSystemView extent:250@100.
1683
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
    77
    tab := NoteBookView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    78
    tab list:#( 'Foo' 'Bar' 'Baz' ).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    79
    tab action:[:aName| Transcript showCR:aName].
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    80
    top open.
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    81
                                                                                [exEnd]
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    82
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    83
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    84
    tabs at bottom
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    85
                                                                                [exBegin]                                      
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    86
    |top tab|
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    87
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    88
    top  := StandardSystemView extent:250@100.
1683
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
    89
    tab := NoteBookView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    90
    tab direction:#bottom.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    91
    tab list:#( 'Foo' 'Bar' 'Baz' ).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    92
    tab action:[:aName| Transcript showCR:aName].
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    93
    top open.
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    94
                                                                                [exEnd]
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    95
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    96
    tabs at left
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    97
                                                                                [exBegin]                                      
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    98
    |top tab|
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    99
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   100
    top  := StandardSystemView extent:100@200.
1683
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
   101
    tab := NoteBookView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   102
    tab direction:#left.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   103
    tab list:#( 'Foo' 'Bar' 'Baz' ).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   104
    tab action:[:aName| Transcript showCR:aName].
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   105
    top open.
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   106
                                                                                [exEnd]
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   107
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   108
    tabs at right
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   109
                                                                                [exBegin]                                      
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   110
    |top tab|
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   111
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   112
    top  := StandardSystemView extent:100@200.
1683
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
   113
    tab := NoteBookView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   114
    tab direction:#right.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   115
    tab list:#( 'Foo' 'Bar' 'Baz' ).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   116
    tab action:[:aName| Transcript showCR:aName].
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   117
    top open.
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   118
                                                                                [exEnd]
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   119
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   120
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   121
"
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   122
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   123
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   124
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   125
!NoteBookView class methodsFor:'defaults'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   126
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   127
defaultFont
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   128
    ^ MenuView defaultFont
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   129
!
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   130
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   131
updateStyleCache
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   132
"
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   133
self updateStyleCache
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   134
"
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   135
    DefaultForegroundColor := StyleSheet colorAt:#'noteBook.foregroundColor'.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   136
    DefaultForegroundColor isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   137
        DefaultForegroundColor := StyleSheet colorAt:#'button.foregroundColor'.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   138
    ].
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   139
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   140
    DefaultActiveForegroundColor := StyleSheet colorAt:#'noteBook.activeForegroundColor'.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   141
    DefaultActiveForegroundColor isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   142
        DefaultActiveForegroundColor := StyleSheet colorAt:#'button.activeForegroundColor'
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   143
    ].
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   144
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   145
    DefaultLightColor := StyleSheet colorAt:#'noteBook.lightColor'.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   146
    DefaultLightColor isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   147
        DefaultLightColor := StyleSheet colorAt:'button.lightColor'
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   148
    ].
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   149
    DefaultHalfLightColor := StyleSheet colorAt:#'noteBook.halfLightColor'.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   150
    DefaultHalfLightColor isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   151
        DefaultHalfLightColor := StyleSheet colorAt:#'button.halfLightColor'
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   152
    ].    
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   153
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   154
    DefaultShadowColor := StyleSheet colorAt:#'noteBook.shadowColor'.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   155
    DefaultShadowColor isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   156
        DefaultShadowColor := StyleSheet colorAt:'button.shadowColor'
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   157
    ].
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   158
    DefaultHalfShadowColor := StyleSheet colorAt:#'noteBook.halfShadowColor'.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   159
    DefaultHalfShadowColor isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   160
        DefaultHalfShadowColor := StyleSheet colorAt:#'button.halfShadowColor'
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   161
    ].
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   162
    DefaultEdgeStyle := StyleSheet at:#'noteBook.edgeStyle'.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   163
    DefaultEdgeStyle isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   164
        DefaultEdgeStyle := StyleSheet at:#'button.edgeStyle'
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   165
    ].
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   166
1683
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
   167
    DefaultEdgeStyle == #softWin95 ifFalse:[
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   168
        DefaultEdgeStyle := nil
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   169
    ].
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   170
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   171
! !
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   172
1724
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   173
!NoteBookView methodsFor:'accepting - items'!
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   174
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   175
tabAtIndex:tabIndex put:newLabel
1880
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   176
    |tab layout prefX prefY|
1724
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   177
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   178
    "/ a single items label has changed
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   179
    tab := list at:tabIndex ifAbsent:nil.
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   180
    tab notNil ifTrue:[
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   181
        tab label:newLabel on:self.
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   182
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   183
        "/ no resizing, if the new string fits
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   184
        "/ and is not too small for current tab-layout
1880
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   185
        layout := tab layout.
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   186
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   187
        (     (prefX := tab preferredExtentX) <= layout width
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   188
         and:[(prefY := tab preferredExtentY) <= layout height]
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   189
        ) ifTrue:[
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   190
            "/ the new string fits into current tab-layout
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   191
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   192
            numberOfLines == 1 ifTrue:[         "/ do not change the layout
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   193
                ^ self invalidateTab:tab
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   194
            ].
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   195
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   196
            "/ check whether the string is not too small for current tab-layout
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   197
            ((layout width <= (prefX * 1.5)) and:[layout height <= (prefY * 1.5)]) ifTrue:[
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   198
                ^ self invalidateTab:tab.      "/ do not change the layout
1724
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   199
            ].
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   200
        ].
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   201
        self recomputeList.
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   202
        self invalidate.
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   203
        ^ self.
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   204
    ].
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   205
    "/ can this happen ?
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   206
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   207
    "Created: / 25.2.2000 / 14:13:59 / cg"
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   208
! !
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   209
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   210
!NoteBookView methodsFor:'accessing'!
355
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   212
canvas
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   213
    ^ canvas
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   214
!
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   215
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   216
canvas:aCanvas
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   217
    "change the canvas; the containter view
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   218
    "
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   219
    aCanvas == canvas ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   220
        canvas notNil ifTrue:[
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
   221
            (keepCanvas or:[(canvas objectAttributeAt:#isTabItem) == true]) ifTrue:[
1413
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   222
                canvas unmap.
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   223
            ] ifFalse:[
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   224
                canvas destroy.
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   225
            ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   226
        ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   227
        (canvas := aCanvas) notNil ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   228
            tabModus := false.
2035
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   229
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   230
            self resizeCanvas.
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   231
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
   232
            (subViews size == 0 or:[(subViews includesIdentical:canvas) not]) ifTrue:[
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
   233
                self addSubView:canvas
1549
4c09c03efa29 never add a subcanvas twice
Stefan Vogel <sv@exept.de>
parents: 1543
diff changeset
   234
            ].
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
   235
1687
70888239654f category changes
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
   236
            realized ifTrue:[
1892
be1292a9c565 if keepCanvas is true, use realize only once
tm
parents: 1880
diff changeset
   237
                (keepCanvas or:[(canvas objectAttributeAt:#isTabItem) == true]) ifTrue:[
be1292a9c565 if keepCanvas is true, use realize only once
tm
parents: 1880
diff changeset
   238
                    canvas id isNil ifTrue:[
be1292a9c565 if keepCanvas is true, use realize only once
tm
parents: 1880
diff changeset
   239
                        canvas realize
be1292a9c565 if keepCanvas is true, use realize only once
tm
parents: 1880
diff changeset
   240
                    ] ifFalse:[
be1292a9c565 if keepCanvas is true, use realize only once
tm
parents: 1880
diff changeset
   241
                        canvas map.
be1292a9c565 if keepCanvas is true, use realize only once
tm
parents: 1880
diff changeset
   242
                    ]
be1292a9c565 if keepCanvas is true, use realize only once
tm
parents: 1880
diff changeset
   243
                ] ifFalse:[
be1292a9c565 if keepCanvas is true, use realize only once
tm
parents: 1880
diff changeset
   244
                    canvas realize.
be1292a9c565 if keepCanvas is true, use realize only once
tm
parents: 1880
diff changeset
   245
                ].
2036
6f3927ad36fc oops - strange side effect
Claus Gittinger <cg@exept.de>
parents: 2035
diff changeset
   246
                canvas raise.
1687
70888239654f category changes
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
   247
            ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   248
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   249
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   250
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   251
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   252
canvasFrameLevel
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   253
    "inset of the canvas relative to my canvas boundery
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   254
    "
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   255
    ^ canvasFrameLevel
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   256
!
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   257
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   258
canvasFrameLevel:anInteger
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   259
    "set the inset of the canvas relative to my canvas boundery
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   260
    "
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   261
    canvasFrameLevel ~~ anInteger ifTrue:[
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   262
        canvasFrameLevel := anInteger.
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   263
        self recomputeList.
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   264
        self invalidate.
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   265
    ].
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   266
!
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   267
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   268
canvasInset
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   269
    "inset of the canvas relativr to my frame
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   270
    "
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   271
    ^ canvasInset
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   272
!
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   273
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   274
canvasInset:anInset
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   275
    "inset of the canvas relativr to my frame
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   276
    "
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   277
    anInset ~~ canvasInset ifTrue:[
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   278
        canvasInset := anInset.
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   279
        self recomputeList.
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   280
        self invalidate.
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   281
    ].
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   282
!
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   283
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   284
list
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   285
    "return the list of Tabs or Labels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   286
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   287
    ^ list collect:[:aTab| aTab label ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   288
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   289
!
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   290
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   291
list:aList
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   292
    "set the list
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   293
    "
1771
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   294
    |size name newList|
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   295
1771
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   296
    name    := self selection.
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   297
    newList := OrderedCollection new.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   298
1771
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   299
    aList size == 0 ifTrue:[
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   300
        list do:[:aTab| aTab removeDependent:self].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   301
    ] ifFalse:[
1771
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   302
        list do:[:aTab| |m|
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   303
            (     (m := aTab model) notNil
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   304
             and:[(aList includesIdentical:m)]
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   305
            ) ifFalse:[
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   306
                aTab removeDependent:self
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   307
            ]
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   308
        ].
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   309
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   310
        aList do:[:el| |i tab|
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   311
            (    el isNil
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   312
             or:[(tab := list detect:[:t| t model == el] ifNone:nil) isNil]
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   313
            ) ifTrue:[
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   314
                tab := Tab label:el on:self.
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   315
                tab addDependent:self.
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   316
            ].
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   317
            newList add:tab
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   318
        ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   319
    ].
1771
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   320
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   321
    list            := newList.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   322
    preferredExtent := nil.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   323
    numberOfLines   := nil.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   324
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   325
    selection notNil ifTrue:[
1433
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   326
        useIndex ifTrue:[
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   327
            selection > list size ifTrue:[
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   328
                selection := nil.
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   329
                self selectionChanged.
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   330
            ]
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   331
        ] ifFalse:[
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   332
            selection := list findFirst:[:el| el label = name ].
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   333
            selection == 0 ifTrue:[
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   334
                selection := nil.
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   335
                self selectionChanged.
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   336
            ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   337
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   338
    ].
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   339
    self recomputeList.
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   340
    self invalidate.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   341
!
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   342
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   343
listIndexOf:something
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   344
    "convert something to an index into list or nil.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   345
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   346
    |index|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   347
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   348
    something isNil ifTrue:[^ nil ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   349
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   350
    something isNumber ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   351
        index := something
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   352
    ] ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   353
        index := list findFirst:[:aTab|aTab label = something].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   354
        index == 0 ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   355
            index := list findFirst:[:aTab|aTab printableLabel = something]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   356
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   357
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   358
    ^ (index between:1 and:list size) ifTrue:[index] ifFalse:[nil]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   359
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   360
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   361
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   362
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   363
tabLevel
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   364
    "level of the tab relative to the canvas
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   365
    "
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   366
    ^ tabLevel
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   367
!
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   368
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   369
tabLevel:anInteger
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   370
    "set the level of the tab relative to the canvas
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   371
    "
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   372
    tabLevel ~~ anInteger ifTrue:[
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   373
        tabLevel := anInteger.
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   374
"/        self recomputeList.
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   375
        self invalidate.
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   376
    ].
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   377
!
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   378
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   379
useIndex
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   380
    "use index instead of name
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   381
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   382
    ^ useIndex
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   383
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   384
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   385
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   386
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   387
useIndex:aBoolean
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   388
    "set/clear the useIndex flag. If set, both actionBlock and change-messages
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   389
     are passed the index(indices) of the selection as argument. 
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   390
     If clear, the value(s) (i.e. the selected string) is passed.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   391
     Default is false."
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   392
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   393
    useIndex := aBoolean
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   394
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   395
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   396
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   397
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   398
!NoteBookView methodsFor:'accessing-actions'!
1802
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   399
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   400
accessTabMenuAction
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   401
    "callback to retrieve the menu for a specific tab.
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   402
     the argument to the block is the index of the tab
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   403
    "
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   404
    ^ accessTabMenuAction
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   405
!
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   406
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   407
accessTabMenuAction:aOneArgAction
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   408
    "callback to retrieve the menu for a specific tab.
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   409
     the argument to the block is the index of the tab
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   410
    "
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   411
    accessTabMenuAction := aOneArgAction.
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   412
!
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   413
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   414
action
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   415
    "get the action block to be performed on select; the argument to
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   416
     the block is the selected index or nil in case of no selection.
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   417
    "
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   418
    ^ action
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   419
!
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   420
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   421
action:oneArgBlock
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   422
    "set the action block to be performed on select; the argument to
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   423
     the block is the selected index or nil in case of no selection.
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   424
    "
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   425
    action := oneArgBlock.
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   426
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   427
! !
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   428
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   429
!NoteBookView methodsFor:'accessing-behavior'!
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   430
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   431
enabled
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   432
    "returns true if tabs are enabled
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   433
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   434
    ^ enabled
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   435
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   436
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   437
enabled:aState
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   438
    "set enabled state
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   439
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   440
    |state|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   441
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   442
    state := aState ? true.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   443
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   444
    enabled ~~ state ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   445
        enabled := state.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   446
        self invalidate.
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   447
    ]
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   448
!
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   449
1413
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   450
keepCanvas:aBoolean
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   451
    "if false (the default), the previous canvas is destroyed, whenever
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   452
     a new canvas is set.
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   453
     if true, it is unmapped and kept.
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   454
     Set this flag, if the application changes the canvas but wants
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   455
     them to be kept for fast switching."
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   456
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   457
    keepCanvas := aBoolean.
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   458
!
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   459
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   460
selectConditionBlock
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   461
    "get the conditionBlock; this block is evaluated before a selection
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   462
     change is performed; the change will not be done, if the evaluation
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   463
     returns false. The argument to the block is the selection index
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   464
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   465
    ^ selectConditionBlock
432
dedc8dee12f5 created:
ca
parents: 419
diff changeset
   466
!
dedc8dee12f5 created:
ca
parents: 419
diff changeset
   467
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   468
selectConditionBlock:aOneArgBlock
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   469
    "get the conditionBlock; this block is evaluated before a selection
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   470
     change is performed; the change will not be done, if the evaluation
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   471
     returns false. The argument to the block is the selection index
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   472
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   473
    selectConditionBlock := aOneArgBlock
432
dedc8dee12f5 created:
ca
parents: 419
diff changeset
   474
! !
dedc8dee12f5 created:
ca
parents: 419
diff changeset
   475
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   476
!NoteBookView methodsFor:'accessing-channels/holders'!
432
dedc8dee12f5 created:
ca
parents: 419
diff changeset
   477
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   478
canvasHolder
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   479
    "get the model, which keeps the canvas, a kind of SimpleView
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   480
    "
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   481
    ^ canvasHolder
355
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
!
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   484
canvasHolder:aValueHolder
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   485
    "set the model, which keeps the canvas, a kind of SimpleView
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   486
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   487
    canvasHolder removeDependent:self. 
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   488
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   489
    (canvasHolder := aValueHolder) notNil ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   490
        canvasHolder addDependent:self.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   491
        self canvas:(canvasHolder value)
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   492
    ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   493
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   494
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   495
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   496
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   497
listHolder
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   498
    "get the model, which keeps the list of Tabs or Labels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   499
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   500
    ^ listHolder
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   501
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   502
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   503
listHolder:aValueHolder
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   504
    "set the model, which keeps the list of Tabs or Labels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   505
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   506
    listHolder removeDependent:self. 
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   507
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   508
    (listHolder := aValueHolder) notNil ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   509
        listHolder addDependent:self.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   510
        self list:listHolder value.
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   511
    ].
432
dedc8dee12f5 created:
ca
parents: 419
diff changeset
   512
!
dedc8dee12f5 created:
ca
parents: 419
diff changeset
   513
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   514
model:aValueHolder
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   515
    "set the model, which keeps the selection
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   516
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   517
    super model:aValueHolder.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   518
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   519
    model notNil ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   520
        self selection:(model value)
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   521
    ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   522
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   523
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   524
!NoteBookView methodsFor:'accessing-dimension'!
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   525
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   526
maxTabHeight
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   527
    |e y|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   528
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   529
    e := self preferredExtent.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   530
    y := self isHorizontal ifTrue:[e y] ifFalse:[e x].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   531
  ^ y - (expandSelection y)
432
dedc8dee12f5 created:
ca
parents: 419
diff changeset
   532
!
dedc8dee12f5 created:
ca
parents: 419
diff changeset
   533
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   534
preferredExtent
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   535
    "compute max extent x/y based on one line
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   536
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   537
    |x "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   538
     y "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   539
    |
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   540
    preferredExtent isNil ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   541
        y := 0.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   542
        x := 0.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   543
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   544
        list notEmpty ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   545
            list do:[:aTab|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   546
                x := x + aTab preferredExtentX.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   547
                y := y max:(aTab preferredExtentY).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   548
            ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   549
        ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   550
        y := y + (expandSelection y).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   551
        x := x + (expandSelection x).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   552
        preferredExtent := self isHorizontal ifTrue:[x @ y] ifFalse:[y @ x]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   553
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   554
    ^ preferredExtent
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   555
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   556
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   557
preferredSizeXorY
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   558
    "returns preferred size dependant on the current view layout and
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   559
     the direction of the tabs
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   560
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   561
    |e y|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   562
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   563
    list isEmpty ifTrue:[^ 0].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   564
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   565
    y := self maxTabHeight.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   566
    e := expandSelection y.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   567
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   568
    numberOfLines isNil ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   569
        self shown ifFalse:[^ y + e ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   570
        self recomputeList.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   571
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   572
    ^ numberOfLines * y + e
419
893e322a86e9 colors derived from background
ca
parents: 408
diff changeset
   573
! !
893e322a86e9 colors derived from background
ca
parents: 408
diff changeset
   574
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   575
!NoteBookView methodsFor:'accessing-look'!
419
893e322a86e9 colors derived from background
ca
parents: 408
diff changeset
   576
1442
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
   577
activeForegroundColor
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
   578
    "get the color to be used for drawing text
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
   579
    "
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
   580
    ^ activeForegroundColor
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
   581
!
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
   582
1689
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   583
activeTabBackgroundColor
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   584
    "get the backgroundColor of the tabs
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   585
    "
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   586
    ^ activeTabBgColor
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   587
!
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   588
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   589
backgroundColor
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   590
    "get backgroundColor of the notebook view
419
893e322a86e9 colors derived from background
ca
parents: 408
diff changeset
   591
    "
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   592
    ^ viewBackground
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   593
!
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   594
1700
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   595
disabledForegroundColor
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   596
    ^ disabledForegroundColor
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   597
!
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   598
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   599
drawLightColor
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   600
    "get the color to be used for lighted edges; bug fix caused by common
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   601
     drawEdge
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   602
    "
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   603
    ^ drawLightColor
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   604
!
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   605
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   606
foregroundColor
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   607
    "get the color to be used for drawing text
419
893e322a86e9 colors derived from background
ca
parents: 408
diff changeset
   608
    "
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   609
    ^ foregroundColor
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   610
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   611
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   612
foregroundColor:aColor
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   613
    "set the color to be used for drawing text
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   614
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   615
    aColor ~= foregroundColor ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   616
        foregroundColor := aColor.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   617
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   618
        shown ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   619
            self invalidate
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   620
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   621
    ]
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   622
419
893e322a86e9 colors derived from background
ca
parents: 408
diff changeset
   623
!
893e322a86e9 colors derived from background
ca
parents: 408
diff changeset
   624
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   625
halfLightColor
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   626
    "get the color to be used for drawing text
419
893e322a86e9 colors derived from background
ca
parents: 408
diff changeset
   627
    "
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   628
    ^ halfLightColor
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   629
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   630
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   631
halfShadowColor
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   632
    ^ halfShadowColor
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   633
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   634
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   635
shadowColor
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   636
    "get the color to be used for shadowed edges
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   637
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   638
    ^ shadowColor
1684
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   639
!
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   640
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   641
shadowColor:aColor
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   642
    "get the color to be used for shadowed edges
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   643
    "
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   644
    super shadowColor:aColor
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   645
!
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   646
1689
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   647
tabBackgroundColor
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   648
    "get the backgroundColor of the tabs
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   649
    "
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   650
    ^ tabBgColor
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   651
!
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   652
1684
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   653
viewBackground:aColor
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   654
    "get backgroundColor of the notebook view
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   655
    "
1689
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   656
    |sameTab sameActiveTab|
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   657
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   658
    sameTab := tabBgColor == viewBackground.
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   659
    sameActiveTab := activeTabBgColor == viewBackground.
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   660
1684
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   661
    super viewBackground:aColor.
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   662
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   663
    (edgeStyle isNil and:[viewBackground isColor]) ifTrue:[
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   664
        halfShadowColor := shadowColor.
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   665
        halfLightColor  := lightColor.
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   666
        drawLightColor  := lightColor.
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   667
    ].
1689
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   668
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   669
    DefaultShadowColor isNil ifTrue:[
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   670
        shadowColor := aColor darkened onDevice:device
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   671
    ].
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   672
    DefaultLightColor isNil ifTrue:[
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   673
        lightColor := aColor lightened onDevice:device
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   674
    ].
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   675
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   676
    sameTab ifTrue:[
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   677
        tabBgColor := viewBackground.
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   678
    ].
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   679
    sameActiveTab ifTrue:[
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   680
        activeTabBgColor := viewBackground.
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   681
    ]
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   682
! !
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   683
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   684
!NoteBookView methodsFor:'accessing-style'!
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   685
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   686
direction
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   687
    "returns the direction of tabs as symbol. On default the value is
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   688
     set to #top. Valid symbols are:
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   689
	#top       arrange tabs to be on top of a view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   690
	#bottom    arrange tabs to be on bottom of a view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   691
	#left      arrange tabs to be on left of a view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   692
	#right     arrange tabs to be on right of a view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   693
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   694
    ^ direction
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   695
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   696
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   697
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   698
direction:aDirection
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   699
    "change the direction of tabs. On default the value is set to #top.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   700
     Valid symbols are:
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   701
        #top       arrange tabs to be on top of a view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   702
        #bottom    arrange tabs to be on bottom of a view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   703
        #left      arrange tabs to be on left of a view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   704
        #right     arrange tabs to be on right of a view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   705
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   706
    direction ~~ aDirection ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   707
        direction       := aDirection.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   708
        preferredExtent := nil.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   709
        numberOfLines   := nil.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   710
        self invalidate.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   711
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   712
!
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   713
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   714
fitLastRow
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   715
    "in case of true, the last row is expanded to the view  size like all
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   716
     other raws. In case of false all the tabs in the last raw keep their
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   717
     preferred extent (x or y) dependant on the direction.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   718
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   719
    ^ fitLastRow
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   720
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   721
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   722
fitLastRow:aBool
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   723
    "in case of true, the last row is expanded to the view  size like all
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   724
     other raws. In case of false all the tabs in the last raw keep their
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   725
     preferred extent (x or y) dependant on the direction.
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   726
    "
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   727
    fitLastRow := aBool
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   728
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   729
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   730
tabModus
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   731
    ^ tabModus
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   732
!
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   733
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   734
tabModus:aBoolean
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   735
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   736
    tabModus ~~ aBoolean ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   737
        (aBoolean and:[canvas notNil]) ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   738
            tabModus := aBoolean.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   739
            numberOfLines := nil.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   740
            shown ifTrue:[self invalidate]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   741
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   742
    ]
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   743
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   744
! !
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   745
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   746
!NoteBookView methodsFor:'change & update'!
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   747
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   748
update:something with:aParameter from:changedObject
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   749
    "one of my models changed its value
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   750
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   751
    |idx tab|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   752
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   753
    changedObject == model         ifTrue:[^ self selection:model value].
1724
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   754
    changedObject == listHolder    ifTrue:[
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   755
        something == #at: ifTrue:[
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   756
            "/ a single items label has changed
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   757
            self tabAtIndex:aParameter put:(listHolder value at:aParameter).
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   758
            ^ self.
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   759
        ].
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   760
        ^ self list:(listHolder value)
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   761
    ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   762
    changedObject == enableChannel ifTrue:[^ self enabled:enableChannel value].
1413
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   763
    changedObject == canvasHolder  ifTrue:[^ self canvas:canvasHolder value].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   764
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   765
    (idx := list findFirst:[:aTab| aTab label == changedObject]) ~~ 0 ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   766
        tab := list at:idx.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   767
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   768
        idx == selection ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   769
            tab isEnabled ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   770
                ^ self selection:nil
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   771
            ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   772
        ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   773
        tab label:(tab label) on:self.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   774
        self invalidateTab:tab
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   775
    ]
1724
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   776
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   777
    "Modified: / 25.2.2000 / 14:14:29 / cg"
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   778
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   779
1700
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   780
!NoteBookView methodsFor:'defaults'!
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   781
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   782
updateStyleCache
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   783
"
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   784
self updateStyleCache
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   785
"
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   786
    DefaultForegroundColor := StyleSheet colorAt:#'noteBook.foregroundColor'.
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   787
    DefaultForegroundColor isNil ifTrue:[
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   788
        DefaultForegroundColor := StyleSheet colorAt:#'button.foregroundColor'.
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   789
    ].
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   790
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   791
    DefaultActiveForegroundColor := StyleSheet colorAt:#'noteBook.activeForegroundColor'.
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   792
    DefaultActiveForegroundColor isNil ifTrue:[
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   793
        DefaultActiveForegroundColor := StyleSheet colorAt:#'button.activeForegroundColor'
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   794
    ].
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   795
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   796
    DefaultLightColor := StyleSheet colorAt:#'noteBook.lightColor'.
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   797
    DefaultLightColor isNil ifTrue:[
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   798
        DefaultLightColor := StyleSheet colorAt:'button.lightColor'
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   799
    ].
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   800
    DefaultHalfLightColor := StyleSheet colorAt:#'noteBook.halfLightColor'.
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   801
    DefaultHalfLightColor isNil ifTrue:[
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   802
        DefaultHalfLightColor := StyleSheet colorAt:#'button.halfLightColor'
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   803
    ].    
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   804
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   805
    DefaultShadowColor := StyleSheet colorAt:#'noteBook.shadowColor'.
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   806
    DefaultShadowColor isNil ifTrue:[
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   807
        DefaultShadowColor := StyleSheet colorAt:'button.shadowColor'
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   808
    ].
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   809
    DefaultHalfShadowColor := StyleSheet colorAt:#'noteBook.halfShadowColor'.
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   810
    DefaultHalfShadowColor isNil ifTrue:[
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   811
        DefaultHalfShadowColor := StyleSheet colorAt:#'button.halfShadowColor'
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   812
    ].
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   813
    DefaultEdgeStyle := StyleSheet at:#'noteBook.edgeStyle'.
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   814
    DefaultEdgeStyle isNil ifTrue:[
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   815
        DefaultEdgeStyle := StyleSheet at:#'button.edgeStyle'
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   816
    ].
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   817
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   818
    DisabledForegroundColor := StyleSheet at:#'noteBook.disabledForegroundColor'.
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   819
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   820
    DefaultEdgeStyle == #softWin95 ifFalse:[
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   821
        DefaultEdgeStyle := nil
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   822
    ].
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   823
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   824
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   825
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   826
! !
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   827
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   828
!NoteBookView methodsFor:'drawing'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   829
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   830
invalidateTab:aTab
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   831
    "invalidate a tab
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   832
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   833
    shown ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   834
        self invalidate:(self computeLayoutForTab:aTab)
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   835
    ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   836
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   837
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   838
redrawX:x y:y width:w height:h
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   839
    "a region must be redrawn
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   840
    "
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   841
    |savClip selectedTab selectedTabsLineNr damage lyt savLyt right|
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   842
2035
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   843
    shown ifFalse:[ ^ self ].
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   844
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   845
    numberOfLines isNil ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   846
        self recomputeList.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   847
      ^ self invalidate
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   848
    ].
1963
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
   849
    selectedTab := selection notNil ifTrue:[list at:selection] ifFalse:[nil].
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
   850
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
   851
    (selectedTab notNil 
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
   852
    and:[(selectedTabsLineNr := selectedTab lineNr) ~~ 1]) 
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
   853
    ifTrue:[
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
   854
        self makeToBaseLine:selectedTabsLineNr.
1962
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
   855
      ^ self
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   856
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   857
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   858
    self paint:(self viewBackground).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   859
    self fillRectangleX:x y:y width:w height:h.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   860
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   861
    savClip := clipRect.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   862
    damage  := Rectangle left:x top:y width:w height:h.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   863
    self clippingRectangle:damage.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   864
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   865
    list notEmpty ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   866
        numberOfLines to:1 by:-1 do:[:aLnNr|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   867
            list reverseDo:[:aTab|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   868
                (     aTab lineNr == aLnNr
1963
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
   869
                 and:[aTab ~~ selectedTab
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   870
                 and:[aTab intersects:damage]]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   871
                ) ifTrue:[
1689
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   872
                    tabBgColor ~~ viewBackground ifTrue:[
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   873
                        self paint:tabBgColor.
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   874
                        self fillRectangle:aTab layout.
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   875
                    ].
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   876
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   877
                    aTab redrawAt:direction selected:false on:self
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   878
                ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   879
            ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   880
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   881
    ] ifFalse:[
1963
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
   882
        selectedTab := nil
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   883
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   884
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   885
    tabModus ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   886
        lyt := self computeBorderLayout.
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   887
        canvasFrameLevel ~~ 0 ifTrue:[
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   888
            self drawEdgesForX:lyt left 
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   889
                             y:lyt top
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   890
                         width:lyt width 
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   891
                        height:lyt height
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   892
                         level:canvasFrameLevel
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   893
                        shadow:shadowColor 
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   894
                         light:lightColor
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   895
                    halfShadow:halfShadowColor 
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   896
                     halfLight:halfLightColor
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   897
                         style:edgeStyle
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   898
        ] ifFalse:[
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   899
            (tabLevel notNil and:[tabLevel ~~ 0]) ifTrue:[
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   900
                list size > 0 ifTrue:[
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   901
                    right := lyt left + lyt width - 1.
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   902
                    self paint:lightColor.
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   903
                    1 to:tabLevel do:[:i |
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   904
                        |y|
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   905
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   906
                        y := lyt top + tabLevel - i.
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   907
                        self displayDeviceLineFromX:(lyt left) y:y toX:right y:y.
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   908
                    ]       
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   909
                ]       
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   910
            ]
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   911
        ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   912
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   913
1963
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
   914
    selectedTab notNil ifTrue:[
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
   915
        lyt := self computeLayoutForTab:selectedTab.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   916
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   917
        (lyt intersects:damage) ifTrue:[
1963
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
   918
            savLyt := selectedTab layout.
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
   919
            selectedTab layout:lyt.
1689
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   920
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   921
            activeTabBgColor ~~ viewBackground ifTrue:[
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   922
                self paint:activeTabBgColor.
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   923
                self fillRectangle:lyt.
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
   924
            ].
1963
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
   925
            selectedTab redrawAt:direction selected:true on:self.
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
   926
1696
f1bae6d68ffe eliminated styleSheet name = win95 queries
Claus Gittinger <cg@exept.de>
parents: 1689
diff changeset
   927
            (self hasFocus 
f1bae6d68ffe eliminated styleSheet name = win95 queries
Claus Gittinger <cg@exept.de>
parents: 1689
diff changeset
   928
            and:[(styleSheet at:#'focusHighlightStyle') == #win95]) ifTrue:[
1963
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
   929
                selectedTab drawWin95FocusFrameOn:self
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
   930
            ].
1963
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
   931
            selectedTab layout:savLyt.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   932
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   933
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   934
    self clippingRectangle:savClip
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   935
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   936
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   937
!NoteBookView methodsFor:'event handling'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   938
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   939
buttonPress:button x:x y:y
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   940
    "a button is pressed; find tab under point and set the selection
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   941
    "
1802
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   942
    |idx tab recv menu|
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   943
1802
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   944
    (enabled and:[list notEmpty]) ifFalse:[
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   945
        ^ self
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   946
    ].
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   947
    (    (idx := list findFirst:[:aTab|aTab containsPointX:x y:y]) == 0
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   948
     or:[(tab := list at:idx ifAbsent:nil) isNil
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   949
     or:[tab isEnabled not]]
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   950
    ) ifTrue:[
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   951
        ^ self
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   952
    ].
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   953
1802
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   954
    ((button == 2) or:[button == #menu]) ifFalse:[
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   955
        "/ change the selection
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   956
        ^ self selection:idx
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   957
    ].
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   958
    (accessTabMenuAction notNil and:[(menu := accessTabMenuAction value:idx) notNil]) ifFalse:[
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   959
        ^ self
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   960
    ].
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   961
    menu isArray ifTrue:[
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   962
        menu := menu decodeAsLiteralArray
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   963
    ].
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   964
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   965
    menu receiver isNil ifTrue:[
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   966
        (recv := self application) isNil ifTrue:[
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   967
            recv := tab model
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   968
        ].
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   969
        recv notNil ifTrue:[
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   970
            menu receiver:recv
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   971
        ] ifFalse:[
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   972
            Transcript showCR:('%1 : MENU HAS NO RECEIVER' bindWith:(self class name)).
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   973
        ]
1802
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   974
    ].
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   975
    menu startUp
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   976
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   977
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   978
keyPress:aKey x:x y:y
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   979
    "selection might change; look for corresponding list entry
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   980
    "
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
   981
    <resource: #keyboard (#CursorRight #CursorLeft #CursorUp #CursorDown)>
1407
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
   982
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
   983
    |sensor size index n key|
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   984
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
   985
    (enabled and:[(size := list size) ~~ 0]) ifFalse:[
1657
061c167ce3db if disabled; call super keyPress:x:y to handle focusSequence
ca
parents: 1549
diff changeset
   986
        ^ super keyPress:aKey x:x y:y
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   987
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   988
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
   989
    (self processAccessCharacter:aKey) ifTrue:[
1407
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
   990
        ^ self
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
   991
    ].
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
   992
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
   993
    (self processShortcutKey:aKey) ifTrue:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
   994
        ^ self
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
   995
    ].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
   996
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
   997
    (size > 1 and:[aKey isSymbol and:[aKey startsWith:'Cursor']]) ifFalse:[
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
   998
        ^ super keyPress:aKey x:x y:y
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
   999
    ].
1407
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1000
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1001
    self isHorizontal ifTrue:[
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1002
        (aKey == #CursorRight or:[aKey == #CursorLeft]) ifFalse:[
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1003
            ^ self
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1004
        ].
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1005
        key := aKey.
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1006
    ] ifFalse:[
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1007
                 aKey == #CursorUp   ifTrue:[key := #CursorLeft]
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1008
        ifFalse:[aKey == #CursorDown ifTrue:[key := #CursorRight]
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1009
        ifFalse:[ ^ self]].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1010
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1011
1407
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1012
    (sensor := self sensor) notNil ifTrue:[
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1013
        n := 1 + (sensor compressKeyPressEventsWithKey:aKey).
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1014
        n := (n \\ size) max:1.
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1015
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1016
        key == #CursorRight ifTrue:[
1407
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1017
            index := selection ? 1.
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1018
            [   (index := index + 1) > size ifTrue:[index := 1].
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1019
                (self isSelectable:index)   ifTrue:[n := n - 1].
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1020
                n ~~ 0
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1021
            ] whileTrue.
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1022
        ] ifFalse:[
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1023
            index := selection ? size.
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1024
            [   (index := index - 1) == 0 ifTrue:[index := size].
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1025
                (self isSelectable:index) ifTrue:[n     := n -1].
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1026
                n ~~ 0
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1027
            ] whileTrue.
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1028
        ].
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1029
        self selection:index
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1030
    ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1031
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1032
1677
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  1033
processShortcutKeyEvent:event
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  1034
    ^ self processShortcutKey:(event key)
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  1035
!
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  1036
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1037
sizeChanged:how
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1038
    "size of view changed 
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1039
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1040
    super sizeChanged:how.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1041
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1042
    list notEmpty ifTrue:[
1403
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1043
        lastComputedExtent ~= self extent ifTrue:[
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1044
            numberOfLines := nil.
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1045
        ]
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1046
    ].
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1047
    shown ifTrue:[self invalidate].
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1048
    self resizeCanvas.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1049
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1050
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1051
!NoteBookView methodsFor:'focus handling'!
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1052
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1053
showFocus:explicit
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1054
    "got the keyboard focus 
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1055
    "
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1056
    |tab|
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1057
1696
f1bae6d68ffe eliminated styleSheet name = win95 queries
Claus Gittinger <cg@exept.de>
parents: 1689
diff changeset
  1058
    (styleSheet at:#'focusHighlightStyle') == #win95 ifTrue:[
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1059
        (tab := self selectedTab) notNil ifTrue:[
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1060
            self invalidateTab:tab
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1061
        ]
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1062
    ] ifFalse:[
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1063
        super showFocus:explicit
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1064
    ]
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1065
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1066
!
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1067
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1068
showNoFocus:explicit
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1069
    "lost the keyboard focus 
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1070
    "
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1071
    |tab|
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1072
1696
f1bae6d68ffe eliminated styleSheet name = win95 queries
Claus Gittinger <cg@exept.de>
parents: 1689
diff changeset
  1073
    (styleSheet at:#'focusHighlightStyle') == #win95 ifTrue:[
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1074
        (tab := self selectedTab) notNil ifTrue:[
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1075
            self invalidateTab:tab
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1076
        ]
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1077
    ] ifFalse:[
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1078
        super showNoFocus:explicit
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1079
    ]
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1080
! !
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1081
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1082
!NoteBookView methodsFor:'help'!
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1083
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1084
helpText
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1085
    "return the helpText for the currently selected item (empty if none)
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1086
    "
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1087
    ^ self helpTextForItemAt:selection
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1088
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1089
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1090
!
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1091
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1092
helpTextAt:srcPoint
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1093
    "return the helpText for aPoint (i.e. when mouse-pointer is moved over an item).
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1094
    "
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1095
    |x y i|
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1096
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1097
    x := srcPoint x.
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1098
    y := srcPoint y.
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1099
    i := list findFirst:[:aTab| aTab containsPointX:x y:y ].
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1100
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1101
  ^ self helpTextForItemAt:i
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1102
!
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1103
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1104
helpTextForItemAt:anIndex
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1105
    |tab|
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1106
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1107
    (     anIndex notNil
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1108
     and:[anIndex ~~ 0
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1109
     and:[(tab := list at:anIndex ifAbsent:nil) notNil
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1110
     and:[(tab := tab model) notNil]]]
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1111
    ) ifTrue:[
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1112
        ^ tab activeHelpText ? ''
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1113
    ].
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1114
    ^ ''
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1115
! !
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1116
1687
70888239654f category changes
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  1117
!NoteBookView methodsFor:'initialization & release'!
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1118
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1119
destroy
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1120
    "remove dependencies
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1121
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1122
    list removeDependent:self.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1123
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1124
    listHolder    removeDependent:self. 
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1125
    canvasHolder  removeDependent:self.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1126
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1127
    super destroy.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1128
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1129
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1130
initStyle
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1131
    "setup style attributes
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1132
    "
1442
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
  1133
    |clr|
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
  1134
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1135
    super initStyle.
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1136
    tabModus  := false.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1137
    edgeStyle := DefaultEdgeStyle.
1442
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
  1138
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1139
    self font:self class defaultFont.
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1140
    drawLightColor := Color veryLightGray onDevice:device.
1442
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
  1141
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1142
    clr := DefaultForegroundColor ? Black.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1143
    foregroundColor := clr onDevice:device.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1144
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1145
    clr := DefaultForegroundColor ? foregroundColor.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1146
    activeForegroundColor := clr onDevice:device.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1147
1988
c4eaa4a81f89 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  1148
    (clr := DefaultShadowColor) isNil ifTrue:[clr := viewBackground darkened].
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1149
    shadowColor := clr onDevice:device.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1150
1988
c4eaa4a81f89 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  1151
    (clr := DefaultLightColor) isNil ifTrue:[clr := viewBackground lightened].
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1152
    lightColor := clr onDevice:device.
1442
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
  1153
1689
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
  1154
    tabBgColor := viewBackground.
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
  1155
    activeTabBgColor := viewBackground.
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
  1156
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1157
    edgeStyle isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1158
        halfShadowColor := shadowColor.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1159
        halfLightColor  := lightColor.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1160
        drawLightColor  := lightColor.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1161
    ] ifFalse:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1162
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1163
        (clr := DefaultHalfShadowColor) isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1164
            clr := shadowColor lightened
1442
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
  1165
        ].
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1166
        halfShadowColor := clr onDevice:device.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1167
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1168
        (clr := DefaultHalfLightColor) isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1169
            clr := lightColor darkened.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1170
        ].
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1171
        halfLightColor := clr onDevice:device.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1172
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1173
        edgeStyle == #soft ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1174
            drawLightColor := halfShadowColor
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1175
        ] ifFalse:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1176
            drawLightColor := Color veryLightGray onDevice:device.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1177
        ]
1442
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
  1178
    ].
1700
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
  1179
    (clr := DisabledForegroundColor) notNil ifTrue:[
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
  1180
        disabledForegroundColor := clr onDevice:device
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
  1181
    ]ifFalse:[
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
  1182
        disabledForegroundColor := drawLightColor
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
  1183
    ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1184
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1185
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1186
initialize
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1187
    "setup default attributes
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1188
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1189
    super initialize.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1190
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1191
    self cursor:Cursor hand.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1192
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1193
    list             := #().
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1194
    useIndex         := true.
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1195
    direction        := #top.
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1196
    fitLastRow       := true.
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1197
    enabled          := true.
1685
7755214df380 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1684
diff changeset
  1198
    expandSelection  := StyleSheet at:#'noteBook.expandSelection'  default:8@8.
7755214df380 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1684
diff changeset
  1199
    canvasInset      := StyleSheet at:#'noteBook.canvasInset'      default:1@1.
7755214df380 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1684
diff changeset
  1200
    canvasFrameLevel := StyleSheet at:#'noteBook.canvasFrameLevel' default:2.
7755214df380 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1684
diff changeset
  1201
    tabMargin        := StyleSheet at:#'noteBook.canvasTabMargin'  default:2.
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1202
    keepCanvas       := false.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1203
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1204
    self lineWidth:0.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1205
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1206
    canvas notNil ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1207
        canvas := canvas in:self.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1208
    ].
1403
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1209
!
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1210
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1211
realize
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1212
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1213
    (canvas notNil and:[numberOfLines isNil]) ifTrue:[
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1214
        self recomputeList
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1215
    ].
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1216
    super realize.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1217
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1218
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1219
!NoteBookView methodsFor:'layout'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1220
1962
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1221
XXmakeToBaseLine:aLnNr
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1222
"/ the old, obsolete algorithm.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1223
"/ does NOT preserve the tab-order.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1224
"/
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1225
"/    |layout1 layoutN topN top1 leftN left1 lineTops
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1226
"/     nr "{ Class:SmallInteger }"
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1227
"/    |
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1228
"/
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1229
"/    lineTops := (1 to:numberOfLines) collect:[:lnr |
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1230
"/                    |tabNr layout|
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1231
"/
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1232
"/                    tabNr := list findFirst:[:aTab| aTab lineNr == lnr].
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1233
"/                    layout := (list at:tabNr) layout.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1234
"/                    layout top.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1235
"/                ].
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1236
"/
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1237
"/    nr := list findFirst:[:aTab| aTab lineNr == 1].
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1238
"/    layout1 := (list at:nr) layout.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1239
"/
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1240
"/    nr := list findFirst:[:aTab| aTab lineNr == aLnNr].
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1241
"/    layoutN := (list at:nr) layout.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1242
"/
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1243
"/    self isHorizontal ifTrue:[
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1244
"/        top1 := layout1 top.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1245
"/        topN := layoutN top.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1246
"/
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1247
"/        list do:[:el|
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1248
"/            (nr := el lineNr) == 1 ifTrue:[
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1249
"/                el layout setTop:topN. el lineNr:aLnNr
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1250
"/            ] ifFalse:[
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1251
"/                nr == aLnNr ifTrue:[
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1252
"/                    el layout setTop:top1. el lineNr:1
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1253
"/                ]
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1254
"/            ]
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1255
"/        ]
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1256
"/    ] ifFalse:[
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1257
"/        left1 := layout1 left.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1258
"/        leftN := layoutN left.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1259
"/
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1260
"/        list do:[:el|
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1261
"/            (nr := el lineNr) == 1 ifTrue:[
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1262
"/                el layout setLeft:leftN. el lineNr:aLnNr
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1263
"/            ] ifFalse:[
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1264
"/                nr == aLnNr ifTrue:[
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1265
"/                    el layout setLeft:left1. el lineNr:1
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1266
"/                ]
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1267
"/            ]
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1268
"/        ]
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1269
"/    ].
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1270
"/    self invalidate
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1271
!
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1272
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1273
computeBorderLayout
2035
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1274
    |xL yT xR yB tab l|
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1275
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1276
    tab := list detect:[:aTab| aTab lineNr == 1] ifNone:nil.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1277
    xL  := 0.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1278
    yT  := 0.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1279
    xR  := width.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1280
    yB  := height.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1281
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1282
    tab notNil ifTrue:[
2035
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1283
        l := tab layout.
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1284
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1285
        direction == #top ifTrue:[
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1286
            yT := l bottom
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1287
        ] ifFalse:[ direction == #bottom ifTrue:[
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1288
            yB := l top
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1289
        ] ifFalse:[ direction == #left   ifTrue:[
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1290
            xL := l right
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1291
        ] ifFalse:[
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1292
            xR := l left
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1293
        ]]]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1294
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1295
    ^ Rectangle left:xL top:yT right:xR bottom:yB
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1296
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1297
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1298
computeLayoutForTab:aTab
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1299
    "calculate extent of a tab
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1300
    "
2035
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1301
    |layout x y w h level tlevel newTop newLeft|
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1302
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1303
    layout := aTab layout.
1658
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1304
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1305
    self selectedTab == aTab ifFalse:[
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1306
        ^ layout
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1307
    ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1308
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1309
    level  := tlevel := canvasFrameLevel abs.
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1310
    level == 0 ifTrue:[ tlevel := tabLevel ? 0].
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1311
1658
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1312
    layout := layout copy.
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1313
    w := expandSelection x.
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1314
    h := expandSelection y.
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1315
    x := w // 2.
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1316
    y := h // 2.
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1317
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1318
    (direction == #top or:[direction == #bottom]) ifTrue:[
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1319
        layout setLeft:(layout left   - x).
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1320
        layout   width:(layout width  + w).
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1321
        layout  height:(layout height + y + tlevel).
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1322
2035
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1323
        newTop := layout top .
1658
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1324
        direction == #top ifTrue:[
2035
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1325
            newTop := newTop - y.
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  1326
        ] ifFalse:[
2035
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1327
            newTop := newTop - tlevel.
1658
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1328
        ].
2035
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1329
        layout setTop:newTop.
1658
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1330
        ^ layout
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1331
    ].
1658
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1332
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1333
    layout  setTop:(layout top    - x).
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1334
    layout  height:(layout height + w).
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1335
    layout   width:(layout width  + y + level).
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1336
2035
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1337
    newLeft := layout left.
1658
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1338
    direction == #left ifTrue:[
2035
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1339
        newLeft := newLeft - y.
1658
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1340
    ] ifFalse:[
2035
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1341
        newLeft := newLeft - level.
1658
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1342
    ].
2035
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1343
    layout setLeft:newLeft.
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1344
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1345
    ^ layout
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1346
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1347
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1348
makeToBaseLine:aLnNr
1962
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1349
    "rotate lines to make the line #aLnNr be the new base line (i.e.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1350
     subtract (aLnNr-1) from all lines and take modulu the number of lines"
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1351
1963
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
  1352
    |lineTopsOrLefts isHorizontal|
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
  1353
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
  1354
    isHorizontal := self isHorizontal.
1962
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1355
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1356
    "collect per-lineNr offsets"
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1357
    lineTopsOrLefts := (1 to:numberOfLines) collect:[:lnr |
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1358
                            |tabNr layout|
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1359
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1360
                            tabNr := list findFirst:[:aTab| aTab lineNr == lnr].
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1361
                            layout := (list at:tabNr) layout.
1963
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
  1362
                            isHorizontal ifTrue:[
1962
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1363
                                layout top.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1364
                            ] ifFalse:[
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1365
                                layout left.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1366
                            ].
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1367
                       ].
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1368
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1369
    "change offsets of all tabs"
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1370
    list do:[:el |
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1371
        |layout topOrLeft nr newNr|
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1372
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1373
        nr := el lineNr.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1374
        newNr := nr - aLnNr + 1.
1964
Claus Gittinger <cg@exept.de>
parents: 1963
diff changeset
  1375
        newNr <= 0 ifTrue:[ newNr := newNr + numberOfLines].
1962
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1376
        newNr := ((newNr - 1) \\ numberOfLines) + 1.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1377
        topOrLeft := lineTopsOrLefts at:newNr.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1378
        layout := el layout.
1963
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
  1379
        isHorizontal ifTrue:[
1962
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1380
            layout setTop:topOrLeft.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1381
        ] ifFalse:[
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1382
            layout setLeft:topOrLeft.            
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1383
        ].
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1384
        el lineNr:newNr.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1385
    ].
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1386
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1387
    self invalidate.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1388
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1389
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1390
recomputeList
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1391
    "recompute list
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1392
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1393
    numberOfLines := 1.
1403
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1394
    lastComputedExtent := self extent.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1395
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1396
    list size ~~ 0 ifTrue:[
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1397
        self isHorizontal ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1398
            self recomputeListHorizontal
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1399
        ] ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1400
            self recomputeListVertical
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1401
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1402
    ].
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1403
    self resizeCanvas.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1404
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1405
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1406
recomputeListHorizontal
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1407
    "recompute list
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1408
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1409
    |layout lastLyt checkDir
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1410
     xLeft     "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1411
     yTop      "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1412
     tabWidth  "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1413
     tabHeight "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1414
     lineWidth "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1415
     startX    "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1416
     delta     "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1417
     first     "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1418
     last      "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1419
    |
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1420
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1421
    startX     := expandSelection x // 2 + canvasFrameLevel abs - 2.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1422
    lineWidth  := self width - startX.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1423
    tabHeight  := self maxTabHeight.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1424
    xLeft      := startX.
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1425
    yTop       := expandSelection y // 2 + tabMargin.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1426
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1427
    checkDir := canvas isNil ifTrue:[#top] ifFalse:[#bottom].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1428
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1429
    direction == #bottom ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1430
        yTop := self height - tabHeight - yTop
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1431
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1432
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1433
    list do:[:aTab|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1434
        tabWidth := aTab preferredExtentX.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1435
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1436
        (xLeft + tabWidth > lineWidth and:[xLeft ~~ startX]) ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1437
            numberOfLines := numberOfLines + 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1438
            xLeft := startX.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1439
        ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1440
        aTab lineNr:numberOfLines.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1441
        aTab layout:(Rectangle left:xLeft top:yTop width:tabWidth height:tabHeight).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1442
        xLeft := xLeft + tabWidth
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1443
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1444
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1445
    numberOfLines ~~ 1 ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1446
        last  := numberOfLines.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1447
        delta := direction == #bottom ifFalse:[tabHeight]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1448
                                       ifTrue:[tabHeight negated].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1449
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1450
        list reverseDo:[:aTab|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1451
            aTab lineNr ~~ last ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1452
                last := aTab lineNr.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1453
                yTop := yTop + delta
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1454
            ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1455
            aTab layout setTop:yTop
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1456
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1457
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1458
    tabModus ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1459
        layout := (list at:1) layout.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1460
        delta  := direction == #top ifTrue:[self height - layout bottom]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1461
                                   ifFalse:[layout top negated].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1462
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1463
        list do:[:aTab| aTab layout setTop:(aTab layout top + delta)].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1464
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1465
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1466
    "/ FIT LINES
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1467
    (numberOfLines ~~ 1 or:[fitLastRow]) ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1468
        ^ self
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1469
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1470
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1471
    first := 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1472
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1473
    1 to:numberOfLines do:[:aLnNr|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1474
        last    := list findLast:[:t|t lineNr == aLnNr].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1475
        lastLyt := (list at:last) layout.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1476
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1477
        (delta := lineWidth - lastLyt right) ~~ 0 ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1478
            xLeft := startX.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1479
            delta := delta // (last - first + 1).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1480
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1481
            delta ~~ 0 ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1482
                list from:first to:last do:[:aTab|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1483
                    layout   := aTab layout.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1484
                    tabWidth := layout width + delta.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1485
                    layout setLeft:xLeft.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1486
                    layout width:tabWidth.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1487
                    xLeft := xLeft + tabWidth.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1488
                ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1489
            ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1490
            lastLyt width:(lineWidth - lastLyt left)
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1491
        ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1492
        first := last + 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1493
    ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1494
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1495
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1496
recomputeListVertical
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1497
    "recompute list
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1498
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1499
    |layout lastLyt
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1500
     xTop      "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1501
     yTop      "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1502
     tabWidth  "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1503
     tabHeight "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1504
     lineHeight "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1505
     startY    "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1506
     delta     "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1507
     first     "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1508
     last      "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1509
    |
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1510
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1511
    startY     := expandSelection x // 2 + canvasFrameLevel abs - 2.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1512
    lineHeight := self height - startY.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1513
    tabHeight  := self maxTabHeight.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1514
    yTop       := startY.
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1515
    xTop       := expandSelection y // 2 + tabMargin.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1516
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1517
    direction == #right ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1518
        xTop  := self width - tabHeight - xTop
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1519
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1520
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1521
    list do:[:aTab|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1522
        tabWidth := aTab preferredExtentX.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1523
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1524
        (yTop + tabWidth > lineHeight and:[yTop ~~ startY])ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1525
            numberOfLines := numberOfLines + 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1526
            yTop := startY.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1527
        ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1528
        aTab lineNr:numberOfLines.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1529
        aTab layout:(Rectangle left:xTop top:yTop width:tabHeight height:tabWidth).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1530
        yTop := yTop + tabWidth
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1531
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1532
    numberOfLines ~~ 1 ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1533
        last  := numberOfLines.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1534
        delta := direction == #left ifTrue:[tabHeight] ifFalse:[tabHeight negated].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1535
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1536
        list reverseDo:[:aTab|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1537
            aTab lineNr ~~ last ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1538
                last := aTab lineNr.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1539
                xTop := xTop + delta
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1540
            ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1541
            aTab layout setLeft:xTop
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1542
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1543
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1544
    tabModus ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1545
        layout := (list at:1) layout.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1546
        delta  := direction == #left ifTrue:[self width - layout right]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1547
                                    ifFalse:[layout left negated].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1548
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1549
        list do:[:aTab| aTab layout setLeft:(aTab layout left + delta)].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1550
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1551
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1552
    "/ FIT LINES
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1553
    (numberOfLines ~~ 1 or:[fitLastRow]) ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1554
        ^ self
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1555
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1556
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1557
    first := 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1558
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1559
    1 to:numberOfLines do:[:aLnNr|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1560
        last    := list findLast:[:t|t lineNr == aLnNr].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1561
        lastLyt := (list at:last) layout.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1562
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1563
        (delta := lineHeight - lastLyt bottom) ~~ 0 ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1564
            yTop  := startY.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1565
            delta := delta // (last - first + 1).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1566
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1567
            delta ~~ 0 ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1568
                list from:first to:last do:[:aTab|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1569
                    layout   := aTab layout.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1570
                    tabWidth := layout height + delta.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1571
                    layout setTop:yTop.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1572
                    layout height:tabWidth.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1573
                    yTop := yTop + tabWidth.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1574
                ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1575
            ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1576
            lastLyt height:(lineHeight - lastLyt top)
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1577
        ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1578
        first := last + 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1579
    ]
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1580
!
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1581
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1582
resizeCanvas
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1583
    |layout lvl|
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1584
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1585
    canvas notNil ifTrue:[
2002
d8a0fba7b75a comment
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  1586
        layout := self computeBorderLayout.
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1587
        lvl := canvasFrameLevel abs.
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1588
        layout := layout insetBy:(canvasInset + lvl).
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1589
        lvl == 0 ifTrue:[
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1590
            tabLevel notNil ifTrue:[
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1591
                layout := Rectangle
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1592
                                left:layout left
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1593
                                top:layout top + tabLevel
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1594
                                width:layout width
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1595
                                height:layout height - tabLevel.
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  1596
            ]
2036
6f3927ad36fc oops - strange side effect
Claus Gittinger <cg@exept.de>
parents: 2035
diff changeset
  1597
        ].
2002
d8a0fba7b75a comment
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  1598
"/        ((direction == #top) or:[direction ==#bottom]) ifTrue:[
d8a0fba7b75a comment
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  1599
"/            layout := layout insetBy:((0@canvasInset y) + canvasFrameLevel abs).
d8a0fba7b75a comment
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  1600
"/        ] ifFalse:[
d8a0fba7b75a comment
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  1601
"/            layout := layout insetBy:((canvasInset x @ 0) + canvasFrameLevel abs).
d8a0fba7b75a comment
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  1602
"/        ].
1687
70888239654f category changes
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  1603
        canvas layout:layout.
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1604
    ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1605
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1606
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1607
!NoteBookView methodsFor:'obsolete'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1608
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1609
labels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1610
    "return the list of labels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1611
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1612
    ^ self list
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1613
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1614
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1615
labels:aListOfLabels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1616
    "set the list of labels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1617
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1618
    ^ self list:aListOfLabels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1619
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1620
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1621
labelsHolder
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1622
    "get the model, which keeps the list of Tabs or Labels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1623
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1624
    ^ self listHolder
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1625
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1626
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1627
labelsHolder:aValueHolder
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1628
    "set the model, which keeps the list of Tabs or Labels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1629
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1630
    self listHolder:aValueHolder. 
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1631
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1632
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1633
moveSelectedRow
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1634
     ^ true
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1635
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1636
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1637
moveSelectedRow:something
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1638
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1639
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1640
oneTabPerLine
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1641
    ^ false
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1642
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1643
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1644
oneTabPerLine:something
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1645
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1646
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1647
tabWidget
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1648
    ^ nil
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1649
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1650
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1651
tabWidget:something
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1652
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1653
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1654
!NoteBookView methodsFor:'private'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1655
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1656
processAccessCharacter:aKey
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1657
    "a character is pressed; check for tab identified y the character
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1658
     select the tab and return true or if no tab detected return false
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1659
    "
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1660
    |j size char blck|
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1661
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1662
    (aKey isCharacter and:[(size := list size) ~~ 0]) ifFalse:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1663
        ^ false
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1664
    ].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1665
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1666
    size == selection ifTrue:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1667
        size == 1 ifTrue:[^ false].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1668
        j := 1
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1669
    ] ifFalse:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1670
        j := selection isNil ifTrue:[1] ifFalse:[selection + 1]
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1671
    ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1672
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1673
    char := aKey asLowercase.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1674
    blck := [:i| ((list at:i) accessCharacter == char and:[self isSelectable:i]) ifTrue:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1675
                      self selection:i.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1676
                    ^ true
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1677
                  ]        
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1678
            ].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1679
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1680
    j to:size  do:blck.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1681
    1 to:(j-1) do:blck.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1682
  ^ false
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1683
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1684
!
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1685
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1686
processShortcutKey:aKey
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1687
    "if there is a short-key for that character, process it
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1688
     and return true. Otherwise, return false.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1689
    "
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1690
    |j k size rawKey blck|
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1691
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1692
    (size := list size) == 0 ifTrue:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1693
        ^ false
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1694
    ].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1695
    rawKey := device keyboardMap keyAtValue:aKey ifAbsent:aKey.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1696
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1697
    size == selection ifTrue:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1698
        size == 1 ifTrue:[^ false].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1699
        j := 1
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1700
    ] ifFalse:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1701
        j := selection isNil ifTrue:[1] ifFalse:[selection + 1]
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1702
    ].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1703
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1704
    blck := [:i| k := (list at:i) shortcutKey.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1705
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1706
                 (k notNil and:[(self isSelectable:i) and:[(k == aKey or:[k == rawKey])]]) ifTrue:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1707
                     self selection:i.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1708
                   ^ true
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1709
                 ]
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1710
            ].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1711
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1712
    j to:size  do:blck.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1713
    1 to:(j-1) do:blck.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1714
  ^ false
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1715
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1716
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1717
!NoteBookView methodsFor:'queries'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1718
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1719
isEnabled
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1720
    "returns enabled state
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1721
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1722
    ^ enabled
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1723
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1724
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1725
isFirstTabInLine:aTab
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1726
    |idx tab|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1727
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1728
    idx := list identityIndexOf:aTab.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1729
    tab := list at:(idx - 1) ifAbsent:nil.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1730
  ^ (tab isNil or:[tab lineNr ~~ aTab lineNr])
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1731
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1732
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1733
isHorizontal
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1734
    "returns true in case of direction is #top or #bottom
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1735
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1736
    ^ (direction == #top or:[direction == #bottom])
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1737
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1738
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1739
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1740
isLastTabInLine:aTab
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1741
    |index tab|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1742
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1743
    index := list identityIndexOf:aTab.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1744
    tab := list at:(index + 1) ifAbsent:nil.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1745
  ^ (tab isNil or:[tab lineNr ~~ aTab lineNr])
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1746
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1747
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1748
!NoteBookView methodsFor:'selection'!
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  1749
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1750
isSelectable:anIndex
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1751
    "returns true if tab at an index is selectable
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1752
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1753
    (anIndex notNil and:[anIndex between:1 and:list size]) ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1754
        (list at:anIndex) isEnabled ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1755
            ^ selectConditionBlock isNil ifTrue:[true]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1756
                                        ifFalse:[selectConditionBlock value:anIndex]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1757
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1758
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1759
    ^ false
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1760
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1761
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1762
selectedTab
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1763
    "returns the selected tab ot nil
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1764
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1765
    ^ selection notNil ifTrue:[list at:selection] ifFalse:[nil]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1766
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1767
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1768
selection
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1769
    "return the selection or nil
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1770
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1771
    selection isNil ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1772
        ^ useIndex ifTrue:[0] ifFalse:[nil]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1773
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1774
    ^ useIndex ifTrue:[selection] ifFalse:[(list at:selection) label]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1775
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1776
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1777
selection:anIndexOrNil
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1778
    "change the selection to index or nil. The model and/or actionBlock is notified
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1779
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1780
    |oldSel|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1781
1407
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1782
    anIndexOrNil ~~ selection ifTrue:[
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1783
        oldSel := selection.
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1784
        self setSelection:anIndexOrNil.
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1785
        oldSel ~~ selection ifTrue:[self selectionChanged]
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1786
    ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1787
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1788
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1789
selectionChanged
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1790
    "selection has changed; raise notification
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1791
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1792
    |sel|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1793
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1794
    sel := self selection.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1795
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1796
    model  notNil ifTrue:[model  value:sel].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1797
    action notNil ifTrue:[action value:sel]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1798
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1799
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1800
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1801
setSelection:anIndexOrNil
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1802
    "change the selection to index or nil. No notifications are raised
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1803
    "
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1804
    |newSel lnNr tappl model|
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1805
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1806
    newSel := self listIndexOf:anIndexOrNil.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1807
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1808
    (newSel notNil and:[(self isSelectable:newSel) not]) ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1809
        newSel := nil
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1810
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1811
    selection == newSel ifTrue:[^ self].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1812
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1813
    (shown and:[numberOfLines notNil]) ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1814
        selection := newSel.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1815
        self invalidate
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1816
    ] ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1817
        selection notNil ifTrue:[self invalidateTab:(list at:selection)].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1818
        selection := newSel.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1819
        selection notNil ifTrue:[self invalidateTab:(list at:selection)].
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1820
    ].
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1821
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1822
    (canvas notNil and:[(canvas objectAttributeAt:#isTabItem) == true]) ifTrue:[
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1823
        canvas unmap.
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1824
        canvas := nil.
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1825
    ].
1724
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
  1826
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1827
    (     selection notNil
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1828
     and:[(model := (list at:selection) model) notNil
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1829
     and:[(tappl := model canvasView) notNil]]
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1830
    ) ifFalse:[
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1831
        ^ self
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1832
    ].
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1833
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1834
    canvasHolder notNil ifTrue:[
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1835
        canvasHolder value:tappl
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1836
    ] ifFalse:[
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1837
        self canvas:tappl
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1838
    ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1839
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1840
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1841
!NoteBookView::Tab class methodsFor:'instance creation'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1842
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1843
label:aLabel on:aGC
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1844
    ^ self basicNew label:aLabel on:aGC
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1845
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1846
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1847
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1848
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1849
!NoteBookView::Tab methodsFor:'accessing'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1850
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1851
accessCharacter
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1852
    ^ accessCharacter
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1853
!
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1854
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1855
label
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1856
    "returns my original label
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1857
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1858
    ^ label
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1859
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1860
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1861
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1862
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1863
label:aLabel on:aGC
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1864
    "initialize attributes
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1865
    "
1677
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  1866
    label           := aLabel.
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  1867
    model           := (aLabel isKindOf:TabItem) ifTrue:[aLabel] ifFalse:[nil].
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1868
    accessCharacter := nil.
1677
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  1869
    printableLabel  := model notNil ifTrue:[model rawLabel] ifFalse:[aLabel].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1870
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1871
    printableLabel notNil ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1872
        printableLabel isImageOrForm ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1873
            printableLabel := printableLabel onDevice:(aGC device)
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1874
        ] ifFalse:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1875
            printableLabel isString ifTrue:[
1677
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  1876
                printableLabel := self resolveDisplayStringFor:printableLabel
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  1877
            ] ifFalse:[
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  1878
                printableLabel class == LabelAndIcon ifTrue:[
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  1879
                    printableLabel string:(self resolveDisplayStringFor:(printableLabel string))
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  1880
                ]
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1881
            ].
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  1882
        ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1883
    ] ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1884
        printableLabel := ''
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1885
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1886
    extent := (printableLabel widthOn:aGC) @ (printableLabel heightOn:aGC).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1887
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1888
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1889
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1890
lineNr
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1891
    "get the line number
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1892
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1893
    ^ lineNr
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1894
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1895
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1896
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1897
lineNr:aLineNr
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1898
    "set the line number
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1899
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1900
    lineNr := aLineNr
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1901
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1902
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1903
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1904
model
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1905
    "returns the model, a TabItem or nil
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1906
    "
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1907
    ^ model
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1908
!
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1909
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1910
printableLabel
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1911
    "get my printable label
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1912
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1913
    ^ printableLabel
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1914
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1915
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1916
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1917
shortcutKey
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1918
    "get the  key to press to select the tab item from the keyboard
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1919
    "
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1920
    model notNil ifTrue:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1921
        ^ model shortcutKey
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1922
    ].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1923
    ^ nil
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1924
!
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1925
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1926
string
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1927
    "access the printable string used for steping through a list
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1928
     searching for an entry starting with a character.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1929
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1930
    ^ printableLabel perform:#string ifNotUnderstood:nil
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1931
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1932
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1933
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
  1934
!NoteBookView::Tab methodsFor:'accessing-dimensions'!
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1935
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1936
extent
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1937
    "returns the extent of the label
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1938
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1939
    ^ extent
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1940
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1941
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1942
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1943
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1944
layout
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1945
    "get the tab's layout
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1946
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1947
    ^ layout
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1948
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1949
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1950
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1951
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1952
layout:aLayout
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1953
    "set the tab's layout
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1954
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1955
    layout := aLayout
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1956
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1957
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1958
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1959
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1960
preferredExtentX
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1961
    "returns my preferred extent x
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1962
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1963
    ^ 4 + extent x
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1964
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1965
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1966
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1967
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1968
preferredExtentY
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1969
    "returns my preferred extent y
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1970
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1971
    ^ 4 + extent y
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1972
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1973
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1974
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1975
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
  1976
!NoteBookView::Tab methodsFor:'accessing-mvc'!
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1977
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1978
addDependent:aGC
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1979
    "make the noteBook be a dependent of the tab model
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1980
    "
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1981
    model notNil ifTrue:[
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1982
        model addDependent:aGC
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1983
    ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1984
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1985
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1986
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1987
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1988
removeDependent:aGC
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1989
    "make the noteBook be independent of the tab model
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1990
    "
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1991
    model notNil ifTrue:[
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1992
        model destroyCanvas.
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1993
        model removeDependent:aGC.
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1994
    ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1995
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1996
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1997
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1998
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1999
!NoteBookView::Tab methodsFor:'drawing'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2000
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2001
drawAtBottomOn:aGC selected:isSelected
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2002
    "redraw tab at bottom of view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2003
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2004
    |yT "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2005
     xL "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2006
     xR "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2007
     yB "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2008
    |
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2009
    xL := layout left.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2010
    yT := layout top.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2011
    xR := layout right  - 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2012
    yB := layout bottom - 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2013
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2014
    aGC paint:(aGC halfLightColor).
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2015
    aGC displayLineFromX:xL+1 y:yB-1   toX:xL+1 y:yT.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2016
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2017
    aGC paint:(aGC drawLightColor).
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2018
    aGC displayLineFromX:xL y:yB-2 toX:xL   y:yT.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2019
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2020
    aGC paint:(aGC shadowColor).
1658
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  2021
    aGC displayLineFromX:xL+2 y:yB  toX:xR-2 y:yB.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2022
    aGC displayLineFromX:xR   y:yT   toX:xR   y:yB-2.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2023
    aGC displayPointX:xR-1    y:yB-1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2024
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2025
    aGC paint:(aGC halfShadowColor).
1658
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  2026
    aGC displayLineFromX:xR-1 y:yT   toX:xR-1 y:yB-2.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2027
    aGC displayLineFromX:xL+2 y:yB-1 toX:xR-2 y:yB-1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2028
    aGC displayPointX:xR-2    y:yB-2.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2029
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2030
    isSelected ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2031
        (aGC  isLastTabInLine:self) ifFalse:[aGC displayPointX:xR y:yT].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2032
        (aGC isFirstTabInLine:self) ifFalse:[aGC displayPointX:xL y:yT].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2033
    ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2034
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2035
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2036
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2037
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2038
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2039
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2040
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2041
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2042
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2043
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2044
drawAtLeftOn:aGC selected:isSelected
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2045
    "redraw tab at left of view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2046
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2047
    |yT "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2048
     xL "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2049
     xR "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2050
     yB "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2051
    |
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2052
    xL := layout left.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2053
    yT := layout top.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2054
    xR := layout right  - 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2055
    yB := layout bottom - 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2056
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2057
    aGC paint:(aGC shadowColor).
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2058
    aGC displayLineFromX:xR y:yB toX:xL+2 y:yB.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2059
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2060
    aGC paint:(aGC halfShadowColor).
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2061
    aGC displayLineFromX:xR y:yB-1 toX:xL+1 y:yB-1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2062
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2063
    aGC paint:(aGC drawLightColor).
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2064
    aGC displayLineFromX:xL+2 y:yT   toX:xR   y:yT.
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2065
    aGC displayLineFromX:xL   y:yT+2 toX:xL   y:yB-2.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2066
    aGC displayPointX:xL+1 y:yT+1.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2067
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2068
    aGC paint:(aGC halfLightColor).
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2069
    aGC displayLineFromX:xL+1 y:yT+2 toX:xL+1 y:yB-2.
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2070
    aGC displayLineFromX:xL+2 y:yT+1 toX:xR   y:yT+1.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2071
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2072
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2073
    (aGC isLastTabInLine:self)  ifFalse:[aGC displayPointX:xR y:yB].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2074
    (aGC isFirstTabInLine:self) ifFalse:[aGC displayPointX:xR y:yT].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2075
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2076
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2077
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2078
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2079
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2080
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2081
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2082
drawAtRightOn:aGC selected:isSelected
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2083
    "redraw tab at right of view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2084
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2085
    |yT "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2086
     xL "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2087
     xR "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2088
     yB "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2089
    |
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2090
    xL := layout left.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2091
    yT := layout top.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2092
    xR := layout right - 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2093
    yB := layout bottom - 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2094
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2095
    aGC paint:(aGC drawLightColor).
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2096
    aGC displayLineFromX:xL   y:yT   toX:xR-2 y:yT.
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2097
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2098
    aGC paint:(aGC halfLightColor).
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2099
    aGC displayLineFromX:xL   y:yT+1 toX:xR-2   y:yT+1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2100
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2101
    aGC paint:(aGC shadowColor).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2102
    aGC displayLineFromX:xR-2   y:yB   toX:xL y:yB.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2103
    aGC displayLineFromX:xR   y:yT+2 toX:xR y:yB-2.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2104
    aGC displayPointX:xR-1 y:yB-1.
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2105
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2106
    aGC paint:(aGC halfShadowColor).
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2107
    aGC displayLineFromX:xR-2 y:yB-1 toX:xL y:yB-1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2108
    aGC displayLineFromX:xR-1 y:yT+1 toX:xR-1 y:yB-2.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2109
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2110
    isSelected ifFalse:[^ self].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2111
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2112
    (aGC isLastTabInLine:self)  ifFalse:[aGC displayPointX:xL y:yB].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2113
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2114
    (aGC isFirstTabInLine:self) ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2115
        aGC displayPointX:xL y:yT+1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2116
        aGC displayPointX:xL y:yT
355
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2117
    ].
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2118
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2119
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2120
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2121
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2122
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2123
!
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2124
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2125
drawAtTopOn:aGC selected:isSelected
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2126
    "redraw tab at top of view
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2127
    "
1407
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  2128
    |
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  2129
     yT "{ Class:SmallInteger }"
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2130
     xL "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2131
     xR "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2132
     yB "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2133
    |
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2134
    xL := layout left.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2135
    yT := layout top.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2136
    xR := layout right  - 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2137
    yB := layout bottom - 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2138
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2139
    aGC paint:(aGC shadowColor).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2140
    aGC displayLineFromX:xR   y:yB toX:xR   y:yT+2.
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2141
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2142
    aGC paint:(aGC halfShadowColor).
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2143
    aGC displayLineFromX:xR-1 y:yB toX:xR-1 y:yT+1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2144
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2145
    aGC paint:(aGC drawLightColor).
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  2146
    aGC displayLineFromX:xL+2 y:yT toX:xR-2 y:yT.          "/ top line
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  2147
    aGC displayLineFromX:xL   y:yB toX:xL   y:yT+2.        "/ left line
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2148
    aGC displayPointX:xL+1    y:yT+1.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2149
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2150
    aGC paint:(aGC halfLightColor).
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  2151
    aGC displayLineFromX:xL+2 y:yT+1 toX:xR-2 y:yT+1.      "/ top line 2
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  2152
    aGC displayLineFromX:xL+1 y:yB toX:xL+1 y:yT+2.        "/ left line 2
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2153
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2154
    isSelected ifFalse:[^ self].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2155
    (aGC isLastTabInLine:self)  ifFalse:[aGC displayPointX:xR y:yB].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2156
    (aGC isFirstTabInLine:self) ifFalse:[aGC displayPointX:xL y:yB].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2157
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2158
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2159
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2160
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2161
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  2162
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2163
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2164
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2165
drawWin95FocusFrameOn:aGC
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2166
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2167
"/aGC notNil ifTrue:[^ self].
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2168
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2169
    aGC displayDottedRectangleX:(layout left   + 4)
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2170
                              y:(layout top    + 4)
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2171
                          width:(layout width  - 8)
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2172
                         height:(layout height - 8).
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2173
!
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2174
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2175
redrawAt:aDirection selected:isSelected on:aGC
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2176
    "redraw tab
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2177
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2178
    |dispObj fgColor
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2179
     y  "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2180
     x  "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2181
    |
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2182
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2183
    isSelected ifTrue:[
1689
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
  2184
        aGC paint:(aGC activeTabBackgroundColor).
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2185
        layout displayFilledOn:aGC.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2186
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2187
             aDirection == #top    ifTrue:[self drawAtTopOn:aGC    selected:isSelected]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2188
    ifFalse:[aDirection == #bottom ifTrue:[self drawAtBottomOn:aGC selected:isSelected]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2189
    ifFalse:[aDirection == #right  ifTrue:[self drawAtRightOn:aGC  selected:isSelected]
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2190
    ifFalse:[                              self drawAtLeftOn:aGC   selected:isSelected]]].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2191
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2192
    "/ REDRAW LABEL
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2193
    (aGC isEnabled and:[self isEnabled]) ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2194
        dispObj := printableLabel.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2195
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2196
        (model isNil or:[(fgColor := model foregroundColor) isNil]) ifTrue:[
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2197
            fgColor := isSelected ifTrue:[aGC activeForegroundColor]
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2198
                                 ifFalse:[aGC foregroundColor].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2199
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2200
    ] ifFalse:[
1700
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
  2201
        fgColor := aGC disabledForegroundColor.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2202
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2203
        (dispObj := disabledLabel) isNil ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2204
            (dispObj := printableLabel) isImageOrForm ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2205
                disabledLabel := printableLabel lightened onDevice:(aGC device)
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2206
            ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2207
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2208
    ].
1442
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
  2209
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2210
    aGC paint:fgColor.
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2211
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2212
    (aDirection == #top or:[aDirection == #bottom]) ifTrue:[
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2213
        x := layout left + (layout width  - extent x // 2).
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2214
        y := layout top  + (layout height - extent y // 2).
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2215
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2216
        aDirection == #bottom ifTrue:[y := y - 1] ifFalse:[y := y + 1].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2217
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2218
        dispObj isImageOrForm ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2219
            y := y + aGC font ascent
1683
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
  2220
        ].
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
  2221
        dispObj displayOn:aGC x:x y:y
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2222
    ] ifFalse:[
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2223
        x := layout left + (layout width  - extent y // 2).
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  2224
        y := layout top  + (layout height - extent x // 2).
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2225
1683
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
  2226
        aDirection == #left ifTrue:[
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
  2227
            x := x + 1.
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
  2228
        ] ifFalse:[
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
  2229
            x := x - 1.
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
  2230
        ].
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2231
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2232
        dispObj isImageOrForm ifFalse:[
1663
d8a1a6a12a67 bugfix in: Tab:: redrawAt:selected:on: when rotating
ca
parents: 1659
diff changeset
  2233
d8a1a6a12a67 bugfix in: Tab:: redrawAt:selected:on: when rotating
ca
parents: 1659
diff changeset
  2234
            dispObj isString ifTrue:[ 
d8a1a6a12a67 bugfix in: Tab:: redrawAt:selected:on: when rotating
ca
parents: 1659
diff changeset
  2235
                x := x + aGC font descent.
d8a1a6a12a67 bugfix in: Tab:: redrawAt:selected:on: when rotating
ca
parents: 1659
diff changeset
  2236
            ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2237
            "/ workaround for a bug in display-with-angle,
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2238
            "/ iff displayed string is a labelAndIcon.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2239
            "/ (In this case, display is always opaque, and the current
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2240
            "/  backgroundPaint color is used to fill the underlying rectangle)
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2241
            "/
1663
d8a1a6a12a67 bugfix in: Tab:: redrawAt:selected:on: when rotating
ca
parents: 1659
diff changeset
  2242
            aGC paint:fgColor.
d8a1a6a12a67 bugfix in: Tab:: redrawAt:selected:on: when rotating
ca
parents: 1659
diff changeset
  2243
            aGC backgroundPaint:aGC backgroundColor.
1683
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
  2244
            aGC displayString:dispObj x:x y:y angle:90.
1663
d8a1a6a12a67 bugfix in: Tab:: redrawAt:selected:on: when rotating
ca
parents: 1659
diff changeset
  2245
        ] ifTrue:[
d8a1a6a12a67 bugfix in: Tab:: redrawAt:selected:on: when rotating
ca
parents: 1659
diff changeset
  2246
            (dispObj rotated:90) displayOn:aGC x:x y:y.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2247
        ]
1683
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
  2248
    ]
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2249
! !
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2250
1677
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2251
!NoteBookView::Tab methodsFor:'private'!
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2252
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2253
resolveDisplayStringFor:aString
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2254
    |string size rest pos idx|
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2255
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2256
    size   := aString size.
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2257
    string := aString.
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2258
    pos    := 0.
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2259
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2260
    size > 1 ifTrue:[
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2261
        (model notNil and:[(pos := model accessCharacterPosition) ~~ 0]) ifTrue:[
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2262
            pos > size ifTrue:[pos := 0]
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2263
        ] ifFalse:[
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2264
            idx := 1.
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2265
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2266
            [((idx := string indexOf:$& startingAt:idx) ~~ 0 and:[idx < size])] whileTrue:[
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2267
                rest := string copyFrom:(idx+1).
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2268
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2269
                idx == 1 ifTrue:[string := rest]
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2270
                        ifFalse:[string := (string copyFrom:1 to:(idx-1)), rest].
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2271
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2272
                (string at:idx) == $& ifTrue:[idx := idx + 1]
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2273
                                     ifFalse:[pos := idx].
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2274
                size := size - 1.
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2275
            ]
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2276
        ]
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2277
    ].
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2278
    size ~~ 0 ifTrue:[
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2279
        pos == 0 ifTrue:[
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2280
            pos := 1
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2281
        ] ifFalse:[
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2282
            string isText ifFalse:[
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2283
                string := Text string:string
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2284
            ].
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2285
            string emphasisAt:pos add:#underline
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2286
        ].
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2287
        accessCharacter := (string at:pos) asLowercase
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2288
    ] ifFalse:[
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2289
        accessCharacter := nil
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2290
    ].
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2291
    ^ string
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2292
! !
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2293
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2294
!NoteBookView::Tab methodsFor:'testing'!
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2295
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2296
containsPointX:x y:y
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2297
    "return true, if the point defined by x@y is contained in the tab.
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2298
    "
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2299
    ^ layout notNil ifTrue:[layout containsPointX:x y:y]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2300
                   ifFalse:[false].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2301
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2302
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2303
!
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2304
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2305
intersects:aRectangle
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2306
    "return true, if the intersection between the argument, aRectangle
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2307
     and the tab is not empty
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2308
    "
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2309
    ^ layout notNil ifTrue:[layout intersects:aRectangle]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2310
                   ifFalse:[false].
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2311
432
dedc8dee12f5 created:
ca
parents: 419
diff changeset
  2312
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2313
!
432
dedc8dee12f5 created:
ca
parents: 419
diff changeset
  2314
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2315
isEnabled
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2316
    "returne true if no model exists or the model is enabled
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2317
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2318
    ^ (model isNil or:[model isEnabled])
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2319
355
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2320
386
eb0dd3efd92c bug fixes
ca
parents: 375
diff changeset
  2321
! !
eb0dd3efd92c bug fixes
ca
parents: 375
diff changeset
  2322
355
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2323
!NoteBookView class methodsFor:'documentation'!
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2324
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2325
version
2036
6f3927ad36fc oops - strange side effect
Claus Gittinger <cg@exept.de>
parents: 2035
diff changeset
  2326
    ^ '$Header: /cvs/stx/stx/libwidg2/NoteBookView.st,v 1.55 2001-10-23 22:12:16 cg Exp $'
355
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2327
! !