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