NoteBookView.st
author Claus Gittinger <cg@exept.de>
Wed, 24 Nov 2004 10:41:25 +0100
changeset 2777 56bb352f6b91
parent 2763 844f86135a02
child 2875 6aaefc7aae54
permissions -rw-r--r--
*** empty log message ***
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
2760
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
    17
	instanceVariableNames:'list listHolder foregroundColor backgroundColor selection enabled
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
    18
		action useIndex direction numberOfLines selectConditionBlock
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
    19
		accessTabMenuAction canvas canvasInset canvasHolder
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
    20
		halfLightColor halfShadowColor fitLastRow tabModus
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
    21
		lastComputedExtent keepCanvas activeForegroundColor
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
    22
		activeBackgroundColor drawLightColor edgeStyle tabInset
2431
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
    23
		tabLabelInset disabledForegroundColor tabLevel tabTopMargin
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
    24
		tabBottomMargin selectionInsetX selectionInsetY translateLabel
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
    25
		buttonPrev buttonNext tabRightMargin tabLeftMargin'
2760
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
    26
	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
    27
		DefaultActiveForegroundColor DefaultActiveBackgroundColor
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
    28
		DefaultShadowColor DefaultHalfShadowColor DefaultLightColor
2758
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
    29
		DefaultHalfLightColor DefaultEdgeStyle DisabledForegroundColor
2763
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
    30
		DefaultActiveTabMarkerColor DefaultActiveTabMarkerFgColor'
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    31
	poolDictionaries:''
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    32
	category:'Views-Layout'
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    33
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    34
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    35
Object subclass:#Tab
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
    36
	instanceVariableNames:'label model printableLabel disabledLabel lineNr layout extent
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
    37
		accessCharacter'
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    38
	classVariableNames:''
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    39
	poolDictionaries:''
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    40
	privateIn:NoteBookView
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    41
!
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
!NoteBookView class methodsFor:'documentation'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    44
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    45
copyright
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    46
"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    47
 COPYRIGHT (c) 1997 by eXept Software AG
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    48
              All Rights Reserved
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    49
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    50
 This software is furnished under a license and may be used
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    51
 only in accordance with the terms of that license and with the
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    52
 inclusion of the above copyright notice.   This software may not
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    53
 be provided or otherwise made available to, or used by, any
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    54
 other person.  No title to or ownership of the software is
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    55
 hereby transferred.
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    56
"
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    57
355
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
!
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
documentation
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
"
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    62
    implements the noteBook.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    63
    May also be used on its own (without a surrounding noteBook).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    64
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    65
    [author:]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    66
        Claus Atzkern
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    67
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    68
    [see also:]
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    69
        TabView
355
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
"
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    71
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    72
!
355
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    74
examples
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    75
"
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    76
    tabs at top ( default )
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    77
                                                                                [exBegin]                                      
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    78
    |top tab|
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    79
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    80
    top  := StandardSystemView extent:250@100.
1683
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
    81
    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
    82
    tab list:#( 'Foo' 'Bar' 'Baz' ).
2529
ce78ec72df65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2496
diff changeset
    83
    tab action:[:index| Transcript showCR:index].
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    84
    top open.
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    85
                                                                                [exEnd]
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    86
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    87
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    88
    tabs at bottom
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    89
                                                                                [exBegin]                                      
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    90
    |top tab|
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    91
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    92
    top  := StandardSystemView extent:250@100.
1683
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
    93
    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
    94
    tab direction:#bottom.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
    95
    tab list:#( 'Foo' 'Bar' 'Baz' ).
2529
ce78ec72df65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2496
diff changeset
    96
    tab action:[:index| Transcript showCR:index].
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    97
    top open.
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
    98
                                                                                [exEnd]
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
    99
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   100
    tabs at left
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   101
                                                                                [exBegin]                                      
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   102
    |top tab|
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   103
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   104
    top  := StandardSystemView extent:100@200.
1683
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
   105
    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
   106
    tab direction:#left.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   107
    tab list:#( 'Foo' 'Bar' 'Baz' ).
2529
ce78ec72df65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2496
diff changeset
   108
    tab action:[:index| Transcript showCR:index].
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   109
    top open.
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   110
                                                                                [exEnd]
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   111
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   112
    tabs at right
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   113
                                                                                [exBegin]                                      
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   114
    |top tab|
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   115
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   116
    top  := StandardSystemView extent:100@200.
1683
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
   117
    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
   118
    tab direction:#right.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   119
    tab list:#( 'Foo' 'Bar' 'Baz' ).
2529
ce78ec72df65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2496
diff changeset
   120
    tab action:[:index| Transcript showCR:index].
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   121
    top open.
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   122
                                                                                [exEnd]
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   123
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   124
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   125
"
1401
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
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   128
!NoteBookView class methodsFor:'defaults'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   129
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   130
defaultFont
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   131
    ^ MenuView defaultFont
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   132
!
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   133
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   134
updateStyleCache
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   135
    "extract values from the styleSheet and cache them in class variables"
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   136
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   137
    <resource: #style (#'noteBook.foregroundColor' #'noteBook.backgroundColor'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   138
                       #'noteBook.activeForegroundColor' #'noteBook.activeBackgroundColor'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   139
                       #'noteBook.lightColor' #'noteBook.halfLightColor' #'noteBook.shadowColor'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   140
                       #'noteBook.halfShadowColor' #'noteBook.edgeStyle'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   141
                       #'noteBook.activeTabMarkerColor'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   142
                      )>
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   143
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   144
    DefaultForegroundColor := StyleSheet colorAt:#'noteBook.foregroundColor'.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   145
    DefaultForegroundColor isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   146
        DefaultForegroundColor := StyleSheet colorAt:#'button.foregroundColor'.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   147
    ].
2760
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   148
    DefaultBackgroundColor := StyleSheet colorAt:#'noteBook.backgroundColor'.
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   149
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   150
    DefaultActiveForegroundColor := StyleSheet colorAt:#'noteBook.activeForegroundColor'.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   151
    DefaultActiveForegroundColor isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   152
        DefaultActiveForegroundColor := StyleSheet colorAt:#'button.activeForegroundColor'
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   153
    ].
2760
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   154
    DefaultActiveBackgroundColor := StyleSheet colorAt:#'noteBook.activeBackgroundColor'.
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   155
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   156
    DefaultLightColor := StyleSheet colorAt:#'noteBook.lightColor'.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   157
    DefaultLightColor isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   158
        DefaultLightColor := StyleSheet colorAt:'button.lightColor'
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   159
    ].
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   160
    DefaultHalfLightColor := StyleSheet colorAt:#'noteBook.halfLightColor'.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   161
    DefaultHalfLightColor isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   162
        DefaultHalfLightColor := StyleSheet colorAt:#'button.halfLightColor'
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   163
    ].    
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   164
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   165
    DefaultShadowColor := StyleSheet colorAt:#'noteBook.shadowColor'.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   166
    DefaultShadowColor isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   167
        DefaultShadowColor := StyleSheet colorAt:'button.shadowColor'
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   168
    ].
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   169
    DefaultHalfShadowColor := StyleSheet colorAt:#'noteBook.halfShadowColor'.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   170
    DefaultHalfShadowColor isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   171
        DefaultHalfShadowColor := StyleSheet colorAt:#'button.halfShadowColor'
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   172
    ].
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   173
    DefaultEdgeStyle := StyleSheet at:#'noteBook.edgeStyle'.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   174
    DefaultEdgeStyle isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   175
        DefaultEdgeStyle := StyleSheet at:#'button.edgeStyle'
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   176
    ].
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   177
1683
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
   178
    DefaultEdgeStyle == #softWin95 ifFalse:[
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   179
        DefaultEdgeStyle := nil
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   180
    ].
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   181
2758
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
   182
    DefaultActiveTabMarkerColor := StyleSheet colorAt:#'noteBook.activeTabMarkerColor'.
2763
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   183
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   184
    DefaultActiveTabMarkerColor isNil ifTrue:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   185
        DefaultActiveTabMarkerFgColor := nil.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   186
    ] ifFalse:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   187
        DefaultActiveTabMarkerFgColor :=  Color redByte:255 greenByte:138 blueByte:41.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   188
    ].
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   189
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   190
    "
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   191
     self updateStyleCache
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   192
    "
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   193
! !
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   194
2496
36a30ce247c9 method category rename
Claus Gittinger <cg@exept.de>
parents: 2492
diff changeset
   195
!NoteBookView methodsFor:'accepting-items'!
1724
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   196
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   197
tabAtIndex:tabIndex put:newLabel
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   198
    "called if the contents of a tab changed; test whether the old layout can
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   199
     be reused otherwise we must recompute the whole list
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   200
    "
2431
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   201
    |tab layout prefX prefY tabExtent|
1724
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   202
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   203
    "/ 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
   204
    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
   205
    tab notNil ifTrue:[
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   206
        tab label:newLabel on:self.
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   207
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   208
        "/ 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
   209
        "/ and is not too small for current tab-layout
1880
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   210
        layout := tab layout.
2431
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   211
        tabExtent := self preferredExtentForTab:tab.
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   212
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   213
        (     (prefX := tabExtent x) <= layout width
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   214
         and:[(prefY := tabExtent y) <= layout height]
1880
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   215
        ) ifTrue:[
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   216
            "/ the new string fits into current tab-layout
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   217
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   218
            numberOfLines == 1 ifTrue:[         "/ do not change the layout
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   219
                ^ self invalidateTab:tab
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   220
            ].
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   221
f133d40bd2b0 handle recomputation of layout if label changed
ca
parents: 1818
diff changeset
   222
            "/ 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
   223
            ((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
   224
                ^ 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
   225
            ].
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   226
        ].
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   227
        self recomputeList.
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   228
        self invalidate.
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   229
        ^ self.
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   230
    ].
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   231
    "/ can this happen ?
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   232
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   233
    "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
   234
! !
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   235
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   236
!NoteBookView methodsFor:'accessing'!
355
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   238
canvas
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   239
    "returns the canvas; the containter view
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   240
    "
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   241
    ^ canvas
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   242
!
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   243
2492
b71fe0be4188 must always use #realize for new canvas
martin
parents: 2485
diff changeset
   244
canvas:newCanvas
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
   245
    "change the canvas; the containter view
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   246
    "
2492
b71fe0be4188 must always use #realize for new canvas
martin
parents: 2485
diff changeset
   247
    |oldCanvas|
b71fe0be4188 must always use #realize for new canvas
martin
parents: 2485
diff changeset
   248
b71fe0be4188 must always use #realize for new canvas
martin
parents: 2485
diff changeset
   249
    oldCanvas := canvas.
b71fe0be4188 must always use #realize for new canvas
martin
parents: 2485
diff changeset
   250
b71fe0be4188 must always use #realize for new canvas
martin
parents: 2485
diff changeset
   251
    newCanvas ~~ oldCanvas ifTrue:[
b71fe0be4188 must always use #realize for new canvas
martin
parents: 2485
diff changeset
   252
        oldCanvas notNil ifTrue:[
b71fe0be4188 must always use #realize for new canvas
martin
parents: 2485
diff changeset
   253
            (keepCanvas or:[(oldCanvas objectAttributeAt:#isTabItem) == true]) ifTrue:[
b71fe0be4188 must always use #realize for new canvas
martin
parents: 2485
diff changeset
   254
                oldCanvas unmap.
1413
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   255
            ] ifFalse:[
2492
b71fe0be4188 must always use #realize for new canvas
martin
parents: 2485
diff changeset
   256
                oldCanvas destroy.
1413
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   257
            ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   258
        ].
2492
b71fe0be4188 must always use #realize for new canvas
martin
parents: 2485
diff changeset
   259
        canvas := newCanvas.
b71fe0be4188 must always use #realize for new canvas
martin
parents: 2485
diff changeset
   260
        newCanvas notNil ifTrue:[
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   261
            tabModus := false.
2035
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   262
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   263
            self resizeCanvas.
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   264
2492
b71fe0be4188 must always use #realize for new canvas
martin
parents: 2485
diff changeset
   265
            (subViews size == 0 or:[(subViews includesIdentical:newCanvas) not]) ifTrue:[
b71fe0be4188 must always use #realize for new canvas
martin
parents: 2485
diff changeset
   266
                self addSubView:newCanvas
1549
4c09c03efa29 never add a subcanvas twice
Stefan Vogel <sv@exept.de>
parents: 1543
diff changeset
   267
            ].
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
   268
1687
70888239654f category changes
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
   269
            realized ifTrue:[
2492
b71fe0be4188 must always use #realize for new canvas
martin
parents: 2485
diff changeset
   270
                newCanvas realize.
b71fe0be4188 must always use #realize for new canvas
martin
parents: 2485
diff changeset
   271
                newCanvas raise.
1687
70888239654f category changes
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
   272
            ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   273
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   274
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   275
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   276
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   277
list
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   278
    "return the list of Tabs or Labels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   279
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   280
    ^ list collect:[:aTab| aTab label ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   281
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   282
!
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   283
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   284
list:aList
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   285
    "set the list
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   286
    "
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
   287
    |name newList|
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   288
1771
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   289
    name    := self selection.
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   290
    newList := OrderedCollection new.
1401
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
    aList size == 0 ifTrue:[
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   293
        list do:[:aTab| aTab removeDependent:self].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   294
    ] ifFalse:[
1771
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   295
        list do:[:aTab| |m|
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   296
            (     (m := aTab model) notNil
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   297
             and:[(aList includesIdentical:m)]
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   298
            ) ifFalse:[
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   299
                aTab removeDependent:self
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   300
            ]
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   301
        ].
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   302
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   303
        aList do:[:el| |i tab|
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   304
            (    el isNil
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   305
             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
   306
            ) ifTrue:[
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   307
                tab := Tab label:el on:self.
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   308
                tab addDependent:self.
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   309
            ].
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   310
            newList add:tab
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   311
        ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   312
    ].
1771
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   313
09f150c518d5 error fix when adding dynamicly new tab models
ps
parents: 1770
diff changeset
   314
    list            := newList.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   315
    preferredExtent := nil.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   316
    numberOfLines   := nil.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   317
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   318
    selection notNil ifTrue:[
1433
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   319
        useIndex ifTrue:[
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   320
            selection > list size ifTrue:[
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   321
                selection := nil.
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   322
                self selectionChanged.
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   323
            ]
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   324
        ] ifFalse:[
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   325
            selection := list findFirst:[:el| el label = name ].
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   326
            selection == 0 ifTrue:[
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   327
                selection := nil.
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   328
                self selectionChanged.
54d98f39bc51 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1413
diff changeset
   329
            ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   330
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   331
    ].
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   332
    self recomputeList.
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
   333
    self invalidate.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   334
!
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   335
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   336
listIndexOf:something
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   337
    "convert something to an index into the list;
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   338
     returns the index or nil if not found
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   339
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   340
    |index|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   341
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   342
    something isNil ifTrue:[^ 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
    something isNumber ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   345
        index := something
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   346
    ] ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   347
        index := list findFirst:[:aTab|aTab label = something].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   348
        index == 0 ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   349
            index := list findFirst:[:aTab|aTab printableLabel = something]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   350
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   351
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   352
    ^ (index between:1 and:list size) ifTrue:[index] ifFalse:[nil]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   353
!
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
useIndex
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   356
    "use index instead of tab name
1401
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
    ^ useIndex
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   359
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   360
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   361
useIndex:aBoolean
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   362
    "set/clear the useIndex flag. If set, both actionBlock and change-messages
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   363
     are passed the index(indices) of the selection as argument. 
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   364
     If clear, the value(s) (i.e. the selected string) is passed.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   365
     Default is false."
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   366
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   367
    useIndex := aBoolean
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   368
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   369
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   370
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   371
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   372
!NoteBookView methodsFor:'accessing-actions'!
1802
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   373
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   374
accessTabMenuAction
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   375
    "callback to retrieve the menu for a specific tab.
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   376
     the argument to the block is the index of the tab
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   377
    "
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   378
    ^ accessTabMenuAction
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   379
!
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   380
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   381
accessTabMenuAction:aOneArgAction
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   382
    "callback to retrieve the menu for a specific tab.
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   383
     the argument to the block is the index of the tab
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   384
    "
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   385
    accessTabMenuAction := aOneArgAction.
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   386
!
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   387
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   388
action
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   389
    "get the action block to be performed on select; the argument to
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   390
     the block is the selected index or nil in case of no selection.
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   391
    "
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   392
    ^ action
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   393
!
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   394
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   395
action:oneArgBlock
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   396
    "set the action block to be performed on select; the argument to
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   397
     the block is the selected index or nil in case of no selection.
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   398
    "
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   399
    action := oneArgBlock.
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   400
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   401
! !
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
   402
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   403
!NoteBookView methodsFor:'accessing-behavior'!
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   404
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   405
enabled
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   406
    "returns true if tabs are enabled
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   407
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   408
    ^ enabled
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   409
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   410
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   411
enabled:aState
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   412
    "set enabled state of tabs
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   413
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   414
    |state|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   415
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   416
    state := aState ? true.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   417
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   418
    enabled ~~ state ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   419
        enabled := state.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   420
        self invalidate.
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   421
    ]
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   422
!
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   423
2698
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   424
isEnabled
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   425
    "returns enabled state
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   426
    "
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   427
    ^ enabled
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   428
!
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   429
1413
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   430
keepCanvas:aBoolean
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   431
    "if false (the default), the previous canvas is destroyed, whenever
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   432
     a new canvas is set.
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   433
     if true, it is unmapped and kept.
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   434
     Set this flag, if the application changes the canvas but wants
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   435
     them to be kept for fast switching."
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   436
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   437
    keepCanvas := aBoolean.
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   438
!
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   439
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   440
selectConditionBlock
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   441
    "get the conditionBlock; this block is evaluated before a selection
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   442
     change is performed; the change will not be done, if the evaluation
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   443
     returns false. The argument to the block is the selection index
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   444
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   445
    ^ selectConditionBlock
432
dedc8dee12f5 created:
ca
parents: 419
diff changeset
   446
!
dedc8dee12f5 created:
ca
parents: 419
diff changeset
   447
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   448
selectConditionBlock:aOneArgBlock
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   449
    "get the conditionBlock; this block is evaluated before a selection
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   450
     change is performed; the change will not be done, if the evaluation
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   451
     returns false. The argument to the block is the selection index
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   452
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   453
    selectConditionBlock := aOneArgBlock
2629
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   454
!
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   455
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   456
translateLabel
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   457
    "true if labels are translated
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   458
    "
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   459
    ^ translateLabel    
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   460
!
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   461
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   462
translateLabel:aBoolean
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   463
    "set to true if labels should be translated
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   464
    "
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   465
    translateLabel := aBoolean.
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   466
!
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   467
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   468
translateToDisplayLabel:aString
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   469
    "translate the label
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   470
    "
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   471
    |application builder string|
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   472
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   473
    translateLabel ifFalse:[ ^ aString ].
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   474
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   475
    aString isEmptyOrNil ifTrue:[ ^ aString ].
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   476
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   477
    application := self application.
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   478
    application isNil ifTrue:[^ aString ].
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   479
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   480
    builder := application builder.
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   481
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   482
    builder isNil ifTrue:[
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   483
        string := application resources string:aString.
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   484
    ] ifFalse:[
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   485
        
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   486
        string := builder aspectAt:(aString asSymbol).
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   487
        string notNil ifTrue:[^ string ].
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   488
        string := builder resources string:aString.
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   489
    ].
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
   490
    ^ string ? aString
432
dedc8dee12f5 created:
ca
parents: 419
diff changeset
   491
! !
dedc8dee12f5 created:
ca
parents: 419
diff changeset
   492
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   493
!NoteBookView methodsFor:'accessing-colors'!
419
893e322a86e9 colors derived from background
ca
parents: 408
diff changeset
   494
2760
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   495
activeBackgroundColor
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   496
    "returns the bg color used when drawing the active tabs label"
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   497
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   498
    ^ activeBackgroundColor
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   499
!
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   500
1442
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
   501
activeForegroundColor
2760
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   502
    "returns the color used when drawing the active tabs label"
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   503
1442
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
   504
    ^ activeForegroundColor
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
   505
!
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
   506
2758
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
   507
activeTabMarkerColor
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
   508
    "win-XP style marker"
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
   509
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
   510
    ^ DefaultActiveTabMarkerColor    
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
   511
!
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
   512
2763
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   513
activeTabMarkerFgColor
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   514
    "win-XP style marker"
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   515
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   516
    ^ DefaultActiveTabMarkerFgColor
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   517
!
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   518
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   519
backgroundColor
2760
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   520
    "return the backgroundColor of the notebook view"
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   521
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   522
    ^ backgroundColor
408
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   523
!
e7f5e51656be delegate font:
ca
parents: 403
diff changeset
   524
1700
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   525
disabledForegroundColor
2760
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   526
    "returns the color used when drawing disabled tab labels"
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   527
1700
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   528
    ^ disabledForegroundColor
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   529
!
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
   530
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   531
drawLightColor
2760
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   532
    "get the color to be used for lighted edges; bug fix caused by common drawEdge"
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   533
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   534
    ^ drawLightColor
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   535
!
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
   536
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   537
foregroundColor
2760
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   538
    "return the color used for drawing text"
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   539
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   540
    ^ foregroundColor
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
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   543
foregroundColor:aColor
2760
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   544
    "set the color to be used for drawing text"
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
   545
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   546
    aColor ~= foregroundColor ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   547
        foregroundColor := aColor.
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2629
diff changeset
   548
        self invalidate
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   549
    ]
419
893e322a86e9 colors derived from background
ca
parents: 408
diff changeset
   550
!
893e322a86e9 colors derived from background
ca
parents: 408
diff changeset
   551
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   552
halfLightColor
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   553
    ^ halfLightColor
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
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   556
halfShadowColor
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   557
    ^ halfShadowColor
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
1684
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   560
viewBackground:aColor
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   561
    super viewBackground:aColor.
377fa4df07e3 if viewBackground change, recompute half..Colors !!
ca
parents: 1683
diff changeset
   562
2292
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
   563
"/    (edgeStyle isNil and:[viewBackground isColor]) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
   564
"/        halfShadowColor := shadowColor.
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
   565
"/        halfLightColor  := lightColor.
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
   566
"/        drawLightColor  := lightColor.
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
   567
"/    ].
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
   568
"/
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
   569
"/    DefaultShadowColor isNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
   570
"/        shadowColor := aColor darkened onDevice:device
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
   571
"/    ].
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
   572
"/    DefaultLightColor isNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
   573
"/        lightColor := aColor lightened onDevice:device
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
   574
"/    ].
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   575
! !
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   576
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   577
!NoteBookView methodsFor:'accessing-dimension'!
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   578
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   579
preferredExtent
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   580
    "compute max extent x/y based on one line
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   581
    "
2284
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   582
    |level size x y isHorizontal insetX insetY extent|
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   583
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   584
    preferredExtent notNil ifTrue:[ ^ preferredExtent ].
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   585
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   586
    x := y := 0.
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   587
    level := (tabLevel abs) max:1.
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   588
    size  := list size.
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   589
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   590
    size ~~ 0 ifTrue:[
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   591
        list do:[:aTab|
2431
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   592
            extent := self preferredExtentForTab:aTab.
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   593
            x := extent x + x.
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   594
            y := extent y max:y.
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   595
        ].
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   596
    ].
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   597
    y := y + selectionInsetY + level + tabTopMargin + tabBottomMargin.
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   598
    x := x + selectionInsetX + selectionInsetX + (level + level * size).
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
   599
2284
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   600
    isHorizontal := self isHorizontal.
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   601
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   602
    isHorizontal ifTrue:[
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   603
        x := x + self tabLeftMargin + self tabRightMargin
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   604
    ] ifFalse:[
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   605
        y := y + self tabLeftMargin + self tabRightMargin
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   606
    ].
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   607
2284
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   608
    tabModus ifFalse:[
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   609
        canvasInset isPoint ifTrue:[
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   610
            insetX := canvasInset x.
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   611
            insetY := canvasInset y.
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   612
        ] ifFalse:[
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   613
            insetX := insetY := canvasInset.
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   614
        ].
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   615
        canvas notNil ifTrue:[ extent := canvas preferredExtent ]
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   616
                     ifFalse:[ extent := 100@100 ].
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   617
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   618
        y := y + insetY + insetY + extent y.
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   619
        x := x max:extent x.
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   620
        x := x + insetX + insetX + level + level.
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   621
    ].
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   622
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
   623
    isHorizontal ifTrue:[ ^ x @ y ].
2431
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   624
    ^ y @ x
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   625
!
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   626
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   627
preferredExtentForTab:aTab
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   628
    "returns the preferred extent of a tabulator
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   629
    "
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   630
    ^ aTab extent + tabLabelInset
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   631
! !
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   632
2532
7a06df99a078 category change
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   633
!NoteBookView methodsFor:'accessing-mvc'!
7a06df99a078 category change
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   634
2698
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   635
canvasHolder
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   636
    "get the model, which keeps the canvas, a kind of SimpleView
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   637
    "
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   638
    ^ canvasHolder
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   639
!
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   640
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   641
canvasHolder:aValueHolder
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   642
    "set the model, which keeps the canvas, a kind of SimpleView
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   643
    "
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   644
    canvasHolder removeDependent:self. 
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   645
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   646
    (canvasHolder := aValueHolder) notNil ifTrue:[
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   647
        canvasHolder addDependent:self.
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   648
        self canvas:(canvasHolder value)
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   649
    ]
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   650
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   651
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   652
!
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   653
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   654
listHolder
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   655
    "get the model, which keeps the list of Tabs or Labels
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   656
    "
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   657
    ^ listHolder
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   658
!
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   659
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   660
listHolder:aValueHolder
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   661
    "set the model, which keeps the list of Tabs or Labels
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   662
    "
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   663
    listHolder removeDependent:self. 
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   664
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   665
    (listHolder := aValueHolder) notNil ifTrue:[
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   666
        listHolder addDependent:self.
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   667
        self list:listHolder value.
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   668
    ].
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   669
!
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   670
2532
7a06df99a078 category change
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   671
model:aValueHolder
2533
93463469dba8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2532
diff changeset
   672
    "set the model, which keeps the selection"
93463469dba8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2532
diff changeset
   673
2532
7a06df99a078 category change
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   674
    super model:aValueHolder.
7a06df99a078 category change
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   675
7a06df99a078 category change
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   676
    model notNil ifTrue:[
7a06df99a078 category change
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   677
        self selection:(model value)
7a06df99a078 category change
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   678
    ]
7a06df99a078 category change
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   679
! !
7a06df99a078 category change
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
   680
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   681
!NoteBookView methodsFor:'accessing-style'!
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   682
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   683
canvasInset
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   684
    "inset of the canvas relative to my frame
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   685
        tabLevel + canvasInset == origin of canvas
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   686
    "
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   687
    ^ canvasInset
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   688
!
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   689
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   690
canvasInset:anInset
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   691
    "inset of the canvas relative to my frame
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   692
        tabLevel + canvasInset == origin of canvas
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   693
    "
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   694
    anInset ~~ canvasInset ifTrue:[
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   695
        canvasInset := anInset.
2282
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   696
        self styleChanged.
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   697
    ].
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   698
!
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   699
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   700
direction
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   701
    "returns the direction of tabs as symbol. On default the value is
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   702
     set to #top. Valid symbols are:
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   703
	#top       arrange tabs to be on top of a view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   704
	#bottom    arrange tabs to be on bottom of a view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   705
	#left      arrange tabs to be on left of a view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   706
	#right     arrange tabs to be on right of a view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   707
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   708
    ^ direction
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
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   711
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   712
direction:aDirection
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   713
    "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
   714
     Valid symbols are:
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   715
        #top       arrange tabs to be on top of a view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   716
        #bottom    arrange tabs to be on bottom of a view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   717
        #left      arrange tabs to be on left of a view
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   718
        #right     arrange tabs to be on right of a view
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
    direction ~~ aDirection ifTrue:[
2282
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   721
        direction := aDirection.
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   722
        self styleChanged.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   723
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   724
!
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   725
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   726
fitLastRow
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   727
    "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
   728
     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
   729
     preferred extent (x or y) dependant on the direction.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   730
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   731
    ^ fitLastRow
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   732
!
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
fitLastRow:aBool
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   735
    "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
   736
     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
   737
     preferred extent (x or y) dependant on the direction.
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   738
    "
2282
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   739
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   740
    fitLastRow ~~ aBool ifTrue:[
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   741
        fitLastRow := aBool.
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   742
        self styleChanged.
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   743
    ].
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   744
!
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   745
2698
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   746
hasScrollButtons
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   747
    ^ buttonNext notNil
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   748
!
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   749
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   750
hasScrollButtons:aBoolean
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   751
    |hasScrollButtons|
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   752
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   753
    hasScrollButtons := self hasScrollButtons.
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   754
    hasScrollButtons == aBoolean ifTrue:[^ self].
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   755
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   756
    hasScrollButtons ifTrue:[
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   757
        buttonNext destroy.
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   758
        buttonPrev destroy.
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   759
        buttonNext := buttonPrev := nil.
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   760
    ] ifFalse:[
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   761
        buttonNext := ArrowButton in:self.
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   762
        buttonPrev := ArrowButton in:self.
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   763
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   764
        buttonNext beInvisible.
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   765
        buttonPrev beInvisible.
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   766
        
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   767
"/        realized ifTrue:[
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   768
"/            buttonNext create. "/ realize.
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   769
"/            buttonPrev create. "/ realize.
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   770
"/        ].
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   771
        buttonNext action:[ self scrollButtonPressed:#scrollRight  ].
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   772
        buttonPrev action:[ self scrollButtonPressed:#scrollLeft  ].
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   773
    ].
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   774
    self styleChanged.
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   775
!
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   776
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   777
isHorizontal
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   778
    "returns true in case of direction is #top or #bottom
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   779
    "
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   780
    ^ direction == #top or:[direction == #bottom]
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   781
!
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
   782
2282
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   783
tabBottomMargin
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   784
    "returns the margin between the tabs and the canvas
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   785
    "
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   786
    ^ tabBottomMargin
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   787
!
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   788
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   789
tabBottomMargin:aMargin
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   790
    "set the margin between the tabs and the canvas
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   791
    "
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   792
    |margin|
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   793
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   794
    margin := aMargin max:0.
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   795
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   796
    margin ~~ tabBottomMargin ifTrue:[
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   797
        tabBottomMargin := margin.
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   798
        self styleChanged.
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   799
    ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   800
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   801
2431
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   802
tabLabelInset
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   803
    "inset (a point) of the label relative to its frame
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   804
         preferredExtent of Tab: label extent + tabLabelInset
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   805
    "
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   806
    ^ tabLabelInset
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   807
!
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   808
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   809
tabLabelInset:aPoint
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   810
    "inset (a point) of the label relative to its frame
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   811
         preferredExtent of Tab: label extent + tabLabelInset
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   812
    "
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   813
    |p|
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   814
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   815
    aPoint isNumber ifTrue:[ p := Point x:aPoint y:aPoint ]
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   816
                   ifFalse:[ p := aPoint ].
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   817
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   818
    p ~= tabLabelInset ifTrue:[
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   819
        tabLabelInset := p.
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   820
        self styleChanged.
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   821
    ].
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   822
!
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
   823
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   824
tabLeftMargin
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   825
    "margin to the first visible tab or scroller button
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   826
    "
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   827
    ^ tabLeftMargin
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   828
!
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   829
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   830
tabLeftMargin:aMargin
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   831
    "margin to the first visible tab or scroller button
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   832
    "
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   833
    |margin|
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   834
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   835
    margin := aMargin max:0.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   836
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   837
    margin ~~ tabLeftMargin ifTrue:[
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   838
        tabLeftMargin := margin.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   839
        self styleChanged.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   840
    ].
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   841
!
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   842
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   843
tabLevel
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   844
    "the level of the tabs and noteBook frame
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   845
    "
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   846
    ^ tabLevel
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   847
!
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   848
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   849
tabLevel:aLevel
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   850
    "the level of the tabs and noteBook frame
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   851
    "
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   852
    aLevel ~~ tabLevel ifTrue:[
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   853
        tabLevel := aLevel.
2282
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   854
        self styleChanged.
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   855
    ].
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   856
!
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   857
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   858
tabRightMargin
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   859
    "margin from the last visible tab or scroller button to the view
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   860
    "
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   861
    ^ tabRightMargin
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   862
!
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   863
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   864
tabRightMargin:aMargin
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   865
    "margin from the last visible tab or scroller button to the view
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   866
    "
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   867
    |margin|
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   868
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   869
    margin := aMargin max:0.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   870
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   871
    margin ~~ tabRightMargin ifTrue:[
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   872
        tabRightMargin := margin.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   873
        self styleChanged.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   874
    ].
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   875
!
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   876
2282
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   877
tabTopMargin
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   878
    "returns the margin between the tabs and the widget (not canvas)
2282
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   879
    "
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   880
    ^ tabTopMargin
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   881
!
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   882
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   883
tabTopMargin:aMargin
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   884
    "set the margin between the tabs and the widget (not canvas)
2282
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   885
    "
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   886
    |margin|
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   887
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   888
    margin := aMargin max:0.
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   889
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   890
    margin ~~ tabTopMargin ifTrue:[
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   891
        tabTopMargin := margin.
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   892
        self styleChanged.
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
   893
    ].
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   894
! !
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   895
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   896
!NoteBookView methodsFor:'change & update'!
365d33b8e942 so far so good
ca
parents: 355
diff changeset
   897
2282
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   898
styleChanged
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   899
    "called if the tab style changed
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   900
     list must be recomputed
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   901
    "
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   902
    preferredExtent := nil.
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   903
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   904
    numberOfLines isNil ifTrue:[
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   905
        ^ self.         "/ layout not yet computed
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   906
    ].
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   907
    self recomputeList.
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2629
diff changeset
   908
    self invalidate
2282
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   909
!
cc14f465b708 *** empty log message ***
ca
parents: 2281
diff changeset
   910
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   911
update:something with:aParameter from:changedObject
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   912
    "one of my models changed its value
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   913
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   914
    |idx tab|
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
    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
   917
    changedObject == listHolder    ifTrue:[
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   918
        something == #at: ifTrue:[
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   919
            "/ 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
   920
            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
   921
            ^ self.
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   922
        ].
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   923
        ^ self list:(listHolder value)
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   924
    ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   925
    changedObject == enableChannel ifTrue:[^ self enabled:enableChannel value].
1413
fa86dd0c4246 added #keepCanvas flag.
tm
parents: 1407
diff changeset
   926
    changedObject == canvasHolder  ifTrue:[^ self canvas:canvasHolder value].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   927
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   928
    (idx := list findFirst:[:aTab| aTab label == changedObject]) ~~ 0 ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   929
        tab := list at:idx.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   930
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   931
        idx == selection ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   932
            tab isEnabled ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   933
                ^ self selection:nil
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
        tab label:(tab label) on:self.
2529
ce78ec72df65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2496
diff changeset
   937
        self invalidateTab:tab.
ce78ec72df65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2496
diff changeset
   938
        ^ self.
ce78ec72df65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2496
diff changeset
   939
    ].
ce78ec72df65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2496
diff changeset
   940
ce78ec72df65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2496
diff changeset
   941
    ^ super update:something with:aParameter from:changedObject
1724
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   942
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   943
    "Modified: / 25.2.2000 / 14:14:29 / cg"
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   944
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   945
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   946
!NoteBookView methodsFor:'drawing'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
   947
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   948
computeDrawingClipX:x y:y width:w height:h
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   949
    |trans xOrY wOrHInset|
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   950
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   951
    self hasScrollButtons ifFalse:[^ nil].
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   952
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   953
    trans     := self transformation.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   954
    xOrY      := self tabLeftMargin.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   955
    wOrHInset := self tabRightMargin + xOrY.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   956
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   957
    self isHorizontal ifTrue:[
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   958
        trans notNil ifTrue:[
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   959
            xOrY := trans applyInverseToX:xOrY.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   960
        ].
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   961
        ^ Rectangle left:xOrY top:y width:(self width - wOrHInset) height:h.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   962
    ].
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   963
    trans notNil ifTrue:[
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   964
        xOrY := trans applyInverseToY:xOrY.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   965
    ].
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   966
    ^ Rectangle left:x top:xOrY width:w height:(self height - wOrHInset)
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   967
!
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
   968
2763
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   969
drawActiveTabMarker:aTab
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   970
    "draw a tabs focus-rectangle"
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   971
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   972
    |layout w h yRct yPnt xRct xPnt incY incX markerHeight fgColor bgColor|
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   973
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   974
    layout := aTab layout.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   975
    markerHeight := 3.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   976
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   977
    bgColor := self activeTabMarkerColor.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   978
    fgColor := self activeTabMarkerFgColor.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   979
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   980
    self isHorizontal ifTrue:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   981
        xPnt := layout left + 1.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   982
        w := layout width - 2.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   983
        h := markerHeight.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   984
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   985
        direction == #top ifTrue:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   986
            yPnt := yRct := layout top.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   987
            incY := 1.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   988
        ] ifFalse:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   989
            incY := -1.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   990
            yRct := layout bottom - h.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   991
            yPnt := layout bottom - 1.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   992
        ].
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   993
        bgColor notNil ifTrue:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   994
            self paint:bgColor.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   995
            self fillRectangleX:xPnt y:yRct width:w height:h.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   996
        ].
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   997
        fgColor notNil ifTrue:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   998
            self paint:fgColor.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
   999
            self displayLineFromX:xPnt y:yPnt toX:(xPnt + w - 1) y:yPnt.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1000
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1001
            (markerHeight - 1) timesRepeat:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1002
                yPnt := yPnt + incY.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1003
                self displayPointX:(xPnt - 1) y:yPnt.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1004
                self displayPointX:(xPnt + w) y:yPnt.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1005
            ].
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1006
        ].
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1007
    ] ifFalse:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1008
        w := markerHeight.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1009
        h := layout height - 2.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1010
        yRct := layout top + 1.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1011
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1012
        direction == #left ifTrue:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1013
            incX := 1.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1014
            xRct := xPnt := layout left.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1015
        ] ifFalse:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1016
            incX := -1.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1017
            xRct := layout right - w.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1018
            xPnt := layout right - 1.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1019
        ].
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1020
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1021
        bgColor notNil ifTrue:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1022
            self paint:bgColor.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1023
            self fillRectangleX:xRct y:yRct width:w height:h.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1024
        ].
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1025
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1026
        fgColor notNil ifTrue:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1027
            self paint:fgColor.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1028
            self displayLineFromX:xPnt y:yRct toX:xPnt y:yRct + h - 1.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1029
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1030
            (markerHeight - 1) timesRepeat:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1031
                xPnt := xPnt + incX.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1032
                self displayPointX:xPnt y:(yRct - 1).
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1033
                self displayPointX:xPnt y:(yRct + h).
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1034
            ].
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1035
        ].
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1036
    ].
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1037
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1038
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1039
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1040
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1041
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1042
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1043
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1044
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1045
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1046
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1047
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1048
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1049
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1050
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1051
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1052
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1053
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1054
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1055
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1056
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1057
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1058
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1059
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1060
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1061
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1062
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1063
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1064
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1065
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1066
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1067
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1068
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1069
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1070
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1071
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1072
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1073
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1074
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1075
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1076
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1077
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1078
""
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1079
!
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1080
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1081
drawBorderEdges
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1082
    |layout x0 x1 y0 y1 trans|
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1083
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1084
    "/ test whether TabView and not NoteBookView
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1085
    tabModus ifTrue:[^ self].
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1086
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1087
    layout := self computeBorderLayout.
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1088
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1089
    tabLevel ~~ 0 ifTrue:[
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1090
        self drawEdgesForX:(layout left)
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1091
                         y:(layout top)
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1092
                     width:(layout width) 
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1093
                    height:(layout height)
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1094
                     level:tabLevel.
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1095
      ^ self
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1096
    ].
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1097
    list size > 1 ifFalse:[^ self].
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1098
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1099
    self paint:lightColor ? lightColor.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1100
    trans := self transformation.
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1101
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1102
    (direction == #top or:[direction == #bottom]) ifTrue:[
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1103
        direction == #top ifTrue:[ y0 := layout top - 1 ]
2284
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  1104
                         ifFalse:[ y0 := layout bottom ].
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1105
        y1 := y0.
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1106
        x0 := 0.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1107
        trans notNil ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1108
            x0 := trans applyInverseToX:x0.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1109
        ].
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1110
        x1 := x0 + self width.
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1111
    ] ifFalse:[
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1112
        direction == #left ifTrue:[ x0 := layout left - 1 ]
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1113
                          ifFalse:[ x0 := layout right    ].
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1114
        x1 := x0.
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1115
        y0 := 0.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1116
        trans notNil ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1117
            y0 := trans applyInverseToY:y0.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1118
        ].
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1119
        y1 := y0 + self height.
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1120
    ].
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1121
    self displayLineFromX:x0 y:y0 toX:x1 y:y1.
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1122
!
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1123
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1124
drawTabEdgesFor:aTab
2763
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1125
    |layout count leftFg leftHalfFg rightFg x0 x1 y0 y1 isSelected
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1126
     yT "{ Class:SmallInteger }"
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1127
     xL "{ Class:SmallInteger }"
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1128
     xR "{ Class:SmallInteger }"
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1129
     yB "{ Class:SmallInteger }"
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1130
    |
2758
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
  1131
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1132
    count      := tabLevel.
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1133
    isSelected := (self selectedTab == aTab).
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1134
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1135
    count <= 0 ifTrue:[
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1136
        isSelected ifFalse:[ ^ self ].
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1137
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1138
        count == 0 ifTrue:[
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1139
            list size > 1 ifFalse:[^ self].
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1140
            count := 1
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1141
        ] ifFalse:[
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1142
            count := count negated
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1143
        ].
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1144
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1145
        rightFg    := lightColor.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1146
        leftFg     := shadowColor.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1147
        leftHalfFg := halfShadowColor.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1148
    ] ifFalse:[
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1149
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1150
        ((edgeStyle == #soft) and:[tabLevel > 1]) ifTrue:[ rightFg := halfShadowColor ]
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1151
                                                 ifFalse:[ rightFg := shadowColor ].
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1152
        leftFg     := lightColor.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1153
        leftHalfFg := halfLightColor.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1154
    ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1155
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1156
    (leftHalfFg notNil and:[edgeStyle == #soft and:[tabLevel > 0]]) ifTrue:[
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1157
        leftFg := leftHalfFg
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1158
    ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1159
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1160
    layout := aTab layout.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1161
    xL := layout left.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1162
    yT := layout top.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1163
    xR := layout right  - 1.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1164
    yB := layout bottom - 1.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1165
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1166
    x0 := xL + count.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1167
    x1 := xR - count.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1168
    y0 := yT + count.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1169
    y1 := yB - count.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1170
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1171
    direction == #top ifTrue:[
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1172
        self paint:rightFg.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1173
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1174
        0 to:count - 1 do:[:i|              "/ vertical: right
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1175
            self displayLineFromX:xR - i y:yB toX:xR - i  y:y0 - i.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1176
        ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1177
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1178
        self paint:leftFg.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1179
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1180
        0 to:count - 1 do:[:i|              "/ horizontal: left       
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1181
            self displayLineFromX:xL + i y:y0 - i toX:xL + i y:yB.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1182
        ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1183
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1184
        0 to:count - 1 do:[:i|              "/ horizontal: top
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1185
            self displayLineFromX:x0 - i y:yT + i toX:x1 y:yT + i.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1186
        ].
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1187
        (isSelected and:[count > 1]) ifFalse:[^ self].
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1188
        (self isLastTabInLine:aTab)   ifTrue:[^ self].
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1189
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1190
        y0 := yB + 1.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1191
        x1 := x1 + 1.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1192
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1193
        1 to:count - 1 do:[:i|              "/ horizontal line
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1194
            self displayLineFromX:x1 + i y:y0 - i toX:xR  y:y0 - i.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1195
        ].
2758
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
  1196
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1197
        ^ self
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1198
    ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1199
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1200
    direction == #bottom ifTrue:[
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1201
        self paint:leftFg.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1202
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1203
        0 to:count - 1 do:[:i|              "/ vertical : left
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1204
            self displayLineFromX:xL + i y:yT toX:xL + i y:y1+i.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1205
        ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1206
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1207
        self paint:rightFg.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1208
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1209
        0 to:count - 1 do:[:i|              "/ horizontal: bottom
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1210
            self displayLineFromX:x0 y:yB-i toX:x1 + i y:yB-i.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1211
        ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1212
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1213
        0 to:count - 1 do:[:i|              "/ vertical: right
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1214
            self displayLineFromX:xR-i y:yT toX:xR-i y:y1+i.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1215
        ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1216
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1217
        (isSelected and:[count > 1]) ifFalse:[^ self].
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1218
        (self isFirstTabInLine:aTab)  ifTrue:[^ self].
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1219
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1220
        x0 := x0 - 1.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1221
        y0 := yT - 1.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1222
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1223
        1 to:count - 1 do:[:i|              "/ selection shadow
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1224
            self displayLineFromX:xL y:y0 + i toX:x0-i  y:y0 + i.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1225
        ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1226
        ^ self
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1227
    ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1228
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1229
    direction == #right ifTrue:[
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1230
        self paint:leftFg.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1231
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1232
        0 to:count - 1 do:[:i|              "/ horizontal: top
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1233
            self displayLineFromX:xL y:yT + i toX:x1+i  y:yT + i.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1234
        ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1235
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1236
        self paint:rightFg.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1237
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1238
        0 to:count - 1 do:[:i|              "/ vertical: right
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1239
            self displayLineFromX:xR-i y:y0 toX:xR-i  y:y1.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1240
        ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1241
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1242
        1 to:count do:[:i|              "/ horizontal: bottom
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1243
            self displayLineFromX:xL y:y1+i toX:xR-i  y:y1+i.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1244
        ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1245
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1246
        (isSelected and:[count > 1]) ifFalse:[^ self].
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1247
        (self isFirstTabInLine:aTab)  ifTrue:[^ self].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1248
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1249
        x0 := x0 - 1.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1250
        y0 := yT - 1.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1251
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1252
        1 to:count - 1 do:[:i|              "/ selection shadow
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1253
            self displayLineFromX:xL y:y0 + i toX:x0-i  y:y0 + i.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1254
        ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1255
        ^ self
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1256
    ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1257
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1258
    "/ direction == #left
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1259
    self paint:rightFg.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1260
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1261
    x0 := xL + count.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1262
    x1 := xR - count.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1263
    y0 := yT + count.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1264
    y1 := yB - count.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1265
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1266
    0 to:count - 1 do:[:i|      "/ horizontal: bottom
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1267
        self displayLineFromX:x0 - i y:yB - i toX:xR  y:yB - i.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1268
    ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1269
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1270
    self paint:leftFg.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1271
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1272
    0 to:count - 1 do:[:i|      "/ vertical: left
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1273
        self displayLineFromX:xL + i y:y0 toX:xL + i y:y1.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1274
    ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1275
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1276
    1 to:count do:[:i|          "/ horizontal: top
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1277
        self displayLineFromX:xL + i y:y0 - i toX:xR y:y0 - i.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1278
    ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1279
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1280
    (isSelected and:[count > 1]) ifFalse:[^ self].
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1281
    (self isLastTabInLine:aTab)   ifTrue:[^ self].
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1282
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1283
    x1 := x1 + 1.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1284
    y0 := yB + 1.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1285
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1286
    1 to:count - 1 do:[:i|      "/ selection shadow
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1287
        self displayLineFromX:x1+i y:yB + 1 - i toX:xR  y:yB + 1 - i.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1288
    ].
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1289
!
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1290
2762
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1291
drawTabFocus:aTab
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1292
    "draw a tabs focus-rectangle"
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1293
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1294
    |layout extent voffs hoffs|
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1295
2763
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1296
    self supportsFocusOnTab ifFalse:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1297
        ^ self.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1298
    ].
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1299
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1300
    self activeTabMarkerColor notNil ifTrue:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1301
        self drawActiveTabMarker:aTab.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1302
        ^ self.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1303
    ].
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1304
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1305
    self hasFocus ifFalse:[
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1306
        ^ self.
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1307
    ].
2762
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1308
    layout := aTab layout.
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1309
    extent := aTab extent.
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1310
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1311
    self isHorizontal ifTrue:[
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1312
        voffs  := (layout height - extent y) // 2 max:0.
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1313
        hoffs  := (layout width  - extent x) // 2 max:0.
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1314
    ] ifFalse:[
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1315
        voffs  := (layout height - extent x) // 2 max:0.
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1316
        hoffs  := (layout width  - extent y) // 2 max:0.
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1317
    ].
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1318
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1319
    self paint:(Color black).
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1320
2763
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1321
    self displayDottedRectangleX:(layout left   + hoffs - 1)
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1322
                               y:(layout top    + voffs - 1)
2762
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1323
                           width:(layout width  - hoffs - hoffs + 2)
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1324
                          height:(layout height - voffs - voffs + 2).
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1325
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1326
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1327
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1328
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1329
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1330
""
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1331
!
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1332
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1333
invalidateSelectedTab
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1334
    |selectedTab|
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1335
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1336
    selectedTab := self selectedTab.
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1337
    selectedTab notNil ifTrue:[
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1338
        self invalidateTab:selectedTab
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1339
    ].
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1340
!
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1341
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1342
invalidateTab:aTab
2762
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1343
    "invalidate a tab (i.e. force it to be redrawn)"
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1344
2213
58cc47a8fb2d some redrawing refactored
Claus Gittinger <cg@exept.de>
parents: 2161
diff changeset
  1345
    |tabBounds|
58cc47a8fb2d some redrawing refactored
Claus Gittinger <cg@exept.de>
parents: 2161
diff changeset
  1346
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1347
    shown ifTrue:[
2213
58cc47a8fb2d some redrawing refactored
Claus Gittinger <cg@exept.de>
parents: 2161
diff changeset
  1348
        tabBounds := self computeLayoutForTab:aTab.
58cc47a8fb2d some redrawing refactored
Claus Gittinger <cg@exept.de>
parents: 2161
diff changeset
  1349
        self invalidate:tabBounds.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1350
    ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1351
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1352
2288
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1353
redrawTab:aTab
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1354
    "redraw a tab
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1355
    "
2762
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1356
    |isSelected layout fgColor|
2288
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1357
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1358
    isSelected := self selectedTab == aTab.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1359
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1360
    layout := aTab layout.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1361
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1362
    isSelected ifTrue:[
2760
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
  1363
        self paint:(self activeBackgroundColor).
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
  1364
    ] ifFalse:[
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
  1365
        self paint:(self backgroundColor).
2288
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1366
    ].
2760
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
  1367
    self fillRectangle:layout.
2288
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1368
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1369
    (enabled and:[aTab isEnabled]) ifFalse:[
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1370
        fgColor := disabledForegroundColor.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1371
    ] ifTrue:[
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1372
        fgColor := aTab foregroundColor.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1373
        fgColor isNil ifTrue:[
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1374
            isSelected ifTrue:[ fgColor := activeForegroundColor ]
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1375
                      ifFalse:[ fgColor := foregroundColor ].
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1376
        ]
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1377
    ].
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1378
    self paint:fgColor.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1379
    aTab displayOn:self inset:(tabLevel abs) direction:direction.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1380
    self drawTabEdgesFor:aTab.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1381
2763
844f86135a02 markers XP style support
ca
parents: 2762
diff changeset
  1382
    isSelected ifTrue:[
2762
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1383
        self drawTabFocus:aTab
2288
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1384
    ].
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1385
!
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1386
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1387
redrawX:x y:y width:w height:h
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1388
    "a region must be redrawn
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  1389
    "
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1390
    |selectedTab line damage layout selectedLayout clip|
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1391
2035
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1392
    shown ifFalse:[ ^ self ].
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1393
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1394
    numberOfLines isNil ifTrue:[
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1395
        self recomputeList.
2215
cdec3af44868 bug fix in setSelection:
ca
parents: 2213
diff changeset
  1396
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1397
        numberOfLines notNil ifTrue:[
2215
cdec3af44868 bug fix in setSelection:
ca
parents: 2213
diff changeset
  1398
            self invalidate
cdec3af44868 bug fix in setSelection:
ca
parents: 2213
diff changeset
  1399
        ].
cdec3af44868 bug fix in setSelection:
ca
parents: 2213
diff changeset
  1400
        ^ self
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1401
    ].
2213
58cc47a8fb2d some redrawing refactored
Claus Gittinger <cg@exept.de>
parents: 2161
diff changeset
  1402
    selectedTab := self selectedTab.
1963
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
  1403
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1404
    selectedTab notNil ifTrue:[
2288
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1405
        (line := selectedTab lineNr) ~~ 1 ifTrue:[
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1406
            self makeToBaseLine:line.
2760
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
  1407
            ^ self
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1408
        ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1409
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1410
    self paint:(self viewBackground).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1411
    self fillRectangleX:x y:y width:w height:h.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1412
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1413
    list size == 0 ifTrue:[ ^ self ].
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1414
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1415
    self drawBorderEdges.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1416
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1417
    damage := Rectangle left:x top:y width:w height:h.
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1418
    clip   := self computeDrawingClipX:x y:y width:w height:h.
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1419
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1420
    numberOfLines to:1 by:-1 do:[:aLnNr|
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1421
        list reverseDo:[:aTab|
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1422
            (     aTab lineNr == aLnNr
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1423
             and:[aTab ~~ selectedTab
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1424
             and:[aTab intersects:damage]]
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1425
            ) ifTrue:[
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1426
                clip notNil ifTrue:[
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1427
                    self clippingRectangle:clip.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1428
                    clip := nil.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1429
                ].
2288
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1430
                self redrawTab:aTab.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1431
            ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1432
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1433
    ].
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1434
    selectedTab isNil ifTrue:[
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1435
        ^ self
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1436
    ].
2288
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1437
    layout := self computeLayoutForTab:selectedTab.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1438
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1439
    (layout intersects:damage) ifTrue:[
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1440
        clip notNil ifTrue:[
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1441
            self clippingRectangle:clip.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1442
            clip := nil.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1443
        ].
2288
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1444
        selectedLayout := selectedTab layout.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1445
        selectedTab layout:layout.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1446
        self redrawTab:selectedTab.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  1447
        selectedTab layout:selectedLayout.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1448
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1449
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1450
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1451
!NoteBookView methodsFor:'event handling'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1452
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1453
buttonPress:button x:x y:y
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1454
    "a button is pressed; find tab under point and set the selection
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1455
    "
1802
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1456
    |idx tab recv menu|
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1457
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1458
    enabled     ifFalse:[ ^ self ].
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1459
    list isEmpty ifTrue:[ ^ self ].
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1460
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1461
    idx := list findFirst:[:aTab| aTab containsPointX:x y:y ].
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1462
    idx == 0 ifTrue:[ ^ self ].
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1463
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1464
    tab := list at:idx.
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1465
    tab isEnabled ifFalse:[ ^ self ].
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  1466
1802
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1467
    ((button == 2) or:[button == #menu]) ifFalse:[
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1468
        "/ change the selection
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1469
        ^ self selection:idx
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1470
    ].
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1471
    accessTabMenuAction isNil ifTrue:[ ^ self ].
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1472
    menu := accessTabMenuAction value:idx.
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1473
    menu isNil ifTrue:[ ^ self ].
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1474
1802
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1475
    menu isArray ifTrue:[
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1476
        menu := menu decodeAsLiteralArray
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1477
    ].
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1478
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1479
    menu receiver isNil ifTrue:[
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1480
        (recv := self application) isNil ifTrue:[
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1481
            recv := tab model
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1482
        ].
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1483
        recv notNil ifTrue:[
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1484
            menu receiver:recv
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1485
        ] ifFalse:[
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1486
            Transcript showCR:('%1 : MENU HAS NO RECEIVER' bindWith:(self class name)).
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1487
        ]
1802
131532a28106 adding callback for tab menus
ca
parents: 1801
diff changeset
  1488
    ].
2333
eeff6439157e can now specify if menu action is to be performed by
ca
parents: 2292
diff changeset
  1489
    self startUpMenu:menu
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1490
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1491
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1492
keyPress:aKey x:x y:y
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1493
    "selection might change; look for corresponding list entry
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1494
    "
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1495
    <resource: #keyboard (#CursorRight #CursorLeft #CursorUp #CursorDown)>
1407
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1496
2758
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
  1497
    |sensor size index n selectNext selectPrev|
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1498
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1499
    (enabled and:[(size := list size) ~~ 0]) ifFalse:[
1657
061c167ce3db if disabled; call super keyPress:x:y to handle focusSequence
ca
parents: 1549
diff changeset
  1500
        ^ super keyPress:aKey x:x y:y
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1501
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1502
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1503
    (self processAccessCharacter:aKey) ifTrue:[
1407
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1504
        ^ self
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1505
    ].
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1506
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1507
    (self processShortcutKey:aKey) ifTrue:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1508
        ^ self
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1509
    ].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  1510
2758
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
  1511
    selectNext := selectPrev := false.
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
  1512
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
  1513
    ((aKey == #CursorRight) or:[aKey == #CursorDown]) ifTrue:[
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
  1514
        selectNext := true.
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
  1515
    ] ifFalse:[ ((aKey == #CursorLeft) or:[aKey == #CursorUp]) ifTrue:[
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
  1516
        selectPrev := true.
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
  1517
    ] ifFalse:[ aKey == #Tab ifTrue:[
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
  1518
        selectNext := true.
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
  1519
    ] ifFalse:[
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1520
        ^ super keyPress:aKey x:x y:y
2758
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
  1521
    ]]].
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
  1522
2396
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1523
    sensor := self sensor.
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1524
    sensor notNil ifTrue:[
1407
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1525
        n := 1 + (sensor compressKeyPressEventsWithKey:aKey).
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1526
        n := (n \\ size) max:1.
2396
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1527
    ] ifFalse:[
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1528
        n := 1.
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1529
    ].
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1530
    index := selection ? 0.
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1531
2758
89a2c0da11ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
  1532
    selectNext ifTrue:[
2396
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1533
        n timesRepeat:[
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1534
            index := self nextSelectableAfter:index wrapAtEnd:true.
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1535
            index == 0 ifTrue:[^ self].
1407
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  1536
        ].
2396
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1537
    ] ifFalse:[
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1538
        n timesRepeat:[
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1539
            index := self previousSelectableBefore:index wrapAtBegin:true.
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1540
            index == 0 ifTrue:[^ self].
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1541
        ].
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1542
    ].
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  1543
    self selection:index.
1401
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
1677
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  1546
processShortcutKeyEvent:event
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  1547
    ^ self processShortcutKey:(event key)
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  1548
!
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  1549
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1550
sizeChanged:how
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1551
    "size of view changed 
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1552
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1553
    super sizeChanged:how.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1554
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1555
    list notEmpty ifTrue:[
1403
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1556
        lastComputedExtent ~= self extent ifTrue:[
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1557
            numberOfLines := nil.
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1558
        ]
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1559
    ].
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2629
diff changeset
  1560
    self invalidate.
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1561
    self resizeCanvas.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1562
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1563
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1564
!NoteBookView methodsFor:'focus handling'!
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1565
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1566
showFocus:explicit
2762
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1567
    "got the keyboard focus"
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1568
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1569
    self supportsFocusOnTab ifTrue:[
2762
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1570
        self invalidateSelectedTab
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1571
    ] ifFalse:[
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1572
        super showFocus:explicit
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1573
    ]
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1574
!
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1575
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1576
showNoFocus:explicit
2762
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1577
    "lost the keyboard focus"
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1578
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1579
    self supportsFocusOnTab ifTrue:[
2762
98eb83162881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2760
diff changeset
  1580
        self invalidateSelectedTab
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1581
    ] ifFalse:[
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1582
        super showNoFocus:explicit
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1583
    ]
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1584
!
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1585
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1586
supportsFocusOnTab
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1587
    "returns true if focus is supported
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1588
    "
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1589
    ^ (styleSheet at:#'focusHighlightStyle') == #win95
1659
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1590
! !
905be916cd83 showFocus for window style
ca
parents: 1658
diff changeset
  1591
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1592
!NoteBookView methodsFor:'help'!
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1593
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1594
helpText
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1595
    "return the helpText for the currently selected item (empty if none)
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1596
    "
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1597
    ^ self helpTextForItemAt:selection
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1598
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1599
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1600
!
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1601
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1602
helpTextAt:srcPoint
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1603
    "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
  1604
    "
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1605
    |x y i|
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1606
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1607
    x := srcPoint x.
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1608
    y := srcPoint y.
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1609
    i := list findFirst:[:aTab| aTab containsPointX:x y:y ].
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1610
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1611
  ^ self helpTextForItemAt:i
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1612
!
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1613
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1614
helpTextForItemAt:anIndex
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1615
    |tab|
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1616
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1617
    (     anIndex notNil
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1618
     and:[anIndex ~~ 0
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1619
     and:[(tab := list at:anIndex ifAbsent:nil) notNil
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1620
     and:[(tab := tab model) notNil]]]
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1621
    ) ifTrue:[
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1622
        ^ tab activeHelpText ? ''
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1623
    ].
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1624
    ^ ''
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1625
! !
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  1626
1687
70888239654f category changes
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  1627
!NoteBookView methodsFor:'initialization & release'!
1401
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
destroy
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1630
    "remove dependencies
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
    list removeDependent:self.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1633
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1634
    listHolder    removeDependent:self. 
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1635
    canvasHolder  removeDependent:self.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1636
2723
8532bbba673b call #releaseAsSubCanvas on destroyed applications
ca
parents: 2718
diff changeset
  1637
    list notEmptyOrNil ifTrue:[
8532bbba673b call #releaseAsSubCanvas on destroyed applications
ca
parents: 2718
diff changeset
  1638
        list do:[:anItem| |model|
8532bbba673b call #releaseAsSubCanvas on destroyed applications
ca
parents: 2718
diff changeset
  1639
            model := anItem model.
8532bbba673b call #releaseAsSubCanvas on destroyed applications
ca
parents: 2718
diff changeset
  1640
            model notNil ifTrue:[
8532bbba673b call #releaseAsSubCanvas on destroyed applications
ca
parents: 2718
diff changeset
  1641
                model destroyCanvas.
8532bbba673b call #releaseAsSubCanvas on destroyed applications
ca
parents: 2718
diff changeset
  1642
            ]
8532bbba673b call #releaseAsSubCanvas on destroyed applications
ca
parents: 2718
diff changeset
  1643
        ]
8532bbba673b call #releaseAsSubCanvas on destroyed applications
ca
parents: 2718
diff changeset
  1644
    ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1645
    super destroy.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1646
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1647
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1648
initStyle
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1649
    "setup style attributes
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1650
    "
1442
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
  1651
    |clr|
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
  1652
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1653
    super initStyle.
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1654
    tabModus  := false.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1655
    edgeStyle := DefaultEdgeStyle.
1442
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
  1656
2760
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
  1657
    clr := styleSheet colorAt:#'noteBook.viewBackground'.
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
  1658
    clr notNil ifTrue:[ viewBackground := clr ].
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
  1659
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1660
    self font:self class defaultFont.
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1661
    drawLightColor := Color veryLightGray onDevice:device.
1442
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
  1662
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1663
    clr := DefaultForegroundColor ? Black.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1664
    foregroundColor := clr onDevice:device.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1665
2760
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
  1666
    clr := DefaultBackgroundColor ? viewBackground.
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
  1667
    backgroundColor := clr onDevice:device.
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
  1668
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
  1669
    clr := DefaultActiveBackgroundColor ? backgroundColor.
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
  1670
    activeBackgroundColor := clr onDevice:device.
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
  1671
80be1c193c4f more xp style
Claus Gittinger <cg@exept.de>
parents: 2759
diff changeset
  1672
    clr := DefaultActiveForegroundColor ? foregroundColor.
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1673
    activeForegroundColor := clr onDevice:device.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1674
2292
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1675
"/    (clr := DefaultShadowColor) isNil ifTrue:[clr := viewBackground darkened].
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1676
"/    shadowColor := clr onDevice:device.
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1677
"/    (clr := DefaultLightColor) isNil ifTrue:[clr := viewBackground lightened].
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1678
"/    lightColor := clr onDevice:device.
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1679
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1680
    (clr := DefaultShadowColor) notNil ifTrue:[shadowColor := clr onDevice:device].
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1681
    (clr := DefaultLightColor) notNil ifTrue:[lightColor := clr onDevice:device].
1689
ecb51abe4a6b preps to allow for tabColor and activeTabColor to be
Claus Gittinger <cg@exept.de>
parents: 1687
diff changeset
  1682
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1683
    edgeStyle isNil ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1684
        halfShadowColor := shadowColor.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1685
        halfLightColor  := lightColor.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1686
        drawLightColor  := lightColor.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1687
    ] ifFalse:[
2292
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1688
"/        (clr := DefaultHalfShadowColor) isNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1689
"/            clr := shadowColor lightened
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1690
"/        ].
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1691
"/        halfShadowColor := clr onDevice:device.
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1692
"/
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1693
"/        (clr := DefaultHalfLightColor) isNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1694
"/            clr := lightColor darkened.
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1695
"/        ].
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1696
"/        halfLightColor := clr onDevice:device.
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1697
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1698
        (clr := DefaultHalfShadowColor) notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1699
            halfShadowColor := clr onDevice:device.
1442
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
  1700
        ].
2292
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1701
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1702
        (clr := DefaultHalfLightColor) notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1703
            halfLightColor := clr onDevice:device.
1682
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1704
        ].
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1705
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1706
        edgeStyle == #soft ifTrue:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1707
            drawLightColor := halfShadowColor
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1708
        ] ifFalse:[
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1709
            drawLightColor := Color veryLightGray onDevice:device.
3c43fa6f9fdf drawing
ca
parents: 1680
diff changeset
  1710
        ]
1442
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
  1711
    ].
1700
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
  1712
    (clr := DisabledForegroundColor) notNil ifTrue:[
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
  1713
        disabledForegroundColor := clr onDevice:device
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
  1714
    ]ifFalse:[
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
  1715
        disabledForegroundColor := drawLightColor
e2cda6e56205 support DisabledForegroundColor
ca
parents: 1696
diff changeset
  1716
    ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1717
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1718
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1719
initialize
2746
2c614cc1559c Do not hardcode noteBook.tabTobMargin for windows
Stefan Vogel <sv@exept.de>
parents: 2740
diff changeset
  1720
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1721
    super initialize.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1722
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1723
    self cursor:Cursor hand.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1724
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1725
    list             := #().
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1726
    useIndex         := true.
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1727
    direction        := #top.
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1728
    fitLastRow       := true.
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1729
    enabled          := true.
1685
7755214df380 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1684
diff changeset
  1730
    canvasInset      := StyleSheet at:#'noteBook.canvasInset'      default:1@1.
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1731
    keepCanvas       := false.
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1732
    tabLevel         := StyleSheet at:#'noteBook.tabLevel'         default:1.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1733
    tabLabelInset    := StyleSheet at:#'noteBook.tabLabelInset'    default:6@4.
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1734
    selectionInsetX  := (2 max:(tabLevel abs)) + 1.
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1735
    selectionInsetY  := (2 max:(tabLevel abs)) + 1.
2629
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  1736
    translateLabel   := false.
2285
0f3ce1478322 margins from styleSheet
ca
parents: 2284
diff changeset
  1737
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1738
    tabRightMargin   := 0.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1739
    tabLeftMargin    := 0.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1740
2746
2c614cc1559c Do not hardcode noteBook.tabTobMargin for windows
Stefan Vogel <sv@exept.de>
parents: 2740
diff changeset
  1741
    tabTopMargin    := StyleSheet at:#'noteBook.tabTopMargin' default:4.
2285
0f3ce1478322 margins from styleSheet
ca
parents: 2284
diff changeset
  1742
    tabBottomMargin := StyleSheet at:#'noteBook.tabBottomMargin' default:1.
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1743
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1744
    self lineWidth:0.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1745
2529
ce78ec72df65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2496
diff changeset
  1746
"/    canvas notNil ifTrue:[
ce78ec72df65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2496
diff changeset
  1747
"/        canvas := canvas in:self.
ce78ec72df65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2496
diff changeset
  1748
"/    ].
1403
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1749
!
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1750
2682
765eccde4ba7 raise canvas on map
ca
parents: 2677
diff changeset
  1751
mapped
765eccde4ba7 raise canvas on map
ca
parents: 2677
diff changeset
  1752
765eccde4ba7 raise canvas on map
ca
parents: 2677
diff changeset
  1753
    super mapped.
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1754
2682
765eccde4ba7 raise canvas on map
ca
parents: 2677
diff changeset
  1755
    canvas notNil ifTrue:[
765eccde4ba7 raise canvas on map
ca
parents: 2677
diff changeset
  1756
        canvas raise
765eccde4ba7 raise canvas on map
ca
parents: 2677
diff changeset
  1757
    ].
765eccde4ba7 raise canvas on map
ca
parents: 2677
diff changeset
  1758
!
765eccde4ba7 raise canvas on map
ca
parents: 2677
diff changeset
  1759
2739
f54f0d4e08b1 enhancements by Jan
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1760
postRealize
f54f0d4e08b1 enhancements by Jan
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1761
    "automatically set the initially selected notebook tab;
f54f0d4e08b1 enhancements by Jan
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1762
     unless it has been set already (by setup code)"
f54f0d4e08b1 enhancements by Jan
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1763
f54f0d4e08b1 enhancements by Jan
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1764
    selection isNil ifTrue:[
f54f0d4e08b1 enhancements by Jan
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1765
        self setSelection:1.
f54f0d4e08b1 enhancements by Jan
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1766
    ].
f54f0d4e08b1 enhancements by Jan
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1767
    super postRealize.
f54f0d4e08b1 enhancements by Jan
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1768
!
f54f0d4e08b1 enhancements by Jan
Claus Gittinger <cg@exept.de>
parents: 2725
diff changeset
  1769
1403
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1770
realize
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1771
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1772
    (canvas notNil and:[numberOfLines isNil]) ifTrue:[
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1773
        self recomputeList
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1774
    ].
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1775
    super realize.
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
!NoteBookView methodsFor:'layout'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1779
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1780
computeBorderLayout
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1781
    "returns the layout of the frame araound the canvas
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1782
    "
2035
6cc4d73f17e1 bug fix when chaning the canvas before being realized
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
  1783
    |xL yT xR yB tab l|
1401
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
    xL  := 0.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1786
    yT  := 0.
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1787
    xR  := self width.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1788
    yB  := self height.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1789
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1790
    list notEmpty ifTrue:[
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1791
        tab := list detect:[:aTab| aTab lineNr == 1] ifNone:nil.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1792
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1793
        tab notNil ifTrue:[
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1794
            l := tab layout.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1795
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1796
                      direction == #top    ifTrue:[ yT := l bottom ]
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1797
            ifFalse:[ direction == #bottom ifTrue:[ yB := l top    ]
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1798
            ifFalse:[ direction == #left   ifTrue:[ xL := l right  ]
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  1799
            ifFalse:[
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1800
                xR := l left
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1801
            ]]]
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1802
        ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1803
    ].
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1804
    self buttonLayoutUpdate.        
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1805
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1806
    ^ Rectangle left:xL top:yT right:xR bottom:yB
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1807
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1808
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1809
computeLayoutForTab:aTab
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1810
    "calculate extent of a tab
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1811
    "
2289
d09c42411c8d *** empty log message ***
ca
parents: 2288
diff changeset
  1812
    |layout bwAbs left right top bottom|
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1813
2687
7c7bedb930c6 bugfix for empty selection
ca
parents: 2686
diff changeset
  1814
    aTab isNil ifTrue:[^ nil].
7c7bedb930c6 bugfix for empty selection
ca
parents: 2686
diff changeset
  1815
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1816
    layout := aTab layout.
1658
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1817
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1818
    self selectedTab == aTab ifFalse:[
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1819
        ^ layout
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1820
    ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1821
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1822
    bwAbs  := tabLevel abs.
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1823
    left   := layout left.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1824
    right  := layout right.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1825
    top    := layout top.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1826
    bottom := layout bottom.
1658
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1827
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1828
    (direction == #top or:[direction == #bottom]) ifTrue:[
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1829
        left   := left - selectionInsetX.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1830
        right  := right + selectionInsetX.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1831
2289
d09c42411c8d *** empty log message ***
ca
parents: 2288
diff changeset
  1832
        bwAbs == 0 ifTrue:[
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1833
            left  == 0          ifTrue:[ left  := left  - 1 ].
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1834
            right == self width ifTrue:[ right := right + 1 ].
2289
d09c42411c8d *** empty log message ***
ca
parents: 2288
diff changeset
  1835
        ].
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1836
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1837
        direction == #top  ifTrue:[
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1838
            bottom := bottom + bwAbs.
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1839
            top    := top - selectionInsetY.
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  1840
        ] ifFalse:[
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1841
            top    := top    - bwAbs.
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1842
            bottom := bottom + selectionInsetY.
1658
3011b6a68e38 bug fixes in drawing bottom and left handles
ca
parents: 1657
diff changeset
  1843
        ].
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1844
    ] ifFalse:[
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1845
        top    := top    - selectionInsetX.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1846
        bottom := bottom + selectionInsetX.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1847
2289
d09c42411c8d *** empty log message ***
ca
parents: 2288
diff changeset
  1848
        bwAbs == 0 ifTrue:[
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1849
            top    == 0           ifTrue:[ top    := top    - 1 ].
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1850
            bottom == self height ifTrue:[ bottom := bottom + 1 ].
2289
d09c42411c8d *** empty log message ***
ca
parents: 2288
diff changeset
  1851
        ].
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1852
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1853
        direction == #left ifTrue:[
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1854
            right := right + bwAbs.
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1855
            left  := left  - selectionInsetY
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1856
        ] ifFalse:[
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1857
            left  := left  - bwAbs.
2280
93b2df2d91fd *** empty log message ***
ca
parents: 2279
diff changeset
  1858
            right := right + selectionInsetY.
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1859
        ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1860
    ].
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  1861
    ^ Rectangle left:left top:top right:right bottom:bottom
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1862
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1863
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1864
makeToBaseLine:aLnNr
1962
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1865
    "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
  1866
     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
  1867
1963
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
  1868
    |lineTopsOrLefts isHorizontal|
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
  1869
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
  1870
    isHorizontal := self isHorizontal.
1962
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1871
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1872
    "collect per-lineNr offsets"
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1873
    lineTopsOrLefts := (1 to:numberOfLines) collect:[:lnr |
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1874
                            |tabNr layout|
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1875
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1876
                            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
  1877
                            layout := (list at:tabNr) layout.
1963
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
  1878
                            isHorizontal ifTrue:[
1962
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1879
                                layout top.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1880
                            ] ifFalse:[
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1881
                                layout left.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1882
                            ].
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1883
                       ].
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1884
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1885
    "change offsets of all tabs"
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1886
    list do:[:el |
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1887
        |layout topOrLeft nr newNr|
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1888
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1889
        nr := el lineNr.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1890
        newNr := nr - aLnNr + 1.
1964
Claus Gittinger <cg@exept.de>
parents: 1963
diff changeset
  1891
        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
  1892
        newNr := ((newNr - 1) \\ numberOfLines) + 1.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1893
        topOrLeft := lineTopsOrLefts at:newNr.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1894
        layout := el layout.
1963
38173bc0bd42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1962
diff changeset
  1895
        isHorizontal ifTrue:[
1962
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1896
            layout setTop:topOrLeft.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1897
        ] ifFalse:[
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1898
            layout setLeft:topOrLeft.            
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1899
        ].
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1900
        el lineNr:newNr.
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1901
    ].
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1902
5b0098ec76a8 preserve the tabs order when selecting a tab
Claus Gittinger <cg@exept.de>
parents: 1892
diff changeset
  1903
    self invalidate.
1401
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
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1906
recomputeList
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1907
    "recompute list
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1908
    "
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1909
    |tab|
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1910
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1911
    numberOfLines      := 1.
1403
2bf484705c41 optimize opening
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
  1912
    lastComputedExtent := self extent.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1913
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1914
    self transformation:nil.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1915
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1916
    list size ~~ 0 ifTrue:[
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1917
        self isHorizontal ifTrue:[ self recomputeListHorizontal ]
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1918
                         ifFalse:[ self recomputeListVertical ].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1919
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1920
        tab := self selectedTab.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1921
        tab isNil ifTrue:[tab := list first].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1922
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1923
    ].
2725
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  1924
    self validateVisibleCanvas.
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  1925
    self resizeCanvas.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1926
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1927
    self hasScrollButtons ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1928
        self isHorizontal ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1929
            buttonNext direction:#right.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1930
            buttonPrev direction:#left.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1931
        ] ifFalse:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1932
            buttonNext direction:#down.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1933
            buttonPrev direction:#up.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1934
        ].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1935
        self makeVisible:tab.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1936
    ].
1401
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
recomputeListHorizontal
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1940
    "recompute list
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1941
    "
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1942
    |layout lastLyt tabExtent isScrollable
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1943
     xLeft       "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1944
     xRight      "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1945
     yTop        "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1946
     tabWidth    "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1947
     tabHeight   "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1948
     delta       "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1949
     first       "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1950
     last        "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1951
     border      "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1952
     lastLnNr    "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1953
     tabLvlAbs   "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1954
     minLeft     "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1955
     maxRight    "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1956
     leftMargin  "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1957
     rightMargin "{ Class:SmallInteger }"
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1958
    |
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1959
    numberOfLines := 1.
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1960
    tabLvlAbs     := tabLevel abs max:1.
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1961
    border        := tabLevel * 2.
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1962
    tabHeight     := 0.
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1963
    leftMargin    := self tabLeftMargin.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1964
    rightMargin   := self tabRightMargin.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1965
    minLeft       := leftMargin + selectionInsetX.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1966
    maxRight      := self width - rightMargin - selectionInsetX.
2286
43f23901a999 *** empty log message ***
ca
parents: 2285
diff changeset
  1967
    xLeft         := minLeft.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1968
    isScrollable  := self hasScrollButtons.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1969
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1970
    list do:[:aTab|
2431
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
  1971
        tabExtent := self preferredExtentForTab:aTab.
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
  1972
        tabWidth  := tabExtent x + border.
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
  1973
        tabHeight := tabExtent y max:tabHeight.
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1974
        xRight    := xLeft + tabWidth.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1975
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  1976
        (isScrollable not and:[xRight > maxRight]) ifTrue:[
2286
43f23901a999 *** empty log message ***
ca
parents: 2285
diff changeset
  1977
            xLeft ~~ minLeft ifTrue:[
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1978
                numberOfLines := numberOfLines + 1.
2286
43f23901a999 *** empty log message ***
ca
parents: 2285
diff changeset
  1979
                xLeft  := minLeft.
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1980
                xRight := xLeft + tabWidth.
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1981
            ].
2286
43f23901a999 *** empty log message ***
ca
parents: 2285
diff changeset
  1982
            xRight > maxRight ifTrue:[
43f23901a999 *** empty log message ***
ca
parents: 2285
diff changeset
  1983
                tabWidth := maxRight - minLeft.
43f23901a999 *** empty log message ***
ca
parents: 2285
diff changeset
  1984
                xRight   := maxRight.
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1985
            ].
1401
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
        aTab lineNr:numberOfLines.
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1988
        aTab layout:(Rectangle left:xLeft top:0 width:tabWidth height:tabHeight).
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1989
        xLeft := xRight.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  1990
    ].
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1991
    tabHeight := tabHeight + tabLvlAbs.
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  1992
    yTop      := selectionInsetY + tabTopMargin.
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1993
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1994
    direction == #bottom ifTrue:[
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  1995
        yTop  := self height - tabHeight - yTop.
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1996
        delta := tabHeight negated.
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1997
    ] ifFalse:[
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1998
        delta := tabHeight
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  1999
    ].
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2000
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2001
    lastLnNr := numberOfLines.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2002
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2003
    list reverseDo:[:aTab|
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2004
        aTab lineNr ~~ lastLnNr ifTrue:[
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2005
            lastLnNr := aTab lineNr.
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2006
            yTop := yTop + delta
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2007
        ].
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2008
        layout := aTab layout.
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2009
        layout setTop:yTop.
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2010
        layout height:tabHeight.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2011
    ].
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2012
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2013
    tabModus ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2014
        layout := (list at:1) layout.
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2015
        delta  := direction == #top ifTrue:[self height - layout bottom]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2016
                                   ifFalse:[layout top negated].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2017
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2018
        list do:[:aTab| aTab layout setTop:(aTab layout top + delta)].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2019
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2020
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2021
    "/ FIT LINES
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2022
    (numberOfLines ~~ 1 or:[fitLastRow]) ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2023
        ^ self
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
    first := 1.
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
    1 to:numberOfLines do:[:aLnNr|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2029
        last    := list findLast:[:t|t lineNr == aLnNr].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2030
        lastLyt := (list at:last) layout.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2031
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2032
        (delta := maxRight - lastLyt right) > 0 ifTrue:[
2286
43f23901a999 *** empty log message ***
ca
parents: 2285
diff changeset
  2033
            xLeft := minLeft.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2034
            delta := delta // (last - first + 1).
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
            delta ~~ 0 ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2037
                list from:first to:last do:[:aTab|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2038
                    layout   := aTab layout.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2039
                    tabWidth := layout width + delta.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2040
                    layout setLeft:xLeft.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2041
                    layout width:tabWidth.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2042
                    xLeft := xLeft + tabWidth.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2043
                ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2044
            ].
2286
43f23901a999 *** empty log message ***
ca
parents: 2285
diff changeset
  2045
            lastLyt width:(maxRight - lastLyt left)
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2046
        ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2047
        first := last + 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2048
    ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2049
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2050
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2051
recomputeListVertical
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2052
    "recompute list
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2053
    "
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2054
    |layout lastLyt tabExtent isScrollable
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2055
     xTop        "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2056
     yTop        "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2057
     yBottom     "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2058
     tabWidth    "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2059
     tabHeight   "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2060
     delta       "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2061
     first       "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2062
     last        "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2063
     border      "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2064
     tabLvlAbs   "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2065
     minTop      "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2066
     maxBottom   "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2067
     leftMargin  "{ Class:SmallInteger }"
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2068
     rightMargin "{ Class:SmallInteger }"
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2069
    |
2010
644587a3b8e2 added tabLevel
Claus Gittinger <cg@exept.de>
parents: 2002
diff changeset
  2070
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2071
    numberOfLines := 1.
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2072
    tabLvlAbs     := (tabLevel abs) max:1.
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2073
    border        := tabLvlAbs * 2.
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2074
    tabHeight     := 0.
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2075
    leftMargin    := self tabLeftMargin.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2076
    rightMargin   := self tabRightMargin.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2077
    minTop        := leftMargin + selectionInsetX.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2078
    maxBottom     := self height - rightMargin - selectionInsetX.    
2286
43f23901a999 *** empty log message ***
ca
parents: 2285
diff changeset
  2079
    yTop          := minTop.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2080
    isScrollable  := self hasScrollButtons.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2081
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2082
    list do:[:aTab|
2431
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
  2083
        tabExtent := self preferredExtentForTab:aTab.
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
  2084
        tabWidth  := tabExtent x + border.
1b643b88adb1 configurable tabLabelInset (default from Stylesheet)
ca
parents: 2396
diff changeset
  2085
        tabHeight := tabExtent y max:tabHeight.
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2086
        yBottom   := yTop + tabWidth.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2087
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2088
        (isScrollable not and:[yBottom > maxBottom]) ifTrue:[
2286
43f23901a999 *** empty log message ***
ca
parents: 2285
diff changeset
  2089
            yTop ~~ minTop ifTrue:[
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2090
                numberOfLines := numberOfLines + 1.
2286
43f23901a999 *** empty log message ***
ca
parents: 2285
diff changeset
  2091
                yTop    := minTop.
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2092
                yBottom := yTop + tabWidth.
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2093
            ].
2286
43f23901a999 *** empty log message ***
ca
parents: 2285
diff changeset
  2094
            yBottom > maxBottom ifTrue:[
43f23901a999 *** empty log message ***
ca
parents: 2285
diff changeset
  2095
                tabWidth := maxBottom - minTop.
43f23901a999 *** empty log message ***
ca
parents: 2285
diff changeset
  2096
                yBottom  := maxBottom.
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2097
            ].
1401
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
        aTab lineNr:numberOfLines.
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2100
        aTab layout:(Rectangle left:0 top:yTop width:tabHeight height:tabWidth).
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2101
        yTop := yBottom
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2102
    ].
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2103
    tabHeight := tabHeight + tabLvlAbs.
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2104
    xTop      := selectionInsetY + tabTopMargin.
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2105
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2106
    direction == #right ifTrue:[
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2107
        xTop  := self width - tabHeight - xTop.
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2108
        delta := tabHeight negated.
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2109
    ] ifFalse:[
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2110
        delta := tabHeight.
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2111
    ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2112
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2113
    last  := numberOfLines.
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2114
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2115
    list reverseDo:[:aTab|
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2116
        aTab lineNr ~~ last ifTrue:[
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2117
            last := aTab lineNr.
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2118
            xTop := xTop + delta
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2119
        ].
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2120
        layout := aTab layout.
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2121
        layout setLeft:xTop.
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2122
        layout   width:tabHeight.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2123
    ].
2281
7a0aed755e96 *** empty log message ***
ca
parents: 2280
diff changeset
  2124
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2125
    tabModus ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2126
        layout := (list at:1) layout.
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2127
        delta  := direction == #left ifTrue:[self width - layout right]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2128
                                    ifFalse:[layout left negated].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2129
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2130
        list do:[:aTab| aTab layout setLeft:(aTab layout left + delta)].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2131
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2132
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2133
    "/ FIT LINES
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2134
    (numberOfLines ~~ 1 or:[fitLastRow]) ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2135
        ^ self
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2136
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2137
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2138
    first := 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2139
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2140
    1 to:numberOfLines do:[:aLnNr|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2141
        last    := list findLast:[:t|t lineNr == aLnNr].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2142
        lastLyt := (list at:last) layout.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2143
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2144
        (delta := maxBottom - lastLyt bottom) > 0 ifTrue:[
2286
43f23901a999 *** empty log message ***
ca
parents: 2285
diff changeset
  2145
            yTop  := minTop.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2146
            delta := delta // (last - first + 1).
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
            delta ~~ 0 ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2149
                list from:first to:last do:[:aTab|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2150
                    layout   := aTab layout.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2151
                    tabWidth := layout height + delta.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2152
                    layout setTop:yTop.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2153
                    layout height:tabWidth.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2154
                    yTop := yTop + tabWidth.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2155
                ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2156
            ].
2286
43f23901a999 *** empty log message ***
ca
parents: 2285
diff changeset
  2157
            lastLyt height:(maxBottom - lastLyt top)
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2158
        ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2159
        first := last + 1.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2160
    ]
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  2161
!
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  2162
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  2163
resizeCanvas
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  2164
    |layout borderWd|
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  2165
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  2166
    canvas notNil ifTrue:[
2002
d8a0fba7b75a comment
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  2167
        layout := self computeBorderLayout.
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  2168
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  2169
        list notEmpty ifTrue:[
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  2170
            borderWd := tabLevel abs.
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  2171
            layout   := layout insetBy:(canvasInset + borderWd).
2284
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  2172
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  2173
            tabBottomMargin > 0 ifTrue:[
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  2174
                (direction == #top or:[direction == #bottom]) ifTrue:[
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  2175
                    layout height:(layout height - tabBottomMargin).
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  2176
                    direction == #top ifTrue:[
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  2177
                        layout setTop:(layout top + tabBottomMargin)
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  2178
                    ]
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  2179
                ] ifFalse:[
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  2180
                    layout width:(layout width - tabBottomMargin).
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  2181
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  2182
                    direction == #left ifTrue:[
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  2183
                        layout setLeft:(layout left + tabBottomMargin)
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  2184
                    ]
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  2185
                ]
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  2186
                
98fe5dda1454 *** empty log message ***
ca
parents: 2283
diff changeset
  2187
            ].
2036
6f3927ad36fc oops - strange side effect
Claus Gittinger <cg@exept.de>
parents: 2035
diff changeset
  2188
        ].
2161
f62cdcac0e9f do not change the layout, if the computation results in the
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
  2189
        layout = canvas layout ifFalse:[
f62cdcac0e9f do not change the layout, if the computation results in the
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
  2190
            canvas layout:layout.
2278
1ce91d0009e8 *** empty log message ***
ca
parents: 2215
diff changeset
  2191
        ].
1680
f4214f754c57 bug fixes redraw;
ca
parents: 1678
diff changeset
  2192
    ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2193
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2194
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2195
!NoteBookView methodsFor:'obsolete'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2196
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2197
canvasFrameLevel
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2198
    "ignorred
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2199
    "
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2200
    ^ 0
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2201
!
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2202
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2203
canvasFrameLevel:anInteger
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2204
    "ignorred
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2205
    "
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2206
!
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2207
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2208
labels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2209
    "return the list of labels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2210
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2211
    ^ self list
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2212
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2213
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2214
labels:aListOfLabels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2215
    "set the list of labels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2216
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2217
    ^ self list:aListOfLabels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2218
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2219
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2220
labelsHolder
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2221
    "get the model, which keeps the list of Tabs or Labels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2222
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2223
    ^ self listHolder
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2224
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2225
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2226
labelsHolder:aValueHolder
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2227
    "set the model, which keeps the list of Tabs or Labels
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2228
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2229
    self listHolder:aValueHolder. 
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2230
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2231
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2232
!NoteBookView methodsFor:'private'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2233
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2234
processAccessCharacter:aKey
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2235
    "a character is pressed; check for tab identified y the character
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2236
     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
  2237
    "
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2238
    |j size char blck|
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2239
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2240
    (aKey isCharacter and:[(size := list size) ~~ 0]) ifFalse:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2241
        ^ false
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2242
    ].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2243
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2244
    size == selection ifTrue:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2245
        size == 1 ifTrue:[^ false].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2246
        j := 1
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2247
    ] ifFalse:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2248
        j := selection isNil ifTrue:[1] ifFalse:[selection + 1]
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2249
    ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2250
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2251
    char := aKey asLowercase.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2252
    blck := [:i| ((list at:i) accessCharacter == char and:[self isSelectable:i]) ifTrue:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2253
                      self selection:i.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2254
                    ^ true
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2255
                  ]        
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2256
            ].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2257
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2258
    j to:size  do:blck.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2259
    1 to:(j-1) do:blck.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2260
  ^ false
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2261
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2262
!
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2263
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2264
processShortcutKey:aKey
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2265
    "if there is a short-key for that character, process it
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2266
     and return true. Otherwise, return false.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2267
    "
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2268
    |j k size rawKey blck|
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2269
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2270
    (size := list size) == 0 ifTrue:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2271
        ^ false
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2272
    ].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2273
    rawKey := device keyboardMap keyAtValue:aKey ifAbsent:aKey.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2274
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2275
    size == selection ifTrue:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2276
        size == 1 ifTrue:[^ false].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2277
        j := 1
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2278
    ] ifFalse:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2279
        j := selection isNil ifTrue:[1] ifFalse:[selection + 1]
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2280
    ].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2281
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2282
    blck := [:i| k := (list at:i) shortcutKey.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2283
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2284
                 (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
  2285
                     self selection:i.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2286
                   ^ true
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2287
                 ]
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2288
            ].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2289
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2290
    j to:size  do:blck.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2291
    1 to:(j-1) do:blck.
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2292
  ^ false
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2293
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2294
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2295
!NoteBookView methodsFor:'private-buttons'!
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2296
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2297
buttonLayoutUpdate
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2298
    |layout bW h y w x e|
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2299
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2300
    self hasScrollButtons ifFalse:[^ self].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2301
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2302
    (numberOfLines isNil or:[list size == 0]) ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2303
        self transformation:nil.
2706
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2304
        self hideButton:buttonPrev.
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2305
        self hideButton:buttonNext.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2306
        ^ self
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2307
    ].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2308
    layout := list first layout.
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2309
    bW := self buttonWidth.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2310
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2311
    self isHorizontal ifTrue:[
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2312
        y := layout top.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2313
        h := layout height.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2314
        e := bW @ h.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2315
        buttonPrev origin:(self tabLeftMargin)@y extent:e.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2316
        buttonNext origin:(self width - self tabRightMargin - bW) @ y extent:e.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2317
    ] ifFalse:[
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2318
        x := layout left.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2319
        w := layout width.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2320
        e := w @ bW.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2321
        buttonPrev origin:x@(self tabLeftMargin) extent:e.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2322
        buttonNext origin:x@(self height - self tabRightMargin - bW) extent:e.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2323
    ].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2324
!
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2325
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2326
buttonWidth
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2327
    "returns the button extent x or y dependent on the layout
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2328
    "
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2329
    ^ 16
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2330
!
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2331
2706
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2332
hideButton:aButton
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2333
    aButton controller buttonRelease:#select x:0 y:0.
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2334
    aButton unmap.
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2335
!
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2336
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2337
makeVisible:aTab
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2338
    "setup transformation to make the selection visible;
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2339
     returns true if the transformation has changed otherwise false.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2340
    "
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2341
    |layoutLast isHorizontal max maxAllowed oldTrans newTrans leftMargin rightMargin|
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2342
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2343
    (numberOfLines notNil and:[self hasScrollButtons]) ifFalse:[
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2344
        ^ false
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2345
    ].
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2346
2687
7c7bedb930c6 bugfix for empty selection
ca
parents: 2686
diff changeset
  2347
    aTab isNil ifTrue:[
7c7bedb930c6 bugfix for empty selection
ca
parents: 2686
diff changeset
  2348
        list size == 0 ifTrue:[
2706
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2349
            self hideButton:buttonPrev.
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2350
            self hideButton:buttonNext.
2687
7c7bedb930c6 bugfix for empty selection
ca
parents: 2686
diff changeset
  2351
            self transformation:nil.
7c7bedb930c6 bugfix for empty selection
ca
parents: 2686
diff changeset
  2352
        ].
7c7bedb930c6 bugfix for empty selection
ca
parents: 2686
diff changeset
  2353
        ^ false.
7c7bedb930c6 bugfix for empty selection
ca
parents: 2686
diff changeset
  2354
    ].
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2355
    oldTrans     := self transformation.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2356
    isHorizontal := self isHorizontal.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2357
    layoutLast   := list last layout.
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2358
    leftMargin   := self tabLeftMargin.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2359
    rightMargin  := self tabRightMargin.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2360
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2361
    isHorizontal ifTrue:[
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2362
        max        := layoutLast right.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2363
        maxAllowed := self width - rightMargin.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2364
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2365
        max > maxAllowed ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2366
            self makeVisibleHorizontal:aTab.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2367
        ] ifFalse:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2368
            self transformation:nil.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2369
        ].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2370
    ] ifFalse:[
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2371
        max        := layoutLast bottom.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2372
        maxAllowed := self height - rightMargin.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2373
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2374
        max > maxAllowed ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2375
            self makeVisibleVertical:aTab.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2376
        ] ifFalse:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2377
            self transformation:nil.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2378
        ].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2379
    ].                
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2380
    newTrans := self transformation.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2381
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2382
    newTrans isNil ifTrue:[
2706
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2383
        self hideButton:buttonPrev.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2384
    ] ifFalse:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2385
        buttonPrev map.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2386
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2387
        max := isHorizontal ifTrue:[newTrans applyToX:max]
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2388
                           ifFalse:[newTrans applyToY:max].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2389
    ].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2390
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2391
    max > maxAllowed ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2392
        buttonNext map
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2393
    ] ifFalse:[
2706
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2394
        self hideButton:buttonNext.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2395
    ].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2396
    ^ oldTrans ~~ newTrans
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2397
!
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2398
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2399
makeVisibleHorizontal:aTab
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2400
    "setup transformation to make the horizontal selection visible
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2401
    "
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2402
    |trans bounds xL xR xI minLeft maxRight|
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2403
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2404
    trans  := self transformation.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2405
    bounds := self computeLayoutForTab:aTab.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2406
    xL     := bounds left.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2407
    xI     := self buttonWidth.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2408
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2409
    trans notNil ifTrue:[ xL := trans applyToX:xL ].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2410
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2411
    minLeft := self tabLeftMargin.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2412
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2413
    xL < (xI + minLeft) ifTrue:[
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2414
        list first == aTab ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2415
            trans := nil.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2416
        ] ifFalse:[
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2417
            trans := WindowingTransformation scale:nil translation:(((xI + minLeft) - bounds left) @ 0).
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2418
        ].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2419
        self transformation:trans.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2420
        ^ self
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2421
    ].
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2422
    xR       := xL + bounds width.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2423
    maxRight := self width - self tabRightMargin.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2424
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2425
    xR > (maxRight - xI) ifTrue:[
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2426
        list last == aTab ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2427
            xI := 0.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2428
        ].
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2429
        trans := WindowingTransformation scale:nil translation:((maxRight - xI - bounds right) @ 0).
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2430
        self transformation:trans.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2431
    ].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2432
!
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2433
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2434
makeVisibleVertical:aTab
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2435
    "setup transformation to make the vertical selection visible
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2436
    "
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2437
    |trans bounds xL xR xI minTop maxBot|
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2438
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2439
    trans   := self transformation.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2440
    bounds  := self computeLayoutForTab:aTab.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2441
    xL      := bounds top.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2442
    xI      := self buttonWidth.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2443
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2444
    trans notNil ifTrue:[ xL := trans applyToY:xL ].
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2445
    minTop := self tabLeftMargin.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2446
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2447
    xL < (xI + minTop) ifTrue:[
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2448
        list first == aTab ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2449
            trans := nil
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2450
        ] ifFalse:[
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2451
            trans := WindowingTransformation scale:nil translation:(0@((minTop + xI) - bounds top)).
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2452
        ].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2453
        self transformation:trans.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2454
        ^ self
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2455
    ].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2456
    xR := xL + bounds height.
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2457
    maxBot := self height - self tabRightMargin.
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2458
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2459
    xR > (maxBot - xI) ifTrue:[
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2460
        list last == aTab ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2461
            xI := 0.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2462
        ].
2691
e0c0363d973b support of left and right margin
ca
parents: 2687
diff changeset
  2463
        trans := WindowingTransformation scale:nil translation:(0@ (maxBot - xI - bounds bottom)).
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2464
        self transformation:trans.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2465
    ].
2698
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2466
!
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2467
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2468
scrollButtonPressed:whichButton
2706
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2469
    |trans idx isNext nIdx pIdx|
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2470
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2471
    list isEmptyOrNil ifTrue:[^ self].
2698
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2472
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2473
    whichButton == #scrollRight ifTrue:[
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2474
        isNext := true
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2475
    ] ifFalse:[
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2476
        whichButton == #scrollLeft ifFalse:[^ self].
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2477
        isNext := false.
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2478
    ].
2706
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2479
    trans := self transformation.
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2480
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2481
    self isHorizontal ifTrue:[ |y xN xP|
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2482
        y  := list first layout top.
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2483
        xN := buttonNext origin x + 2.
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2484
        xP := buttonPrev corner x - 2.   
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2485
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2486
        trans notNil ifTrue:[
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2487
            xN := trans applyInverseToX:xN.
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2488
            xP := trans applyInverseToX:xP.
2698
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2489
        ].
2706
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2490
        nIdx := list findFirst:[:aTab| aTab containsPointX:xN y:y ].
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2491
        pIdx := list findFirst:[:aTab| aTab containsPointX:xP y:y ].
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2492
    ] ifFalse:[ |x yN yP|
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2493
        x  := list first layout left.
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2494
        yN := buttonNext origin y + 2.
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2495
        yP := buttonPrev corner y - 2.
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2496
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2497
        trans notNil ifTrue:[
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2498
            yN := trans applyInverseToY:yN.
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2499
            yP := trans applyInverseToY:yP.
2698
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2500
        ].
2706
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2501
        nIdx := list findFirst:[:aTab| aTab containsPointX:x y:yN ].
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2502
        pIdx := list findFirst:[:aTab| aTab containsPointX:x y:yP ].
2698
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2503
    ].
2706
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2504
    idx := isNext ifTrue:[nIdx] ifFalse:[pIdx].
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2505
2698
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2506
    idx == 0 ifTrue:[
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2507
        idx := isNext ifTrue:[list size] ifFalse:[1].
2706
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2508
    ] ifFalse:[ |revIdx|
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2509
        revIdx := isNext ifTrue:[pIdx] ifFalse:[nIdx].
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2510
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2511
        revIdx == idx ifTrue:[
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2512
            isNext ifTrue:[
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2513
                idx := revIdx + 1 min:(list size).
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2514
            ] ifFalse:[
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2515
                idx := revIdx - 1 max:1.
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2516
            ]
396f42adc012 bugfix: scroll next/prev on very long tab labels
ca
parents: 2698
diff changeset
  2517
        ].
2698
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2518
    ].
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2519
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2520
    (self makeVisible:(list at:idx ifAbsent:nil)) ifTrue:[
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2521
        self invalidate.
b7a80e7a16d2 Checkin for cg.
martin
parents: 2691
diff changeset
  2522
    ].
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2523
! !
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2524
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2525
!NoteBookView methodsFor:'queries'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2526
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2527
isFirstTabInLine:aTab
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2528
    "returns true if the tab is the first tab in the line
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2529
     used by drawing
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2530
    "
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2531
    |idx prevTab|
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2532
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2533
    idx := list identityIndexOf:aTab.
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2534
    prevTab := list at:(idx - 1) ifAbsent:nil.
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2535
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2536
  ^ prevTab isNil or:[prevTab lineNr ~~ aTab lineNr]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2537
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2538
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2539
isLastTabInLine:aTab
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2540
    "returns true if the tab is the last tab in the line
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2541
     used by drawing
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2542
    "
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2543
    |index nextTab|
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2544
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2545
    index   := list identityIndexOf:aTab.
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2546
    nextTab := list at:(index + 1) ifAbsent:nil.
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2547
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2548
  ^ nextTab isNil or:[nextTab lineNr ~~ aTab lineNr]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2549
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2550
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2551
!NoteBookView methodsFor:'selection'!
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2552
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2553
isSelectable:anIndex
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2554
    "returns true if tab at an index is selectable
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2555
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2556
    (anIndex notNil and:[anIndex between:1 and:list size]) ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2557
        (list at:anIndex) isEnabled ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2558
            ^ selectConditionBlock isNil ifTrue:[true]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2559
                                        ifFalse:[selectConditionBlock value:anIndex]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2560
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2561
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2562
    ^ false
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2563
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2564
2396
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2565
nextSelectableAfter:anIndex wrapAtEnd:wrapAtEnd
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2566
    "return the index of the next selectable entry after the index;
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2567
     wrap at end if the wrapAtEnd flag is set to true.
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2568
    "
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2569
    |size idx|
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2570
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2571
    size := list size.
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2572
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2573
    size > 1 ifTrue:[
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2574
        idx := anIndex + 1.
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2575
        idx to:size do:[:i| (self isSelectable:i) ifTrue:[^ i] ].
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2576
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2577
        wrapAtEnd ifTrue:[
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2578
            idx := anIndex - 1.
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2579
            1 to:idx do:[:i| (self isSelectable:i) ifTrue:[^ i] ].
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2580
        ]
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2581
    ].
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2582
    ^ 0
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2583
!
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2584
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2585
previousSelectableBefore:anIndex wrapAtBegin:wrapAtBegin
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2586
    "return the index of the previous selectable entry before the index;
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2587
     wrap at begin if the wrapAtBegin flag is set to true.
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2588
    "
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2589
    |size idx|
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2590
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2591
    size := list size.
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2592
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2593
    size > 1 ifTrue:[
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2594
        idx := anIndex - 1.
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2595
        idx to:1 by:-1 do:[:i| (self isSelectable:i) ifTrue:[^ i] ].
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2596
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2597
        wrapAtBegin ifTrue:[
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2598
            idx := anIndex + 1.
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2599
            size to:idx by:-1 do:[:i| (self isSelectable:i) ifTrue:[^ i] ].
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2600
        ]
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2601
    ].
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2602
    ^ 0
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2603
!
775112222b05 add #nextSelectableAfter:.. and #previousSelectableBefore:...; prepared for Tabbing
ca
parents: 2391
diff changeset
  2604
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2605
selectedTab
2718
3da9fcf60559 *** empty log message ***
ca
parents: 2706
diff changeset
  2606
    "returns the selected tab or nil
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2607
    "
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2608
    (selection notNil and:[selection ~~ 0]) ifTrue:[
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2609
        ^ list at:selection ifAbsent:nil
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2610
    ].
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2611
    ^ nil
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2612
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2613
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2614
selection
2740
c9812e019351 enhancements by Jan
Claus Gittinger <cg@exept.de>
parents: 2739
diff changeset
  2615
    "return the selection or nil/o; caring for the useIndex setting.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2616
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2617
    selection isNil ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2618
        ^ useIndex ifTrue:[0] ifFalse:[nil]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2619
    ].
2213
58cc47a8fb2d some redrawing refactored
Claus Gittinger <cg@exept.de>
parents: 2161
diff changeset
  2620
    ^ useIndex ifTrue:[selection] ifFalse:[self selectedTab label]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2621
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2622
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2623
selection:anIndexOrNil
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2624
    "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
  2625
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2626
    |oldSel|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2627
1407
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  2628
    anIndexOrNil ~~ selection ifTrue:[
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  2629
        oldSel := selection.
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  2630
        self setSelection:anIndexOrNil.
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  2631
        oldSel ~~ selection ifTrue:[self selectionChanged]
4f151198c452 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1403
diff changeset
  2632
    ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2633
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2634
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2635
selectionChanged
2532
7a06df99a078 category change
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
  2636
    "selection has changed; update model and evaluate change action"
7a06df99a078 category change
Claus Gittinger <cg@exept.de>
parents: 2529
diff changeset
  2637
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2638
    |sel|
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2639
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2640
    sel := self selection.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2641
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2642
    model  notNil ifTrue:[model  value:sel].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2643
    action notNil ifTrue:[action value:sel]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2644
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2645
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2646
setSelection:anIndexOrNil
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2647
    "change the selection to index or nil. No notifications are raised
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2648
    "
2725
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2649
    |newSel oldSel oldBounds newBounds|
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2650
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2651
    newSel := self listIndexOf:anIndexOrNil.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2652
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2653
    (newSel notNil and:[(self isSelectable:newSel) not]) ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2654
        newSel := nil
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2655
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2656
    selection == newSel ifTrue:[^ self].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2657
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2658
    numberOfLines isNil ifTrue:[
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2659
        selection := newSel.
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2660
        ^ self.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2661
    ].
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2662
    oldSel    := selection.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2663
    selection := newSel.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2664
    newBounds := self computeLayoutForTab:(self selectedTab).
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2665
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2666
    (self makeVisible:(self selectedTab)) ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2667
        self invalidate.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2668
    ] ifFalse:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2669
        shown ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2670
            oldSel notNil ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2671
                selection := oldSel.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2672
                oldBounds := self computeLayoutForTab:(self selectedTab).
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2673
                selection := newSel.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2674
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2675
                (newBounds notNil and:[newBounds intersects:oldBounds]) ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2676
                    newBounds := newBounds merge:oldBounds.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2677
                ] ifFalse:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2678
                    self invalidate:oldBounds
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2679
                ].
2215
cdec3af44868 bug fix in setSelection:
ca
parents: 2213
diff changeset
  2680
            ].
2686
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2681
            newBounds notNil ifTrue:[
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2682
                self invalidate:newBounds.
9f19f9c776e1 new functionality: make scrollable
ca
parents: 2682
diff changeset
  2683
            ]
2215
cdec3af44868 bug fix in setSelection:
ca
parents: 2213
diff changeset
  2684
        ].
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2685
    ].
2725
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2686
    self validateVisibleCanvas.
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2687
!
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2688
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2689
validateVisibleCanvas
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2690
    |model newCanvas selectedTab|
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2691
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2692
    selectedTab := self selectedTab.
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2693
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2694
    selectedTab notNil ifTrue:[
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2695
        model := selectedTab model.
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2696
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2697
        model isNil ifTrue:[
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2698
            ^ self
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2699
        ].
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2700
        newCanvas := model canvasView.
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2701
    ].
1724
6557e3112383 avoid redraw/resize if a tabItems label has changed,
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
  2702
2725
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2703
    newCanvas == canvas ifTrue:[
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2704
        ^ self
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2705
    ].
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2706
2725
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2707
    canvas notNil ifTrue:[
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2708
        (canvas objectAttributeAt:#isTabItem) == true ifFalse:[
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2709
            ^ self.
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2710
        ]
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2711
    ].
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2712
    self canvas:newCanvas.
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2713
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2714
    canvasHolder notNil ifTrue:[
2725
69a5b53b1b72 bugfix: update visible canvas if selection changed
ca
parents: 2723
diff changeset
  2715
        canvasHolder value:newCanvas.
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2716
    ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2717
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2718
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2719
!NoteBookView::Tab class methodsFor:'instance creation'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2720
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2721
label:aLabel on:aGC
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2722
    ^ self basicNew label:aLabel on:aGC
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2723
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2724
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2725
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2726
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2727
!NoteBookView::Tab methodsFor:'accessing'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2728
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2729
accessCharacter
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2730
    "returns the access character or nil
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2731
    "
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2732
    ^ accessCharacter
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2733
!
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2734
2288
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2735
foregroundColor
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2736
    "returns the foregroundColor or nil
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2737
    "
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2738
    model notNil ifTrue:[
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2739
        ^ model foregroundColor
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2740
    ].
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2741
    ^ nil
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2742
!
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2743
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2744
label
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2745
    "returns my original label
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2746
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2747
    ^ label
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2748
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2749
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2750
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2751
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2752
label:aLabel on:aGC
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2753
    "initialize attributes
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2754
    "
1677
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2755
    label           := aLabel.
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2756
    model           := (aLabel isKindOf:TabItem) ifTrue:[aLabel] ifFalse:[nil].
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2757
    accessCharacter := nil.
1677
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2758
    printableLabel  := model notNil ifTrue:[model rawLabel] ifFalse:[aLabel].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2759
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2760
    printableLabel notNil ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2761
        printableLabel isImageOrForm ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2762
            printableLabel := printableLabel onDevice:(aGC device)
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2763
        ] ifFalse:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2764
            printableLabel isString ifTrue:[
2629
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2765
                printableLabel := self resolveDisplayStringFor:printableLabel on:aGC.
1677
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2766
            ] ifFalse:[
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2767
                printableLabel class == LabelAndIcon ifTrue:[
2629
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2768
                    printableLabel string:(self resolveDisplayStringFor:(printableLabel string) on:aGC)
1677
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2769
                ]
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2770
            ].
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2771
        ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2772
    ] ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2773
        printableLabel := ''
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2774
    ].
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2775
    extent := (printableLabel widthOn:aGC) @ (printableLabel heightOn:aGC).
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2776
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2777
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2778
lineNr
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2779
    "get the line number within the noteBook view
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2780
     1 -> on top of the wizard
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2781
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2782
    ^ lineNr
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2783
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2784
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2785
lineNr:aLineNr
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2786
    "set the line number within the noteBook view
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2787
     1 -> on top of the wizard
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2788
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2789
    lineNr := aLineNr
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2790
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2791
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2792
model
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2793
    "returns the model, a TabItem or nil
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2794
    "
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2795
    ^ model
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2796
!
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2797
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2798
printableLabel
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2799
    "get my printable label
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2800
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2801
    ^ printableLabel
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2802
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2803
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2804
1672
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2805
shortcutKey
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2806
    "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
  2807
    "
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2808
    model notNil ifTrue:[
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2809
        ^ model shortcutKey
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2810
    ].
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2811
    ^ nil
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2812
!
31dcb579f88a support accelerator and accessCharacter (position or &)
ca
parents: 1663
diff changeset
  2813
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2814
string
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2815
    "access the printable string used for steping through a list
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2816
     searching for an entry starting with a character.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2817
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2818
    ^ printableLabel perform:#string ifNotUnderstood:nil
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2819
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2820
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2821
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
  2822
!NoteBookView::Tab methodsFor:'accessing-dimensions'!
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2823
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2824
extent
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2825
    "returns the extent of the label, the minimum size required by the tab
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2826
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2827
    ^ extent
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2828
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2829
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2830
layout
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2831
    "get the tab's layout, set by the noteBook view
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2832
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2833
    ^ layout
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2834
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2835
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2836
layout:aLayout
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2837
    "set the tab's layout
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2838
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2839
    layout := aLayout
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2840
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2841
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2842
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2843
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
  2844
!NoteBookView::Tab methodsFor:'accessing-mvc'!
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2845
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2846
addDependent:aGC
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2847
    "make the noteBook be a dependent of the tab model
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2848
    "
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2849
    model notNil ifTrue:[
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2850
        model addDependent:aGC
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2851
    ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2852
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2853
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2854
!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2855
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2856
removeDependent:aGC
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2857
    "make the noteBook be independent of the tab model
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2858
    "
1759
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2859
    model notNil ifTrue:[
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2860
        model destroyCanvas.
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2861
        model removeDependent:aGC.
a8b1d1fad2f1 add more functionality; canvas and help
ca
parents: 1724
diff changeset
  2862
    ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2863
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2864
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2865
! !
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2866
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2867
!NoteBookView::Tab methodsFor:'drawing'!
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2868
2288
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2869
displayOn:aGC inset:inset direction:aDirection
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2870
    "redraw tab
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2871
    "
2288
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2872
    |dispObj lft wdt top hgt
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2873
     y  "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2874
     x  "{ Class:SmallInteger }"
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2875
    |
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2876
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2877
    "/ REDRAW LABEL
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2878
    (aGC isEnabled and:[self isEnabled]) ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2879
        dispObj := printableLabel.
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2880
    ] ifFalse:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2881
        (dispObj := disabledLabel) isNil ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2882
            (dispObj := printableLabel) isImageOrForm ifTrue:[
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2883
                disabledLabel := printableLabel lightened onDevice:(aGC device)
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2884
            ]
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2885
        ]
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2886
    ].
1442
afa1cabf4e9c viewStyle
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
  2887
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2888
    (aDirection == #top or:[aDirection == #bottom]) ifTrue:[
2288
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2889
        lft := layout left  + inset.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2890
        wdt := layout right - inset - lft.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2891
        wdt > 4 ifFalse:[^ self].
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2892
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2893
        x := (wdt - extent x) // 2.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2894
        x < 0 ifTrue:[
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2895
            dispObj := '...'.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2896
            x := 0.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2897
        ].
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2898
        x := x + lft.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2899
        y := layout top  + (layout height - inset - extent y // 2).
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2900
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2901
        aDirection == #top ifTrue:[ y := y + inset ].
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2902
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2431
diff changeset
  2903
        y := y + (dispObj ascentOn:aGC).
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2431
diff changeset
  2904
"/        dispObj isImageOrForm ifFalse:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2431
diff changeset
  2905
"/            y := y + aGC font ascent
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2431
diff changeset
  2906
"/        ].
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2907
        dispObj displayOn:aGC x:x y:y.
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2431
diff changeset
  2908
        ^ self
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2909
    ].
2288
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2910
    top := layout  top   + inset.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2911
    hgt := layout bottom - inset - top.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2912
    hgt > 4 ifFalse:[^ self].
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2913
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2914
    y := (hgt - extent x) // 2.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2915
    y < 0 ifTrue:[
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2916
        dispObj := '...'.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2917
        y := 0.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2918
    ].
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2919
    y := y + top.
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2920
    x := layout left + (layout width  - inset - extent y // 2).
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2921
43db53a74240 *** empty log message ***
ca
parents: 2287
diff changeset
  2922
    aDirection == #left ifTrue:[ x := x + inset ].
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2923
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2924
    dispObj isImageOrForm ifFalse:[
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2925
        dispObj isString ifTrue:[ 
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2926
            x := x + aGC font descent.
1683
282290942a56 bug fixes in category examples
ca
parents: 1682
diff changeset
  2927
        ].
2283
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2928
        "/ workaround for a bug in display-with-angle,
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2929
        "/ iff displayed string is a labelAndIcon.
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2930
        "/ (In this case, display is always opaque, and the current
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2931
        "/  backgroundPaint color is used to fill the underlying rectangle)
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2932
        "/
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2933
        aGC backgroundPaint:aGC backgroundColor.
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2934
        aGC displayString:dispObj x:x y:y angle:90.
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2935
    ] ifTrue:[
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2936
        (dispObj rotated:90) displayOn:aGC x:x y:y.
1ee9ad793fbd *** empty log message ***
ca
parents: 2282
diff changeset
  2937
    ].
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2938
! !
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2939
1677
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2940
!NoteBookView::Tab methodsFor:'private'!
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2941
2629
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2942
resolveDisplayStringFor:aString on:aNoteBook
1677
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2943
    |string size rest pos idx|
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2944
2629
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2945
    accessCharacter := nil.
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2946
    string := aNoteBook translateToDisplayLabel:aString.
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2947
    size   := string size.
1677
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2948
    pos    := 0.
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2949
2629
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2950
    size == 0 ifTrue:[ ^ string ].
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2951
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2952
    (model notNil and:[(pos := model accessCharacterPosition) ~~ 0]) ifTrue:[
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2953
        pos > size ifTrue:[pos := 0]
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2954
    ] ifFalse:[
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2955
        idx := 1.
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2956
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2957
        [((idx := string indexOf:$& startingAt:idx) ~~ 0 and:[idx < size])] whileTrue:[
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2958
            rest := string copyFrom:(idx+1).
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2959
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2960
            idx == 1 ifTrue:[string := rest]
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2961
                    ifFalse:[string := (string copyFrom:1 to:(idx-1)), rest].
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2962
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2963
            (string at:idx) == $& ifTrue:[idx := idx + 1]
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2964
                                 ifFalse:[pos := idx].
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2965
            size := size - 1.
1677
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2966
        ]
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2967
    ].
2629
ccf1cca9d6e0 support of translateLabel
ca
parents: 2608
diff changeset
  2968
1677
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2969
    size ~~ 0 ifTrue:[
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2970
        pos == 0 ifTrue:[
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2971
            pos := 1
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2972
        ] ifFalse:[
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2973
            string isText ifFalse:[
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2974
                string := Text string:string
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2975
            ].
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2976
            string emphasisAt:pos add:#underline
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2977
        ].
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2978
        accessCharacter := (string at:pos) asLowercase
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2979
    ].
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2980
    ^ string
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2981
! !
f5a30ef6a195 accessCharacter for LabelAndIcon support
ca
parents: 1672
diff changeset
  2982
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2983
!NoteBookView::Tab methodsFor:'testing'!
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2984
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2985
containsPointX:x y:y
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2986
    "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
  2987
    "
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2988
    layout isNil ifTrue:[^ false].
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2989
  ^ layout containsPointX:x y:y
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2990
!
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2991
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2992
intersects:aRectangle
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2993
    "return true, if the intersection between the argument, aRectangle
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2994
     and the tab is not empty
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  2995
    "
2279
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2996
    layout isNil ifTrue:[^ false].
5a50cd5af676 *** empty log message ***
ca
parents: 2278
diff changeset
  2997
  ^ layout intersects:aRectangle
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  2998
!
432
dedc8dee12f5 created:
ca
parents: 419
diff changeset
  2999
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3000
isEnabled
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3001
    "returne true if no model exists or the model is enabled
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3002
    "
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  3003
    ^ (model isNil or:[model isEnabled])
375
365d33b8e942 so far so good
ca
parents: 355
diff changeset
  3004
355
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3005
386
eb0dd3efd92c bug fixes
ca
parents: 375
diff changeset
  3006
! !
eb0dd3efd92c bug fixes
ca
parents: 375
diff changeset
  3007
355
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3008
!NoteBookView class methodsFor:'documentation'!
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3009
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3010
version
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
  3011
    ^ '$Header: /cvs/stx/stx/libwidg2/NoteBookView.st,v 1.104 2004-11-24 09:40:14 cg Exp $'
355
4f9e1c795986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3012
! !