Browse Source

* unicode versions of TView.TextWidth and CTextWidth

git-svn-id: branches/unicodekvm@48564 -
nickysn 4 years ago
parent
commit
763124567d
1 changed files with 23 additions and 0 deletions
  1. 23 0
      packages/fv/src/views.inc

+ 23 - 0
packages/fv/src/views.inc

@@ -371,8 +371,13 @@ TYPE
       FUNCTION GetColor (Color: Word): Word;
       FUNCTION Valid (Command: Word): Boolean; Virtual;
       FUNCTION GetState (AState: Word): Boolean;
+{$ifdef FV_UNICODE}
+      FUNCTION TextWidth (const Txt: UnicodeString): Sw_Integer;
+      FUNCTION CTextWidth (const Txt: UnicodeString): Sw_Integer;
+{$else FV_UNICODE}
       FUNCTION TextWidth (const Txt: String): Sw_Integer;
       FUNCTION CTextWidth (const Txt: String): Sw_Integer;
+{$endif FV_UNICODE}
       FUNCTION MouseInView (Point: TPoint): Boolean;
       FUNCTION CommandEnabled (Command: Word): Boolean;
       FUNCTION OverLapsArea (X1, Y1, X2, Y2: Sw_Integer): Boolean;
@@ -1232,6 +1237,23 @@ END;
 {--TView--------------------------------------------------------------------}
 {  TextWidth -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 25Nov99 LdB         }
 {---------------------------------------------------------------------------}
+{$ifdef FV_UNICODE}
+FUNCTION TView.TextWidth (const Txt: UnicodeString): Sw_Integer;
+BEGIN
+   TextWidth := Length(Txt);             { Calc text length }
+END;
+
+FUNCTION TView.CTextWidth (const Txt: UnicodeString): Sw_Integer;
+VAR I: Sw_Integer; S: UnicodeString;
+BEGIN
+   S := Txt;                                          { Transfer text }
+   Repeat
+     I := Pos('~', S);                                { Check for tilde }
+      If (I <> 0) Then System.Delete(S, I, 1);        { Remove the tilde }
+   Until (I = 0);                                     { Remove all tildes }
+   CTextWidth := Length(S);             { Calc text length }
+END;
+{$else FV_UNICODE}
 FUNCTION TView.TextWidth (const Txt: String): Sw_Integer;
 BEGIN
    TextWidth := Length(Txt);             { Calc text length }
@@ -1247,6 +1269,7 @@ BEGIN
    Until (I = 0);                                     { Remove all tildes }
    CTextWidth := Length(S);             { Calc text length }
 END;
+{$endif FV_UNICODE}
 
 {--TView--------------------------------------------------------------------}
 {  MouseInView -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 12Sep97 LdB       }