MenuView.st
changeset 2572 9b09dd9d9dae
parent 2521 ca205c023cc1
child 2575 a0381bf78464
equal deleted inserted replaced
2571:1e7e3f041f07 2572:9b09dd9d9dae
  1363     |s x l isSubMenuEntry|
  1363     |s x l isSubMenuEntry|
  1364 
  1364 
  1365     "/ this is somewhat complicated: we have the symbolic key at hand,
  1365     "/ this is somewhat complicated: we have the symbolic key at hand,
  1366     "/ but want to show the untranslated (inverse keyBoardMapped) key & modifier
  1366     "/ but want to show the untranslated (inverse keyBoardMapped) key & modifier
  1367     "/
  1367     "/
  1368 
       
  1369     s := self shortKeyStringFor:aSymbolicKey.
  1368     s := self shortKeyStringFor:aSymbolicKey.
  1370     s isNil ifTrue:[^ self].
  1369     s isNil ifTrue:[^ self].
  1371 
  1370 
  1372     l := self visibleLineToAbsoluteLine:visLineNr.
  1371     l := self visibleLineToAbsoluteLine:visLineNr.
       
  1372 
       
  1373     disabledEtchedFgColor notNil ifTrue:[
       
  1374         (self isInSelection:l) ifFalse:[
       
  1375             s := s asText emphasisAllAdd:(#etchColor -> disabledEtchedFgColor)
       
  1376         ]
       
  1377     ].
  1373     isSubMenuEntry := (subMenus notNil and:[(subMenus at:l) notNil]).
  1378     isSubMenuEntry := (subMenus notNil and:[(subMenus at:l) notNil]).
  1374 
  1379 
  1375     isSubMenuEntry ifFalse:[
  1380     isSubMenuEntry ifFalse:[
  1376 	"/ this aligns them along their left
  1381         "/ this aligns them along their left
  1377 	x := width - textStartLeft - self shortKeyInset.
  1382         x := width - textStartLeft - self shortKeyInset.
  1378     ] ifTrue:[
  1383     ] ifTrue:[
  1379 	"/ this aligns them at the right
  1384         "/ this aligns them at the right
  1380 	x := width - leftMargin - (font widthOf:s).
  1385         x := width - leftMargin - (font widthOf:s).
  1381 	x := x - 16    "/ should query for the arrow size here ...
  1386         x := x - 16    "/ should query for the arrow size here ...
  1382     ].
  1387     ].
  1383 
  1388 
  1384     hilightStyle == #openwin ifTrue:[
  1389     hilightStyle == #openwin ifTrue:[
  1385 	x := x - 2            "/ inset of rounded rectangle
  1390         x := x - 2            "/ inset of rounded rectangle
  1386     ].
  1391     ].
  1387 
  1392 
  1388     self drawLine:s fromX:x inVisible:visLineNr with:fg and:bg
  1393     self drawLine:s fromX:x inVisible:visLineNr with:fg and:bg
  1389 
  1394 
  1390     "Created: 28.2.1996 / 18:48:05 / cg"
  1395     "Created: 28.2.1996 / 18:48:05 / cg"
  2544         empty line                  : leave blank
  2549         empty line                  : leave blank
  2545      there may be more in the future.
  2550      there may be more in the future.
  2546     "
  2551     "
  2547 
  2552 
  2548     |line lineNr y isSpecial isSeparatingLine 
  2553     |line lineNr y isSpecial isSeparatingLine 
  2549      isDoubleLine right clr1 clr2 text|
  2554      isDoubleLine right clr1 clr2 text key|
  2550 
  2555 
  2551     line := self visibleAt:visLineNr.
  2556     line := self visibleAt:visLineNr.
  2552 
  2557 
  2553     isSpecial := isDoubleLine := isSeparatingLine := false.
  2558     isSpecial := isDoubleLine := isSeparatingLine := false.
  2554     (line = '-') ifTrue:[
  2559     (line = '-') ifTrue:[
  2574                 drawLine:text 
  2579                 drawLine:text 
  2575                 atX:(textStartLeft - viewOrigin x) 
  2580                 atX:(textStartLeft - viewOrigin x) 
  2576                 inVisible:visLineNr 
  2581                 inVisible:visLineNr 
  2577                 with:disabledFgColor 
  2582                 with:disabledFgColor 
  2578                 and:bgColor.
  2583                 and:bgColor.
       
  2584 
       
  2585             "/
       
  2586             "/ is there a shortKey ?
       
  2587             "/
       
  2588             ((ShowAcceleratorKeys ~~ false)
       
  2589             and:[shortKeys notNil 
       
  2590             and:[(key := shortKeys at:lineNr ifAbsent:nil) notNil]]) ifTrue:[
       
  2591                 self drawAccelerator:key inVisibleLine:visLineNr with:disabledFgColor and:bgColor
       
  2592             ]
  2579             "/ self drawVisibleLine:visLineNr with:disabledFgColor and:bgColor
  2593             "/ self drawVisibleLine:visLineNr with:disabledFgColor and:bgColor
  2580         ] ifTrue:[
  2594         ] ifTrue:[
  2581             super redrawVisibleLine:visLineNr
  2595             super redrawVisibleLine:visLineNr
  2582         ].
  2596         ].
  2583 
  2597 
  2746 ! !
  2760 ! !
  2747 
  2761 
  2748 !MenuView class methodsFor:'documentation'!
  2762 !MenuView class methodsFor:'documentation'!
  2749 
  2763 
  2750 version
  2764 version
  2751     ^ '$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.135 2002-02-26 13:03:06 cg Exp $'
  2765     ^ '$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.136 2002-08-06 08:42:55 cg Exp $'
  2752 ! !
  2766 ! !