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