UIPainter.st
changeset 197 646d24a7ad36
parent 195 350f95af5d9d
child 206 1c3fb15ffd62
equal deleted inserted replaced
196:56f63eb42a34 197:646d24a7ad36
   806     objectList selectGroup
   806     objectList selectGroup
   807 ! !
   807 ! !
   808 
   808 
   809 !UIPainter methodsFor:'active help'!
   809 !UIPainter methodsFor:'active help'!
   810 
   810 
   811 activeHelpApplicationClass
       
   812     "gets application class keeping the associated help component
       
   813     "
       
   814     |cls|
       
   815 
       
   816     specClass notNil ifTrue:[
       
   817         specClass isBehavior ifFalse:[cls := Smalltalk at:specClass asSymbol]
       
   818                               ifTrue:[cls := specClass].
       
   819 
       
   820         (cls includesBehavior:UISpecification) ifTrue:[
       
   821             cls := UISpecificationTool
       
   822         ]
       
   823     ].
       
   824   ^ cls
       
   825 !
       
   826 
       
   827 activeHelpTool
   811 activeHelpTool
   828     |cls|
   812     "setup help tool
   829 
   813     "
   830     activeHelpTool isNil ifTrue:[
   814     activeHelpTool isNil ifTrue:[
   831         activeHelpTool := UIHelpTool new.
   815         activeHelpTool := UIHelpTool new.
   832 
   816         activeHelpTool helpSpecFrom:specClass.
   833         (cls := self activeHelpApplicationClass) notNil ifTrue:[
       
   834             activeHelpTool dictionary:(cls helpSpec).
       
   835         ]
       
   836     ].
   817     ].
   837     ^ activeHelpTool
   818     ^ activeHelpTool
   838 !
   819 !
   839 
   820 
   840 showHelp:aHelpText for:view
   821 showHelp:aHelpText for:view
  1544     (ReadStream on:code) fileIn.
  1525     (ReadStream on:code) fileIn.
  1545 
  1526 
  1546 !
  1527 !
  1547 
  1528 
  1548 doInstallHelp
  1529 doInstallHelp
  1549     |dict cls src|
  1530     "install help text
  1550 
  1531     "
  1551     cls := self activeHelpApplicationClass.
  1532     activeHelpTool notNil ifTrue:[
  1552 
  1533         activeHelpTool installHelpSpecInto:specClass
  1553     cls isNil ifTrue:[
  1534     ] ifFalse:[
  1554         ^ self information:'no application class defined'
  1535         self information:'no help text defined'
  1555     ].
  1536     ]    
  1556 
       
  1557     activeHelpTool isNil ifTrue:[
       
  1558         ^ self information:'no help text defined'
       
  1559     ].    
       
  1560     dict := activeHelpTool dictionary.
       
  1561     src  := '' writeStream.
       
  1562 
       
  1563     src nextPutAll:
       
  1564 
       
  1565 'helpSpec
       
  1566     "return a dictionary filled with helpKey -> helptext associations.
       
  1567      These are used by the activeHelp tool.
       
  1568     "
       
  1569   ^ super helpSpec addPairsFrom:#(
       
  1570 
       
  1571 '.
       
  1572 
       
  1573     dict keysAndValuesDo:[:key :txt|
       
  1574         |t|
       
  1575         src nextPutLine:key storeString.
       
  1576         
       
  1577         t := txt asString.
       
  1578         (t endsWith:Character cr) ifTrue:[
       
  1579             t := t copyWithoutLast:1
       
  1580         ].
       
  1581         src nextPutLine:t storeString; cr.
       
  1582     ].
       
  1583     src nextPutLine:')'.
       
  1584     src := src contents.
       
  1585     Compiler compile:src forClass:cls class inCategory:'help specs'
       
  1586 !
  1537 !
  1587 
  1538 
  1588 doInstallSpec
  1539 doInstallSpec
  1589     |code painter|
  1540     |code painter|
  1590 
  1541