Browse Source

* unicode fixes

git-svn-id: branches/unicodekvm@48625 -
nickysn 4 years ago
parent
commit
8a0a97576a
2 changed files with 12 additions and 4 deletions
  1. 10 4
      packages/fv/src/dialogs.inc
  2. 2 0
      packages/fv/src/platform.inc

+ 10 - 4
packages/fv/src/dialogs.inc

@@ -1817,12 +1817,12 @@ END;
 {  CanScroll -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB         }
 {  CanScroll -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB         }
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
 FUNCTION TInputLine.CanScroll (Delta: Sw_Integer): Boolean;
 FUNCTION TInputLine.CanScroll (Delta: Sw_Integer): Boolean;
-VAR S: String;
+VAR S: Sw_String;
 BEGIN
 BEGIN
    If (Delta < 0) Then CanScroll := FirstPos > 0      { Check scroll left }
    If (Delta < 0) Then CanScroll := FirstPos > 0      { Check scroll left }
      Else If (Delta > 0) Then Begin
      Else If (Delta > 0) Then Begin
-       If (Data = Nil) Then S := '' Else              { Data ptr invalid }
-         S := Copy(Data^, FirstPos+1, Length(Data^)
+       If Data = Sw_PString_Empty Then S := '' Else   { Data ptr invalid }
+         S := Copy(Data Sw_PString_DeRef, FirstPos+1, Length(Data Sw_PString_DeRef)
           - FirstPos);                                { Fetch max string }
           - FirstPos);                                { Fetch max string }
        CanScroll := (TextWidth(S)) > (Size.X -
        CanScroll := (TextWidth(S)) > (Size.X -
          TextWidth(LeftArr) - TextWidth(RightArr));   { Check scroll right }
          TextWidth(LeftArr) - TextWidth(RightArr));   { Check scroll right }
@@ -1848,7 +1848,7 @@ BEGIN
    Flags := AFlags;                                   { Hold flags }
    Flags := AFlags;                                   { Hold flags }
    If (AFlags AND bfDefault <> 0) Then AmDefault := True
    If (AFlags AND bfDefault <> 0) Then AmDefault := True
      Else AmDefault := False;                         { Check if default }
      Else AmDefault := False;                         { Check if default }
-   Title := NewStr(ATitle);                           { Hold title string }
+   Title := Sw_NewStr(ATitle);                           { Hold title string }
    Command := ACommand;                               { Hold button command }
    Command := ACommand;                               { Hold button command }
    TabMask := TabMask OR (tmLeft + tmRight +
    TabMask := TabMask OR (tmLeft + tmRight +
      tmTab + tmShiftTab + tmUp + tmDown);             { Set tab masks }
      tmTab + tmShiftTab + tmUp + tmDown);             { Set tab masks }
@@ -1860,7 +1860,11 @@ END;
 CONSTRUCTOR TButton.Load (Var S: TStream);
 CONSTRUCTOR TButton.Load (Var S: TStream);
 BEGIN
 BEGIN
    Inherited Load(S);                                 { Call ancestor }
    Inherited Load(S);                                 { Call ancestor }
+{$ifdef FV_UNICODE}
+   Title := S.ReadUnicodeString;                      { Read title }
+{$else FV_UNICODE}
    Title := S.ReadStr;                                { Read title }
    Title := S.ReadStr;                                { Read title }
+{$endif FV_UNICODE}
    S.Read(Command, SizeOf(Command));                  { Read command }
    S.Read(Command, SizeOf(Command));                  { Read command }
    S.Read(Flags, SizeOf(Flags));                      { Read flags }
    S.Read(Flags, SizeOf(Flags));                      { Read flags }
    S.Read(AmDefault, SizeOf(AmDefault));              { Read if default }
    S.Read(AmDefault, SizeOf(AmDefault));              { Read if default }
@@ -1874,7 +1878,9 @@ END;
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
 DESTRUCTOR TButton.Done;
 DESTRUCTOR TButton.Done;
 BEGIN
 BEGIN
+{$ifndef FV_UNICODE}
    If (Title <> Nil) Then DisposeStr(Title);          { Dispose title }
    If (Title <> Nil) Then DisposeStr(Title);          { Dispose title }
+{$endif FV_UNICODE}
    Inherited Done;                                    { Call ancestor }
    Inherited Done;                                    { Call ancestor }
 END;
 END;
 
 

+ 2 - 0
packages/fv/src/platform.inc

@@ -181,8 +181,10 @@ FOR FPC THESE ARE THE TRANSLATIONS
 
 
   {$IFDEF FV_UNICODE}
   {$IFDEF FV_UNICODE}
     {$DEFINE Sw_PString_DeRef:=}
     {$DEFINE Sw_PString_DeRef:=}
+    {$DEFINE Sw_NewStr:=}
   {$ELSE FV_UNICODE}
   {$ELSE FV_UNICODE}
     {$DEFINE Sw_PString_DeRef:=^}
     {$DEFINE Sw_PString_DeRef:=^}
+    {$DEFINE Sw_NewStr:=NewStr}
   {$ENDIF FV_UNICODE}
   {$ENDIF FV_UNICODE}
 
 
   {$UNDEF PROC_Real}
   {$UNDEF PROC_Real}