mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 04:29:27 +02:00
* textwidth doesn't support ~ anymore, added CTextWidth with ~ support
This commit is contained in:
parent
7e126adf31
commit
0be931fc60
@ -1891,7 +1891,7 @@ BEGIN
|
|||||||
End;
|
End;
|
||||||
If (Title <> Nil) Then Begin { We have a title }
|
If (Title <> Nil) Then Begin { We have a title }
|
||||||
If (Flags AND bfLeftJust = 0) Then Begin { Not left set title }
|
If (Flags AND bfLeftJust = 0) Then Begin { Not left set title }
|
||||||
I := TextWidth(Title^); { Fetch title width }
|
I := CTextWidth(Title^); { Fetch title width }
|
||||||
I := (RawSize.X - I) DIV 2; { Centre in button }
|
I := (RawSize.X - I) DIV 2; { Centre in button }
|
||||||
End Else I := FontWidth; { Left edge of button }
|
End Else I := FontWidth; { Left edge of button }
|
||||||
If not TextModeGFV then Begin
|
If not TextModeGFV then Begin
|
||||||
@ -4229,7 +4229,10 @@ END;
|
|||||||
END.
|
END.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.24 2004-11-03 10:37:24 peter
|
Revision 1.25 2004-11-03 12:09:08 peter
|
||||||
|
* textwidth doesn't support ~ anymore, added CTextWidth with ~ support
|
||||||
|
|
||||||
|
Revision 1.24 2004/11/03 10:37:24 peter
|
||||||
* cursor probs fixed
|
* cursor probs fixed
|
||||||
|
|
||||||
Revision 1.23 2004/11/02 23:53:19 peter
|
Revision 1.23 2004/11/02 23:53:19 peter
|
||||||
|
15
fv/menus.pas
15
fv/menus.pas
@ -955,7 +955,7 @@ BEGIN
|
|||||||
MoveCStr(B, ' '+P^.Name^+' ', Color); { Name to buffer }
|
MoveCStr(B, ' '+P^.Name^+' ', Color); { Name to buffer }
|
||||||
WriteBuf(I, 0, J, 1, B); { Write the string }
|
WriteBuf(I, 0, J, 1, B); { Write the string }
|
||||||
K := I*FontWidth; { X start position }
|
K := I*FontWidth; { X start position }
|
||||||
L := K + TextWidth(' '+P^.Name^+' '); { X end position }
|
L := K + CTextWidth(' '+P^.Name^+' '); { X end position }
|
||||||
If AdvancedMenus Then Begin
|
If AdvancedMenus Then Begin
|
||||||
GraphLine(K, 0, L, 0, White); { Redraw top line }
|
GraphLine(K, 0, L, 0, White); { Redraw top line }
|
||||||
GraphLine(K, FontHeight-1, L,
|
GraphLine(K, FontHeight-1, L,
|
||||||
@ -1017,7 +1017,7 @@ BEGIN
|
|||||||
While (P <> Nil) Do Begin { While valid item }
|
While (P <> Nil) Do Begin { While valid item }
|
||||||
R.A.X := I*FontWidth; { Move area along }
|
R.A.X := I*FontWidth; { Move area along }
|
||||||
If (P^.Name <> Nil) Then Begin { Valid name }
|
If (P^.Name <> Nil) Then Begin { Valid name }
|
||||||
R.B.X := R.A.X+TextWidth(' ' + P^.Name^ + ' ');{ Add text width }
|
R.B.X := R.A.X+CTextWidth(' ' + P^.Name^ + ' ');{ Add text width }
|
||||||
I := I + CStrLen(P^.Name^) + 2; { Add item length }
|
I := I + CStrLen(P^.Name^) + 2; { Add item length }
|
||||||
End Else R.B.X := R.A.X;
|
End Else R.B.X := R.A.X;
|
||||||
If (P = Item) Then break; { Requested item found }
|
If (P = Item) Then break; { Requested item found }
|
||||||
@ -1046,7 +1046,7 @@ BEGIN
|
|||||||
If (P^.Command <> 0) AND (P^.Param <> Nil)
|
If (P^.Command <> 0) AND (P^.Param <> Nil)
|
||||||
Then S := S + ' - ' + P^.Param^; { Add any parameter }
|
Then S := S + ' - ' + P^.Param^; { Add any parameter }
|
||||||
End;
|
End;
|
||||||
L := TextWidth(S); { Width of string }
|
L := CTextWidth(S); { Width of string }
|
||||||
If (L > W) Then W := L; { Hold maximum }
|
If (L > W) Then W := L; { Hold maximum }
|
||||||
Inc(H); { Inc count of items }
|
Inc(H); { Inc count of items }
|
||||||
P := P^.Next; { Move to next item }
|
P := P^.Next; { Move to next item }
|
||||||
@ -1155,7 +1155,7 @@ BEGIN
|
|||||||
If (P = Current) Then Begin { Selected item }
|
If (P = Current) Then Begin { Selected item }
|
||||||
Tx := 2 * FontWidth; { X offset }
|
Tx := 2 * FontWidth; { X offset }
|
||||||
Ty := Y * FontHeight; { Y offset }
|
Ty := Y * FontHeight; { Y offset }
|
||||||
BicolorRectangle(Tx, Ty, Tx + TextWidth(S)
|
BicolorRectangle(Tx, Ty, Tx + CTextWidth(S)
|
||||||
- 1, Ty + FontHeight - 1, White,
|
- 1, Ty + FontHeight - 1, White,
|
||||||
DarkGray, False); { Draw higlight box }
|
DarkGray, False); { Draw higlight box }
|
||||||
End;
|
End;
|
||||||
@ -1476,7 +1476,7 @@ VAR Mouse: TPoint; T, Tt: PStatusItem;
|
|||||||
While (T <> Nil) Do Begin { While item valid }
|
While (T <> Nil) Do Begin { While item valid }
|
||||||
If (T^.Text <> Nil) Then Begin { Check valid text }
|
If (T^.Text <> Nil) Then Begin { Check valid text }
|
||||||
Xi := X; { Hold initial x value }
|
Xi := X; { Hold initial x value }
|
||||||
X := Xi + TextWidth(' ' + T^.Text^ + ' '); { Add text width }
|
X := Xi + CTextWidth(' ' + T^.Text^ + ' '); { Add text width }
|
||||||
If (Mouse.X >= Xi) AND (Mouse.X < X)
|
If (Mouse.X >= Xi) AND (Mouse.X < X)
|
||||||
Then Begin
|
Then Begin
|
||||||
ItemMouseIsIn := T; { Selected item }
|
ItemMouseIsIn := T; { Selected item }
|
||||||
@ -1759,7 +1759,10 @@ END;
|
|||||||
END.
|
END.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.17 2004-11-02 23:53:19 peter
|
Revision 1.18 2004-11-03 12:09:08 peter
|
||||||
|
* textwidth doesn't support ~ anymore, added CTextWidth with ~ support
|
||||||
|
|
||||||
|
Revision 1.17 2004/11/02 23:53:19 peter
|
||||||
* fixed crashes with ide and 1.9.x
|
* fixed crashes with ide and 1.9.x
|
||||||
|
|
||||||
Revision 1.16 2002/10/17 11:24:17 pierre
|
Revision 1.16 2002/10/17 11:24:17 pierre
|
||||||
|
17
fv/views.pas
17
fv/views.pas
@ -396,7 +396,8 @@ TYPE
|
|||||||
FUNCTION GetColor (Color: Word): Word;
|
FUNCTION GetColor (Color: Word): Word;
|
||||||
FUNCTION Valid (Command: Word): Boolean; Virtual;
|
FUNCTION Valid (Command: Word): Boolean; Virtual;
|
||||||
FUNCTION GetState (AState: Word): Boolean;
|
FUNCTION GetState (AState: Word): Boolean;
|
||||||
FUNCTION TextWidth (Txt: String): Sw_Integer;
|
FUNCTION TextWidth (const Txt: String): Sw_Integer;
|
||||||
|
FUNCTION CTextWidth (const Txt: String): Sw_Integer;
|
||||||
FUNCTION MouseInView (Point: TPoint): Boolean;
|
FUNCTION MouseInView (Point: TPoint): Boolean;
|
||||||
FUNCTION CommandEnabled (Command: Word): Boolean;
|
FUNCTION CommandEnabled (Command: Word): Boolean;
|
||||||
FUNCTION OverLapsArea (X1, Y1, X2, Y2: Sw_Integer): Boolean;
|
FUNCTION OverLapsArea (X1, Y1, X2, Y2: Sw_Integer): Boolean;
|
||||||
@ -1195,7 +1196,12 @@ END;
|
|||||||
{--TView--------------------------------------------------------------------}
|
{--TView--------------------------------------------------------------------}
|
||||||
{ TextWidth -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 25Nov99 LdB }
|
{ TextWidth -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 25Nov99 LdB }
|
||||||
{---------------------------------------------------------------------------}
|
{---------------------------------------------------------------------------}
|
||||||
FUNCTION TView.TextWidth (Txt: String): Sw_Integer;
|
FUNCTION TView.TextWidth (const Txt: String): Sw_Integer;
|
||||||
|
BEGIN
|
||||||
|
TextWidth := Length(Txt) * SysFontWidth; { Calc text length }
|
||||||
|
END;
|
||||||
|
|
||||||
|
FUNCTION TView.CTextWidth (const Txt: String): Sw_Integer;
|
||||||
VAR I: Sw_Integer; S: String;
|
VAR I: Sw_Integer; S: String;
|
||||||
BEGIN
|
BEGIN
|
||||||
S := Txt; { Transfer text }
|
S := Txt; { Transfer text }
|
||||||
@ -1203,7 +1209,7 @@ BEGIN
|
|||||||
I := Pos('~', S); { Check for tilde }
|
I := Pos('~', S); { Check for tilde }
|
||||||
If (I <> 0) Then System.Delete(S, I, 1); { Remove the tilde }
|
If (I <> 0) Then System.Delete(S, I, 1); { Remove the tilde }
|
||||||
Until (I = 0); { Remove all tildes }
|
Until (I = 0); { Remove all tildes }
|
||||||
TextWidth := Length(S) * SysFontWidth; { Calc text length }
|
CTextWidth := Length(S) * SysFontWidth; { Calc text length }
|
||||||
END;
|
END;
|
||||||
|
|
||||||
{--TView--------------------------------------------------------------------}
|
{--TView--------------------------------------------------------------------}
|
||||||
@ -5860,7 +5866,10 @@ END.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.42 2004-11-03 10:37:24 peter
|
Revision 1.43 2004-11-03 12:09:08 peter
|
||||||
|
* textwidth doesn't support ~ anymore, added CTextWidth with ~ support
|
||||||
|
|
||||||
|
Revision 1.42 2004/11/03 10:37:24 peter
|
||||||
* cursor probs fixed
|
* cursor probs fixed
|
||||||
|
|
||||||
Revision 1.41 2004/11/02 23:53:19 peter
|
Revision 1.41 2004/11/02 23:53:19 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user