UIPainter.st
changeset 2208 4e1c31df6014
parent 2206 1a7921b6c104
child 2210 0a2c19976d82
equal deleted inserted replaced
2207:7f16eb639cc1 2208:4e1c31df6014
     1 "
     1 "
     2  COPYRIGHT (c) 1995-1998 by eXept Software AG
     2  COPYRIGHT (c) 1995-1998 by eXept Software AG
     3 	      All Rights Reserved
     3               All Rights Reserved
     4 
     4 
     5  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
     6  only in accordance with the terms of that license and with the
     6  only in accordance with the terms of that license and with the
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 "{ Package: 'stx:libtool2' }"
    12 "{ Package: 'stx:libtool2' }"
    13 
    13 
    14 ResourceSpecEditor subclass:#UIPainter
    14 ResourceSpecEditor subclass:#UIPainter
    15 	instanceVariableNames:'specSuperclassName treeView selectionPanel specTool layoutTool
    15         instanceVariableNames:'specSuperclassName treeView selectionPanel specTool layoutTool
    16 		helpTool painterView painter'
    16                 helpTool painterView painter'
    17 	classVariableNames:''
    17         classVariableNames:''
    18 	poolDictionaries:''
    18         poolDictionaries:''
    19 	category:'Interface-UIPainter'
    19         category:'Interface-UIPainter'
    20 !
    20 !
    21 
    21 
    22 SelectionInTreeView subclass:#TreeView
    22 SelectionInTreeView subclass:#TreeView
    23 	instanceVariableNames:'lastDrawnMaster cvsEventsDisabled windowSpec windowSpecClass'
    23         instanceVariableNames:'lastDrawnMaster cvsEventsDisabled windowSpec windowSpecClass'
    24 	classVariableNames:''
    24         classVariableNames:''
    25 	poolDictionaries:''
    25         poolDictionaries:''
    26 	privateIn:UIPainter
    26         privateIn:UIPainter
    27 !
    27 !
    28 
    28 
    29 !UIPainter class methodsFor:'documentation'!
    29 !UIPainter class methodsFor:'documentation'!
    30 
    30 
    31 copyright
    31 copyright
    32 "
    32 "
    33  COPYRIGHT (c) 1995-1998 by eXept Software AG
    33  COPYRIGHT (c) 1995-1998 by eXept Software AG
    34 	      All Rights Reserved
    34               All Rights Reserved
    35 
    35 
    36  This software is furnished under a license and may be used
    36  This software is furnished under a license and may be used
    37  only in accordance with the terms of that license and with the
    37  only in accordance with the terms of that license and with the
    38  inclusion of the above copyright notice.   This software may not
    38  inclusion of the above copyright notice.   This software may not
    39  be provided or otherwise made available to, or used by, any
    39  be provided or otherwise made available to, or used by, any
    51     classes, typically subclasses of the class ApplicationModel. These specifications
    51     classes, typically subclasses of the class ApplicationModel. These specifications
    52     are used by the UIBuilder to generate the application window and its widgets when 
    52     are used by the UIBuilder to generate the application window and its widgets when 
    53     opening the application.
    53     opening the application.
    54 
    54 
    55     [start with:]
    55     [start with:]
    56 	UIPainter open
    56         UIPainter open
    57 
    57 
    58     [author:]
    58     [author:]
    59 	Claus Gittinger, eXept Software AG
    59         Claus Gittinger, eXept Software AG
    60 	Claus Atzkern, eXept Software AG
    60         Claus Atzkern, eXept Software AG
    61 	Thomas Zwick, eXept Software AG
    61         Thomas Zwick, eXept Software AG
    62 
    62 
    63     [see also:]
    63     [see also:]
    64 	UIBuilder
    64         UIBuilder
    65 	ApplicationModel
    65         ApplicationModel
    66 	UISpecification
    66         UISpecification
    67 "
    67 "
    68 
    68 
    69 ! !
    69 ! !
    70 
    70 
    71 !UIPainter class methodsFor:'instance creation'!
    71 !UIPainter class methodsFor:'instance creation'!
    89 !UIPainter class methodsFor:'accessing'!
    89 !UIPainter class methodsFor:'accessing'!
    90 
    90 
    91 defaultNameOfCanvas
    91 defaultNameOfCanvas
    92     "returns the default name of the application"
    92     "returns the default name of the application"
    93 
    93 
    94     ^'NewApplication'
    94     ^ 'NewApplication'
    95 
       
    96 ! !
    95 ! !
    97 
    96 
    98 !UIPainter class methodsFor:'help specs'!
    97 !UIPainter class methodsFor:'help specs'!
    99 
    98 
   100 flyByHelpSpec
    99 flyByHelpSpec
   324 convertString:aString maxLineSize:maxCharactersPerLine skipLineFeed:skipLineFeed
   323 convertString:aString maxLineSize:maxCharactersPerLine skipLineFeed:skipLineFeed
   325     "converts a string to a string collection with maximum characters
   324     "converts a string to a string collection with maximum characters
   326      per line
   325      per line
   327     "
   326     "
   328     |stream
   327     |stream
   329 	max     "{ Class:SmallInteger }"
   328         max     "{ Class:SmallInteger }"
   330 	size    "{ Class:SmallInteger }"
   329         size    "{ Class:SmallInteger }"
   331 	start   "{ Class:SmallInteger }"
   330         start   "{ Class:SmallInteger }"
   332 	stop    "{ Class:SmallInteger }"
   331         stop    "{ Class:SmallInteger }"
   333 	cpySz   "{ Class:SmallInteger }"
   332         cpySz   "{ Class:SmallInteger }"
   334 	lnSz    "{ Class:SmallInteger }"
   333         lnSz    "{ Class:SmallInteger }"
   335 	atBeginOfLine|
   334         atBeginOfLine|
   336 
   335 
   337     maxCharactersPerLine < 20 ifFalse:[max := maxCharactersPerLine - 1]
   336     maxCharactersPerLine < 20 ifFalse:[max := maxCharactersPerLine - 1]
   338 			       ifTrue:[max := 20].
   337                                ifTrue:[max := 20].
   339 
   338 
   340     (size := aString size) <= max ifTrue:[
   339     (size := aString size) <= max ifTrue:[
   341 	^ aString
   340         ^ aString
   342     ].
   341     ].
   343     start  := 1.
   342     start  := 1.
   344     lnSz   := 0.
   343     lnSz   := 0.
   345     stream := (String new:size) writeStream.
   344     stream := (String new:size) writeStream.
   346 
   345 
   347     atBeginOfLine := true.
   346     atBeginOfLine := true.
   348 
   347 
   349     [start <= size] whileTrue:[
   348     [start <= size] whileTrue:[
   350 	(start := aString indexOfNonSeparatorStartingAt:start) == 0 ifTrue:[
   349         (start := aString indexOfNonSeparatorStartingAt:start) == 0 ifTrue:[
   351 	    ^ stream contents
   350             ^ stream contents
   352 	].
   351         ].
   353 	(aString at:start) == $\ ifTrue:[
   352         (aString at:start) == $\ ifTrue:[
   354 	    skipLineFeed ifFalse:[
   353             skipLineFeed ifFalse:[
   355 		stream nextPut:$\
   354                 stream nextPut:$\
   356 	    ].
   355             ].
   357 	    start := start + 1.
   356             start := start + 1.
   358 	    stream cr.
   357             stream cr.
   359 	    start := start + 1.
   358             start := start + 1.
   360 	    lnSz := 0.
   359             lnSz := 0.
   361 	] ifFalse:[
   360         ] ifFalse:[
   362 	    (stop := aString indexOfSeparatorStartingAt:start) == 0 ifTrue:[
   361             (stop := aString indexOfSeparatorStartingAt:start) == 0 ifTrue:[
   363 		stop := size + 1
   362                 stop := size + 1
   364 	    ].
   363             ].
   365 	    (aString at:(stop - 1)) == $\ ifTrue:[
   364             (aString at:(stop - 1)) == $\ ifTrue:[
   366 		stop := stop - 1
   365                 stop := stop - 1
   367 	    ].
   366             ].
   368 	    cpySz := stop - start.
   367             cpySz := stop - start.
   369 
   368 
   370 	    lnSz == 0 ifFalse:[
   369             lnSz == 0 ifFalse:[
   371 		(lnSz := lnSz + cpySz) >= max ifTrue:[stream cr.    lnSz := cpySz. atBeginOfLine := true. ]
   370                 (lnSz := lnSz + cpySz) >= max ifTrue:[stream cr.    lnSz := cpySz. atBeginOfLine := true. ]
   372 					     ifFalse:[stream space. lnSz := lnSz + 1]
   371                                              ifFalse:[stream space. lnSz := lnSz + 1]
   373 	    ] ifTrue:[
   372             ] ifTrue:[
   374 		lnSz := cpySz
   373                 lnSz := cpySz
   375 	    ].
   374             ].
   376 	    stream nextPutAll:aString startingAt:start to:(stop - 1).
   375             stream nextPutAll:aString startingAt:start to:(stop - 1).
   377 	    start := stop.
   376             start := stop.
   378 	]
   377         ]
   379     ].
   378     ].
   380     ^ stream contents
   379     ^ stream contents
   381 
   380 
   382     "Modified: / 1.2.1998 / 14:42:56 / cg"
   381     "Modified: / 1.2.1998 / 14:42:56 / cg"
   383 ! !
   382 ! !
   487     "
   486     "
   488 
   487 
   489     <resource: #image>
   488     <resource: #image>
   490 
   489 
   491     ^Icon
   490     ^Icon
   492 	constantNamed:#'UIPainter iconAlignB'
   491         constantNamed:#'UIPainter iconAlignB'
   493 	ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@E@@@@@@@G@@@@@@@G@E@@@@@G@G@@@@@G@G@@@@@G@G@@@E@G@G@@@G@G@G@K@G@G@G@@@G@G@G@A@G@G@G@@@G@G@G@K@@@@@@@@B*****(@B*****(@@@@@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@G C@G @@G'' @G'' @G'' @G'' G'''' G'''' G'''' G''''!!G'''' G'''' G'''' G'''' O??0O??0@@@@@@@C@@@@') ; yourself); yourself]
   492         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@E@@@@@@@G@@@@@@@G@E@@@@@G@G@@@@@G@G@@@@@G@G@@@E@G@G@@@G@G@G@K@G@G@G@@@G@G@G@A@G@G@G@@@G@G@G@K@@@@@@@@B*****(@B*****(@@@@@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@G C@G @@G'' @G'' @G'' @G'' G'''' G'''' G'''' G''''!!G'''' G'''' G'''' G'''' O??0O??0@@@@@@@C@@@@') ; yourself); yourself]
   494 !
   493 !
   495 
   494 
   496 iconAlignL
   495 iconAlignL
   497     "This resource specification was automatically generated
   496     "This resource specification was automatically generated
   498      by the ImageEditor of ST/X."
   497      by the ImageEditor of ST/X."
   505     "
   504     "
   506 
   505 
   507     <resource: #image>
   506     <resource: #image>
   508 
   507 
   509     ^Icon
   508     ^Icon
   510 	constantNamed:#'UIPainter iconAlignL'
   509         constantNamed:#'UIPainter iconAlignL'
   511 	ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@(@@@@@@@(@@@@@@@(UUUP@I@(_??0@@@(@@@@@@@(@@@@@@@(@@@@@@@(@@@@@@@(UUUU@@@(_???@@@(@@@@@E@(@@@@@@@(@@@@@@@(@@@@@@@(UU@@@@@(_?@@@@@(@@@@@@@(@@@@@@@@@@@@@E@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@F@@@G?>@G?>@G?>@G?>@F@@@F@@@G?? G?? G?? G?? F@@@F@@@G? @G? @G? @G? @F@@@@@@@@@@@') ; yourself); yourself]
   510         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@(@@@@@@@(@@@@@@@(UUUP@I@(_??0@@@(@@@@@@@(@@@@@@@(@@@@@@@(@@@@@@@(UUUU@@@(_???@@@(@@@@@E@(@@@@@@@(@@@@@@@(@@@@@@@(UU@@@@@(_?@@@@@(@@@@@@@(@@@@@@@@@@@@@E@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@F@@@G?>@G?>@G?>@G?>@F@@@F@@@G?? G?? G?? G?? F@@@F@@@G? @G? @G? @G? @F@@@@@@@@@@@') ; yourself); yourself]
   512 !
   511 !
   513 
   512 
   514 iconAlignLR
   513 iconAlignLR
   515     "This resource specification was automatically generated
   514     "This resource specification was automatically generated
   516      by the ImageEditor of ST/X."
   515      by the ImageEditor of ST/X."
   523     "
   522     "
   524 
   523 
   525     <resource: #image>
   524     <resource: #image>
   526 
   525 
   527     ^Icon
   526     ^Icon
   528 	constantNamed:#'UIPainter iconAlignLR'
   527         constantNamed:#'UIPainter iconAlignLR'
   529 	ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@(@@@B @@(@@@B @@(UUUR I@(_??2 @@(@@@B @@(@@@B @@(@@@B @@(@@@B @@(UUUR @@(_??2 @@(@@@B E@(@@@B @@(@@@B @@(@@@B @@(UUUR @@(_??B @@(@@@B @@(@@@B @@@@@@@@E@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@F@A G?? G?? G?? G?? F@A F@A G?? G?? G?? G?? F@A F@A G?? G?? G?; G?? F@A @@@@@@@@') ; yourself); yourself]
   528         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@(@@@B @@(@@@B @@(UUUR I@(_??2 @@(@@@B @@(@@@B @@(@@@B @@(@@@B @@(UUUR @@(_??2 @@(@@@B E@(@@@B @@(@@@B @@(@@@B @@(UUUR @@(_??B @@(@@@B @@(@@@B @@@@@@@@E@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@F@A G?? G?? G?? G?? F@A F@A G?? G?? G?? G?? F@A F@A G?? G?? G?; G?? F@A @@@@@@@@') ; yourself); yourself]
   530 !
   529 !
   531 
   530 
   532 iconAlignR
   531 iconAlignR
   533     "This resource specification was automatically generated
   532     "This resource specification was automatically generated
   534      by the ImageEditor of ST/X."
   533      by the ImageEditor of ST/X."
   541     "
   540     "
   542 
   541 
   543     <resource: #image>
   542     <resource: #image>
   544 
   543 
   545     ^Icon
   544     ^Icon
   546 	constantNamed:#'UIPainter iconAlignR'
   545         constantNamed:#'UIPainter iconAlignR'
   547 	ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@B @@@@@@B @@@UUUR I@@_??2 @@@@@@B @@@@@@B @@@@@@B @@@@@@B @@EUUUR @@G???2 @@@@@@B E@@@@@B @@@@@@B @@@@@@B @@@@EUR @@@@G?2 @@@@@@B @@@@@@B @@@@@@@@E@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@A A?? A?? A?? A?? @@A @@A G?? G?? G?? G?? @@A @@A @G? @G? @G? @G? @@A @@@@@@@@') ; yourself); yourself]
   546         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@B @@@@@@B @@@UUUR I@@_??2 @@@@@@B @@@@@@B @@@@@@B @@@@@@B @@EUUUR @@G???2 @@@@@@B E@@@@@B @@@@@@B @@@@@@B @@@@EUR @@@@G?2 @@@@@@B @@@@@@B @@@@@@@@E@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@A A?? A?? A?? A?? @@A @@A G?? G?? G?? G?? @@A @@A @G? @G? @G? @G? @@A @@@@@@@@') ; yourself); yourself]
   548 !
   547 !
   549 
   548 
   550 iconAlignT
   549 iconAlignT
   551     "This resource specification was automatically generated
   550     "This resource specification was automatically generated
   552      by the ImageEditor of ST/X."
   551      by the ImageEditor of ST/X."
   559     "
   558     "
   560 
   559 
   561     <resource: #image>
   560     <resource: #image>
   562 
   561 
   563     ^Icon
   562     ^Icon
   564 	constantNamed:#'UIPainter iconAlignT'
   563         constantNamed:#'UIPainter iconAlignT'
   565 	ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@B*****(@B*****(@@@@@@@@@@E@E@E@K@G@G@G@@@G@G@G@A@G@G@G@@@G@G@G@K@G@G@G@@@@@G@G@@@@@G@G@@@@@G@G@@@@@G@G@@@@@G@@@@@@@G@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@C@@@@O??0O??0G'''' G'''' G'''' G'''' G''''!!G'''' G'''' G'''' @G'' @G'' @G'' @G'' @G @@G C@@@@@@@@@@@@') ; yourself); yourself]
   564         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@B*****(@B*****(@@@@@@@@@@E@E@E@K@G@G@G@@@G@G@G@A@G@G@G@@@G@G@G@K@G@G@G@@@@@G@G@@@@@G@G@@@@@G@G@@@@@G@G@@@@@G@@@@@@@G@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@C@@@@O??0O??0G'''' G'''' G'''' G'''' G''''!!G'''' G'''' G'''' @G'' @G'' @G'' @G'' @G @@G C@@@@@@@@@@@@') ; yourself); yourself]
   566 !
   565 !
   567 
   566 
   568 iconAlignTB
   567 iconAlignTB
   569     "This resource specification was automatically generated
   568     "This resource specification was automatically generated
   570      by the ImageEditor of ST/X."
   569      by the ImageEditor of ST/X."
   577     "
   576     "
   578 
   577 
   579     <resource: #image>
   578     <resource: #image>
   580 
   579 
   581     ^Icon
   580     ^Icon
   582 	constantNamed:#'UIPainter iconAlignTB'
   581         constantNamed:#'UIPainter iconAlignTB'
   583 	ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@A@@@@@@@@@@@@@@@@B*****(@B*****(@@@@@@@@@@E@E@E@G@G@G@G@@@G@G@G@@@G@G@G@@@G@G@G@H@G@G@G@@@G@G@G@A@G@G@G@@@G@G@G@@@G@G@D@@@@@@@@@@B*****(@B*****(@@@@@@@@@@@@@@@@H@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@C@@@@O??0O??0G'''' G''''!!G'''' G'''' G'''' G'''' G'''' G'''' G''''!!G''''!!G''& G'''' O??0O??2@@@@@@@@@@@@') ; yourself); yourself]
   582         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@A@@@@@@@@@@@@@@@@B*****(@B*****(@@@@@@@@@@E@E@E@G@G@G@G@@@G@G@G@@@G@G@G@@@G@G@G@H@G@G@G@@@G@G@G@A@G@G@G@@@G@G@G@@@G@G@D@@@@@@@@@@B*****(@B*****(@@@@@@@@@@@@@@@@H@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@C@@@@O??0O??0G'''' G''''!!G'''' G'''' G'''' G'''' G'''' G'''' G''''!!G''''!!G''& G'''' O??0O??2@@@@@@@@@@@@') ; yourself); yourself]
   584 !
   583 !
   585 
   584 
   586 iconCenterH
   585 iconCenterH
   587     "This resource specification was automatically generated
   586     "This resource specification was automatically generated
   588      by the ImageEditor of ST/X."
   587      by the ImageEditor of ST/X."
   732     <resource: #canvas>
   731     <resource: #canvas>
   733 
   732 
   734     ^
   733     ^
   735      
   734      
   736        #(#FullSpec
   735        #(#FullSpec
   737 	  #window: 
   736           #window: 
   738 	   #(#WindowSpec
   737            #(#WindowSpec
   739 	      #name: 'GUI Painter'
   738               #name: 'GUI Painter'
   740 	      #layout: #(#LayoutFrame 291 0 130 0 637 0 289 0)
   739               #layout: #(#LayoutFrame 291 0 130 0 637 0 289 0)
   741 	      #label: 'GUI Painter'
   740               #label: 'GUI Painter'
   742 	      #min: #(#Point 350 160)
   741               #min: #(#Point 350 160)
   743 	      #max: #(#Point 500 160)
   742               #max: #(#Point 500 160)
   744 	      #bounds: #(#Rectangle 291 130 638 290)
   743               #bounds: #(#Rectangle 291 130 638 290)
   745 	      #usePreferredExtent: false
   744               #usePreferredExtent: false
   746 	  )
   745           )
   747 	  #component: 
   746           #component: 
   748 	   #(#SpecCollection
   747            #(#SpecCollection
   749 	      #collection: 
   748               #collection: 
   750 	       #(
   749                #(
   751 		 #(#FramedBoxSpec
   750                  #(#FramedBoxSpec
   752 		    #name: 'FramedBox'
   751                     #name: 'FramedBox'
   753 		    #layout: #(#LayoutFrame 0 0.0 3 0.0 0 1.0 -35 1.0)
   752                     #layout: #(#LayoutFrame 0 0.0 3 0.0 0 1.0 -35 1.0)
   754 		    #component: 
   753                     #component: 
   755 		     #(#SpecCollection
   754                      #(#SpecCollection
   756 			#collection: 
   755                         #collection: 
   757 			 #(
   756                          #(
   758 			   #(#LabelSpec
   757                            #(#LabelSpec
   759 			      #name: 'selectorLabel'
   758                               #name: 'selectorLabel'
   760 			      #layout: #(#AlignmentOrigin 67 0.11 29 0 1 0.5)
   759                               #layout: #(#AlignmentOrigin 67 0.11 29 0 1 0.5)
   761 			      #label: 'Selector:'
   760                               #label: 'Selector:'
   762 			      #translateLabel: true
   761                               #translateLabel: true
   763 			      #adjust: #right
   762                               #adjust: #right
   764 			      #resizeForLabel: true
   763                               #resizeForLabel: true
   765 			  )
   764                           )
   766 			   #(#InputFieldSpec
   765                            #(#InputFieldSpec
   767 			      #name: 'methodNameField'
   766                               #name: 'methodNameField'
   768 			      #layout: #(#LayoutFrame 70 0.11 18 0 4 1.0 40 0)
   767                               #layout: #(#LayoutFrame 70 0.11 18 0 4 1.0 40 0)
   769 			      #tabable: true
   768                               #tabable: true
   770 			      #model: #methodNameChannel
   769                               #model: #methodNameChannel
   771 			      #group: #inputGroup
   770                               #group: #inputGroup
   772 			  )
   771                           )
   773 			   #(#LabelSpec
   772                            #(#LabelSpec
   774 			      #name: 'classLabel'
   773                               #name: 'classLabel'
   775 			      #layout: #(#AlignmentOrigin 67 0.11 54 0 1 0.5)
   774                               #layout: #(#AlignmentOrigin 67 0.11 54 0 1 0.5)
   776 			      #label: 'Class:'
   775                               #label: 'Class:'
   777 			      #translateLabel: true
   776                               #translateLabel: true
   778 			      #adjust: #right
   777                               #adjust: #right
   779 			      #resizeForLabel: true
   778                               #resizeForLabel: true
   780 			  )
   779                           )
   781 			   #(#InputFieldSpec
   780                            #(#InputFieldSpec
   782 			      #name: 'classNameField'
   781                               #name: 'classNameField'
   783 			      #layout: #(#LayoutFrame 70 0.11 43 0 4 1.0 65 0)
   782                               #layout: #(#LayoutFrame 70 0.11 43 0 4 1.0 65 0)
   784 			      #tabable: true
   783                               #tabable: true
   785 			      #model: #classNameChannel
   784                               #model: #classNameChannel
   786 			      #group: #inputGroup
   785                               #group: #inputGroup
   787 			  )
   786                           )
   788 			   #(#LabelSpec
   787                            #(#LabelSpec
   789 			      #name: 'superClassLabel'
   788                               #name: 'superClassLabel'
   790 			      #layout: #(#AlignmentOrigin 67 0.11 79 0 1 0.5)
   789                               #layout: #(#AlignmentOrigin 67 0.11 79 0 1 0.5)
   791 			      #label: 'Superclass:'
   790                               #label: 'Superclass:'
   792 			      #translateLabel: true
   791                               #translateLabel: true
   793 			      #adjust: #right
   792                               #adjust: #right
   794 			      #resizeForLabel: true
   793                               #resizeForLabel: true
   795 			  )
   794                           )
   796 			   #(#ComboBoxSpec
   795                            #(#ComboBoxSpec
   797 			      #name: 'superclassNameComboBox'
   796                               #name: 'superclassNameComboBox'
   798 			      #layout: #(#LayoutFrame 70 0.11 68 0 4 1.0 90 0)
   797                               #layout: #(#LayoutFrame 70 0.11 68 0 4 1.0 90 0)
   799 			      #tabable: true
   798                               #tabable: true
   800 			      #model: #superclassNameChannel
   799                               #model: #superclassNameChannel
   801 			      #comboList: #superclassNameDefaults
   800                               #comboList: #superclassNameDefaults
   802 			  )
   801                           )
   803 			)
   802                         )
   804 		    )
   803                     )
   805 		    #label: 'Define Class And Selector'
   804                     #label: 'Define Class And Selector'
   806 		    #labelPosition: #topLeft
   805                     #labelPosition: #topLeft
   807 		    #translateLabel: true
   806                     #translateLabel: true
   808 		)
   807                 )
   809 		 #(#UISubSpecification
   808                  #(#UISubSpecification
   810 		    #name: 'subSpec'
   809                     #name: 'subSpec'
   811 		    #layout: #(#LayoutFrame 0 0.0 -29 1 0 1.0 -5 1)
   810                     #layout: #(#LayoutFrame 0 0.0 -29 1 0 1.0 -5 1)
   812 		    #majorKey: #ToolApplicationModel
   811                     #majorKey: #ToolApplicationModel
   813 		    #minorKey: #windowSpecForCommitWithoutChannels
   812                     #minorKey: #windowSpecForCommitWithoutChannels
   814 		)
   813                 )
   815 	      )
   814               )
   816 	  )
   815           )
   817       )
   816       )
   818 
   817 
   819     "Modified: / 13.8.1998 / 19:59:44 / cg"
   818     "Modified: / 13.8.1998 / 19:59:44 / cg"
   820 !
   819 !
   821 
   820 
  1817 
  1816 
  1818     ^
  1817     ^
  1819      
  1818      
  1820        #(#Menu
  1819        #(#Menu
  1821           
  1820           
  1822 	   #(
  1821            #(
  1823 	     #(#MenuItem
  1822              #(#MenuItem
  1824 		#label: 'Up'
  1823                 #label: 'Up'
  1825 		#translateLabel: true
  1824                 #translateLabel: true
  1826 		#value: #doStepUp
  1825                 #value: #doStepUp
  1827 		#activeHelpKey: #moveWidgetUp
  1826                 #activeHelpKey: #moveWidgetUp
  1828 		#enabled: #canChangeOrderInContainer
  1827                 #enabled: #canChangeOrderInContainer
  1829 		#labelImage: #(#ResourceRetriever #Icon #upIcon 'Up')
  1828                 #labelImage: #(#ResourceRetriever #Icon #upIcon 'Up')
  1830 	    )
  1829             )
  1831 	     #(#MenuItem
  1830              #(#MenuItem
  1832 		#label: 'Down'
  1831                 #label: 'Down'
  1833 		#translateLabel: true
  1832                 #translateLabel: true
  1834 		#value: #doStepDown
  1833                 #value: #doStepDown
  1835 		#activeHelpKey: #moveWidgetDown
  1834                 #activeHelpKey: #moveWidgetDown
  1836 		#enabled: #canChangeOrderInContainer
  1835                 #enabled: #canChangeOrderInContainer
  1837 		#labelImage: #(#ResourceRetriever #Icon #downIcon 'Down')
  1836                 #labelImage: #(#ResourceRetriever #Icon #downIcon 'Down')
  1838 	    )
  1837             )
  1839 	     #(#MenuItem
  1838              #(#MenuItem
  1840 		#label: 'Into'
  1839                 #label: 'Into'
  1841 		#translateLabel: true
  1840                 #translateLabel: true
  1842 		#value: #doStepIn
  1841                 #value: #doStepIn
  1843 		#activeHelpKey: #moveWidgetInto
  1842                 #activeHelpKey: #moveWidgetInto
  1844 		#enabled: #canMoveSelectionIntoContainer
  1843                 #enabled: #canMoveSelectionIntoContainer
  1845 		#labelImage: #(#ResourceRetriever #Icon #downRightIcon 'Into')
  1844                 #labelImage: #(#ResourceRetriever #Icon #downRightIcon 'Into')
  1846 	    )
  1845             )
  1847 	     #(#MenuItem
  1846              #(#MenuItem
  1848 		#label: 'Out'
  1847                 #label: 'Out'
  1849 		#translateLabel: true
  1848                 #translateLabel: true
  1850 		#value: #doStepOut
  1849                 #value: #doStepOut
  1851 		#activeHelpKey: #moveWidgetOut
  1850                 #activeHelpKey: #moveWidgetOut
  1852 		#enabled: #canMoveSelectionOutOfContainer
  1851                 #enabled: #canMoveSelectionOutOfContainer
  1853 		#labelImage: #(#ResourceRetriever #Icon #leftDownIcon 'Out')
  1852                 #labelImage: #(#ResourceRetriever #Icon #leftDownIcon 'Out')
  1854 	    )
  1853             )
  1855 	  ) nil
  1854           ) nil
  1856 	  nil
  1855           nil
  1857       )
  1856       )
  1858 !
  1857 !
  1859 
  1858 
  1860 menuReplaceWidget
  1859 menuReplaceWidget
  1861     "This resource specification was automatically generated
  1860     "This resource specification was automatically generated
  2266     "returns a boolean value holder which is set to true if the gallery is shown"
  2265     "returns a boolean value holder which is set to true if the gallery is shown"
  2267 
  2266 
  2268     |holder|
  2267     |holder|
  2269 
  2268 
  2270     (holder := builder bindingAt:#galleryShown) isNil ifTrue:[
  2269     (holder := builder bindingAt:#galleryShown) isNil ifTrue:[
  2271 	builder aspectAt:#galleryShown put:(holder :=  true asValue).
  2270         builder aspectAt:#galleryShown put:(holder :=  true asValue).
  2272 	holder addDependent:self
  2271         holder addDependent:self
  2273     ].
  2272     ].
  2274     ^ holder
  2273     ^ holder
  2275 
  2274 
  2276 !
  2275 !
  2277 
  2276 
  2319     "returns a boolean value holder which is set to true if the painter is shown"
  2318     "returns a boolean value holder which is set to true if the painter is shown"
  2320 
  2319 
  2321     |holder|
  2320     |holder|
  2322 
  2321 
  2323     (holder := builder bindingAt:#painterShown) isNil ifTrue:[
  2322     (holder := builder bindingAt:#painterShown) isNil ifTrue:[
  2324 	builder aspectAt:#painterShown put:(holder :=  true asValue).
  2323         builder aspectAt:#painterShown put:(holder :=  true asValue).
  2325 	holder addDependent:self
  2324         holder addDependent:self
  2326     ].
  2325     ].
  2327     ^ holder
  2326     ^ holder
  2328 
  2327 
  2329 !
  2328 !
  2330 
  2329 
  2344     "returns a value holder which keeps the label of the current section in the notebook"
  2343     "returns a value holder which keeps the label of the current section in the notebook"
  2345 
  2344 
  2346     |holder|
  2345     |holder|
  2347 
  2346 
  2348     (holder := builder bindingAt:#tabModel) isNil ifTrue:[
  2347     (holder := builder bindingAt:#tabModel) isNil ifTrue:[
  2349 	holder := AspectAdaptor new subject:self; forAspect:#tabSelection.
  2348         holder := AspectAdaptor new subject:self; forAspect:#tabSelection.
  2350 	builder aspectAt:#tabModel put:holder.
  2349         builder aspectAt:#tabModel put:holder.
  2351     ].
  2350     ].
  2352     ^ holder
  2351     ^ holder
  2353 !
  2352 !
  2354 
  2353 
  2355 treeView
  2354 treeView
  2477     "opens a Hierarchical List Editor on current widget"
  2476     "opens a Hierarchical List Editor on current widget"
  2478 
  2477 
  2479     |selector editor spec|
  2478     |selector editor spec|
  2480 
  2479 
  2481     (self resolveName:specClassName) isNil ifTrue:[
  2480     (self resolveName:specClassName) isNil ifTrue:[
  2482 	self askForSaving ifFalse: [^self]
  2481         self askForSaving ifFalse: [^self]
  2483     ].
  2482     ].
  2484 
  2483 
  2485     spec := self specTool specification.
  2484     spec := self specTool specification.
  2486     (selector := spec hierarchicalList) notNil ifTrue:[
  2485     (selector := spec hierarchicalList) notNil ifTrue:[
  2487 	selector := selector asSymbol
  2486         selector := selector asSymbol
  2488     ].
  2487     ].
  2489 
  2488 
  2490     editor := HierarchicalListEditor new.
  2489     editor := HierarchicalListEditor new.
  2491     editor masterApplication:self.
  2490     editor masterApplication:self.
  2492     editor openModalOnClass:specClassName andSelector:selector.
  2491     editor openModalOnClass:specClassName andSelector:selector.
  2493 
  2492 
  2494     editor specSelector ~= selector ifTrue:[
  2493     editor specSelector ~= selector ifTrue:[
  2495 	editor hasSaved ifTrue:[
  2494         editor hasSaved ifTrue:[
  2496 	    spec hierarchicalList:editor specSelector.
  2495             spec hierarchicalList:editor specSelector.
  2497 	    self modifiedChannel value:true.
  2496             self modifiedChannel value:true.
  2498 	    self accept
  2497             self accept
  2499 	]
  2498         ]
  2500     ]
  2499     ]
  2501 
  2500 
  2502     "Modified: / 16.7.1998 / 18:15:46 / cg"
  2501     "Modified: / 16.7.1998 / 18:15:46 / cg"
  2503 !
  2502 !
  2504 
  2503 
  2896     "asks for defining an application class"
  2895     "asks for defining an application class"
  2897 
  2896 
  2898     self askForSectionModification.    
  2897     self askForSectionModification.    
  2899 
  2898 
  2900     ((YesNoBox title:'No application class defined yet!!')        
  2899     ((YesNoBox title:'No application class defined yet!!')        
  2901 	noText:'Cancel';
  2900         noText:'Cancel';
  2902 	yesText:'Define';
  2901         yesText:'Define';
  2903 	showAtPointer;
  2902         showAtPointer;
  2904 	accepted) ifFalse: [^false].
  2903         accepted) ifFalse: [^false].
  2905 
  2904 
  2906     self doSave.
  2905     self doSave.
  2907 
  2906 
  2908     ^true
  2907     ^true
  2909 !
  2908 !
  2910 
  2909 
  2911 askForSectionModification
  2910 askForSectionModification
  2912     "asks for section modification in the notebook"
  2911     "asks for section modification in the notebook"
  2913 
  2912 
  2914     self isModified ifTrue:[
  2913     self isModified ifTrue:[
  2915 	(self confirm:'Accept modifications in section ' , tabSelection printString asBoldText, '?') ifTrue:[
  2914         (self confirm:'Accept modifications in section ' , tabSelection printString asBoldText, '?') ifTrue:[
  2916 	    self accept
  2915             self accept
  2917 	] ifFalse: [
  2916         ] ifFalse: [
  2918 	    self cancel
  2917             self cancel
  2919 	]
  2918         ]
  2920     ]
  2919     ]
  2921 !
  2920 !
  2922 
  2921 
  2923 checkClassAndSelector
  2922 checkClassAndSelector
  2924     "checks for class & superclass"
  2923     "checks for class & superclass"
  3080     "sets view for layout tool"
  3079     "sets view for layout tool"
  3081 
  3080 
  3082     |type|
  3081     |type|
  3083 
  3082 
  3084     self painter topView == aView ifTrue:[
  3083     self painter topView == aView ifTrue:[
  3085 	type := #Extent
  3084         type := #Extent
  3086     ].
  3085     ].
  3087     self layoutTool layoutView:aView type:type spec:aSpec
  3086     self layoutTool layoutView:aView type:type spec:aSpec
  3088 
  3087 
  3089 !
  3088 !
  3090 
  3089 
  3158 hasSpecClassAndSelector
  3157 hasSpecClassAndSelector
  3159     "answers whether an application class and a selector under which
  3158     "answers whether an application class and a selector under which
  3160      the window spec is stored is defined"
  3159      the window spec is stored is defined"
  3161 
  3160 
  3162     specSelector size > 1 ifTrue:[
  3161     specSelector size > 1 ifTrue:[
  3163 	^ self hasSpecClass
  3162         ^ self hasSpecClass
  3164     ].
  3163     ].
  3165     ^ false
  3164     ^ false
  3166 !
  3165 !
  3167 
  3166 
  3168 isHelpToolSelected
  3167 isHelpToolSelected
  3408     "handles a close request for a specific view"
  3407     "handles a close request for a specific view"
  3409 
  3408 
  3410     |topView|
  3409     |topView|
  3411 
  3410 
  3412     (topView := self window) == aTopView ifTrue:[
  3411     (topView := self window) == aTopView ifTrue:[
  3413 	super closeRequestFor:aTopView
  3412         super closeRequestFor:aTopView
  3414     ] ifFalse:[
  3413     ] ifFalse:[
  3415 	aTopView = selectionPanel window ifTrue:[
  3414         aTopView = selectionPanel window ifTrue:[
  3416 	    self galleryShown value:false
  3415             self galleryShown value:false
  3417 	] ifFalse:[
  3416         ] ifFalse:[
  3418 	    aTopView == (self painter topView) ifTrue:[
  3417             aTopView == (self painter topView) ifTrue:[
  3419 		self painterShown value:false
  3418                 self painterShown value:false
  3420 	    ] ifFalse:[
  3419             ] ifFalse:[
  3421 		aTopView closeRequest
  3420                 aTopView closeRequest
  3422 	    ]
  3421             ]
  3423 	].
  3422         ].
  3424 	topView raise.
  3423         topView raise.
  3425     ].
  3424     ].
  3426 !
  3425 !
  3427 
  3426 
  3428 commonPostBuild
  3427 commonPostBuild
  3429     "sets the root of the tree view as first selection;
  3428     "sets the root of the tree view as first selection;
  4099     "opens an inspector on the view of the selected widget"
  4098     "opens an inspector on the view of the selected widget"
  4100 
  4099 
  4101     |selection|
  4100     |selection|
  4102 
  4101 
  4103     ((selection := self painter selection) isCollection and: [selection size >= 1]) ifTrue:[
  4102     ((selection := self painter selection) isCollection and: [selection size >= 1]) ifTrue:[
  4104 	selection first inspect
  4103         selection first inspect
  4105     ] ifFalse: [
  4104     ] ifFalse: [
  4106 	selection inspect
  4105         selection inspect
  4107     ]
  4106     ]
  4108 
  4107 
  4109 !
  4108 !
  4110 
  4109 
  4111 doLoad
  4110 doLoad
  4193     |view|
  4192     |view|
  4194 
  4193 
  4195     self askForModification ifFalse: [^nil].
  4194     self askForModification ifFalse: [^nil].
  4196 
  4195 
  4197     (view := Screen current viewFromUser) notNil ifTrue:[
  4196     (view := Screen current viewFromUser) notNil ifTrue:[
  4198 	view == Screen current rootView ifFalse:[
  4197         view == Screen current rootView ifFalse:[
  4199 	    self painter setupFromSpec:(UISpecification fromView:view topView).
  4198             self painter setupFromSpec:(UISpecification fromView:view topView).
  4200 	]
  4199         ]
  4201     ].
  4200     ].
  4202 
  4201 
  4203     self updateInfoLabel
  4202     self updateInfoLabel
  4204 
  4203 
  4205 !
  4204 !
  4340     "opens a code view with the contents of the window spec"
  4339     "opens a code view with the contents of the window spec"
  4341 
  4340 
  4342     self askForSectionModification.
  4341     self askForSectionModification.
  4343 
  4342 
  4344     CodeView 
  4343     CodeView 
  4345 	openWith: self painter generateWindowSpecMethodSource 
  4344         openWith: self painter generateWindowSpecMethodSource 
  4346 	title: 'Window Spec'
  4345         title: 'Window Spec'
  4347 
  4346 
  4348 !
  4347 !
  4349 
  4348 
  4350 replaceWidgetByClass:aSpecOrWidgetClass
  4349 replaceWidgetByClass:aSpecOrWidgetClass
  4351     |specClass oldSpec newSpec sel painter|
  4350     |specClass oldSpec newSpec sel painter|
  4380 documentation
  4379 documentation
  4381 "
  4380 "
  4382     selection in tree view; only used by the UIPainter
  4381     selection in tree view; only used by the UIPainter
  4383 
  4382 
  4384     [see also:]
  4383     [see also:]
  4385 	SelectionInTreeView
  4384         SelectionInTreeView
  4386 	SelectionInTree
  4385         SelectionInTree
  4387 	TreeItem
  4386         TreeItem
  4388 	UIPainter
  4387         UIPainter
  4389 
  4388 
  4390     [author:]
  4389     [author:]
  4391 	Claus Atzkern
  4390         Claus Atzkern
  4392 "
  4391 "
  4393 
  4392 
  4394 
  4393 
  4395 ! !
  4394 ! !
  4396 
  4395 
  4482 
  4481 
  4483 itemOfView:aView
  4482 itemOfView:aView
  4484     "returns item assigned to view or nil"
  4483     "returns item assigned to view or nil"
  4485 
  4484 
  4486     aView notNil ifTrue:[
  4485     aView notNil ifTrue:[
  4487 	self allItemsDo:[:anItem|
  4486         self allItemsDo:[:anItem|
  4488 	    (anItem contents view == aView) ifTrue:[^ anItem]
  4487             (anItem contents view == aView) ifTrue:[^ anItem]
  4489 	]
  4488         ]
  4490     ].
  4489     ].
  4491     ^ nil
  4490     ^ nil
  4492 
  4491 
  4493 
  4492 
  4494 !
  4493 !
  4525 
  4524 
  4526 propertyDetect:aOneArgBlock
  4525 propertyDetect:aOneArgBlock
  4527     "evaluates the block on each property"
  4526     "evaluates the block on each property"
  4528 
  4527 
  4529     self allItemsDo:[:anItem|
  4528     self allItemsDo:[:anItem|
  4530 	(aOneArgBlock value:(anItem contents)) ifTrue:[^ anItem contents]
  4529         (aOneArgBlock value:(anItem contents)) ifTrue:[^ anItem contents]
  4531     ].
  4530     ].
  4532     ^ nil
  4531     ^ nil
  4533 
  4532 
  4534 !
  4533 !
  4535 
  4534 
  4538      or empty selection "
  4537      or empty selection "
  4539 
  4538 
  4540     |idx|
  4539     |idx|
  4541 
  4540 
  4542     selection size == 1 ifTrue:[
  4541     selection size == 1 ifTrue:[
  4543 	(idx := selection first) ~~ 1 ifTrue:[          "canvas: not yet supported"
  4542         (idx := selection first) ~~ 1 ifTrue:[          "canvas: not yet supported"
  4544 	    ^ (listOfNodes at:idx) contents
  4543             ^ (listOfNodes at:idx) contents
  4545 	]
  4544         ]
  4546     ].
  4545     ].
  4547     ^ nil
  4546     ^ nil
  4548 
  4547 
  4549 ! !
  4548 ! !
  4550 
  4549 
  4567 
  4566 
  4568     lastDrawnMaster := nil.
  4567     lastDrawnMaster := nil.
  4569     windowSpec := nil.
  4568     windowSpec := nil.
  4570 
  4569 
  4571     self canvas subViews copy do:[:aView|
  4570     self canvas subViews copy do:[:aView|
  4572 	"/ care to not destroy the transparent input view
  4571         "/ care to not destroy the transparent input view
  4573 	(aView isInputOnly) ifFalse:[aView destroy]
  4572         (aView isInputOnly) ifFalse:[aView destroy]
  4574     ].
  4573     ].
  4575     model root name: UIPainter defaultNameOfCanvas asBoldText.
  4574     model root name: UIPainter defaultNameOfCanvas asBoldText.
  4576     model removeAllOtherThanRoot.
  4575     model removeAllOtherThanRoot.
  4577 
  4576 
  4578 !
  4577 !
  4581     "removes a view"
  4580     "removes a view"
  4582 
  4581 
  4583     |item prnt|
  4582     |item prnt|
  4584 
  4583 
  4585     ((item := self itemOfView:aView) notNil and:[(prnt := item parent) notNil]) ifTrue:[
  4584     ((item := self itemOfView:aView) notNil and:[(prnt := item parent) notNil]) ifTrue:[
  4586 	aView destroy.
  4585         aView destroy.
  4587 	prnt contents view sizeChanged:nil.
  4586         prnt contents view sizeChanged:nil.
  4588 	model remove:item
  4587         model remove:item
  4589     ]
  4588     ]
  4590 
  4589 
  4591 
  4590 
  4592 ! !
  4591 ! !
  4593 
  4592 
  4600 
  4599 
  4601     fullSpec := FullSpec new.
  4600     fullSpec := FullSpec new.
  4602     fullSpec name:specNameSymbol.
  4601     fullSpec name:specNameSymbol.
  4603 
  4602 
  4604     fullSpec fromBuilder:(self canvas topView)
  4603     fullSpec fromBuilder:(self canvas topView)
  4605 	      components:(SpecCollection new collection:aSpecArray).
  4604               components:(SpecCollection new collection:aSpecArray).
  4606 
  4605 
  4607     windowSpec notNil ifTrue:[
  4606     windowSpec notNil ifTrue:[
  4608 	winSpec := fullSpec window.
  4607         winSpec := fullSpec window.
  4609 	winSpec copyValuesFromSpec:windowSpec.
  4608         winSpec copyValuesFromSpec:windowSpec.
  4610 	winSpec name: winSpec label.
  4609         winSpec name: winSpec label.
  4611     ].    
  4610     ].    
  4612     ^ fullSpec literalArrayEncoding.
  4611     ^ fullSpec literalArrayEncoding.
  4613 
  4612 
  4614 !
  4613 !
  4615 
  4614 
  4637     "canvas changed its selection
  4636     "canvas changed its selection
  4638     "
  4637     "
  4639     |sel list size|
  4638     |sel list size|
  4640 
  4639 
  4641     ((sel := aSelection) isNil or:[sel isCollection]) ifFalse:[
  4640     ((sel := aSelection) isNil or:[sel isCollection]) ifFalse:[
  4642 	sel := Array with:sel
  4641         sel := Array with:sel
  4643     ].
  4642     ].
  4644 
  4643 
  4645     (size := sel size) ~~ 0 ifTrue:[
  4644     (size := sel size) ~~ 0 ifTrue:[
  4646 	list := OrderedCollection new:size.
  4645         list := OrderedCollection new:size.
  4647 
  4646 
  4648 	sel do:[:aView||item|
  4647         sel do:[:aView||item|
  4649 	    (item := self itemOfView:aView) notNil ifTrue:[
  4648             (item := self itemOfView:aView) notNil ifTrue:[
  4650 		list add:item.
  4649                 list add:item.
  4651 		model doMakeVisible:item.
  4650                 model doMakeVisible:item.
  4652 	    ]
  4651             ]
  4653 	].
  4652         ].
  4654 	sel := list collect:[:anItem| self indexOfNode:anItem ].
  4653         sel := list collect:[:anItem| self indexOfNode:anItem ].
  4655     ].
  4654     ].
  4656     self cvsEventsDisabledDo:[ self selection:sel ].            
  4655     self cvsEventsDisabledDo:[ self selection:sel ].            
  4657 
  4656 
  4658 
  4657 
  4659 
  4658 
  4666     |item index oldSel|
  4665     |item index oldSel|
  4667 
  4666 
  4668     item := self itemOfView:aView.
  4667     item := self itemOfView:aView.
  4669 
  4668 
  4670     item notNil ifTrue:[
  4669     item notNil ifTrue:[
  4671 	model doMakeVisible:item.
  4670         model doMakeVisible:item.
  4672 
  4671 
  4673 	(index := self indexOfNode:item) ~~ 0 ifTrue:[
  4672         (index := self indexOfNode:item) ~~ 0 ifTrue:[
  4674 	    oldSel := selection copy.
  4673             oldSel := selection copy.
  4675 	    self addToSelection:index.
  4674             self addToSelection:index.
  4676 	    self selectionChangedFrom:oldSel
  4675             self selectionChangedFrom:oldSel
  4677 	]        
  4676         ]        
  4678     ]            
  4677     ]            
  4679 
  4678 
  4680 
  4679 
  4681 
  4680 
  4682 !
  4681 !
  4688 
  4687 
  4689     (     (item := self itemOfView:aView) notNil
  4688     (     (item := self itemOfView:aView) notNil
  4690      and:[(index := self indexOfNode:item) ~~ 0
  4689      and:[(index := self indexOfNode:item) ~~ 0
  4691      and:[self isInSelection:index]]
  4690      and:[self isInSelection:index]]
  4692     ) ifTrue:[
  4691     ) ifTrue:[
  4693 	oldSel := selection copy.
  4692         oldSel := selection copy.
  4694 	self removeFromSelection:index.
  4693         self removeFromSelection:index.
  4695 	self selectionChangedFrom:oldSel.
  4694         self selectionChangedFrom:oldSel.
  4696     ].
  4695     ].
  4697 
  4696 
  4698 
  4697 
  4699 ! !
  4698 ! !
  4700 
  4699 
  4710     (    aName size ~~ 0
  4709     (    aName size ~~ 0
  4711      and:[(name := aName string withoutSeparators) size ~~ 0
  4710      and:[(name := aName string withoutSeparators) size ~~ 0
  4712      and:[(self propertyDetect:[:p| p name = name]) isNil
  4711      and:[(self propertyDetect:[:p| p name = name]) isNil
  4713      and:[node name ~= name]]]
  4712      and:[node name ~= name]]]
  4714     ) ifTrue:[
  4713     ) ifTrue:[
  4715 	node name: name asBoldText.
  4714         node name: name asBoldText.
  4716 	node changed.   
  4715         node changed.   
  4717     ].
  4716     ].
  4718 !
  4717 !
  4719 
  4718 
  4720 layoutChanged
  4719 layoutChanged
  4721     "layout of any component changed; in case of single selection, the
  4720     "layout of any component changed; in case of single selection, the
  4722      application will be informed to update its layout
  4721      application will be informed to update its layout
  4723     "
  4722     "
  4724     selection size == 1 ifTrue:[
  4723     selection size == 1 ifTrue:[
  4725 	self application layoutChanged
  4724         self application layoutChanged
  4726     ]
  4725     ]
  4727 
  4726 
  4728 
  4727 
  4729 !
  4728 !
  4730 
  4729 
  4734     |item idx end|
  4733     |item idx end|
  4735 
  4734 
  4736     item := self itemOfView:(aProperty view).
  4735     item := self itemOfView:(aProperty view).
  4737 
  4736 
  4738     item notNil ifTrue:[
  4737     item notNil ifTrue:[
  4739 	item contents:aProperty.
  4738         item contents:aProperty.
  4740 
  4739 
  4741 	item name = aProperty name ifFalse:[
  4740         item name = aProperty name ifFalse:[
  4742 	    idx := self firstLineShown.
  4741             idx := self firstLineShown.
  4743 
  4742 
  4744 	    (end := self lastLineShown) > listOfNodes size ifTrue:[
  4743             (end := self lastLineShown) > listOfNodes size ifTrue:[
  4745 		end := listOfNodes size
  4744                 end := listOfNodes size
  4746 	    ].                          
  4745             ].                          
  4747 	    item changed.   
  4746             item changed.   
  4748 
  4747 
  4749 	    [idx <= end] whileTrue:[
  4748             [idx <= end] whileTrue:[
  4750 		(listOfNodes at:idx) == item ifTrue:[
  4749                 (listOfNodes at:idx) == item ifTrue:[
  4751 		    self redrawLine:idx.                "/ is visible; redraw line
  4750                     self redrawLine:idx.                "/ is visible; redraw line
  4752 		    end := 0
  4751                     end := 0
  4753 		] ifFalse:[
  4752                 ] ifFalse:[
  4754 		    idx := idx + 1
  4753                     idx := idx + 1
  4755 		]
  4754                 ]
  4756 	    ]
  4755             ]
  4757 	].
  4756         ].
  4758 
  4757 
  4759 	self selectedNode == item ifTrue:[              "/ inform application
  4758         self selectedNode == item ifTrue:[              "/ inform application
  4760 	    self application propertyChanged
  4759             self application propertyChanged
  4761 	]
  4760         ]
  4762     ].
  4761     ].
  4763 
  4762 
  4764 
  4763 
  4765 ! !
  4764 ! !
  4766 
  4765 
  4860 
  4859 
  4861 doubleClicked
  4860 doubleClicked
  4862     "disables collapsing of the root item"
  4861     "disables collapsing of the root item"
  4863 
  4862 
  4864     self selectedNode == model root ifFalse:[
  4863     self selectedNode == model root ifFalse:[
  4865 	super doubleClicked
  4864         super doubleClicked
  4866     ]
  4865     ]
  4867 
  4866 
  4868 
  4867 
  4869 !
  4868 !
  4870 
  4869 
  4874     |dX|
  4873     |dX|
  4875 
  4874 
  4876     super redrawLabelAt:x y:yTop index:anIndex.
  4875     super redrawLabelAt:x y:yTop index:anIndex.
  4877 
  4876 
  4878     ((selection size > 1) and: [selection first == anIndex]) ifTrue:[
  4877     ((selection size > 1) and: [selection first == anIndex]) ifTrue:[
  4879 	dX := textInset - 1.
  4878         dX := textInset - 1.
  4880 	self paint:(Color red). "/ self application painter handleMasterColor.
  4879         self paint:(Color red). "/ self application painter handleMasterColor.
  4881 	self fillRectangleX:(x - dX - 2)
  4880         self fillRectangleX:(x - dX - 2)
  4882 			  y:yTop + ((fontHeight - dX) // 2)
  4881                           y:yTop + ((fontHeight - dX) // 2)
  4883 		      width:dX
  4882                       width:dX
  4884 		     height:dX
  4883                      height:dX
  4885     ]
  4884     ]
  4886 ! !
  4885 ! !
  4887 
  4886 
  4888 !UIPainter::TreeView methodsFor:'initialization'!
  4887 !UIPainter::TreeView methodsFor:'initialization'!
  4889 
  4888 
  4897     self showDirectoryIndicator: true.
  4896     self showDirectoryIndicator: true.
  4898     self showDirectoryIndicatorForRoot: false.
  4897     self showDirectoryIndicatorForRoot: false.
  4899 
  4898 
  4900     self model iconAction: 
  4899     self model iconAction: 
  4901     [:aNode|
  4900     [:aNode|
  4902 	|specClass|       
  4901         |specClass|       
  4903 	(specClass := aNode contents spec) isNil 
  4902         (specClass := aNode contents spec) isNil 
  4904 	    ifTrue: [WindowSpec icon]
  4903             ifTrue: [WindowSpec icon]
  4905 	    ifFalse:[specClass class icon]
  4904             ifFalse:[specClass class icon]
  4906     ].
  4905     ].
  4907 
  4906 
  4908     self model labelAction: 
  4907     self model labelAction: 
  4909     [:aNode|
  4908     [:aNode|
  4910 	|spec|
  4909         |spec|
  4911 	(spec := aNode contents spec) notNil
  4910         (spec := aNode contents spec) notNil
  4912 	    ifTrue: [self nameForSpecInList:spec] 
  4911             ifTrue: [self nameForSpecInList:spec] 
  4913 	    ifFalse:[aNode name]
  4912             ifFalse:[aNode name]
  4914     ]
  4913     ]
  4915 ! !
  4914 ! !
  4916 
  4915 
  4917 !UIPainter::TreeView methodsFor:'private'!
  4916 !UIPainter::TreeView methodsFor:'private'!
  4918 
  4917 
  4930 
  4929 
  4931     super selectionChangedFrom:oldSelection.
  4930     super selectionChangedFrom:oldSelection.
  4932     size := selection size.
  4931     size := selection size.
  4933 
  4932 
  4934     cvsEventsDisabled ifFalse:[
  4933     cvsEventsDisabled ifFalse:[
  4935 	(size ~~ 0 and:[size ~~ 1 or:[selection first ~~ 1]]) ifTrue:[
  4934         (size ~~ 0 and:[size ~~ 1 or:[selection first ~~ 1]]) ifTrue:[
  4936 	    sel := OrderedCollection new.
  4935             sel := OrderedCollection new.
  4937 
  4936 
  4938 	    selection do:[:i|
  4937             selection do:[:i|
  4939 		i ~~ 1 ifTrue:[sel add:(listOfNodes at:i) contents view]
  4938                 i ~~ 1 ifTrue:[sel add:(listOfNodes at:i) contents view]
  4940 	    ]
  4939             ]
  4941 	].
  4940         ].
  4942 	self canvas updateSelectionFromModel:sel
  4941         self canvas updateSelectionFromModel:sel
  4943     ].             
  4942     ].             
  4944     size = 1 ifTrue:[
  4943     size = 1 ifTrue:[
  4945 	oldSelection size > 1 ifTrue: [
  4944         oldSelection size > 1 ifTrue: [
  4946 	    (listOfNodes at:lastDrawnMaster) retrieveLabel.
  4945             (listOfNodes at:lastDrawnMaster) retrieveLabel.
  4947 	    self redrawLine: lastDrawnMaster. 
  4946             self redrawLine: lastDrawnMaster. 
  4948 	    lastDrawnMaster := selection first
  4947             lastDrawnMaster := selection first
  4949 	]
  4948         ]
  4950     ].
  4949     ].
  4951     size > 1 ifTrue:[
  4950     size > 1 ifTrue:[
  4952 	selection first ~~ lastDrawnMaster ifTrue: [
  4951         selection first ~~ lastDrawnMaster ifTrue: [
  4953 	    (listOfNodes at:selection first) retrieveLabel.
  4952             (listOfNodes at:selection first) retrieveLabel.
  4954 	    lastDrawnMaster notNil ifTrue: [(listOfNodes at:lastDrawnMaster) retrieveLabel].
  4953             lastDrawnMaster notNil ifTrue: [(listOfNodes at:lastDrawnMaster) retrieveLabel].
  4955 	    self redrawLine: lastDrawnMaster. 
  4954             self redrawLine: lastDrawnMaster. 
  4956 	    self redrawLine: (lastDrawnMaster := selection first)
  4955             self redrawLine: (lastDrawnMaster := selection first)
  4957 	]
  4956         ]
  4958     ]         
  4957     ]         
  4959     ifFalse: [
  4958     ifFalse: [
  4960 	lastDrawnMaster := nil
  4959         lastDrawnMaster := nil
  4961     ] 
  4960     ] 
  4962 ! !
  4961 ! !
  4963 
  4962 
  4964 !UIPainter::TreeView methodsFor:'queries'!
  4963 !UIPainter::TreeView methodsFor:'queries'!
  4965 
  4964 
  4988 canMoveOrAlignSelection
  4987 canMoveOrAlignSelection
  4989     "returns true if any selection exists and all widgets in the selection
  4988     "returns true if any selection exists and all widgets in the selection
  4990      can change their layout through to a move or align operation"
  4989      can change their layout through to a move or align operation"
  4991 
  4990 
  4992     selection size == 0 ifTrue:[
  4991     selection size == 0 ifTrue:[
  4993 	^ false
  4992         ^ false
  4994     ].
  4993     ].
  4995 
  4994 
  4996     selection do:[:i|
  4995     selection do:[:i|
  4997 	i == 1 ifTrue:[^ false].
  4996         i == 1 ifTrue:[^ false].
  4998 
  4997 
  4999 	(self canvas canChangeLayoutOfView:((listOfNodes at:i) contents view)) ifFalse:[
  4998         (self canvas canChangeLayoutOfView:((listOfNodes at:i) contents view)) ifFalse:[
  5000 	    ^ false
  4999             ^ false
  5001 	]
  5000         ]
  5002     ].
  5001     ].
  5003     ^ true
  5002     ^ true
  5004 !
  5003 !
  5005 
  5004 
  5006 canMoveSelectionIntoContainer
  5005 canMoveSelectionIntoContainer
  5027 
  5026 
  5028     (     (item := self selectedNode) isNil
  5027     (     (item := self selectedNode) isNil
  5029       or:[(prnt := item parent) isNil
  5028       or:[(prnt := item parent) isNil
  5030       or:[prnt parent isNil]]
  5029       or:[prnt parent isNil]]
  5031     ) ifTrue:[
  5030     ) ifTrue:[
  5032 	^ false
  5031         ^ false
  5033     ].
  5032     ].
  5034     ^ true
  5033     ^ true
  5035 !
  5034 !
  5036 
  5035 
  5037 canResizeSelectedWidget
  5036 canResizeSelectedWidget
  5039      within a widget which allows to resize sub components"
  5038      within a widget which allows to resize sub components"
  5040 
  5039 
  5041     |selectedNode|
  5040     |selectedNode|
  5042 
  5041 
  5043     (selectedNode := self selectedNode) notNil ifTrue:[
  5042     (selectedNode := self selectedNode) notNil ifTrue:[
  5044 	(selectedNode := selectedNode parent) notNil ifTrue:[
  5043         (selectedNode := selectedNode parent) notNil ifTrue:[
  5045 	    ^ (selectedNode parent isNil or:[selectedNode contents spec class canResizeSubComponents])
  5044             ^ (selectedNode parent isNil or:[selectedNode contents spec class canResizeSubComponents])
  5046 	]
  5045         ]
  5047     ].
  5046     ].
  5048     ^ false
  5047     ^ false
  5049 !
  5048 !
  5050 
  5049 
  5051 hasOneSelectionOtherThanCanvas
  5050 hasOneSelectionOtherThanCanvas
  5109     (     (item := self selectedNode) isNil
  5108     (     (item := self selectedNode) isNil
  5110       or:[(prnt := item parent) isNil
  5109       or:[(prnt := item parent) isNil
  5111       or:[(prnt := prnt childAt:((prnt indexOfChild:item) + 1)) isNil
  5110       or:[(prnt := prnt childAt:((prnt indexOfChild:item) + 1)) isNil
  5112       or:[prnt contents spec class supportsSubComponents not]]]
  5111       or:[prnt contents spec class supportsSubComponents not]]]
  5113     ) ifFalse:[
  5112     ) ifFalse:[
  5114 	self doChangeHierarchyOf:prnt
  5113         self doChangeHierarchyOf:prnt
  5115     ]
  5114     ]
  5116 !
  5115 !
  5117 
  5116 
  5118 doStepOut
  5117 doStepOut
  5119     |item|
  5118     |item|
  5120 
  5119 
  5121     ((item := self selectedNode) notNil and:[(item := item parent) notNil]) ifTrue:[
  5120     ((item := self selectedNode) notNil and:[(item := item parent) notNil]) ifTrue:[
  5122 	self doChangeHierarchyOf:(item parent)
  5121         self doChangeHierarchyOf:(item parent)
  5123     ].
  5122     ].
  5124 !
  5123 !
  5125 
  5124 
  5126 doStepOver:anIndex
  5125 doStepOver:anIndex
  5127     "moves child 'anOffset' forward or backward in list of children"
  5126     "moves child 'anOffset' forward or backward in list of children"