UIPainter.st
changeset 2217 b54632779619
parent 2213 cb1e13d68761
child 2218 01fdf3323d89
equal deleted inserted replaced
2216:83fa306392ad 2217:b54632779619
     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:'UseViewScroller'
    17         classVariableNames:'SelectionPanelClass UseViewScroller'
    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'!
    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 
       
    97 selectionPanelClass:something
       
    98     "set the class used as selection panel.
       
    99      this is UISelectionPanel as default"
       
   100 
       
   101     SelectionPanelClass := something.
    95 ! !
   102 ! !
    96 
   103 
    97 !UIPainter class methodsFor:'help specs'!
   104 !UIPainter class methodsFor:'help specs'!
    98 
   105 
    99 flyByHelpSpec
   106 flyByHelpSpec
   323 convertString:aString maxLineSize:maxCharactersPerLine skipLineFeed:skipLineFeed
   330 convertString:aString maxLineSize:maxCharactersPerLine skipLineFeed:skipLineFeed
   324     "converts a string to a string collection with maximum characters
   331     "converts a string to a string collection with maximum characters
   325      per line
   332      per line
   326     "
   333     "
   327     |stream
   334     |stream
   328 	max     "{ Class:SmallInteger }"
   335         max     "{ Class:SmallInteger }"
   329 	size    "{ Class:SmallInteger }"
   336         size    "{ Class:SmallInteger }"
   330 	start   "{ Class:SmallInteger }"
   337         start   "{ Class:SmallInteger }"
   331 	stop    "{ Class:SmallInteger }"
   338         stop    "{ Class:SmallInteger }"
   332 	cpySz   "{ Class:SmallInteger }"
   339         cpySz   "{ Class:SmallInteger }"
   333 	lnSz    "{ Class:SmallInteger }"
   340         lnSz    "{ Class:SmallInteger }"
   334 	atBeginOfLine|
   341         atBeginOfLine|
   335 
   342 
   336     maxCharactersPerLine < 20 ifFalse:[max := maxCharactersPerLine - 1]
   343     maxCharactersPerLine < 20 ifFalse:[max := maxCharactersPerLine - 1]
   337 			       ifTrue:[max := 20].
   344                                ifTrue:[max := 20].
   338 
   345 
   339     (size := aString size) <= max ifTrue:[
   346     (size := aString size) <= max ifTrue:[
   340 	^ aString
   347         ^ aString
   341     ].
   348     ].
   342     start  := 1.
   349     start  := 1.
   343     lnSz   := 0.
   350     lnSz   := 0.
   344     stream := (String new:size) writeStream.
   351     stream := (String new:size) writeStream.
   345 
   352 
   346     atBeginOfLine := true.
   353     atBeginOfLine := true.
   347 
   354 
   348     [start <= size] whileTrue:[
   355     [start <= size] whileTrue:[
   349 	(start := aString indexOfNonSeparatorStartingAt:start) == 0 ifTrue:[
   356         (start := aString indexOfNonSeparatorStartingAt:start) == 0 ifTrue:[
   350 	    ^ stream contents
   357             ^ stream contents
   351 	].
   358         ].
   352 	(aString at:start) == $\ ifTrue:[
   359         (aString at:start) == $\ ifTrue:[
   353 	    skipLineFeed ifFalse:[
   360             skipLineFeed ifFalse:[
   354 		stream nextPut:$\
   361                 stream nextPut:$\
   355 	    ].
   362             ].
   356 	    start := start + 1.
   363             start := start + 1.
   357 	    stream cr.
   364             stream cr.
   358 	    start := start + 1.
   365             start := start + 1.
   359 	    lnSz := 0.
   366             lnSz := 0.
   360 	] ifFalse:[
   367         ] ifFalse:[
   361 	    (stop := aString indexOfSeparatorStartingAt:start) == 0 ifTrue:[
   368             (stop := aString indexOfSeparatorStartingAt:start) == 0 ifTrue:[
   362 		stop := size + 1
   369                 stop := size + 1
   363 	    ].
   370             ].
   364 	    (aString at:(stop - 1)) == $\ ifTrue:[
   371             (aString at:(stop - 1)) == $\ ifTrue:[
   365 		stop := stop - 1
   372                 stop := stop - 1
   366 	    ].
   373             ].
   367 	    cpySz := stop - start.
   374             cpySz := stop - start.
   368 
   375 
   369 	    lnSz == 0 ifFalse:[
   376             lnSz == 0 ifFalse:[
   370 		(lnSz := lnSz + cpySz) >= max ifTrue:[stream cr.    lnSz := cpySz. atBeginOfLine := true. ]
   377                 (lnSz := lnSz + cpySz) >= max ifTrue:[stream cr.    lnSz := cpySz. atBeginOfLine := true. ]
   371 					     ifFalse:[stream space. lnSz := lnSz + 1]
   378                                              ifFalse:[stream space. lnSz := lnSz + 1]
   372 	    ] ifTrue:[
   379             ] ifTrue:[
   373 		lnSz := cpySz
   380                 lnSz := cpySz
   374 	    ].
   381             ].
   375 	    stream nextPutAll:aString startingAt:start to:(stop - 1).
   382             stream nextPutAll:aString startingAt:start to:(stop - 1).
   376 	    start := stop.
   383             start := stop.
   377 	]
   384         ]
   378     ].
   385     ].
   379     ^ stream contents
   386     ^ stream contents
   380 
   387 
   381     "Modified: / 1.2.1998 / 14:42:56 / cg"
   388     "Modified: / 1.2.1998 / 14:42:56 / cg"
   382 ! !
   389 ! !
   508     "
   515     "
   509 
   516 
   510     <resource: #image>
   517     <resource: #image>
   511 
   518 
   512     ^Icon
   519     ^Icon
   513 	constantNamed:#'UIPainter iconAlignB'
   520         constantNamed:#'UIPainter iconAlignB'
   514 	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]
   521         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]
   515 !
   522 !
   516 
   523 
   517 iconAlignL
   524 iconAlignL
   518     "This resource specification was automatically generated
   525     "This resource specification was automatically generated
   519      by the ImageEditor of ST/X."
   526      by the ImageEditor of ST/X."
   526     "
   533     "
   527 
   534 
   528     <resource: #image>
   535     <resource: #image>
   529 
   536 
   530     ^Icon
   537     ^Icon
   531 	constantNamed:#'UIPainter iconAlignL'
   538         constantNamed:#'UIPainter iconAlignL'
   532 	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]
   539         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]
   533 !
   540 !
   534 
   541 
   535 iconAlignLR
   542 iconAlignLR
   536     "This resource specification was automatically generated
   543     "This resource specification was automatically generated
   537      by the ImageEditor of ST/X."
   544      by the ImageEditor of ST/X."
   544     "
   551     "
   545 
   552 
   546     <resource: #image>
   553     <resource: #image>
   547 
   554 
   548     ^Icon
   555     ^Icon
   549 	constantNamed:#'UIPainter iconAlignLR'
   556         constantNamed:#'UIPainter iconAlignLR'
   550 	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]
   557         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]
   551 !
   558 !
   552 
   559 
   553 iconAlignR
   560 iconAlignR
   554     "This resource specification was automatically generated
   561     "This resource specification was automatically generated
   555      by the ImageEditor of ST/X."
   562      by the ImageEditor of ST/X."
   562     "
   569     "
   563 
   570 
   564     <resource: #image>
   571     <resource: #image>
   565 
   572 
   566     ^Icon
   573     ^Icon
   567 	constantNamed:#'UIPainter iconAlignR'
   574         constantNamed:#'UIPainter iconAlignR'
   568 	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]
   575         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]
   569 !
   576 !
   570 
   577 
   571 iconAlignT
   578 iconAlignT
   572     "This resource specification was automatically generated
   579     "This resource specification was automatically generated
   573      by the ImageEditor of ST/X."
   580      by the ImageEditor of ST/X."
   580     "
   587     "
   581 
   588 
   582     <resource: #image>
   589     <resource: #image>
   583 
   590 
   584     ^Icon
   591     ^Icon
   585 	constantNamed:#'UIPainter iconAlignT'
   592         constantNamed:#'UIPainter iconAlignT'
   586 	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]
   593         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]
   587 !
   594 !
   588 
   595 
   589 iconAlignTB
   596 iconAlignTB
   590     "This resource specification was automatically generated
   597     "This resource specification was automatically generated
   591      by the ImageEditor of ST/X."
   598      by the ImageEditor of ST/X."
   598     "
   605     "
   599 
   606 
   600     <resource: #image>
   607     <resource: #image>
   601 
   608 
   602     ^Icon
   609     ^Icon
   603 	constantNamed:#'UIPainter iconAlignTB'
   610         constantNamed:#'UIPainter iconAlignTB'
   604 	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]
   611         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]
   605 !
   612 !
   606 
   613 
   607 iconCenterH
   614 iconCenterH
   608     "This resource specification was automatically generated
   615     "This resource specification was automatically generated
   609      by the ImageEditor of ST/X."
   616      by the ImageEditor of ST/X."
   734         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   741         ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
   735 @@@@@@@@@@UUUT@@@@???4@@@@@@@@@@@@@*(@@@@@JB@@@@@@JB@@@@@@JB@@@@@@J*(@@@@@@@@@@@@@UUUT@@@@???4@@@@@@@@@@@@J*(@@@@@JB@@@@
   742 @@@@@@@@@@UUUT@@@@???4@@@@@@@@@@@@@*(@@@@@JB@@@@@@JB@@@@@@JB@@@@@@J*(@@@@@@@@@@@@@UUUT@@@@???4@@@@@@@@@@@@J*(@@@@@JB@@@@
   736 @@JB@@@@@@@B@@@@@@@*(@@@@@@@@@@@@@UUUT@@@@???4@@@@@@@@@@') ; 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??CA??@@G0@@A@@@A@@@A@@@G0CA??@A??@A??@A??@@G0C@A@@@A@@@A@@@G0AA??AA??@A??@A??B') ; yourself); yourself]
   743 @@JB@@@@@@@B@@@@@@@*(@@@@@@@@@@@@@UUUT@@@@???4@@@@@@@@@@') ; 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??CA??@@G0@@A@@@A@@@A@@@G0CA??@A??@A??@A??@@G0C@A@@@A@@@A@@@G0AA??AA??@A??@A??B') ; yourself); yourself]
   737 ! !
   744 ! !
   738 
   745 
       
   746 !UIPainter class methodsFor:'initialize'!
       
   747 
       
   748 initialize
       
   749     SelectionPanelClass isNil ifTrue:[
       
   750         SelectionPanelClass := UISelectionPanel
       
   751     ].
       
   752 ! !
       
   753 
   739 !UIPainter class methodsFor:'interface specs'!
   754 !UIPainter class methodsFor:'interface specs'!
   740 
   755 
   741 dialogSpecForDefiningClassAndSelector
   756 dialogSpecForDefiningClassAndSelector
   742     "This resource specification was automatically generated
   757     "This resource specification was automatically generated
   743      by the UIPainter of ST/X."
   758      by the UIPainter of ST/X."
   753     <resource: #canvas>
   768     <resource: #canvas>
   754 
   769 
   755     ^
   770     ^
   756      
   771      
   757        #(#FullSpec
   772        #(#FullSpec
   758 	  #window: 
   773           #window: 
   759 	   #(#WindowSpec
   774            #(#WindowSpec
   760 	      #name: 'GUI Painter'
   775               #name: 'GUI Painter'
   761 	      #layout: #(#LayoutFrame 291 0 130 0 637 0 289 0)
   776               #layout: #(#LayoutFrame 291 0 130 0 637 0 289 0)
   762 	      #label: 'GUI Painter'
   777               #label: 'GUI Painter'
   763 	      #min: #(#Point 350 160)
   778               #min: #(#Point 350 160)
   764 	      #max: #(#Point 500 160)
   779               #max: #(#Point 500 160)
   765 	      #bounds: #(#Rectangle 291 130 638 290)
   780               #bounds: #(#Rectangle 291 130 638 290)
   766 	      #usePreferredExtent: false
   781               #usePreferredExtent: false
   767 	  )
   782           )
   768 	  #component: 
   783           #component: 
   769 	   #(#SpecCollection
   784            #(#SpecCollection
   770 	      #collection: 
   785               #collection: 
   771 	       #(
   786                #(
   772 		 #(#FramedBoxSpec
   787                  #(#FramedBoxSpec
   773 		    #name: 'FramedBox'
   788                     #name: 'FramedBox'
   774 		    #layout: #(#LayoutFrame 0 0.0 3 0.0 0 1.0 -35 1.0)
   789                     #layout: #(#LayoutFrame 0 0.0 3 0.0 0 1.0 -35 1.0)
   775 		    #component: 
   790                     #component: 
   776 		     #(#SpecCollection
   791                      #(#SpecCollection
   777 			#collection: 
   792                         #collection: 
   778 			 #(
   793                          #(
   779 			   #(#LabelSpec
   794                            #(#LabelSpec
   780 			      #name: 'selectorLabel'
   795                               #name: 'selectorLabel'
   781 			      #layout: #(#AlignmentOrigin 67 0.11 29 0 1 0.5)
   796                               #layout: #(#AlignmentOrigin 67 0.11 29 0 1 0.5)
   782 			      #label: 'Selector:'
   797                               #label: 'Selector:'
   783 			      #translateLabel: true
   798                               #translateLabel: true
   784 			      #adjust: #right
   799                               #adjust: #right
   785 			      #resizeForLabel: true
   800                               #resizeForLabel: true
   786 			  )
   801                           )
   787 			   #(#InputFieldSpec
   802                            #(#InputFieldSpec
   788 			      #name: 'methodNameField'
   803                               #name: 'methodNameField'
   789 			      #layout: #(#LayoutFrame 70 0.11 18 0 4 1.0 40 0)
   804                               #layout: #(#LayoutFrame 70 0.11 18 0 4 1.0 40 0)
   790 			      #tabable: true
   805                               #tabable: true
   791 			      #model: #methodNameChannel
   806                               #model: #methodNameChannel
   792 			      #group: #inputGroup
   807                               #group: #inputGroup
   793 			  )
   808                           )
   794 			   #(#LabelSpec
   809                            #(#LabelSpec
   795 			      #name: 'classLabel'
   810                               #name: 'classLabel'
   796 			      #layout: #(#AlignmentOrigin 67 0.11 54 0 1 0.5)
   811                               #layout: #(#AlignmentOrigin 67 0.11 54 0 1 0.5)
   797 			      #label: 'Class:'
   812                               #label: 'Class:'
   798 			      #translateLabel: true
   813                               #translateLabel: true
   799 			      #adjust: #right
   814                               #adjust: #right
   800 			      #resizeForLabel: true
   815                               #resizeForLabel: true
   801 			  )
   816                           )
   802 			   #(#InputFieldSpec
   817                            #(#InputFieldSpec
   803 			      #name: 'classNameField'
   818                               #name: 'classNameField'
   804 			      #layout: #(#LayoutFrame 70 0.11 43 0 4 1.0 65 0)
   819                               #layout: #(#LayoutFrame 70 0.11 43 0 4 1.0 65 0)
   805 			      #tabable: true
   820                               #tabable: true
   806 			      #model: #classNameChannel
   821                               #model: #classNameChannel
   807 			      #group: #inputGroup
   822                               #group: #inputGroup
   808 			  )
   823                           )
   809 			   #(#LabelSpec
   824                            #(#LabelSpec
   810 			      #name: 'superClassLabel'
   825                               #name: 'superClassLabel'
   811 			      #layout: #(#AlignmentOrigin 67 0.11 79 0 1 0.5)
   826                               #layout: #(#AlignmentOrigin 67 0.11 79 0 1 0.5)
   812 			      #label: 'Superclass:'
   827                               #label: 'Superclass:'
   813 			      #translateLabel: true
   828                               #translateLabel: true
   814 			      #adjust: #right
   829                               #adjust: #right
   815 			      #resizeForLabel: true
   830                               #resizeForLabel: true
   816 			  )
   831                           )
   817 			   #(#ComboBoxSpec
   832                            #(#ComboBoxSpec
   818 			      #name: 'superclassNameComboBox'
   833                               #name: 'superclassNameComboBox'
   819 			      #layout: #(#LayoutFrame 70 0.11 68 0 4 1.0 90 0)
   834                               #layout: #(#LayoutFrame 70 0.11 68 0 4 1.0 90 0)
   820 			      #tabable: true
   835                               #tabable: true
   821 			      #model: #superclassNameChannel
   836                               #model: #superclassNameChannel
   822 			      #comboList: #superclassNameDefaults
   837                               #comboList: #superclassNameDefaults
   823 			  )
   838                           )
   824 			)
   839                         )
   825 		    )
   840                     )
   826 		    #label: 'Define Class And Selector'
   841                     #label: 'Define Class And Selector'
   827 		    #labelPosition: #topLeft
   842                     #labelPosition: #topLeft
   828 		    #translateLabel: true
   843                     #translateLabel: true
   829 		)
   844                 )
   830 		 #(#UISubSpecification
   845                  #(#UISubSpecification
   831 		    #name: 'subSpec'
   846                     #name: 'subSpec'
   832 		    #layout: #(#LayoutFrame 0 0.0 -29 1 0 1.0 -5 1)
   847                     #layout: #(#LayoutFrame 0 0.0 -29 1 0 1.0 -5 1)
   833 		    #majorKey: #ToolApplicationModel
   848                     #majorKey: #ToolApplicationModel
   834 		    #minorKey: #windowSpecForCommitWithoutChannels
   849                     #minorKey: #windowSpecForCommitWithoutChannels
   835 		)
   850                 )
   836 	      )
   851               )
   837 	  )
   852           )
   838       )
   853       )
   839 
   854 
   840     "Modified: / 13.8.1998 / 19:59:44 / cg"
   855     "Modified: / 13.8.1998 / 19:59:44 / cg"
   841 !
   856 !
   842 
   857 
  1838 
  1853 
  1839     ^
  1854     ^
  1840      
  1855      
  1841        #(#Menu
  1856        #(#Menu
  1842           
  1857           
  1843 	   #(
  1858            #(
  1844 	     #(#MenuItem
  1859              #(#MenuItem
  1845 		#label: 'Up'
  1860                 #label: 'Up'
  1846 		#translateLabel: true
  1861                 #translateLabel: true
  1847 		#value: #doStepUp
  1862                 #value: #doStepUp
  1848 		#activeHelpKey: #moveWidgetUp
  1863                 #activeHelpKey: #moveWidgetUp
  1849 		#enabled: #canChangeOrderInContainer
  1864                 #enabled: #canChangeOrderInContainer
  1850 		#labelImage: #(#ResourceRetriever #Icon #upIcon 'Up')
  1865                 #labelImage: #(#ResourceRetriever #Icon #upIcon 'Up')
  1851 	    )
  1866             )
  1852 	     #(#MenuItem
  1867              #(#MenuItem
  1853 		#label: 'Down'
  1868                 #label: 'Down'
  1854 		#translateLabel: true
  1869                 #translateLabel: true
  1855 		#value: #doStepDown
  1870                 #value: #doStepDown
  1856 		#activeHelpKey: #moveWidgetDown
  1871                 #activeHelpKey: #moveWidgetDown
  1857 		#enabled: #canChangeOrderInContainer
  1872                 #enabled: #canChangeOrderInContainer
  1858 		#labelImage: #(#ResourceRetriever #Icon #downIcon 'Down')
  1873                 #labelImage: #(#ResourceRetriever #Icon #downIcon 'Down')
  1859 	    )
  1874             )
  1860 	     #(#MenuItem
  1875              #(#MenuItem
  1861 		#label: 'Into'
  1876                 #label: 'Into'
  1862 		#translateLabel: true
  1877                 #translateLabel: true
  1863 		#value: #doStepIn
  1878                 #value: #doStepIn
  1864 		#activeHelpKey: #moveWidgetInto
  1879                 #activeHelpKey: #moveWidgetInto
  1865 		#enabled: #canMoveSelectionIntoContainer
  1880                 #enabled: #canMoveSelectionIntoContainer
  1866 		#labelImage: #(#ResourceRetriever #Icon #downRightIcon 'Into')
  1881                 #labelImage: #(#ResourceRetriever #Icon #downRightIcon 'Into')
  1867 	    )
  1882             )
  1868 	     #(#MenuItem
  1883              #(#MenuItem
  1869 		#label: 'Out'
  1884                 #label: 'Out'
  1870 		#translateLabel: true
  1885                 #translateLabel: true
  1871 		#value: #doStepOut
  1886                 #value: #doStepOut
  1872 		#activeHelpKey: #moveWidgetOut
  1887                 #activeHelpKey: #moveWidgetOut
  1873 		#enabled: #canMoveSelectionOutOfContainer
  1888                 #enabled: #canMoveSelectionOutOfContainer
  1874 		#labelImage: #(#ResourceRetriever #Icon #leftDownIcon 'Out')
  1889                 #labelImage: #(#ResourceRetriever #Icon #leftDownIcon 'Out')
  1875 	    )
  1890             )
  1876 	  ) nil
  1891           ) nil
  1877 	  nil
  1892           nil
  1878       )
  1893       )
  1879 !
  1894 !
  1880 
  1895 
  1881 menuReplaceWidget
  1896 menuReplaceWidget
  1882     "This resource specification was automatically generated
  1897     "This resource specification was automatically generated
  2287     "returns a boolean value holder which is set to true if the gallery is shown"
  2302     "returns a boolean value holder which is set to true if the gallery is shown"
  2288 
  2303 
  2289     |holder|
  2304     |holder|
  2290 
  2305 
  2291     (holder := builder bindingAt:#galleryShown) isNil ifTrue:[
  2306     (holder := builder bindingAt:#galleryShown) isNil ifTrue:[
  2292 	builder aspectAt:#galleryShown put:(holder :=  true asValue).
  2307         builder aspectAt:#galleryShown put:(holder :=  true asValue).
  2293 	holder addDependent:self
  2308         holder addDependent:self
  2294     ].
  2309     ].
  2295     ^ holder
  2310     ^ holder
  2296 
  2311 
  2297 !
  2312 !
  2298 
  2313 
  2340     "returns a boolean value holder which is set to true if the painter is shown"
  2355     "returns a boolean value holder which is set to true if the painter is shown"
  2341 
  2356 
  2342     |holder|
  2357     |holder|
  2343 
  2358 
  2344     (holder := builder bindingAt:#painterShown) isNil ifTrue:[
  2359     (holder := builder bindingAt:#painterShown) isNil ifTrue:[
  2345 	builder aspectAt:#painterShown put:(holder :=  true asValue).
  2360         builder aspectAt:#painterShown put:(holder :=  true asValue).
  2346 	holder addDependent:self
  2361         holder addDependent:self
  2347     ].
  2362     ].
  2348     ^ holder
  2363     ^ holder
  2349 
  2364 
  2350 !
  2365 !
  2351 
  2366 
  2365     "returns a value holder which keeps the label of the current section in the notebook"
  2380     "returns a value holder which keeps the label of the current section in the notebook"
  2366 
  2381 
  2367     |holder|
  2382     |holder|
  2368 
  2383 
  2369     (holder := builder bindingAt:#tabModel) isNil ifTrue:[
  2384     (holder := builder bindingAt:#tabModel) isNil ifTrue:[
  2370 	holder := AspectAdaptor new subject:self; forAspect:#tabSelection.
  2385         holder := AspectAdaptor new subject:self; forAspect:#tabSelection.
  2371 	builder aspectAt:#tabModel put:holder.
  2386         builder aspectAt:#tabModel put:holder.
  2372     ].
  2387     ].
  2373     ^ holder
  2388     ^ holder
  2374 !
  2389 !
  2375 
  2390 
  2376 treeView
  2391 treeView
  2498     "opens a Hierarchical List Editor on current widget"
  2513     "opens a Hierarchical List Editor on current widget"
  2499 
  2514 
  2500     |selector editor spec|
  2515     |selector editor spec|
  2501 
  2516 
  2502     (self resolveName:specClassName) isNil ifTrue:[
  2517     (self resolveName:specClassName) isNil ifTrue:[
  2503 	self askForSaving ifFalse: [^self]
  2518         self askForSaving ifFalse: [^self]
  2504     ].
  2519     ].
  2505 
  2520 
  2506     spec := self specTool specification.
  2521     spec := self specTool specification.
  2507     (selector := spec hierarchicalList) notNil ifTrue:[
  2522     (selector := spec hierarchicalList) notNil ifTrue:[
  2508 	selector := selector asSymbol
  2523         selector := selector asSymbol
  2509     ].
  2524     ].
  2510 
  2525 
  2511     editor := HierarchicalListEditor new.
  2526     editor := HierarchicalListEditor new.
  2512     editor masterApplication:self.
  2527     editor masterApplication:self.
  2513     editor openModalOnClass:specClassName andSelector:selector.
  2528     editor openModalOnClass:specClassName andSelector:selector.
  2514 
  2529 
  2515     editor specSelector ~= selector ifTrue:[
  2530     editor specSelector ~= selector ifTrue:[
  2516 	editor hasSaved ifTrue:[
  2531         editor hasSaved ifTrue:[
  2517 	    spec hierarchicalList:editor specSelector.
  2532             spec hierarchicalList:editor specSelector.
  2518 	    self modifiedChannel value:true.
  2533             self modifiedChannel value:true.
  2519 	    self accept
  2534             self accept
  2520 	]
  2535         ]
  2521     ]
  2536     ]
  2522 
  2537 
  2523     "Modified: / 16.7.1998 / 18:15:46 / cg"
  2538     "Modified: / 16.7.1998 / 18:15:46 / cg"
  2524 !
  2539 !
  2525 
  2540 
  2931     "asks for defining an application class"
  2946     "asks for defining an application class"
  2932 
  2947 
  2933     self askForSectionModification.    
  2948     self askForSectionModification.    
  2934 
  2949 
  2935     ((YesNoBox title:'No application class defined yet!!')        
  2950     ((YesNoBox title:'No application class defined yet!!')        
  2936 	noText:'Cancel';
  2951         noText:'Cancel';
  2937 	yesText:'Define';
  2952         yesText:'Define';
  2938 	showAtPointer;
  2953         showAtPointer;
  2939 	accepted) ifFalse: [^false].
  2954         accepted) ifFalse: [^false].
  2940 
  2955 
  2941     self doSave.
  2956     self doSave.
  2942 
  2957 
  2943     ^true
  2958     ^true
  2944 !
  2959 !
  2945 
  2960 
  2946 askForSectionModification
  2961 askForSectionModification
  2947     "asks for section modification in the notebook"
  2962     "asks for section modification in the notebook"
  2948 
  2963 
  2949     self isModified ifTrue:[
  2964     self isModified ifTrue:[
  2950 	(self confirm:'Accept modifications in section ' , tabSelection printString asBoldText, '?') ifTrue:[
  2965         (self confirm:'Accept modifications in section ' , tabSelection printString asBoldText, '?') ifTrue:[
  2951 	    self accept
  2966             self accept
  2952 	] ifFalse: [
  2967         ] ifFalse: [
  2953 	    self cancel
  2968             self cancel
  2954 	]
  2969         ]
  2955     ]
  2970     ]
  2956 !
  2971 !
  2957 
  2972 
  2958 checkClassAndSelector
  2973 checkClassAndSelector
  2959     "checks for class & superclass"
  2974     "checks for class & superclass"
  3209 hasSpecClassAndSelector
  3224 hasSpecClassAndSelector
  3210     "answers whether an application class and a selector under which
  3225     "answers whether an application class and a selector under which
  3211      the window spec is stored is defined"
  3226      the window spec is stored is defined"
  3212 
  3227 
  3213     specSelector size > 1 ifTrue:[
  3228     specSelector size > 1 ifTrue:[
  3214 	^ self hasSpecClass
  3229         ^ self hasSpecClass
  3215     ].
  3230     ].
  3216     ^ false
  3231     ^ false
  3217 !
  3232 !
  3218 
  3233 
  3219 isHelpToolSelected
  3234 isHelpToolSelected
  3459     "handles a close request for a specific view"
  3474     "handles a close request for a specific view"
  3460 
  3475 
  3461     |topView|
  3476     |topView|
  3462 
  3477 
  3463     (topView := self window) == aTopView ifTrue:[
  3478     (topView := self window) == aTopView ifTrue:[
  3464 	super closeRequestFor:aTopView
  3479         super closeRequestFor:aTopView
  3465     ] ifFalse:[
  3480     ] ifFalse:[
  3466 	aTopView = selectionPanel window ifTrue:[
  3481         aTopView = selectionPanel window ifTrue:[
  3467 	    self galleryShown value:false
  3482             self galleryShown value:false
  3468 	] ifFalse:[
  3483         ] ifFalse:[
  3469 	    aTopView == (self painter topView) ifTrue:[
  3484             aTopView == (self painter topView) ifTrue:[
  3470 		self painterShown value:false
  3485                 self painterShown value:false
  3471 	    ] ifFalse:[
  3486             ] ifFalse:[
  3472 		aTopView closeRequest
  3487                 aTopView closeRequest
  3473 	    ]
  3488             ]
  3474 	].
  3489         ].
  3475 	topView raise.
  3490         topView raise.
  3476     ].
  3491     ].
  3477 !
  3492 !
  3478 
  3493 
  3479 commonPostBuild
  3494 commonPostBuild
  3480     "sets the root of the tree view as first selection;
  3495     "sets the root of the tree view as first selection;
  4195     "opens an inspector on the view of the selected widget"
  4210     "opens an inspector on the view of the selected widget"
  4196 
  4211 
  4197     |selection|
  4212     |selection|
  4198 
  4213 
  4199     ((selection := self painter selection) isCollection and: [selection size >= 1]) ifTrue:[
  4214     ((selection := self painter selection) isCollection and: [selection size >= 1]) ifTrue:[
  4200 	selection first inspect
  4215         selection first inspect
  4201     ] ifFalse: [
  4216     ] ifFalse: [
  4202 	selection inspect
  4217         selection inspect
  4203     ]
  4218     ]
  4204 
  4219 
  4205 !
  4220 !
  4206 
  4221 
  4207 doLoad
  4222 doLoad
  4289     |view|
  4304     |view|
  4290 
  4305 
  4291     self askForModification ifFalse: [^nil].
  4306     self askForModification ifFalse: [^nil].
  4292 
  4307 
  4293     (view := Screen current viewFromUser) notNil ifTrue:[
  4308     (view := Screen current viewFromUser) notNil ifTrue:[
  4294 	view == Screen current rootView ifFalse:[
  4309         view == Screen current rootView ifFalse:[
  4295 	    self painter setupFromSpec:(UISpecification fromView:view topView).
  4310             self painter setupFromSpec:(UISpecification fromView:view topView).
  4296 	]
  4311         ]
  4297     ].
  4312     ].
  4298 
  4313 
  4299     self updateInfoLabel
  4314     self updateInfoLabel
  4300 
  4315 
  4301 !
  4316 !
  4437     "opens a code view with the contents of the window spec"
  4452     "opens a code view with the contents of the window spec"
  4438 
  4453 
  4439     self askForSectionModification.
  4454     self askForSectionModification.
  4440 
  4455 
  4441     CodeView 
  4456     CodeView 
  4442 	openWith: self painter generateWindowSpecMethodSource 
  4457         openWith: self painter generateWindowSpecMethodSource 
  4443 	title: 'Window Spec'
  4458         title: 'Window Spec'
  4444 
  4459 
  4445 !
  4460 !
  4446 
  4461 
  4447 replaceWidgetByClass:aSpecOrWidgetClass
  4462 replaceWidgetByClass:aSpecOrWidgetClass
  4448     |specClass oldSpec newSpec sel painter|
  4463     |specClass oldSpec newSpec sel painter|
  4477 documentation
  4492 documentation
  4478 "
  4493 "
  4479     selection in tree view; only used by the UIPainter
  4494     selection in tree view; only used by the UIPainter
  4480 
  4495 
  4481     [see also:]
  4496     [see also:]
  4482 	SelectionInTreeView
  4497         SelectionInTreeView
  4483 	SelectionInTree
  4498         SelectionInTree
  4484 	TreeItem
  4499         TreeItem
  4485 	UIPainter
  4500         UIPainter
  4486 
  4501 
  4487     [author:]
  4502     [author:]
  4488 	Claus Atzkern
  4503         Claus Atzkern
  4489 "
  4504 "
  4490 
  4505 
  4491 
  4506 
  4492 ! !
  4507 ! !
  4493 
  4508 
  4579 
  4594 
  4580 itemOfView:aView
  4595 itemOfView:aView
  4581     "returns item assigned to view or nil"
  4596     "returns item assigned to view or nil"
  4582 
  4597 
  4583     aView notNil ifTrue:[
  4598     aView notNil ifTrue:[
  4584 	self allItemsDo:[:anItem|
  4599         self allItemsDo:[:anItem|
  4585 	    (anItem contents view == aView) ifTrue:[^ anItem]
  4600             (anItem contents view == aView) ifTrue:[^ anItem]
  4586 	]
  4601         ]
  4587     ].
  4602     ].
  4588     ^ nil
  4603     ^ nil
  4589 
  4604 
  4590 
  4605 
  4591 !
  4606 !
  4622 
  4637 
  4623 propertyDetect:aOneArgBlock
  4638 propertyDetect:aOneArgBlock
  4624     "evaluates the block on each property"
  4639     "evaluates the block on each property"
  4625 
  4640 
  4626     self allItemsDo:[:anItem|
  4641     self allItemsDo:[:anItem|
  4627 	(aOneArgBlock value:(anItem contents)) ifTrue:[^ anItem contents]
  4642         (aOneArgBlock value:(anItem contents)) ifTrue:[^ anItem contents]
  4628     ].
  4643     ].
  4629     ^ nil
  4644     ^ nil
  4630 
  4645 
  4631 !
  4646 !
  4632 
  4647 
  4635      or empty selection "
  4650      or empty selection "
  4636 
  4651 
  4637     |idx|
  4652     |idx|
  4638 
  4653 
  4639     selection size == 1 ifTrue:[
  4654     selection size == 1 ifTrue:[
  4640 	(idx := selection first) ~~ 1 ifTrue:[          "canvas: not yet supported"
  4655         (idx := selection first) ~~ 1 ifTrue:[          "canvas: not yet supported"
  4641 	    ^ (listOfNodes at:idx) contents
  4656             ^ (listOfNodes at:idx) contents
  4642 	]
  4657         ]
  4643     ].
  4658     ].
  4644     ^ nil
  4659     ^ nil
  4645 
  4660 
  4646 ! !
  4661 ! !
  4647 
  4662 
  4664 
  4679 
  4665     lastDrawnMaster := nil.
  4680     lastDrawnMaster := nil.
  4666     windowSpec := nil.
  4681     windowSpec := nil.
  4667 
  4682 
  4668     self canvas subViews copy do:[:aView|
  4683     self canvas subViews copy do:[:aView|
  4669 	"/ care to not destroy the transparent input view
  4684         "/ care to not destroy the transparent input view
  4670 	(aView isInputOnly) ifFalse:[aView destroy]
  4685         (aView isInputOnly) ifFalse:[aView destroy]
  4671     ].
  4686     ].
  4672     model root name: UIPainter defaultNameOfCanvas asBoldText.
  4687     model root name: UIPainter defaultNameOfCanvas asBoldText.
  4673     model removeAllOtherThanRoot.
  4688     model removeAllOtherThanRoot.
  4674 
  4689 
  4675 !
  4690 !
  4678     "removes a view"
  4693     "removes a view"
  4679 
  4694 
  4680     |item prnt|
  4695     |item prnt|
  4681 
  4696 
  4682     ((item := self itemOfView:aView) notNil and:[(prnt := item parent) notNil]) ifTrue:[
  4697     ((item := self itemOfView:aView) notNil and:[(prnt := item parent) notNil]) ifTrue:[
  4683 	aView destroy.
  4698         aView destroy.
  4684 	prnt contents view sizeChanged:nil.
  4699         prnt contents view sizeChanged:nil.
  4685 	model remove:item
  4700         model remove:item
  4686     ]
  4701     ]
  4687 
  4702 
  4688 
  4703 
  4689 ! !
  4704 ! !
  4690 
  4705 
  4733     "canvas changed its selection
  4748     "canvas changed its selection
  4734     "
  4749     "
  4735     |sel list size|
  4750     |sel list size|
  4736 
  4751 
  4737     ((sel := aSelection) isNil or:[sel isCollection]) ifFalse:[
  4752     ((sel := aSelection) isNil or:[sel isCollection]) ifFalse:[
  4738 	sel := Array with:sel
  4753         sel := Array with:sel
  4739     ].
  4754     ].
  4740 
  4755 
  4741     (size := sel size) ~~ 0 ifTrue:[
  4756     (size := sel size) ~~ 0 ifTrue:[
  4742 	list := OrderedCollection new:size.
  4757         list := OrderedCollection new:size.
  4743 
  4758 
  4744 	sel do:[:aView||item|
  4759         sel do:[:aView||item|
  4745 	    (item := self itemOfView:aView) notNil ifTrue:[
  4760             (item := self itemOfView:aView) notNil ifTrue:[
  4746 		list add:item.
  4761                 list add:item.
  4747 		model doMakeVisible:item.
  4762                 model doMakeVisible:item.
  4748 	    ]
  4763             ]
  4749 	].
  4764         ].
  4750 	sel := list collect:[:anItem| self indexOfNode:anItem ].
  4765         sel := list collect:[:anItem| self indexOfNode:anItem ].
  4751     ].
  4766     ].
  4752     self cvsEventsDisabledDo:[ self selection:sel ].            
  4767     self cvsEventsDisabledDo:[ self selection:sel ].            
  4753 
  4768 
  4754 
  4769 
  4755 
  4770 
  4762     |item index oldSel|
  4777     |item index oldSel|
  4763 
  4778 
  4764     item := self itemOfView:aView.
  4779     item := self itemOfView:aView.
  4765 
  4780 
  4766     item notNil ifTrue:[
  4781     item notNil ifTrue:[
  4767 	model doMakeVisible:item.
  4782         model doMakeVisible:item.
  4768 
  4783 
  4769 	(index := self indexOfNode:item) ~~ 0 ifTrue:[
  4784         (index := self indexOfNode:item) ~~ 0 ifTrue:[
  4770 	    oldSel := selection copy.
  4785             oldSel := selection copy.
  4771 	    self addToSelection:index.
  4786             self addToSelection:index.
  4772 	    self selectionChangedFrom:oldSel
  4787             self selectionChangedFrom:oldSel
  4773 	]        
  4788         ]        
  4774     ]            
  4789     ]            
  4775 
  4790 
  4776 
  4791 
  4777 
  4792 
  4778 !
  4793 !
  4784 
  4799 
  4785     (     (item := self itemOfView:aView) notNil
  4800     (     (item := self itemOfView:aView) notNil
  4786      and:[(index := self indexOfNode:item) ~~ 0
  4801      and:[(index := self indexOfNode:item) ~~ 0
  4787      and:[self isInSelection:index]]
  4802      and:[self isInSelection:index]]
  4788     ) ifTrue:[
  4803     ) ifTrue:[
  4789 	oldSel := selection copy.
  4804         oldSel := selection copy.
  4790 	self removeFromSelection:index.
  4805         self removeFromSelection:index.
  4791 	self selectionChangedFrom:oldSel.
  4806         self selectionChangedFrom:oldSel.
  4792     ].
  4807     ].
  4793 
  4808 
  4794 
  4809 
  4795 ! !
  4810 ! !
  4796 
  4811 
  4806     (    aName size ~~ 0
  4821     (    aName size ~~ 0
  4807      and:[(name := aName string withoutSeparators) size ~~ 0
  4822      and:[(name := aName string withoutSeparators) size ~~ 0
  4808      and:[(self propertyDetect:[:p| p name = name]) isNil
  4823      and:[(self propertyDetect:[:p| p name = name]) isNil
  4809      and:[node name ~= name]]]
  4824      and:[node name ~= name]]]
  4810     ) ifTrue:[
  4825     ) ifTrue:[
  4811 	node name: name asBoldText.
  4826         node name: name asBoldText.
  4812 	node changed.   
  4827         node changed.   
  4813     ].
  4828     ].
  4814 !
  4829 !
  4815 
  4830 
  4816 layoutChanged
  4831 layoutChanged
  4817     "layout of any component changed; in case of single selection, the
  4832     "layout of any component changed; in case of single selection, the
  4818      application will be informed to update its layout
  4833      application will be informed to update its layout
  4819     "
  4834     "
  4820     selection size == 1 ifTrue:[
  4835     selection size == 1 ifTrue:[
  4821 	self application layoutChanged
  4836         self application layoutChanged
  4822     ]
  4837     ]
  4823 
  4838 
  4824 
  4839 
  4825 !
  4840 !
  4826 
  4841 
  4830     |item idx end|
  4845     |item idx end|
  4831 
  4846 
  4832     item := self itemOfView:(aProperty view).
  4847     item := self itemOfView:(aProperty view).
  4833 
  4848 
  4834     item notNil ifTrue:[
  4849     item notNil ifTrue:[
  4835 	item contents:aProperty.
  4850         item contents:aProperty.
  4836 
  4851 
  4837 	item name = aProperty name ifFalse:[
  4852         item name = aProperty name ifFalse:[
  4838 	    idx := self firstLineShown.
  4853             idx := self firstLineShown.
  4839 
  4854 
  4840 	    (end := self lastLineShown) > listOfNodes size ifTrue:[
  4855             (end := self lastLineShown) > listOfNodes size ifTrue:[
  4841 		end := listOfNodes size
  4856                 end := listOfNodes size
  4842 	    ].                          
  4857             ].                          
  4843 	    item changed.   
  4858             item changed.   
  4844 
  4859 
  4845 	    [idx <= end] whileTrue:[
  4860             [idx <= end] whileTrue:[
  4846 		(listOfNodes at:idx) == item ifTrue:[
  4861                 (listOfNodes at:idx) == item ifTrue:[
  4847 		    self redrawLine:idx.                "/ is visible; redraw line
  4862                     self redrawLine:idx.                "/ is visible; redraw line
  4848 		    end := 0
  4863                     end := 0
  4849 		] ifFalse:[
  4864                 ] ifFalse:[
  4850 		    idx := idx + 1
  4865                     idx := idx + 1
  4851 		]
  4866                 ]
  4852 	    ]
  4867             ]
  4853 	].
  4868         ].
  4854 
  4869 
  4855 	self selectedNode == item ifTrue:[              "/ inform application
  4870         self selectedNode == item ifTrue:[              "/ inform application
  4856 	    self application propertyChanged
  4871             self application propertyChanged
  4857 	]
  4872         ]
  4858     ].
  4873     ].
  4859 
  4874 
  4860 
  4875 
  4861 ! !
  4876 ! !
  4862 
  4877 
  4956 
  4971 
  4957 doubleClicked
  4972 doubleClicked
  4958     "disables collapsing of the root item"
  4973     "disables collapsing of the root item"
  4959 
  4974 
  4960     self selectedNode == model root ifFalse:[
  4975     self selectedNode == model root ifFalse:[
  4961 	super doubleClicked
  4976         super doubleClicked
  4962     ]
  4977     ]
  4963 
  4978 
  4964 
  4979 
  4965 !
  4980 !
  4966 
  4981 
  4970     |dX|
  4985     |dX|
  4971 
  4986 
  4972     super redrawLabelAt:x y:yTop index:anIndex.
  4987     super redrawLabelAt:x y:yTop index:anIndex.
  4973 
  4988 
  4974     ((selection size > 1) and: [selection first == anIndex]) ifTrue:[
  4989     ((selection size > 1) and: [selection first == anIndex]) ifTrue:[
  4975 	dX := textInset - 1.
  4990         dX := textInset - 1.
  4976 	self paint:(Color red). "/ self application painter handleMasterColor.
  4991         self paint:(Color red). "/ self application painter handleMasterColor.
  4977 	self fillRectangleX:(x - dX - 2)
  4992         self fillRectangleX:(x - dX - 2)
  4978 			  y:yTop + ((fontHeight - dX) // 2)
  4993                           y:yTop + ((fontHeight - dX) // 2)
  4979 		      width:dX
  4994                       width:dX
  4980 		     height:dX
  4995                      height:dX
  4981     ]
  4996     ]
  4982 ! !
  4997 ! !
  4983 
  4998 
  4984 !UIPainter::TreeView methodsFor:'initialization'!
  4999 !UIPainter::TreeView methodsFor:'initialization'!
  4985 
  5000 
  4993     self showDirectoryIndicator: true.
  5008     self showDirectoryIndicator: true.
  4994     self showDirectoryIndicatorForRoot: false.
  5009     self showDirectoryIndicatorForRoot: false.
  4995 
  5010 
  4996     self model iconAction: 
  5011     self model iconAction: 
  4997     [:aNode|
  5012     [:aNode|
  4998 	|specClass|       
  5013         |specClass|       
  4999 	(specClass := aNode contents spec) isNil 
  5014         (specClass := aNode contents spec) isNil 
  5000 	    ifTrue: [WindowSpec icon]
  5015             ifTrue: [WindowSpec icon]
  5001 	    ifFalse:[specClass class icon]
  5016             ifFalse:[specClass class icon]
  5002     ].
  5017     ].
  5003 
  5018 
  5004     self model labelAction: 
  5019     self model labelAction: 
  5005     [:aNode|
  5020     [:aNode|
  5006 	|spec|
  5021         |spec|
  5007 	(spec := aNode contents spec) notNil
  5022         (spec := aNode contents spec) notNil
  5008 	    ifTrue: [self nameForSpecInList:spec] 
  5023             ifTrue: [self nameForSpecInList:spec] 
  5009 	    ifFalse:[aNode name]
  5024             ifFalse:[aNode name]
  5010     ]
  5025     ]
  5011 ! !
  5026 ! !
  5012 
  5027 
  5013 !UIPainter::TreeView methodsFor:'private'!
  5028 !UIPainter::TreeView methodsFor:'private'!
  5014 
  5029 
  5026 
  5041 
  5027     super selectionChangedFrom:oldSelection.
  5042     super selectionChangedFrom:oldSelection.
  5028     size := selection size.
  5043     size := selection size.
  5029 
  5044 
  5030     cvsEventsDisabled ifFalse:[
  5045     cvsEventsDisabled ifFalse:[
  5031 	(size ~~ 0 and:[size ~~ 1 or:[selection first ~~ 1]]) ifTrue:[
  5046         (size ~~ 0 and:[size ~~ 1 or:[selection first ~~ 1]]) ifTrue:[
  5032 	    sel := OrderedCollection new.
  5047             sel := OrderedCollection new.
  5033 
  5048 
  5034 	    selection do:[:i|
  5049             selection do:[:i|
  5035 		i ~~ 1 ifTrue:[sel add:(listOfNodes at:i) contents view]
  5050                 i ~~ 1 ifTrue:[sel add:(listOfNodes at:i) contents view]
  5036 	    ]
  5051             ]
  5037 	].
  5052         ].
  5038 	self canvas updateSelectionFromModel:sel
  5053         self canvas updateSelectionFromModel:sel
  5039     ].             
  5054     ].             
  5040     size = 1 ifTrue:[
  5055     size = 1 ifTrue:[
  5041 	oldSelection size > 1 ifTrue: [
  5056         oldSelection size > 1 ifTrue: [
  5042 	    (listOfNodes at:lastDrawnMaster) retrieveLabel.
  5057             (listOfNodes at:lastDrawnMaster) retrieveLabel.
  5043 	    self redrawLine: lastDrawnMaster. 
  5058             self redrawLine: lastDrawnMaster. 
  5044 	    lastDrawnMaster := selection first
  5059             lastDrawnMaster := selection first
  5045 	]
  5060         ]
  5046     ].
  5061     ].
  5047     size > 1 ifTrue:[
  5062     size > 1 ifTrue:[
  5048 	selection first ~~ lastDrawnMaster ifTrue: [
  5063         selection first ~~ lastDrawnMaster ifTrue: [
  5049 	    (listOfNodes at:selection first) retrieveLabel.
  5064             (listOfNodes at:selection first) retrieveLabel.
  5050 	    lastDrawnMaster notNil ifTrue: [(listOfNodes at:lastDrawnMaster) retrieveLabel].
  5065             lastDrawnMaster notNil ifTrue: [(listOfNodes at:lastDrawnMaster) retrieveLabel].
  5051 	    self redrawLine: lastDrawnMaster. 
  5066             self redrawLine: lastDrawnMaster. 
  5052 	    self redrawLine: (lastDrawnMaster := selection first)
  5067             self redrawLine: (lastDrawnMaster := selection first)
  5053 	]
  5068         ]
  5054     ]         
  5069     ]         
  5055     ifFalse: [
  5070     ifFalse: [
  5056 	lastDrawnMaster := nil
  5071         lastDrawnMaster := nil
  5057     ] 
  5072     ] 
  5058 ! !
  5073 ! !
  5059 
  5074 
  5060 !UIPainter::TreeView methodsFor:'queries'!
  5075 !UIPainter::TreeView methodsFor:'queries'!
  5061 
  5076 
  5084 canMoveOrAlignSelection
  5099 canMoveOrAlignSelection
  5085     "returns true if any selection exists and all widgets in the selection
  5100     "returns true if any selection exists and all widgets in the selection
  5086      can change their layout through to a move or align operation"
  5101      can change their layout through to a move or align operation"
  5087 
  5102 
  5088     selection size == 0 ifTrue:[
  5103     selection size == 0 ifTrue:[
  5089 	^ false
  5104         ^ false
  5090     ].
  5105     ].
  5091 
  5106 
  5092     selection do:[:i|
  5107     selection do:[:i|
  5093 	i == 1 ifTrue:[^ false].
  5108         i == 1 ifTrue:[^ false].
  5094 
  5109 
  5095 	(self canvas canChangeLayoutOfView:((listOfNodes at:i) contents view)) ifFalse:[
  5110         (self canvas canChangeLayoutOfView:((listOfNodes at:i) contents view)) ifFalse:[
  5096 	    ^ false
  5111             ^ false
  5097 	]
  5112         ]
  5098     ].
  5113     ].
  5099     ^ true
  5114     ^ true
  5100 !
  5115 !
  5101 
  5116 
  5102 canMoveSelectionIntoContainer
  5117 canMoveSelectionIntoContainer
  5123 
  5138 
  5124     (     (item := self selectedNode) isNil
  5139     (     (item := self selectedNode) isNil
  5125       or:[(prnt := item parent) isNil
  5140       or:[(prnt := item parent) isNil
  5126       or:[prnt parent isNil]]
  5141       or:[prnt parent isNil]]
  5127     ) ifTrue:[
  5142     ) ifTrue:[
  5128 	^ false
  5143         ^ false
  5129     ].
  5144     ].
  5130     ^ true
  5145     ^ true
  5131 !
  5146 !
  5132 
  5147 
  5133 canResizeSelectedWidget
  5148 canResizeSelectedWidget
  5135      within a widget which allows to resize sub components"
  5150      within a widget which allows to resize sub components"
  5136 
  5151 
  5137     |selectedNode|
  5152     |selectedNode|
  5138 
  5153 
  5139     (selectedNode := self selectedNode) notNil ifTrue:[
  5154     (selectedNode := self selectedNode) notNil ifTrue:[
  5140 	(selectedNode := selectedNode parent) notNil ifTrue:[
  5155         (selectedNode := selectedNode parent) notNil ifTrue:[
  5141 	    ^ (selectedNode parent isNil or:[selectedNode contents spec class canResizeSubComponents])
  5156             ^ (selectedNode parent isNil or:[selectedNode contents spec class canResizeSubComponents])
  5142 	]
  5157         ]
  5143     ].
  5158     ].
  5144     ^ false
  5159     ^ false
  5145 !
  5160 !
  5146 
  5161 
  5147 hasOneSelectionOtherThanCanvas
  5162 hasOneSelectionOtherThanCanvas
  5205     (     (item := self selectedNode) isNil
  5220     (     (item := self selectedNode) isNil
  5206       or:[(prnt := item parent) isNil
  5221       or:[(prnt := item parent) isNil
  5207       or:[(prnt := prnt childAt:((prnt indexOfChild:item) + 1)) isNil
  5222       or:[(prnt := prnt childAt:((prnt indexOfChild:item) + 1)) isNil
  5208       or:[prnt contents spec class supportsSubComponents not]]]
  5223       or:[prnt contents spec class supportsSubComponents not]]]
  5209     ) ifFalse:[
  5224     ) ifFalse:[
  5210 	self doChangeHierarchyOf:prnt
  5225         self doChangeHierarchyOf:prnt
  5211     ]
  5226     ]
  5212 !
  5227 !
  5213 
  5228 
  5214 doStepOut
  5229 doStepOut
  5215     |item|
  5230     |item|
  5216 
  5231 
  5217     ((item := self selectedNode) notNil and:[(item := item parent) notNil]) ifTrue:[
  5232     ((item := self selectedNode) notNil and:[(item := item parent) notNil]) ifTrue:[
  5218 	self doChangeHierarchyOf:(item parent)
  5233         self doChangeHierarchyOf:(item parent)
  5219     ].
  5234     ].
  5220 !
  5235 !
  5221 
  5236 
  5222 doStepOver:anIndex
  5237 doStepOver:anIndex
  5223     "moves child 'anOffset' forward or backward in list of children"
  5238     "moves child 'anOffset' forward or backward in list of children"
  5261 !UIPainter class methodsFor:'documentation'!
  5276 !UIPainter class methodsFor:'documentation'!
  5262 
  5277 
  5263 version
  5278 version
  5264     ^ '$Header$'
  5279     ^ '$Header$'
  5265 ! !
  5280 ! !
       
  5281 
       
  5282 UIPainter initialize!