2858 Therefore, this method should be redefined in views which will be used |
2856 Therefore, this method should be redefined in views which will be used |
2859 with national characters (i.e. editTextViews)." |
2857 with national characters (i.e. editTextViews)." |
2860 |
2858 |
2861 |hMax newDeviceFont| |
2859 |hMax newDeviceFont| |
2862 |
2860 |
2863 newDeviceFont := gc createFontOnDevice. |
2861 newDeviceFont := gc deviceFont. |
2864 hMax := newDeviceFont height. |
2862 hMax := newDeviceFont height. |
2865 |
2863 |
2866 includesNonStrings == true ifTrue:[ |
2864 includesNonStrings == true ifTrue:[ |
2867 "/ |
2865 "/ |
2868 "/ find maximum height of lines |
2866 "/ find maximum height of lines |
2869 "/ |
2867 "/ |
2870 hMax := list inject:hMax into:[:maxSoFar :thisLine | |
2868 hMax := list inject:hMax into:[:maxSoFar :thisLine | |
2871 thisLine isNil ifTrue:[ |
2869 thisLine isNil ifTrue:[ |
2872 maxSoFar |
2870 maxSoFar |
2873 ] ifFalse:[ |
2871 ] ifFalse:[ |
2874 (thisLine isSingleByteString) ifTrue:[ |
2872 (thisLine isSingleByteString) ifTrue:[ |
2875 maxSoFar |
2873 maxSoFar |
2876 ] ifFalse:[ |
2874 ] ifFalse:[ |
2877 maxSoFar max:(thisLine heightOn:self) |
2875 maxSoFar max:(thisLine heightOn:self) |
2878 ] |
2876 ] |
2879 ] |
2877 ] |
2880 ]. |
2878 ]. |
2881 |
2879 |
2882 ]. |
2880 ]. |
2883 fontHeight := newDeviceFont maxHeight. |
2881 fontHeight := newDeviceFont maxHeight. |
2884 "/ fontHeight := font height. |
2882 "/ fontHeight := font height. |
2885 fontHeight := fontHeight max:(hMax + lineSpacing). |
2883 fontHeight := fontHeight max:(hMax + lineSpacing). |
3452 ! |
3450 ! |
3453 |
3451 |
3454 heightForLines:numberOfLines |
3452 heightForLines:numberOfLines |
3455 "return the height of the receiver, if numberOfLines are to be displayed" |
3453 "return the height of the receiver, if numberOfLines are to be displayed" |
3456 |
3454 |
3457 |font| |
3455 ^ numberOfLines * fontHeight + topMargin + gc deviceFont descent + lineSpacing + (margin * 2) |
3458 |
|
3459 "need a device font for query" |
|
3460 font := gc createFontOnDevice. |
|
3461 ^ numberOfLines * fontHeight + topMargin + font descent + lineSpacing + (margin * 2) |
|
3462 |
3456 |
3463 "Created: 27.1.1996 / 16:55:39 / cg" |
3457 "Created: 27.1.1996 / 16:55:39 / cg" |
3464 ! |
3458 ! |
3465 |
3459 |
3466 heightOfContents |
3460 heightOfContents |
3467 "return the height of the contents in pixels |
3461 "return the height of the contents in pixels |
3468 - used for scrollbar interface" |
3462 - used for scrollbar interface" |
3469 |
3463 |
3470 |numLines font| |
3464 |numLines| |
3471 |
3465 |
3472 numLines := self numberOfLines. |
3466 numLines := self numberOfLines. |
3473 numLines == 0 ifTrue:[^ 0]. |
3467 numLines == 0 ifTrue:[^ 0]. |
3474 |
3468 |
3475 "/ |
3469 "/ |
3476 "/ kludge for last partial line |
3470 "/ kludge for last partial line |
3477 "/ |
3471 "/ |
3478 "/ nFullLinesShown ~~ nLinesShown ifTrue:[ |
3472 "/ nFullLinesShown ~~ nLinesShown ifTrue:[ |
3479 "/ numLines := numLines + 1 |
3473 "/ numLines := numLines + 1 |
3480 "/ ]. |
3474 "/ ]. |
3481 " |
|
3482 need device-font for query |
|
3483 " |
|
3484 font := gc createFontOnDevice. |
|
3485 ^ numLines * fontHeight "dont take font height here - think of LabelAndIcons" |
3475 ^ numLines * fontHeight "dont take font height here - think of LabelAndIcons" |
3486 "/ + textStartTop |
3476 "/ + textStartTop |
3487 - (lineSpacing // 2) |
3477 - (lineSpacing // 2) |
3488 + (font descent) |
3478 + (gc deviceFont descent) |
3489 "/ + (font descent * 2) "makes it look better" |
3479 "/ + (font descent * 2) "makes it look better" |
3490 . |
3480 . |
3491 |
3481 |
3492 "/ "it used to be that code - which is wrong" |
3482 "/ "it used to be that code - which is wrong" |
3493 "/ (nLinesShown == nFullLinesShown) ifTrue:[ |
3483 "/ (nLinesShown == nFullLinesShown) ifTrue:[ |
3642 widthOfWidestLine notNil ifTrue:[ |
3632 widthOfWidestLine notNil ifTrue:[ |
3643 "/ already computed (cached); this cache is cleared when the contents is modified |
3633 "/ already computed (cached); this cache is cleared when the contents is modified |
3644 ^ widthOfWidestLine + (leftMargin * 2) |
3634 ^ widthOfWidestLine + (leftMargin * 2) |
3645 ]. |
3635 ]. |
3646 |
3636 |
3647 font := gc createFontOnDevice. |
3637 font := gc deviceFont. |
3648 checkedLinesForWidthOfContentsComputation isNil ifTrue:[ |
3638 checkedLinesForWidthOfContentsComputation isNil ifTrue:[ |
3649 start := 1. |
3639 start := 1. |
3650 stop := list size |
3640 stop := list size |
3651 ] ifFalse:[ |
3641 ] ifFalse:[ |
3652 checkedLinesForWidthOfContentsComputation >= 0 ifTrue:[ |
3642 checkedLinesForWidthOfContentsComputation >= 0 ifTrue:[ |
3719 ! |
3709 ! |
3720 |
3710 |
3721 widthOfLine:lineNr |
3711 widthOfLine:lineNr |
3722 "return the width of a line in pixels" |
3712 "return the width of a line in pixels" |
3723 |
3713 |
3724 |line font| |
3714 |line| |
3725 |
3715 |
3726 list isNil ifTrue:[^ 0]. |
3716 list isNil ifTrue:[^ 0]. |
3727 lineNr > list size ifTrue:[^ 0]. |
3717 lineNr > list size ifTrue:[^ 0]. |
3728 line := list at:lineNr. |
3718 line := list at:lineNr. |
3729 list isNil ifTrue:[^ 0]. |
3719 list isNil ifTrue:[^ 0]. |
3730 |
3720 |
3731 font := gc createFontOnDevice. |
|
3732 (line isSingleByteString) ifTrue:[ |
3721 (line isSingleByteString) ifTrue:[ |
3733 ^ font widthOf:line |
3722 ^ gc deviceFont widthOf:line |
3734 ]. |
3723 ]. |
3735 ^ line widthOn:self |
3724 ^ line widthOn:self |
3736 |
3725 |
3737 "Created: / 10.11.1998 / 23:59:20 / cg" |
3726 "Created: / 10.11.1998 / 23:59:20 / cg" |
3738 "Modified: / 11.11.1998 / 15:25:07 / cg" |
3727 "Modified: / 11.11.1998 / 15:25:07 / cg" |