Browse Source

+ use Sw_String in unit menus/umenus to reduce the number of ifdefs

git-svn-id: branches/unicodekvm@48602 -
nickysn 4 years ago
parent
commit
5dae243ffd
2 changed files with 11 additions and 39 deletions
  1. 2 0
      packages/fv/fpmake.pp
  2. 9 39
      packages/fv/src/menus.inc

+ 2 - 0
packages/fv/fpmake.pp

@@ -232,6 +232,7 @@ begin
           AddInclude('platform.inc');
           AddInclude('platform.inc');
           AddUnit('drivers');
           AddUnit('drivers');
           AddUnit('views');
           AddUnit('views');
+          AddUnit('fvcommon');
           AddUnit('fvconsts');
           AddUnit('fvconsts');
         end;
         end;
     T:=P.Targets.AddUnit('umenus.pas');
     T:=P.Targets.AddUnit('umenus.pas');
@@ -241,6 +242,7 @@ begin
           AddInclude('platform.inc');
           AddInclude('platform.inc');
           AddUnit('udrivers');
           AddUnit('udrivers');
           AddUnit('uviews');
           AddUnit('uviews');
+          AddUnit('ufvcommon');
           AddUnit('fvconsts');
           AddUnit('fvconsts');
         end;
         end;
     T:=P.Targets.AddUnit('msgbox.pas');
     T:=P.Targets.AddUnit('msgbox.pas');

+ 9 - 39
packages/fv/src/menus.inc

@@ -76,9 +76,9 @@ USES
    {$ENDIF}
    {$ENDIF}
 
 
 {$ifdef FV_UNICODE}
 {$ifdef FV_UNICODE}
-   objects, udrivers, uviews, fvconsts;               { GFV standard units }
+   objects, udrivers, uviews, UFVCommon, fvconsts;               { GFV standard units }
 {$else FV_UNICODE}
 {$else FV_UNICODE}
-   objects, drivers, views, fvconsts;                 { GFV standard units }
+   objects, drivers, views, fvcommon, fvconsts;                 { GFV standard units }
 {$endif FV_UNICODE}
 {$endif FV_UNICODE}
 
 
 {***************************************************************************}
 {***************************************************************************}
@@ -258,11 +258,7 @@ TYPE
       CONSTRUCTOR Load (Var S: TStream);
       CONSTRUCTOR Load (Var S: TStream);
       DESTRUCTOR Done; Virtual;
       DESTRUCTOR Done; Virtual;
       FUNCTION GetPalette: PPalette; Virtual;
       FUNCTION GetPalette: PPalette; Virtual;
-{$ifdef FV_UNICODE}
-      FUNCTION Hint (AHelpCtx: Word): UnicodeString; Virtual;
-{$else FV_UNICODE}
-      FUNCTION Hint (AHelpCtx: Word): String; Virtual;
-{$endif FV_UNICODE}
+      FUNCTION Hint (AHelpCtx: Word): Sw_String; Virtual;
       PROCEDURE Draw; Virtual;
       PROCEDURE Draw; Virtual;
       PROCEDURE Update; Virtual;
       PROCEDURE Update; Virtual;
       PROCEDURE Store (Var S: TStream);
       PROCEDURE Store (Var S: TStream);
@@ -344,13 +340,8 @@ with the given parameter values (using NewStr to allocate the Text).
 An error in creating will return a nil pointer.
 An error in creating will return a nil pointer.
 15May98 LdB
 15May98 LdB
 ---------------------------------------------------------------------}
 ---------------------------------------------------------------------}
-{$ifdef FV_UNICODE}
-FUNCTION NewStatusKey (AText: UnicodeString; AKeyCode: Word; ACommand: Word;
-  ANext: PStatusItem): PStatusItem;
-{$else FV_UNICODE}
-FUNCTION NewStatusKey (AText: String; AKeyCode: Word; ACommand: Word;
+FUNCTION NewStatusKey (AText: Sw_String; AKeyCode: Word; ACommand: Word;
   ANext: PStatusItem): PStatusItem;
   ANext: PStatusItem): PStatusItem;
-{$endif FV_UNICODE}
 
 
 {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
 {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
 {                           OBJECT REGISTER ROUTINES                        }
 {                           OBJECT REGISTER ROUTINES                        }
@@ -1052,11 +1043,7 @@ END;
 CONSTRUCTOR TMenuBox.Init (Var Bounds: TRect; AMenu: PMenu;
 CONSTRUCTOR TMenuBox.Init (Var Bounds: TRect; AMenu: PMenu;
   AParentMenu: PMenuView);
   AParentMenu: PMenuView);
 VAR W, H, L: SmallInt; P: PMenuItem; R: TRect;
 VAR W, H, L: SmallInt; P: PMenuItem; R: TRect;
-{$ifdef FV_UNICODE}
-    S: UnicodeString;
-{$else FV_UNICODE}
-    S: String;
-{$endif FV_UNICODE}
+    S: Sw_String;
 BEGIN
 BEGIN
    W := 0;                                            { Clear initial width }
    W := 0;                                            { Clear initial width }
    H := 2;                                            { Set initial height }
    H := 2;                                            { Set initial height }
@@ -1102,11 +1089,7 @@ END;
 PROCEDURE TMenuBox.Draw;
 PROCEDURE TMenuBox.Draw;
 VAR CNormal, CSelect, CSelectDisabled, CDisabled, Color: Word; Index, Y: SmallInt;
 VAR CNormal, CSelect, CSelectDisabled, CDisabled, Color: Word; Index, Y: SmallInt;
     P: PMenuItem; B: TDrawBuffer;
     P: PMenuItem; B: TDrawBuffer;
-{$ifdef FV_UNICODE}
-    S: UnicodeString;
-{$else FV_UNICODE}
-    S: String;
-{$endif FV_UNICODE}
+    S: SW_String;
 Type
 Type
    FrameLineType = (UpperLine,NormalLine,SeparationLine,LowerLine);
    FrameLineType = (UpperLine,NormalLine,SeparationLine,LowerLine);
 {$ifdef FV_UNICODE}
 {$ifdef FV_UNICODE}
@@ -1382,11 +1365,7 @@ END;
 {--TStatusLine--------------------------------------------------------------}
 {--TStatusLine--------------------------------------------------------------}
 {  Hint -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 11May98 LdB              }
 {  Hint -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 11May98 LdB              }
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
-{$ifdef FV_UNICODE}
-FUNCTION TStatusLine.Hint (AHelpCtx: Word): UnicodeString;
-{$else FV_UNICODE}
-FUNCTION TStatusLine.Hint (AHelpCtx: Word): String;
-{$endif FV_UNICODE}
+FUNCTION TStatusLine.Hint (AHelpCtx: Word): Sw_String;
 BEGIN
 BEGIN
    Hint := '';                                        { Return nothing }
    Hint := '';                                        { Return nothing }
 END;
 END;
@@ -1562,11 +1541,7 @@ END;
 PROCEDURE TStatusLine.DrawSelect (Selected: PStatusItem);
 PROCEDURE TStatusLine.DrawSelect (Selected: PStatusItem);
 VAR I, L: SmallInt; Color, CSelect, CNormal, CSelDisabled, CNormDisabled: Word;
 VAR I, L: SmallInt; Color, CSelect, CNormal, CSelDisabled, CNormDisabled: Word;
     B: TDrawBuffer; T: PStatusItem;
     B: TDrawBuffer; T: PStatusItem;
-{$ifdef FV_UNICODE}
-    HintBuf: UnicodeString;
-{$else FV_UNICODE}
-    HintBuf: String;
-{$endif FV_UNICODE}
+    HintBuf: Sw_String;
 BEGIN
 BEGIN
    CNormal := GetColor($0301);                        { Normal colour }
    CNormal := GetColor($0301);                        { Normal colour }
    CSelect := GetColor($0604);                        { Select colour }
    CSelect := GetColor($0604);                        { Select colour }
@@ -1773,13 +1748,8 @@ END;
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
 {  NewStatusKey -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 15May98 LdB      }
 {  NewStatusKey -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 15May98 LdB      }
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
-{$ifdef FV_UNICODE}
-FUNCTION NewStatusKey (AText: UnicodeString; AKeyCode: Word; ACommand: Word;
+FUNCTION NewStatusKey (AText: Sw_String; AKeyCode: Word; ACommand: Word;
   ANext: PStatusItem): PStatusItem;
   ANext: PStatusItem): PStatusItem;
-{$else FV_UNICODE}
-FUNCTION NewStatusKey (AText: String; AKeyCode: Word; ACommand: Word;
-  ANext: PStatusItem): PStatusItem;
-{$endif FV_UNICODE}
 VAR T: PStatusItem;
 VAR T: PStatusItem;
 BEGIN
 BEGIN
    New(T);                                            { Allocate memory }
    New(T);                                            { Allocate memory }