1399 CAVEAT: with the addition of Text objects, |
1399 CAVEAT: with the addition of Text objects, |
1400 this method is going to be obsoleted by a textStyle |
1400 this method is going to be obsoleted by a textStyle |
1401 method, which allows specific control over |
1401 method, which allows specific control over |
1402 normalFont/boldFont/italicFont parameters." |
1402 normalFont/boldFont/italicFont parameters." |
1403 |
1403 |
1404 super font:(aFont onDevice:device). |
1404 super font:aFont. |
1405 preferredExtent := nil. |
1405 preferredExtent := nil. |
1406 shown ifTrue:[ |
1406 shown ifTrue:[ |
1407 self resize |
1407 self resize |
1408 ] ifFalse:[ |
1408 ] ifFalse:[ |
1409 needResize := true |
1409 needResize := true |
1517 ]. |
1517 ]. |
1518 |
1518 |
1519 subMenus at:i put:aPopUpMenu. |
1519 subMenus at:i put:aPopUpMenu. |
1520 aPopUpMenu notNil ifTrue:[ |
1520 aPopUpMenu notNil ifTrue:[ |
1521 aPopUpMenu isBlock ifFalse:[ |
1521 aPopUpMenu isBlock ifFalse:[ |
1522 aPopUpMenu device:device. |
1522 aPopUpMenu device:self graphicsDevice. |
1523 (receiver notNil and:[aPopUpMenu receiver isNil]) ifTrue:[ |
1523 (receiver notNil and:[aPopUpMenu receiver isNil]) ifTrue:[ |
1524 aPopUpMenu receiver:receiver |
1524 aPopUpMenu receiver:receiver |
1525 ] |
1525 ] |
1526 ]. |
1526 ]. |
1527 ]. |
1527 ]. |
1549 |s x l isSubMenuEntry| |
1549 |s x l isSubMenuEntry| |
1550 |
1550 |
1551 "/ this is somewhat complicated: we have the symbolic key at hand, |
1551 "/ this is somewhat complicated: we have the symbolic key at hand, |
1552 "/ but want to show the untranslated (inverse keyBoardMapped) key & modifier |
1552 "/ but want to show the untranslated (inverse keyBoardMapped) key & modifier |
1553 "/ |
1553 "/ |
1554 s := device shortKeyStringFor:aSymbolicKey. |
1554 s := self graphicsDevice shortKeyStringFor:aSymbolicKey. |
1555 s isNil ifTrue:[^ self]. |
1555 s isNil ifTrue:[^ self]. |
1556 |
1556 |
1557 l := self visibleLineToAbsoluteLine:visLineNr. |
1557 l := self visibleLineToAbsoluteLine:visLineNr. |
1558 |
1558 |
1559 disabledEtchedFgColor notNil ifTrue:[ |
1559 disabledEtchedFgColor notNil ifTrue:[ |
1568 isSubMenuEntry ifFalse:[ |
1568 isSubMenuEntry ifFalse:[ |
1569 "/ this aligns them along their left |
1569 "/ this aligns them along their left |
1570 x := width - textStartLeft - self shortKeyInset. |
1570 x := width - textStartLeft - self shortKeyInset. |
1571 ] ifTrue:[ |
1571 ] ifTrue:[ |
1572 "/ this aligns them at the right |
1572 "/ this aligns them at the right |
1573 x := width - leftMargin - (font widthOf:s). |
1573 x := width - leftMargin - (gc font widthOf:s). |
1574 x := x - 16 "/ should query for the arrow size here ... |
1574 x := x - 16 "/ should query for the arrow size here ... |
1575 ]. |
1575 ]. |
1576 |
1576 |
1577 hilightStyle == #openwin ifTrue:[ |
1577 hilightStyle == #openwin ifTrue:[ |
1578 x := x - 2 "/ inset of rounded rectangle |
1578 x := x - 2 "/ inset of rounded rectangle |
1626 markIndex ~~ 1 ifTrue:[ |
1626 markIndex ~~ 1 ifTrue:[ |
1627 super drawVisibleLine:visLineNr from:1 to:(markIndex-1) with:fg and:bg. |
1627 super drawVisibleLine:visLineNr from:1 to:(markIndex-1) with:fg and:bg. |
1628 ]. |
1628 ]. |
1629 |
1629 |
1630 (markType == $c) ifTrue:[ |
1630 (markType == $c) ifTrue:[ |
1631 w := font widthOf:'V'. |
1631 w := gc font widthOf:'V'. |
1632 check ifTrue:[ |
1632 check ifTrue:[ |
1633 form := checkOnImage. |
1633 form := checkOnImage. |
1634 ] ifFalse:[ |
1634 ] ifFalse:[ |
1635 form := checkOffImage. |
1635 form := checkOffImage. |
1636 ] |
1636 ] |
1637 ] ifFalse:[ |
1637 ] ifFalse:[ |
1638 (markType == $b) ifTrue:[ |
1638 (markType == $b) ifTrue:[ |
1639 w := font maxWidth. "/ font widthOf:' '. |
1639 w := gc font maxWidth. "/ font widthOf:' '. |
1640 ] ifFalse:[ |
1640 ] ifFalse:[ |
1641 (markType == $t) ifTrue:[ |
1641 (markType == $t) ifTrue:[ |
1642 check ifTrue:[form := Cursor thumbsUp sourceForm] |
1642 check ifTrue:[form := Cursor thumbsUp sourceForm] |
1643 ifFalse:[form := Cursor thumbsDown sourceForm] |
1643 ifFalse:[form := Cursor thumbsDown sourceForm] |
1644 ] |
1644 ] |
1650 ]. |
1650 ]. |
1651 |
1651 |
1652 self drawLine:(line copyFrom:markIndex+2) fromX:x+w inVisible:visLineNr with:fg and:bg. |
1652 self drawLine:(line copyFrom:markIndex+2) fromX:x+w inVisible:visLineNr with:fg and:bg. |
1653 self paint:(check ifTrue:[checkColor == bg ifTrue:[fg] ifFalse:[checkColor]] ifFalse:[fg]). |
1653 self paint:(check ifTrue:[checkColor == bg ifTrue:[fg] ifFalse:[checkColor]] ifFalse:[fg]). |
1654 |
1654 |
1655 h := font ascent. |
1655 h := gc font ascent. |
1656 y := y + (font height - h // 2). |
1656 y := y + (gc font height - h // 2). |
1657 yB := y + h - 1. |
1657 yB := y + h - 1. |
1658 |
1658 |
1659 form notNil ifTrue:[ |
1659 form notNil ifTrue:[ |
1660 self displayForm:form x:x y:y |
1660 self displayForm:form x:x y:y |
1661 ] ifFalse:[ |
1661 ] ifFalse:[ |
1982 fetchDeviceResources |
1982 fetchDeviceResources |
1983 "fetch device colors, to avoid reallocation at redraw time" |
1983 "fetch device colors, to avoid reallocation at redraw time" |
1984 |
1984 |
1985 super fetchDeviceResources. |
1985 super fetchDeviceResources. |
1986 |
1986 |
1987 checkColor notNil ifTrue:[checkColor := checkColor onDevice:device]. |
1987 checkColor notNil ifTrue:[checkColor := checkColor onDevice:self graphicsDevice]. |
1988 disabledFgColor notNil ifTrue:[disabledFgColor := disabledFgColor onDevice:device]. |
1988 disabledFgColor notNil ifTrue:[disabledFgColor := disabledFgColor onDevice:self graphicsDevice]. |
1989 |
1989 |
1990 hilightFgColorNoFocus := hilightFgColor. |
1990 hilightFgColorNoFocus := hilightFgColor. |
1991 hilightBgColorNoFocus := hilightBgColor. |
1991 hilightBgColorNoFocus := hilightBgColor. |
1992 |
1992 |
1993 "Created: 14.1.1997 / 00:08:55 / cg" |
1993 "Created: 14.1.1997 / 00:08:55 / cg" |
2006 ! |
2006 ! |
2007 |
2007 |
2008 initStyle |
2008 initStyle |
2009 "setup viewStyle specifics" |
2009 "setup viewStyle specifics" |
2010 |
2010 |
2011 |style| |
2011 |style graphicsDevice| |
2012 |
2012 |
2013 super initStyle. |
2013 super initStyle. |
2014 |
2014 |
|
2015 graphicsDevice := self graphicsDevice. |
2015 DefaultCheckColor notNil ifTrue:[ |
2016 DefaultCheckColor notNil ifTrue:[ |
2016 checkColor := DefaultCheckColor |
2017 checkColor := DefaultCheckColor |
2017 ] ifFalse:[ |
2018 ] ifFalse:[ |
2018 checkColor := fgColor. |
2019 checkColor := fgColor. |
2019 ]. |
2020 ]. |
2020 disabledFgColor := DefaultDisabledForegroundColor. |
2021 disabledFgColor := DefaultDisabledForegroundColor. |
2021 disabledEtchedFgColor := DefaultDisabledEtchedForegroundColor. |
2022 disabledEtchedFgColor := DefaultDisabledEtchedForegroundColor. |
2022 |
2023 |
2023 DefaultForegroundColor notNil ifTrue:[ |
2024 DefaultForegroundColor notNil ifTrue:[ |
2024 fgColor := DefaultForegroundColor onDevice:device |
2025 fgColor := DefaultForegroundColor onDevice:graphicsDevice |
2025 ]. |
2026 ]. |
2026 DefaultBackgroundColor notNil ifTrue:[ |
2027 DefaultBackgroundColor notNil ifTrue:[ |
2027 bgColor := DefaultBackgroundColor onDevice:device |
2028 bgColor := DefaultBackgroundColor onDevice:graphicsDevice |
2028 ]. |
2029 ]. |
2029 |
2030 |
2030 DefaultShadowColor notNil ifTrue:[ |
2031 DefaultShadowColor notNil ifTrue:[ |
2031 shadowColor := DefaultShadowColor onDevice:device |
2032 shadowColor := DefaultShadowColor onDevice:graphicsDevice |
2032 ]. |
2033 ]. |
2033 DefaultLightColor notNil ifTrue:[ |
2034 DefaultLightColor notNil ifTrue:[ |
2034 lightColor := DefaultLightColor onDevice:device |
2035 lightColor := DefaultLightColor onDevice:graphicsDevice |
2035 ]. |
2036 ]. |
2036 |
2037 |
2037 DefaultHilightLevel notNil ifTrue:[ |
2038 DefaultHilightLevel notNil ifTrue:[ |
2038 hilightLevel := DefaultHilightLevel |
2039 hilightLevel := DefaultHilightLevel |
2039 ] ifFalse:[ |
2040 ] ifFalse:[ |
2045 |
2046 |
2046 styleSheet is3D ifTrue:[ |
2047 styleSheet is3D ifTrue:[ |
2047 "some 3D style menu - set hilight defaults to same" |
2048 "some 3D style menu - set hilight defaults to same" |
2048 |
2049 |
2049 DefaultHilightForegroundColor notNil ifTrue:[ |
2050 DefaultHilightForegroundColor notNil ifTrue:[ |
2050 hilightFgColor := DefaultHilightForegroundColor onDevice:device |
2051 hilightFgColor := DefaultHilightForegroundColor onDevice:graphicsDevice |
2051 ] ifFalse:[ |
2052 ] ifFalse:[ |
2052 hilightFgColor := fgColor. |
2053 hilightFgColor := fgColor. |
2053 ]. |
2054 ]. |
2054 DefaultHilightBackgroundColor notNil ifTrue:[ |
2055 DefaultHilightBackgroundColor notNil ifTrue:[ |
2055 hilightBgColor := DefaultHilightBackgroundColor onDevice:device |
2056 hilightBgColor := DefaultHilightBackgroundColor onDevice:graphicsDevice |
2056 ] ifFalse:[ |
2057 ] ifFalse:[ |
2057 hilightBgColor := bgColor. |
2058 hilightBgColor := bgColor. |
2058 ]. |
2059 ]. |
2059 DefaultLineLevel notNil ifTrue:[ |
2060 DefaultLineLevel notNil ifTrue:[ |
2060 lineLevel := DefaultLineLevel |
2061 lineLevel := DefaultLineLevel |
2062 lineLevel := -1. |
2063 lineLevel := -1. |
2063 ] |
2064 ] |
2064 ] ifFalse:[ |
2065 ] ifFalse:[ |
2065 "some 2D style menu - set hilight defaults to inverse" |
2066 "some 2D style menu - set hilight defaults to inverse" |
2066 DefaultHilightForegroundColor notNil ifTrue:[ |
2067 DefaultHilightForegroundColor notNil ifTrue:[ |
2067 hilightFgColor := DefaultHilightForegroundColor onDevice:device |
2068 hilightFgColor := DefaultHilightForegroundColor onDevice:graphicsDevice |
2068 ] ifFalse:[ |
2069 ] ifFalse:[ |
2069 hilightFgColor := bgColor. |
2070 hilightFgColor := bgColor. |
2070 ]. |
2071 ]. |
2071 DefaultHilightBackgroundColor notNil ifTrue:[ |
2072 DefaultHilightBackgroundColor notNil ifTrue:[ |
2072 hilightBgColor := DefaultHilightBackgroundColor onDevice:device |
2073 hilightBgColor := DefaultHilightBackgroundColor onDevice:graphicsDevice |
2073 ] ifFalse:[ |
2074 ] ifFalse:[ |
2074 hilightBgColor := fgColor. |
2075 hilightBgColor := fgColor. |
2075 ]. |
2076 ]. |
2076 DefaultLineLevel notNil ifTrue:[ |
2077 DefaultLineLevel notNil ifTrue:[ |
2077 lineLevel := DefaultLineLevel |
2078 lineLevel := DefaultLineLevel |
2081 ]. |
2082 ]. |
2082 |
2083 |
2083 DefaultLineInset notNil ifTrue:[ |
2084 DefaultLineInset notNil ifTrue:[ |
2084 lineInset := DefaultLineInset |
2085 lineInset := DefaultLineInset |
2085 ] ifFalse:[ |
2086 ] ifFalse:[ |
2086 lineInset := (device horizontalPixelPerMillimeter * 0.8) rounded. |
2087 lineInset := (graphicsDevice horizontalPixelPerMillimeter * 0.8) rounded. |
2087 ]. |
2088 ]. |
2088 |
2089 |
2089 " |
2090 " |
2090 the following has to be changed to |
2091 the following has to be changed to |
2091 use the styleSheet too |
2092 use the styleSheet too |
2092 " |
2093 " |
2093 style := styleSheet name. |
2094 style := styleSheet name. |
2094 |
2095 |
2095 (style == #iris) ifTrue:[ |
2096 (style == #iris) ifTrue:[ |
2096 device hasGrayscales ifTrue:[ |
2097 graphicsDevice hasGrayscales ifTrue:[ |
2097 lineSpacing := 3 |
2098 lineSpacing := 3 |
2098 ]. |
2099 ]. |
2099 ]. |
2100 ]. |
2100 (style == #motif) ifTrue:[ |
2101 (style == #motif) ifTrue:[ |
2101 lineSpacing := (2 * hilightLevel) |
2102 lineSpacing := (2 * hilightLevel) |
2112 "/ ]. |
2113 "/ ]. |
2113 (style == #st80) ifTrue:[ |
2114 (style == #st80) ifTrue:[ |
2114 level := 0. |
2115 level := 0. |
2115 ]. |
2116 ]. |
2116 DefaultViewBackground notNil ifTrue:[ |
2117 DefaultViewBackground notNil ifTrue:[ |
2117 viewBackground := DefaultViewBackground onDevice:device |
2118 viewBackground := DefaultViewBackground onDevice:graphicsDevice |
2118 ]. |
2119 ]. |
2119 |
2120 |
2120 "Modified: / 22-01-1997 / 11:57:23 / cg" |
2121 "Modified: / 22-01-1997 / 11:57:23 / cg" |
2121 "Modified (comment): / 05-10-2011 / 15:50:59 / az" |
2122 "Modified (comment): / 05-10-2011 / 15:50:59 / az" |
2122 ! |
2123 ! |
2136 ]. |
2137 ]. |
2137 |
2138 |
2138 "stupid - have to redo this ..." |
2139 "stupid - have to redo this ..." |
2139 hilightStyle == #openwin ifTrue:[ |
2140 hilightStyle == #openwin ifTrue:[ |
2140 "add some space for rounded-hilight area" |
2141 "add some space for rounded-hilight area" |
2141 self leftMargin:(font height " // 2" + 2 "inset of rounded rect") "10". |
2142 self leftMargin:(gc font height " // 2" + 2 "inset of rounded rect") "10". |
2142 ] ifFalse:[ |
2143 ] ifFalse:[ |
2143 (hilightLevel ~~ 0) ifTrue:[ |
2144 (hilightLevel ~~ 0) ifTrue:[ |
2144 self leftMargin:hilightLevel abs + margin abs + 1. |
2145 self leftMargin:hilightLevel abs + margin abs + 1. |
2145 lineSpacing := lineSpacing max:(hilightLevel abs * 2). |
2146 lineSpacing := lineSpacing max:(hilightLevel abs * 2). |
2146 ]. |
2147 ]. |
2155 font dimensions have changed on the display" |
2156 font dimensions have changed on the display" |
2156 |
2157 |
2157 super recreate. |
2158 super recreate. |
2158 hilightStyle == #openwin ifTrue:[ |
2159 hilightStyle == #openwin ifTrue:[ |
2159 "add some space for rounded-hilight area" |
2160 "add some space for rounded-hilight area" |
2160 self leftMargin:(font height // 2 + 2 "inset of rounded rect") "10". |
2161 self leftMargin:(gc font height // 2 + 2 "inset of rounded rect") "10". |
2161 ] ifFalse:[ |
2162 ] ifFalse:[ |
2162 (hilightLevel ~~ 0) ifTrue:[ |
2163 (hilightLevel ~~ 0) ifTrue:[ |
2163 self leftMargin:hilightLevel abs + self margin abs + 1. |
2164 self leftMargin:hilightLevel abs + self margin abs + 1. |
2164 lineSpacing := lineSpacing max:(hilightLevel abs * 2). |
2165 lineSpacing := lineSpacing max:(hilightLevel abs * 2). |
2165 ] |
2166 ] |
2262 self sendChangeMessageWith:val. |
2263 self sendChangeMessageWith:val. |
2263 |
2264 |
2264 " |
2265 " |
2265 item actions or selectors-array |
2266 item actions or selectors-array |
2266 " |
2267 " |
2267 device activePointerGrab == self ifTrue:[ |
2268 self graphicsDevice activePointerGrab == self ifTrue:[ |
2268 device ungrabPointer. |
2269 self graphicsDevice ungrabPointer. |
2269 ]. |
2270 ]. |
2270 |
2271 |
2271 actions notNil ifTrue:[ |
2272 actions notNil ifTrue:[ |
2272 theAction := actions at:idx ifAbsent:nil. |
2273 theAction := actions at:idx ifAbsent:nil. |
2273 ]. |
2274 ]. |
2534 |
2535 |
2535 shortKeyInset |
2536 shortKeyInset |
2536 "compute the width req'd for the shortKey" |
2537 "compute the width req'd for the shortKey" |
2537 |
2538 |
2538 maxShortKeyStringLen isNil ifTrue:[ |
2539 maxShortKeyStringLen isNil ifTrue:[ |
2539 |
|
2540 shortKeys isNil ifTrue:[ |
2540 shortKeys isNil ifTrue:[ |
2541 maxShortKeyStringLen := 0 |
2541 maxShortKeyStringLen := 0 |
2542 ] ifFalse:[ |
2542 ] ifFalse:[ |
2543 maxShortKeyStringLen := shortKeys |
2543 maxShortKeyStringLen := shortKeys |
2544 inject:0 |
2544 inject:0 |
2545 into:[:maxSoFar :thisKey | |short| |
2545 into:[:maxSoFar :thisKey | |short| |
2546 |
2546 |
2547 thisKey isNil ifTrue:[ |
2547 thisKey isNil ifTrue:[ |
2548 maxSoFar |
2548 maxSoFar |
2549 ] ifFalse:[ |
2549 ] ifFalse:[ |
2550 short := device shortKeyStringFor:thisKey. |
2550 short := self graphicsDevice shortKeyStringFor:thisKey. |
2551 short isNil ifTrue:[ |
2551 short isNil ifTrue:[ |
2552 maxSoFar |
2552 maxSoFar |
2553 ] ifFalse:[ |
2553 ] ifFalse:[ |
2554 maxSoFar max:(font widthOf:short) |
2554 maxSoFar max:(gc font widthOf:short) |
2555 ] |
2555 ] |
2556 ] |
2556 ] |
2557 ] |
2557 ] |
2558 ]. |
2558 ]. |
2559 ]. |
2559 ]. |
2923 my := self yOfVisibleLine:index. |
2923 my := self yOfVisibleLine:index. |
2924 " |
2924 " |
2925 need to know the physical screen coordinate, |
2925 need to know the physical screen coordinate, |
2926 to map the subview there |
2926 to map the subview there |
2927 " |
2927 " |
2928 org := device translatePoint:(mx @ my) fromView:self toView:nil. |
2928 org := self graphicsDevice translatePoint:(mx @ my) fromView:self toView:nil. |
2929 |
2929 |
2930 " |
2930 " |
2931 before showing, process all of my expose events |
2931 before showing, process all of my expose events |
2932 " |
2932 " |
2933 "/ "/ mhmh - is this still needed ? |
2933 "/ "/ mhmh - is this still needed ? |
2934 "/ windowGroup notNil ifTrue:[ |
2934 "/ windowGroup notNil ifTrue:[ |
2935 "/ windowGroup processExposeEvents |
2935 "/ windowGroup processExposeEvents |
2936 "/ ]. |
2936 "/ ]. |
2937 |
2937 |
2938 menu topView device:device. "/ req'd for multiDisplay operation |
2938 menu topView device:self graphicsDevice. "/ req'd for multiDisplay operation |
2939 menu superMenu:self. |
2939 menu superMenu:self. |
2940 |
2940 |
2941 actionBlock notNil ifTrue:[ |
2941 actionBlock notNil ifTrue:[ |
2942 "/ mhmh - I am an ST-80 style menu |
2942 "/ mhmh - I am an ST-80 style menu |
2943 "/ which does not send any messages to the receiver, |
2943 "/ which does not send any messages to the receiver, |