SubCanvas.st
author Claus Gittinger <cg@exept.de>
Mon, 18 Feb 2008 09:33:17 +0100
changeset 3340 1276fa7e42f1
parent 3271 4a1efb576208
child 3351 591bb420e359
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
970
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
     1
"
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
     2
 COPYRIGHT (c) 1998 by eXept Software AG
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
     3
              All Rights Reserved
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
     4
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
     5
 This software is furnished under a license and may be used
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
     6
 only in accordance with the terms of that license and with the
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
     8
 be provided or otherwise made available to, or used by, any
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
     9
 other person.  No title to or ownership of the software is
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    10
 hereby transferred.
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    11
"
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    12
"{ Package: 'stx:libwidg2' }"
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    13
455
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
ScrollableView subclass:#SubCanvas
1912
dc3652682529 superView setting.
martin
parents: 1911
diff changeset
    15
	instanceVariableNames:'builder spec client clientHolder specHolder clientView
dc3652682529 superView setting.
martin
parents: 1911
diff changeset
    16
		clientViewIsScrolled lateBuild useApplicationSubView
dc3652682529 superView setting.
martin
parents: 1911
diff changeset
    17
		keepClientView useOwnBuilder'
dc3652682529 superView setting.
martin
parents: 1911
diff changeset
    18
	classVariableNames:''
dc3652682529 superView setting.
martin
parents: 1911
diff changeset
    19
	poolDictionaries:''
dc3652682529 superView setting.
martin
parents: 1911
diff changeset
    20
	category:'Views-Basic'
455
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
970
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    23
!SubCanvas class methodsFor:'documentation'!
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    24
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    25
copyright
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    26
"
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    27
 COPYRIGHT (c) 1998 by eXept Software AG
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    28
              All Rights Reserved
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    29
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    30
 This software is furnished under a license and may be used
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    31
 only in accordance with the terms of that license and with the
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    33
 be provided or otherwise made available to, or used by, any
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    34
 other person.  No title to or ownership of the software is
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    35
 hereby transferred.
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    36
"
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    37
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    38
!
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    39
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    40
documentation
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    41
"
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    42
    a view for a subApplication.
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    43
1895
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
    44
    Made to be VW compatible as much as possible (try opening a RefactoringBrowser ...).
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
    45
    However, the default setup is not very useful, to embedd arbitrary applications
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
    46
    which are meant to be separate stand-alone applications.
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
    47
    Play with the settings:
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
    48
        keepClientView          (default: true)
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
    49
        useApplicationSubView   (default: false)
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
    50
        useOwnBuilder           (default: false)
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
    51
970
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    52
    [author:]
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    53
        Claus Atzkern
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    54
"
8cbadf2b9825 also send #postBuildWith: to the app.
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
    55
! !
455
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
1414
faf0465c333b defaults for hasHVScrollbar now defined in a class method.
tm
parents: 1412
diff changeset
    57
!SubCanvas class methodsFor:'defaults'!
faf0465c333b defaults for hasHVScrollbar now defined in a class method.
tm
parents: 1412
diff changeset
    58
faf0465c333b defaults for hasHVScrollbar now defined in a class method.
tm
parents: 1412
diff changeset
    59
defaultHorizontalScrollable
faf0465c333b defaults for hasHVScrollbar now defined in a class method.
tm
parents: 1412
diff changeset
    60
    ^ false
faf0465c333b defaults for hasHVScrollbar now defined in a class method.
tm
parents: 1412
diff changeset
    61
faf0465c333b defaults for hasHVScrollbar now defined in a class method.
tm
parents: 1412
diff changeset
    62
faf0465c333b defaults for hasHVScrollbar now defined in a class method.
tm
parents: 1412
diff changeset
    63
!
faf0465c333b defaults for hasHVScrollbar now defined in a class method.
tm
parents: 1412
diff changeset
    64
faf0465c333b defaults for hasHVScrollbar now defined in a class method.
tm
parents: 1412
diff changeset
    65
defaultVerticalScrollable
faf0465c333b defaults for hasHVScrollbar now defined in a class method.
tm
parents: 1412
diff changeset
    66
    ^ false
faf0465c333b defaults for hasHVScrollbar now defined in a class method.
tm
parents: 1412
diff changeset
    67
faf0465c333b defaults for hasHVScrollbar now defined in a class method.
tm
parents: 1412
diff changeset
    68
faf0465c333b defaults for hasHVScrollbar now defined in a class method.
tm
parents: 1412
diff changeset
    69
! !
faf0465c333b defaults for hasHVScrollbar now defined in a class method.
tm
parents: 1412
diff changeset
    70
455
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
!SubCanvas methodsFor:'accessing'!
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
    73
builder
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
    74
    "return the value of the instance variable 'builder' (automatically generated)"
455
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
1893
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
    76
    ^ builder
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
    77
!
455
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
2857
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
    79
builder:aBuilder
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
    80
    builder := aBuilder 
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
    81
!
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
    82
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
    83
client
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
    84
    "return the value of the instance variable 'client' (automatically generated)"
455
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
1893
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
    86
    ^ client
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
    87
!
455
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
    89
client:anApplication spec:aWindowSpecOrSpecSymbol builder:aBuilder
455
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    "release existing components and generate new components from
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
     the given windowSpec, using the given builder."
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
2427
43e68ab02e63 oops - undo last change (postOpen when client changes)
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
    93
    |myApp|
1471
09a5803325e4 when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents: 1467
diff changeset
    94
1686
bafa16adbf14 must release client first,
ca
parents: 1664
diff changeset
    95
    (client notNil and:[client ~~ anApplication]) ifTrue:[
bafa16adbf14 must release client first,
ca
parents: 1664
diff changeset
    96
        client releaseAsSubCanvas.
bafa16adbf14 must release client first,
ca
parents: 1664
diff changeset
    97
        client := nil.
bafa16adbf14 must release client first,
ca
parents: 1664
diff changeset
    98
    ].
bafa16adbf14 must release client first,
ca
parents: 1664
diff changeset
    99
1546
452132649648 Moved #client: and #client:spec: to SimpleView.
Stefan Vogel <sv@exept.de>
parents: 1471
diff changeset
   100
    (builder := aBuilder) isNil ifTrue:[
1846
e90341acd040 comment
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
   101
        builder := anApplication perform:#builder ifNotUnderstood:[UIBuilder new]
1546
452132649648 Moved #client: and #client:spec: to SimpleView.
Stefan Vogel <sv@exept.de>
parents: 1471
diff changeset
   102
    ].
452132649648 Moved #client: and #client:spec: to SimpleView.
Stefan Vogel <sv@exept.de>
parents: 1471
diff changeset
   103
452132649648 Moved #client: and #client:spec: to SimpleView.
Stefan Vogel <sv@exept.de>
parents: 1471
diff changeset
   104
    spec := aWindowSpecOrSpecSymbol.
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   105
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   106
    "/ check for master application
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   107
    (anApplication notNil and:[anApplication masterApplication isNil]) ifTrue:[
1471
09a5803325e4 when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents: 1467
diff changeset
   108
        myApp := self application.
09a5803325e4 when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents: 1467
diff changeset
   109
        myApp ~~ anApplication ifTrue:[
09a5803325e4 when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents: 1467
diff changeset
   110
            anApplication masterApplication:myApp
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   111
        ]
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   112
    ].
1471
09a5803325e4 when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents: 1467
diff changeset
   113
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   114
    client := anApplication.
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   115
    self rebuild.
1471
09a5803325e4 when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents: 1467
diff changeset
   116
    ^ builder
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   117
!
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   118
3340
1276fa7e42f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3271
diff changeset
   119
clientView
1276fa7e42f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3271
diff changeset
   120
    ^ clientView
1276fa7e42f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3271
diff changeset
   121
!
1276fa7e42f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3271
diff changeset
   122
1412
b426fae6edcf fix ViewScroller in scrolledView
tm
parents: 1383
diff changeset
   123
makeClientViewScrollable:aBoolean
b426fae6edcf fix ViewScroller in scrolledView
tm
parents: 1383
diff changeset
   124
    |vs|
b426fae6edcf fix ViewScroller in scrolledView
tm
parents: 1383
diff changeset
   125
b426fae6edcf fix ViewScroller in scrolledView
tm
parents: 1383
diff changeset
   126
    aBoolean ~~ clientViewIsScrolled ifTrue:[
1662
b5ab432da3b9 subApp-channel support;
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   127
        clientView isNil ifTrue:[
1895
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   128
            useApplicationSubView ifTrue:[
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   129
                clientView := ApplicationSubView new.
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   130
            ] ifFalse:[
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   131
                clientView := View new.
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   132
            ]
1662
b5ab432da3b9 subApp-channel support;
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   133
        ].
1412
b426fae6edcf fix ViewScroller in scrolledView
tm
parents: 1383
diff changeset
   134
        aBoolean ifTrue:[
b426fae6edcf fix ViewScroller in scrolledView
tm
parents: 1383
diff changeset
   135
            self scrolledView:(vs := ViewScroller new).
b426fae6edcf fix ViewScroller in scrolledView
tm
parents: 1383
diff changeset
   136
            vs scrolledView:clientView.
b426fae6edcf fix ViewScroller in scrolledView
tm
parents: 1383
diff changeset
   137
        ] ifFalse:[
b426fae6edcf fix ViewScroller in scrolledView
tm
parents: 1383
diff changeset
   138
            self scrolledView:clientView.
b426fae6edcf fix ViewScroller in scrolledView
tm
parents: 1383
diff changeset
   139
        ].
b426fae6edcf fix ViewScroller in scrolledView
tm
parents: 1383
diff changeset
   140
        clientViewIsScrolled := aBoolean.
b426fae6edcf fix ViewScroller in scrolledView
tm
parents: 1383
diff changeset
   141
    ]
b426fae6edcf fix ViewScroller in scrolledView
tm
parents: 1383
diff changeset
   142
1662
b5ab432da3b9 subApp-channel support;
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   143
    "Modified: / 30.1.2000 / 21:36:29 / cg"
1412
b426fae6edcf fix ViewScroller in scrolledView
tm
parents: 1383
diff changeset
   144
!
b426fae6edcf fix ViewScroller in scrolledView
tm
parents: 1383
diff changeset
   145
1450
9994adae5c1c checkin from browser
tm
parents: 1414
diff changeset
   146
setClient:anApplicationModel
9994adae5c1c checkin from browser
tm
parents: 1414
diff changeset
   147
    "set the client - do NOT rebuild"
9994adae5c1c checkin from browser
tm
parents: 1414
diff changeset
   148
9994adae5c1c checkin from browser
tm
parents: 1414
diff changeset
   149
    client := anApplicationModel 
9994adae5c1c checkin from browser
tm
parents: 1414
diff changeset
   150
!
9994adae5c1c checkin from browser
tm
parents: 1414
diff changeset
   151
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   152
spec
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   153
    "return the value of the instance variable 'spec' (automatically generated)"
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   154
1893
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   155
    ^ spec
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   156
!
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   157
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   158
spec:something
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   159
    "set the value of the instance variable 'spec' (automatically generated)"
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   160
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   161
    spec := something.
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   162
    self rebuild.
819
8450cb2ba595 Widget of SubCanvas is self
Stefan Vogel <sv@exept.de>
parents: 609
diff changeset
   163
!
8450cb2ba595 Widget of SubCanvas is self
Stefan Vogel <sv@exept.de>
parents: 609
diff changeset
   164
8450cb2ba595 Widget of SubCanvas is self
Stefan Vogel <sv@exept.de>
parents: 609
diff changeset
   165
widget
8450cb2ba595 Widget of SubCanvas is self
Stefan Vogel <sv@exept.de>
parents: 609
diff changeset
   166
    "ST80 compatibility. 
8450cb2ba595 Widget of SubCanvas is self
Stefan Vogel <sv@exept.de>
parents: 609
diff changeset
   167
     I am my own widget"
8450cb2ba595 Widget of SubCanvas is self
Stefan Vogel <sv@exept.de>
parents: 609
diff changeset
   168
8450cb2ba595 Widget of SubCanvas is self
Stefan Vogel <sv@exept.de>
parents: 609
diff changeset
   169
    ^ self
8450cb2ba595 Widget of SubCanvas is self
Stefan Vogel <sv@exept.de>
parents: 609
diff changeset
   170
8450cb2ba595 Widget of SubCanvas is self
Stefan Vogel <sv@exept.de>
parents: 609
diff changeset
   171
    "Created: / 10.3.1998 / 16:20:52 / stefan"
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   172
! !
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   173
2404
2b7591c982ac category change
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
   174
!SubCanvas methodsFor:'accessing-canvasView handling'!
1895
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   175
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   176
keepClientView:aBoolean
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   177
    keepClientView := aBoolean
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   178
!
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   179
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   180
useApplicationSubView:aBoolean
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   181
    useApplicationSubView := aBoolean
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   182
!
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   183
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   184
useOwnBuilder:aBoolean
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   185
    useOwnBuilder := aBoolean
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   186
! !
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   187
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   188
!SubCanvas methodsFor:'accessing-channels'!
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   189
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   190
clientHolder
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   191
    ^ clientHolder
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   192
!
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   193
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   194
clientHolder:aValueHolder
2857
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   195
    |oldClient|
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   196
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   197
    clientHolder notNil ifTrue:[
2857
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   198
        oldClient := clientHolder value.
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   199
        clientHolder removeDependent:self
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   200
    ].
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   201
    (clientHolder := aValueHolder) notNil ifTrue:[
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   202
        clientHolder addDependent:self
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   203
    ].
2857
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   204
    oldClient ~~ clientHolder value ifTrue:[
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   205
        self updateFromChannels
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   206
    ]
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   207
!
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   208
1893
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   209
clientView:aView
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   210
    clientView notNil ifTrue:[
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   211
        clientView destroy
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   212
    ].
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   213
    clientView := aView
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   214
!
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   215
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   216
specHolder
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   217
    ^ specHolder
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   218
!
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   219
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   220
specHolder:aValueHolder
1905
20ff18462cc6 care for keepClientView setting
tm
parents: 1895
diff changeset
   221
    |oldSpec|
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   222
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   223
    specHolder notNil ifTrue:[
1905
20ff18462cc6 care for keepClientView setting
tm
parents: 1895
diff changeset
   224
        oldSpec := specHolder value.
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   225
        specHolder removeDependent:self
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   226
    ].
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   227
    (specHolder := aValueHolder) notNil ifTrue:[
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   228
        specHolder addDependent:self
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   229
    ].
1905
20ff18462cc6 care for keepClientView setting
tm
parents: 1895
diff changeset
   230
    oldSpec ~~ specHolder value ifTrue:[
20ff18462cc6 care for keepClientView setting
tm
parents: 1895
diff changeset
   231
        self updateFromChannels
20ff18462cc6 care for keepClientView setting
tm
parents: 1895
diff changeset
   232
    ]
2857
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   233
!
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   234
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   235
specHolder:newSpecHolder clientHolder:newClientHolder
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   236
    |oldSpec oldClient|
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   237
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   238
    clientHolder notNil ifTrue:[
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   239
        oldClient := clientHolder value.
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   240
        clientHolder removeDependent:self
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   241
    ].
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   242
    specHolder notNil ifTrue:[
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   243
        oldSpec := specHolder value.
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   244
        specHolder removeDependent:self
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   245
    ].
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   246
    (specHolder := newSpecHolder) notNil ifTrue:[
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   247
        specHolder addDependent:self
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   248
    ].
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   249
    (clientHolder := newClientHolder) notNil ifTrue:[
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   250
        clientHolder addDependent:self
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   251
    ].
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   252
    ((oldSpec ~~ specHolder value) or:[oldClient ~~ clientHolder value]) ifTrue:[
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   253
        self updateFromChannels
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   254
    ]
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   255
! !
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   256
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   257
!SubCanvas methodsFor:'building'!
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   258
1584
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   259
XXrebuild
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   260
    "rebuild
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   261
    "
2083
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   262
"/    | subSpec savedView builderClass boundsOrLayout|
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   263
"/
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   264
"/    superView isNil ifTrue:[
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   265
"/        lateBuild := true.
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   266
"/        ^ self
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   267
"/    ].
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   268
"/
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   269
"/    clientView notNil ifTrue:[
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   270
"/        clientView destroySubViews
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   271
"/    ].
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   272
"/
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   273
"/    spec notNil ifTrue:[
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   274
"/        (subSpec := spec) isSymbol ifTrue:[
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   275
"/            client isNil ifTrue:[
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   276
"/                'SubCanvas [warning]: no client - cannot build spec' infoPrintCR.
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   277
"/                ^ self
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   278
"/            ].
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   279
"/            (subSpec := client class interfaceSpecFor:spec) isNil ifTrue:[
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   280
"/                "/ Transcript showCR:'SubCanvas: nil spec'.
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   281
"/                ^ self
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   282
"/            ]
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   283
"/        ].
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   284
"/
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   285
"/        builder isNil ifTrue:[
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   286
"/            client isNil ifTrue:[
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   287
"/                builderClass := UIBuilder
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   288
"/            ] ifFalse:[
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   289
"/                builderClass := client builderClass
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   290
"/            ].
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   291
"/            builder := builderClass new.
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   292
"/        ].
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   293
"/
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   294
"/        "/ old:
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   295
"/"/         builder buildFromSpec:subSpec in:clientView.
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   296
"/
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   297
"/        "/ new (let app know (somehow) that this is a build
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   298
"/        "/ for a subcanvas (i.e. it can redefine the buildSubCanvase-method
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   299
"/        "/:
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   300
"/        savedView := builder window.
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   301
"/        builder window:clientView.
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   302
"/        [
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   303
"/            client buildSubCanvas:subSpec withBuilder:builder.
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   304
"/        ] ensure:[
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   305
"/            builder window:savedView.
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   306
"/        ].
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   307
"/        clientViewIsScrolled ifTrue:[
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   308
"/            boundsOrLayout := builder spec window layout.
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   309
"/            boundsOrLayout isNil ifTrue:[
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   310
"/                 boundsOrLayout := builder spec window bounds
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   311
"/            ].
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   312
"/            clientView
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   313
"/                extent:(boundsOrLayout rectangleRelativeTo:self bounds preferred:nil) extent.
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   314
"/        ].
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   315
"/
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   316
"/        self realized ifTrue:[
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   317
"/            clientView realizeAllSubViews
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   318
"/        ]
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   319
"/    ]
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   320
"/
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   321
"/    "Modified: / 20.6.1998 / 14:29:00 / cg"
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   322
!
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   323
1584
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   324
container:aView
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   325
    super container:aView.
1846
e90341acd040 comment
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
   326
e90341acd040 comment
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
   327
    "/ my builder can only build the components, when I have a container
e90341acd040 comment
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
   328
    "/ lateBuild is set, if the spec was set some time ago, when I had no container
e90341acd040 comment
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
   329
    "/ Now, we know where to build the GUI ...
e90341acd040 comment
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
   330
    "/ ... and must hurry up to create the widgets.
1584
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   331
    lateBuild == true ifTrue:[
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   332
        lateBuild := false.
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   333
        self rebuild
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   334
    ].
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   335
!
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   336
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   337
rebuild
2912
ac740f182061 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2857
diff changeset
   338
    "rebuild my GUI from the spec."
ac740f182061 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2857
diff changeset
   339
ac740f182061 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2857
diff changeset
   340
    |subSpec savedView savedBuilder builderClass|
1584
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   341
1856
8ecbdc69f11e comment
Claus Gittinger <cg@exept.de>
parents: 1846
diff changeset
   342
    "/ if the superView is not yet created,
8ecbdc69f11e comment
Claus Gittinger <cg@exept.de>
parents: 1846
diff changeset
   343
    "/ we MUST delay building... (sigh)
1905
20ff18462cc6 care for keepClientView setting
tm
parents: 1895
diff changeset
   344
    superView isNil ifTrue:[          
1584
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   345
        lateBuild := true.
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   346
        ^ self
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   347
    ].
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   348
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   349
    clientView notNil ifTrue:[
1893
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   350
        clientView destroySubViews.
1584
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   351
    ].
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   352
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   353
    spec notNil ifTrue:[
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   354
        (subSpec := spec) isSymbol ifTrue:[
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   355
            client isNil ifTrue:[
2394
c3984ea38fb5 only output warning 'no client...' if clientHolder is nil.
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
   356
                clientHolder isNil ifTrue:[
2395
db8f819ae751 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2394
diff changeset
   357
                    ('SubCanvas [warning]: no client - cannot build spec: ' , spec) infoPrintCR.
2394
c3984ea38fb5 only output warning 'no client...' if clientHolder is nil.
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
   358
                ].
1584
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   359
                ^ self
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   360
            ].
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   361
            (subSpec := client class interfaceSpecFor:spec) isNil ifTrue:[
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   362
                "/ Transcript showCR:'SubCanvas: nil spec'.
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   363
                ^ self
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   364
            ]
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   365
        ].
1662
b5ab432da3b9 subApp-channel support;
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   366
        subSpec isArray ifTrue:[
3340
1276fa7e42f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3271
diff changeset
   367
            subSpec := subSpec decodeAsLiteralArray.
1276fa7e42f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3271
diff changeset
   368
            subSpec isArray ifTrue:[self halt].
1662
b5ab432da3b9 subApp-channel support;
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   369
        ].
1584
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   370
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   371
        builder isNil ifTrue:[
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   372
            client isNil ifTrue:[
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   373
                builderClass := UIBuilder
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   374
            ] ifFalse:[
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   375
                builderClass := client builderClass
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   376
            ].
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   377
            builder := builderClass new.
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   378
        ].
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   379
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   380
        "/ old:
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   381
        "/  builder buildFromSpec:subSpec in:clientView.
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   382
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   383
        "/ new (let app know (somehow) that this is a build
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   384
        "/ for a subcanvas (i.e. it can redefine the buildSubCanvas-method):
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   385
1895
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   386
        keepClientView ifFalse:[
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   387
            (clientView notNil and:[clientView application ~~ client]) ifTrue:[
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   388
                clientView destroy.
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   389
                clientView := nil.
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   390
            ].
1893
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   391
        ].
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   392
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   393
        clientView isNil ifTrue:[
1927
4cb8e4ecc425 previous behavior
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   394
            "/ create a new view
1925
6026af8498a5 if keepClientView is set, care for a view being already
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   395
1927
4cb8e4ecc425 previous behavior
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   396
            useApplicationSubView ifTrue:[
4cb8e4ecc425 previous behavior
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   397
                clientView := ApplicationSubView new.
4cb8e4ecc425 previous behavior
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   398
            ] ifFalse:[
4cb8e4ecc425 previous behavior
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   399
                clientView := View new.
1895
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   400
            ]
1893
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   401
        ].
3271
4a1efb576208 update application after rebuild new application
ca
parents: 2916
diff changeset
   402
        useApplicationSubView ifTrue:[
4a1efb576208 update application after rebuild new application
ca
parents: 2916
diff changeset
   403
            clientView application:client.
4a1efb576208 update application after rebuild new application
ca
parents: 2916
diff changeset
   404
        ].
1893
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   405
1584
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   406
        savedView := builder window.
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   407
        builder window:clientView.
1895
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   408
        useOwnBuilder ifTrue:[
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   409
            savedBuilder := client builder.
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   410
            client builder:builder.
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   411
        ].
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   412
1912
dc3652682529 superView setting.
martin
parents: 1911
diff changeset
   413
        [   |savedSuperView|
dc3652682529 superView setting.
martin
parents: 1911
diff changeset
   414
dc3652682529 superView setting.
martin
parents: 1911
diff changeset
   415
            "/ kludge: need superView to be set correctly, in order for
dc3652682529 superView setting.
martin
parents: 1911
diff changeset
   416
            "/ postBuildAsSubCanvas to be invoked (instead of postBuild)
dc3652682529 superView setting.
martin
parents: 1911
diff changeset
   417
            "/ however, must unset the superView for code below ...
dc3652682529 superView setting.
martin
parents: 1911
diff changeset
   418
            savedSuperView := clientView superView.
1914
943f0551bf62 use #setContainer: (to avoid warning message)
penk
parents: 1913
diff changeset
   419
            savedSuperView isNil ifTrue:[clientView setContainer:self].
1912
dc3652682529 superView setting.
martin
parents: 1911
diff changeset
   420
            client buildSubCanvas:subSpec withBuilder:builder.
2091
7f936283ea75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2083
diff changeset
   421
            savedSuperView isNil ifTrue:[clientView setContainer:nil. self removeSubView:clientView. ].
1905
20ff18462cc6 care for keepClientView setting
tm
parents: 1895
diff changeset
   422
20ff18462cc6 care for keepClientView setting
tm
parents: 1895
diff changeset
   423
            keepClientView ifFalse:[    
1908
e86e34794e84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1907
diff changeset
   424
                (scrolledView notNil and:[clientView isComponentOf:scrolledView]) ifTrue:[
1906
0b64cfae3419 checkin from browser
tm
parents: 1905
diff changeset
   425
                    self error:'this should not happen'
1905
20ff18462cc6 care for keepClientView setting
tm
parents: 1895
diff changeset
   426
                ] ifFalse:[
20ff18462cc6 care for keepClientView setting
tm
parents: 1895
diff changeset
   427
                    self scrolledView:clientView.
20ff18462cc6 care for keepClientView setting
tm
parents: 1895
diff changeset
   428
                ]
1907
e8efd065dc2b oops - clientView again
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   429
            ] ifTrue:[
1908
e86e34794e84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1907
diff changeset
   430
                (clientView isComponentOf:self) ifFalse:[
1907
e8efd065dc2b oops - clientView again
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   431
                    self scrolledView:clientView.
e8efd065dc2b oops - clientView again
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   432
                ]
1905
20ff18462cc6 care for keepClientView setting
tm
parents: 1895
diff changeset
   433
            ]
2083
d7b305aea776 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
   434
        ] ensure:[
1662
b5ab432da3b9 subApp-channel support;
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   435
            savedView notNil ifTrue:[
b5ab432da3b9 subApp-channel support;
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   436
                builder window:savedView.
1893
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   437
            ].
1895
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   438
            useOwnBuilder ifTrue:[
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   439
                savedBuilder notNil ifTrue:[
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   440
                    client builder:savedBuilder.
a1b2502c91d7 went back halfway to the old behavior,
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   441
                ]
1662
b5ab432da3b9 subApp-channel support;
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   442
            ]
1584
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   443
        ].
1893
6456c11a1307 View -> ApplicationSubView
tm
parents: 1856
diff changeset
   444
1664
a8b97314f813 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
   445
        clientViewIsScrolled ifTrue:[
3340
1276fa7e42f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3271
diff changeset
   446
            subSpec window layout notNil ifTrue:[
1276fa7e42f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3271
diff changeset
   447
                "/ mhmh - what should we base the size computation on ?
1276fa7e42f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3271
diff changeset
   448
                "/ (I dont see any reason to look at the windows spec at all;
1276fa7e42f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3271
diff changeset
   449
                "/  isn't the user of the spec the only one to control the size).
1276fa7e42f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3271
diff changeset
   450
                clientView extent:(subSpec window bounds extent)
1276fa7e42f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3271
diff changeset
   451
            ] ifFalse:[
1276fa7e42f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3271
diff changeset
   452
                clientView extent:(subSpec window bounds extent)
1276fa7e42f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3271
diff changeset
   453
            ].
1664
a8b97314f813 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
   454
        ].
1584
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   455
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   456
        self realized ifTrue:[
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   457
            clientView realizeAllSubViews
1662
b5ab432da3b9 subApp-channel support;
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   458
        ].
1584
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   459
    ]
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   460
1662
b5ab432da3b9 subApp-channel support;
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   461
    "Modified: / 30.1.2000 / 21:36:40 / cg"
1584
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   462
!
f020416e00ae LetterPrinter now works, after changing #rebuild.
Stefan Vogel <sv@exept.de>
parents: 1577
diff changeset
   463
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   464
releaseAllComponents
2916
27dd039c1cc7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   465
    clientView notNil ifTrue:[
27dd039c1cc7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   466
        clientView destroySubViews.
27dd039c1cc7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   467
    ].
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   468
    builder := nil.
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   469
    spec    := nil.
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   470
    client  := nil.
1662
b5ab432da3b9 subApp-channel support;
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   471
b5ab432da3b9 subApp-channel support;
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   472
    "Modified: / 31.1.2000 / 16:56:14 / cg"
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   473
! !
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   474
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   475
!SubCanvas methodsFor:'change & update'!
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   476
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   477
update:something with:aParameter from:changedObject
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   478
    "one of my models changed its value
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   479
    "
557
7cf5f021983d add method:
ca
parents: 554
diff changeset
   480
    (changedObject == clientHolder or:[changedObject == specHolder]) ifTrue:[
2478
654d6ffde1f8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   481
        self updateFromChannels.
654d6ffde1f8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   482
        ^ self
654d6ffde1f8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   483
    ].
654d6ffde1f8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   484
    super update:something with:aParameter from:changedObject.
557
7cf5f021983d add method:
ca
parents: 554
diff changeset
   485
!
7cf5f021983d add method:
ca
parents: 554
diff changeset
   486
7cf5f021983d add method:
ca
parents: 554
diff changeset
   487
updateFromChannels
7cf5f021983d add method:
ca
parents: 554
diff changeset
   488
    "update canvas from channel
7cf5f021983d add method:
ca
parents: 554
diff changeset
   489
    "
2857
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   490
    |newClient newSpec bldr|
557
7cf5f021983d add method:
ca
parents: 554
diff changeset
   491
7cf5f021983d add method:
ca
parents: 554
diff changeset
   492
    clientHolder isNil ifTrue:[
2857
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   493
        newClient := self application.
1911
60c80cb7e428 No clients specified.
martin
parents: 1908
diff changeset
   494
        bldr := UIBuilder new.
2735
6999d16ef613 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
   495
        bldr isSubBuilder:true.
557
7cf5f021983d add method:
ca
parents: 554
diff changeset
   496
    ] ifFalse:[
2857
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   497
        newClient := clientHolder value
554
c32ed45bfc6e bug fixes for spec derived from channel
ca
parents: 553
diff changeset
   498
    ].
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   499
557
7cf5f021983d add method:
ca
parents: 554
diff changeset
   500
    specHolder isNil ifTrue:[
2857
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   501
        newSpec := #windowSpec
557
7cf5f021983d add method:
ca
parents: 554
diff changeset
   502
    ] ifFalse:[
2857
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   503
        newSpec := specHolder value
557
7cf5f021983d add method:
ca
parents: 554
diff changeset
   504
    ].
2857
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   505
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   506
    (newClient notNil and:[newSpec notNil]) ifTrue:[
557
7cf5f021983d add method:
ca
parents: 554
diff changeset
   507
    ] ifFalse:[
1467
2d85bd1a8267 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
   508
"/        spec notNil ifTrue:[
2d85bd1a8267 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
   509
"/            self halt:'spec but no app'.
2d85bd1a8267 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
   510
"/        ].
2857
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   511
        newClient := nil.
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   512
        newSpec := #windowSpec.  "/ is that true ?
1894
f0469313b9f8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
   513
    ].
2857
8bfa2eebfd2e avoid double-update if clientHolder and specHolder are both set
Claus Gittinger <cg@exept.de>
parents: 2735
diff changeset
   514
    self client:newClient spec:newSpec builder:bldr
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   515
1467
2d85bd1a8267 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
   516
    "Modified: / 5.8.1999 / 13:35:26 / cg"
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   517
! !
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   518
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   519
!SubCanvas methodsFor:'initialization'!
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   520
2156
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   521
initialize
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   522
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   523
    super initialize.
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   524
"/    self scrolledView:(clientView := ApplicationSubView new).
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   525
    clientViewIsScrolled := false.
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   526
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   527
    "/ these defaults make subCanvas compatible with VW;
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   528
    "/ however, they make our life difficult sometimes.
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   529
    keepClientView := true.
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   530
    useApplicationSubView := true "false".
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   531
    useOwnBuilder := false.
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   532
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   533
    spec := #windowSpec.
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   534
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   535
    "Modified: / 31.1.2000 / 16:56:31 / cg"
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   536
!
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   537
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   538
release
1471
09a5803325e4 when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents: 1467
diff changeset
   539
    client notNil ifTrue:[
1702
ff202e263b9d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   540
        client == self application ifTrue:[
ff202e263b9d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   541
            client releaseAsSubCanvas.
ff202e263b9d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   542
        ] ifFalse:[
ff202e263b9d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   543
            client release
ff202e263b9d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   544
        ].
1471
09a5803325e4 when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents: 1467
diff changeset
   545
    ].
09a5803325e4 when destroying or changing the client, release as subApp
Claus Gittinger <cg@exept.de>
parents: 1467
diff changeset
   546
609
ad75d5f13ca1 implement destroy:
ca
parents: 557
diff changeset
   547
    clientHolder notNil ifTrue:[
ad75d5f13ca1 implement destroy:
ca
parents: 557
diff changeset
   548
        clientHolder removeDependent:self.
ad75d5f13ca1 implement destroy:
ca
parents: 557
diff changeset
   549
        clientHolder := nil.
ad75d5f13ca1 implement destroy:
ca
parents: 557
diff changeset
   550
    ].
ad75d5f13ca1 implement destroy:
ca
parents: 557
diff changeset
   551
    specHolder notNil ifTrue:[
ad75d5f13ca1 implement destroy:
ca
parents: 557
diff changeset
   552
        specHolder removeDependent:self.
ad75d5f13ca1 implement destroy:
ca
parents: 557
diff changeset
   553
        specHolder := nil.
ad75d5f13ca1 implement destroy:
ca
parents: 557
diff changeset
   554
    ].
2156
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   555
    super release.
1702
ff202e263b9d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   556
ff202e263b9d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1686
diff changeset
   557
    "Modified: / 13.2.2000 / 23:31:12 / cg"
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   558
! !
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   559
1720
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   560
!SubCanvas methodsFor:'layout'!
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   561
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   562
usedScrolledViewHMarginWhenHasV:hasV andHasH:hasH
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   563
    "return the horizontal margin around (outer margin).
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   564
     Redefined to avoid margin when no scrollers are present"
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   565
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   566
    ^ (hasV or:[hasH]) ifTrue:[scrolledViewHMargin] ifFalse:[0]
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   567
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   568
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   569
!
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   570
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   571
usedScrolledViewVMarginWhenHasV:hasV andHasH:hasH
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   572
    "return the horizontal margin around (outer margin).
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   573
     Redefined to avoid margin when no scrollers are present"
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   574
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   575
    ^ (hasV or:[hasH]) ifTrue:[scrolledViewVMargin] ifFalse:[0]
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   576
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   577
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   578
! !
d855968ce342 redefine margin computations (avoid margin if subcanvas does not scroll).
Claus Gittinger <cg@exept.de>
parents: 1702
diff changeset
   579
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   580
!SubCanvas methodsFor:'queries'!
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   581
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   582
application
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   583
    "return the application, under which this view was opened,
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   584
    "
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   585
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   586
    client notNil ifTrue:[
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   587
        ^ client
455
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   588
    ].
503
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   589
    ^ super application
0a3ef2d34d9d add application holder
ca
parents: 455
diff changeset
   590
455
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   591
! !
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   592
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   593
!SubCanvas class methodsFor:'documentation'!
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   594
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   595
version
3340
1276fa7e42f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3271
diff changeset
   596
    ^ '$Header: /cvs/stx/stx/libwidg2/SubCanvas.st,v 1.57 2008-02-18 08:33:17 cg Exp $'
455
860d66c9f047 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   597
! !