浏览代码

Unicode Free Vision.

Margers 1 月之前
父节点
当前提交
523c2c206a

+ 86 - 6
packages/fv/src/asciitab.inc

@@ -24,7 +24,11 @@
 {                                                          }
 
 {$IFNDEF FPC_DOTTEDUNITS}
+{$ifdef FV_UNICODE}
+UNIT UAsciiTab;
+{$else FV_UNICODE}
 UNIT AsciiTab;
+{$endif FV_UNICODE}
 {$ENDIF FPC_DOTTEDUNITS}
 
 {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
@@ -47,9 +51,21 @@ UNIT AsciiTab;
 {====================================================================}
 
 {$IFDEF FPC_DOTTEDUNITS}
-USES FreeVision.Fvconsts, System.Objects, FreeVision.Drivers, FreeVision.Views, FreeVision.App;      { Standard GFV units }
+USES System.Objects,
+   {$ifdef FV_UNICODE}
+   FreeVision.Ufvcommon,FreeVision.Udrivers,FreeVision.Uviews,FreeVision.Uapp,
+   {$else}
+   FreeVision.Fvcommon,FreeVision.Drivers,FreeVision.Views, FreeVision.App,
+   {$endif}
+   FreeVision.Fvconsts,System.Console.Video;
 {$ELSE FPC_DOTTEDUNITS}
-USES FVConsts, Objects, Drivers, Views, App;      { Standard GFV units }
+USES Objects,
+    {$ifdef FV_UNICODE}
+    UFvcommon, UDrivers, UViews, UApp,
+    {$else}
+    Fvcommon, Drivers, Views, App,          { Standard GFV units }
+    {$endif}
+    FVConsts,Video;
 {$ENDIF FPC_DOTTEDUNITS}
 
 {***************************************************************************}
@@ -76,6 +92,7 @@ type
   PReport = ^TReport;
   TReport = object(TView)
     ASCIIChar: LongInt;
+    constructor Init (Var Bounds: TRect);
     constructor Load(var S: TStream);
     procedure Draw; virtual;
     procedure HandleEvent(var Event:TEvent); virtual;
@@ -145,6 +162,26 @@ procedure RegisterASCIITab;
 {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
 {                          TTable OBJECT METHODS                            }
 {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
+{$ifdef FV_UNICODE}
+const cAsciiTable : array[0..255] of WideChar = ( { cp437, except for NUL char }
+  #$0020, #$263A, #$263B, #$2665, #$2666, #$2663, #$2660, #$2022, #$25D8, #$25CB, #$25D9, #$2642, #$2640, #$266A, #$266B, #$263C
+, #$25BA, #$25C4, #$2195, #$203C, #$00B6, #$00A7, #$25AC, #$21A8, #$2191, #$2193, #$2192, #$2190, #$221F, #$2194, #$25B2, #$25BC
+, #$0020, #$0021, #$0022, #$0023, #$0024, #$0025, #$0026, #$0027, #$0028, #$0029, #$002A, #$002B, #$002C, #$002D, #$002E, #$002F
+, #$0030, #$0031, #$0032, #$0033, #$0034, #$0035, #$0036, #$0037, #$0038, #$0039, #$003A, #$003B, #$003C, #$003D, #$003E, #$003F
+, #$0040, #$0041, #$0042, #$0043, #$0044, #$0045, #$0046, #$0047, #$0048, #$0049, #$004A, #$004B, #$004C, #$004D, #$004E, #$004F
+, #$0050, #$0051, #$0052, #$0053, #$0054, #$0055, #$0056, #$0057, #$0058, #$0059, #$005A, #$005B, #$005C, #$005D, #$005E, #$005F
+, #$0060, #$0061, #$0062, #$0063, #$0064, #$0065, #$0066, #$0067, #$0068, #$0069, #$006A, #$006B, #$006C, #$006D, #$006E, #$006F
+, #$0070, #$0071, #$0072, #$0073, #$0074, #$0075, #$0076, #$0077, #$0078, #$0079, #$007A, #$007B, #$007C, #$007D, #$007E, #$2302 {#$007F is not displayable put #$2302}
+, #$00C7, #$00FC, #$00E9, #$00E2, #$00E4, #$00E0, #$00E5, #$00E7, #$00EA, #$00EB, #$00E8, #$00EF, #$00EE, #$00EC, #$00C4, #$00C5
+, #$00C9, #$00E6, #$00C6, #$00F4, #$00F6, #$00F2, #$00FB, #$00F9, #$00FF, #$00D6, #$00DC, #$00A2, #$00A3, #$00A5, #$20A7, #$0192
+, #$00E1, #$00ED, #$00F3, #$00FA, #$00F1, #$00D1, #$00AA, #$00BA, #$00BF, #$2310, #$00AC, #$00BD, #$00BC, #$00A1, #$00AB, #$00BB
+, #$2591, #$2592, #$2593, #$2502, #$2524, #$2561, #$2562, #$2556, #$2555, #$2563, #$2551, #$2557, #$255D, #$255C, #$255B, #$2510
+, #$2514, #$2534, #$252C, #$251C, #$2500, #$253C, #$255E, #$255F, #$255A, #$2554, #$2569, #$2566, #$2560, #$2550, #$256C, #$2567
+, #$2568, #$2564, #$2565, #$2559, #$2558, #$2552, #$2553, #$256B, #$256A, #$2518, #$250C, #$2588, #$2584, #$258C, #$2590, #$2580
+, #$03B1, #$00DF, #$0393, #$03C0, #$03A3, #$03C3, #$00B5, #$03C4, #$03A6, #$0398, #$03A9, #$03B4, #$221E, #$03C6, #$03B5, #$2229
+, #$2261, #$00B1, #$2265, #$2264, #$2320, #$2321, #$00F7, #$2248, #$00B0, #$2219, #$00B7, #$221A, #$207F, #$00B2, #$25A0, #$00A0
+);
+{$endif}
 
 procedure TTable.Draw;
 var
@@ -155,7 +192,14 @@ begin
   NormColor:=GetColor(1);
   For y:=0 to size.Y-1 do begin
     For x:=0 to size.X-1 do
+{$ifdef FV_UNICODE}
+      begin
+        B[x].Attribute:=NormColor;
+        B[x].ExtendedGraphemeCluster:=cAsciiTable[(y*Size.X+x) and $ff];
+      end;
+{$else}
       B[x]:=(NormColor shl 8) or ((y*Size.X+x) and $ff);
+{$endif}
     WriteLine(0,Y,Size.X,1,B);
   end;
   DrawCurPos(true);
@@ -164,13 +208,22 @@ end;
 procedure TTable.DrawCurPos(enable : boolean);
 var
   Color : byte;
+{$ifdef FV_UNICODE}
+  B : TEnhancedVideoCell;
+{$else}
   B : word;
+{$endif}
 begin
   Color:=GetColor(1);
   { add blinking if enable }
   If Enable then
     Color:=((Color and $F) shl 4) or (Color shr 4);
+{$ifdef FV_UNICODE}
+  B.Attribute:=Color;
+  B.ExtendedGraphemeCluster:=cAsciiTable[(Cursor.Y*Size.X+Cursor.X) and $ff];
+{$else}
   B:=(Color shl 8) or ((Cursor.Y*Size.X+Cursor.X) and $ff);
+{$endif}
   WriteLine(Cursor.X,Cursor.Y,1,1,B);
 end;
 
@@ -183,7 +236,11 @@ var
   var
     newchar : ptrint;
   begin
+{$ifdef FV_UNICODE}
+    newchar:=ptrint(cAsciiTable[(ypos*size.X+xpos) and $ff]);
+{$else}
     newchar:=(ypos*size.X+xpos) and $ff;
+{$endif}
     DrawCurPos(false);
     SetCursor(xpos,ypos);
     Message(Owner,evCommand,AsciiTableCommandBase,
@@ -236,6 +293,18 @@ end;
 {                        TReport OBJECT METHODS                             }
 {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
 
+
+constructor TReport.Init (Var Bounds: TRect);
+begin
+  Inherited Init (Bounds);
+{$ifdef FV_UNICODE}
+  AsciiChar:=longint(cAsciiTable[0]);
+{$else}
+  AsciiChar:=0;
+{$endif}
+end;
+
+
 constructor TReport.Load(var S: TStream);
 begin
   Inherited Load(S);
@@ -244,16 +313,27 @@ end;
 
 procedure TReport.Draw;
   var
-    stHex,stDec : string[3];
-    s : string;
+    stHex,stDec : string[5];
+    s : sw_string;
 begin
   Str(AsciiChar,StDec);
   while length(stDec)<3 do
     stDec:=' '+stDec;
+{$ifdef FV_UNICODE}
+  if length(stDec)<4 then
+    stDec:=' '+stDec;
+  if length(stDec)<5 then
+    stDec:=stDec+' ';
+  stHex:=hexstr(AsciiChar,4);
+  s:='WChar "'+widechar(Word(AsciiChar))+'" Decimal:'+
+     StDec+'Hex:$'+StHex+
+     ''; // //{!ss:fill gap. FormatStr function using be better}
+{$else}
   stHex:=hexstr(AsciiChar,2);
-  s:='AnsiChar "'+chr(AsciiChar)+'" Decimal: '+
-     StDec+' Hex: $'+StHex+
+  s:='AnsiChar "'+chr(AsciiChar)+'" Decimal:'+
+     StDec+' Hex:$'+StHex+
      '  '; // //{!ss:fill gap. FormatStr function using be better}
+{$endif}
   WriteStr(0,0,S,1);
 end;
 

+ 87 - 28
packages/fv/src/colorsel.inc

@@ -21,7 +21,11 @@
  ****************************************************************************}
 
 {$IFNDEF FPC_DOTTEDUNITS}
+{$ifdef FV_UNICODE}
+unit UColorSel;
+{$else FV_UNICODE}
 unit ColorSel;
+{$endif FV_UNICODE}
 {$ENDIF FPC_DOTTEDUNITS}
 {====Include file to sort compiler platform out =====================}
 {$I platform.inc}
@@ -29,11 +33,24 @@ interface
 
 {$IFDEF FPC_DOTTEDUNITS}
 uses
-  System.Objects, FreeVision.Drivers, FreeVision.Dialogs, FreeVision.Views, 
+  System.Objects,
+{$ifdef FV_UNICODE}
+  FreeVision.Ufvcommon,
+  FreeVision.Udrivers, FreeVision.Udialogs, FreeVision.Uviews,
+{$else}
+  FreeVision.Fvcommon,
+  FreeVision.Drivers, FreeVision.Dialogs, FreeVision.Views,
+{$endif}
   FreeVision.Fvconsts;
 {$ELSE FPC_DOTTEDUNITS}
 uses
-  Objects, Drivers, Dialogs, Views, fvconsts;
+  Objects,
+{$ifdef FV_UNICODE}
+  UFVCommon,UDrivers, UDialogs, UViews,
+{$else}
+  FVCommon,Drivers, Dialogs, Views,
+{$endif}
+  FVConsts;
 {$ENDIF FPC_DOTTEDUNITS}
 
 const dialog_colorsel_colors        = 'Colors';
@@ -95,14 +112,14 @@ type
 
   PColorItem = ^TColorItem;
   TColorItem = record
-    Name: PString;
+    Name: Sw_PString;
     Index: Byte;
     Next: PColorItem;
   end;
 
   PColorGroup = ^TColorGroup;
   TColorGroup = record
-    Name: PString;
+    Name: Sw_PString;
     Index: Byte;
     Items: PColorItem;
     Next: PColorGroup;
@@ -122,7 +139,7 @@ type
     constructor Load(var S: TStream);
     procedure Store(var S: TStream);
     procedure FocusItem(Item: Sw_Integer); virtual;
-    function GetText(Item: Sw_Integer; MaxLen: Sw_Integer): String; virtual;
+    function GetText(Item: Sw_Integer; MaxLen: Sw_Integer): Sw_String; virtual;
     procedure HandleEvent(var Event: TEvent); virtual;
     procedure SetGroupIndex(GroupNum, ItemNum: Byte);
     function GetGroup(GroupNum: Byte): PColorGroup;
@@ -136,7 +153,7 @@ type
     Items: PColorItem;
     constructor Init(var Bounds: TRect; AScrollBar: PScrollBar; AItems: PColorItem);
     procedure FocusItem(Item: Sw_Integer); virtual;
-    function GetText(Item: Sw_Integer; MaxLen: Sw_Integer): String; virtual;
+    function GetText(Item: Sw_Integer; MaxLen: Sw_Integer): Sw_String; virtual;
     procedure HandleEvent(var Event: TEvent); virtual;
     procedure SetItems(AItems: PColorItem);
     function GetColorIndex(Item: Sw_integer): Sw_integer;
@@ -156,8 +173,8 @@ type
   PColorDisplay = ^TColorDisplay;
   TColorDisplay = object(TView)
     Color: PByte;
-    Text: PString;
-    constructor Init(var Bounds: TRect; AText: PString);
+    Text: Sw_PString;
+    constructor Init(var Bounds: TRect; AText: Sw_PString);
     constructor Load(var S: TStream);
     procedure Store(var S: TStream);
     procedure HandleEvent(var Event: TEvent); virtual;
@@ -195,8 +212,8 @@ const ColorIndexes : PColorIndex = nil;
 
 procedure RegisterColorsel;
 
-function ColorGroup(Name: string; Items: PColorItem; Next: PColorGroup): PColorGroup;
-function ColorItem(Name: string; Index: Byte; Next: PColorItem): PColorItem;
+function ColorGroup(Name: Sw_String; Items: PColorItem; Next: PColorGroup): PColorGroup;
+function ColorItem(Name: Sw_String; Index: Byte; Next: PColorItem): PColorItem;
 
 procedure LoadIndexes(var S: TStream);
 procedure StoreIndexes(var S: TStream);
@@ -261,22 +278,22 @@ begin
 end;
 
 
-function ColorGroup(Name: string; Items: PColorItem; Next: PColorGroup): PColorGroup;
+function ColorGroup(Name: Sw_String; Items: PColorItem; Next: PColorGroup): PColorGroup;
 var
   R: PColorGroup;
 begin
   New(R);
-  R^.Name := NewStr(Name);
+  R^.Name := Sw_NewStr(Name);
   R^.Items := Items;
   R^.Next := Next;
   ColorGroup := R;
 end;
 
-function ColorItem(Name: string; Index: Byte; Next: PColorItem): PColorItem;
+function ColorItem(Name: Sw_String; Index: Byte; Next: PColorItem): PColorItem;
 var R: PColorItem;
 begin
   New(R);
-  R^.Name := NewStr(Name);
+  R^.Name := Sw_NewStr(Name);
   R^.Index := Index;
   R^.Next := Next;
   ColorItem := R
@@ -426,17 +443,25 @@ var
 
 procedure DrawColorLine (LineNr : sw_word);
 var k: sw_integer;
+const
+{$ifdef FV_UNICODE}
+      ccBlock = WideChar(9608);
+      ccPoint = WideChar(9689); {#$25D9}
+{$else}
+      ccBlock = AnsiChar(#219);
+      ccPoint = AnsiChar(#8);
+{$endif}
 begin
   for k:=0 to 3 do
   begin
-    MoveChar (B[0+k*3], #219, SelColor, 3);
+    MoveChar (B[0+k*3], ccBlock, SelColor, 3);
     if CurColor = Color then
     begin
       if ((k = 0) or (k = 1)) and (CurColor<2) then
         SelColor:=SelColor or $70
       else
         SelColor:=SelColor and $f;
-      MoveChar (B[0+k*3+1], #8, SelColor, 1);
+      MoveChar (B[0+k*3+1], ccPoint, SelColor, 1);
       SelColor:=SelColor or $10;
       SelColor:=SelColor and $1f;
     end;
@@ -464,7 +489,7 @@ end;
 {                      TColorDisplay                                 }
 {--------------------------------------------------------------------}
 
-constructor TColorDisplay.Init(var Bounds: TRect; AText: PString);
+constructor TColorDisplay.Init(var Bounds: TRect; AText: Sw_PString);
 begin
   inherited init(Bounds);
   EventMask := EventMask OR evBroadcast;
@@ -477,7 +502,11 @@ begin
   if not Assigned(Color) then
     GetMem(Color,1);
   S.Read(Color^, SizeOf(Color^));
-  Text:=S.ReadStr;
+{$ifdef FV_UNICODE}
+  Text:=S.ReadUnicodeString;                      { Read title }
+{$else FV_UNICODE}
+  Text:=S.ReadStr;                                { Read title }
+{$endif FV_UNICODE}
 end;
 
 procedure TColorDisplay.Store(var S: TStream);
@@ -487,7 +516,11 @@ begin
   vColor:=0;
   if Assigned(Color) then vColor:=Color^;
   S.Write(vColor, SizeOf(vColor));
+{$ifdef FV_UNICODE}
+  S.WriteUnicodeString(Text);
+{$else FV_UNICODE}
   S.WriteStr(Text);
+{$endif FV_UNICODE}
 end;
 
 procedure TColorDisplay.HandleEvent(var Event: TEvent);
@@ -521,7 +554,7 @@ procedure TColorDisplay.Draw;
 var
   FColor : Byte;
   Y      : sw_integer;
-  S      : String;
+  S      : Sw_String;
   B      : TDrawBuffer;
 begin
   if Assigned(Color) then
@@ -532,8 +565,8 @@ begin
   end else
     FColor := GetColor (2);
   MoveChar (B, ' ', FColor, Size.X);
-  if Assigned(Text) then
-    S:=Text^
+  if (Text <> Sw_PString_Empty) then
+    S:=Text Sw_PString_DeRef
   else
     S:='';
   if length(S) < Size.X then
@@ -549,10 +582,12 @@ end;
 
 destructor TColorDisplay.Done;
 begin
-  if assigned(Text) then
+  if (Text <> Sw_PString_Empty) then
   begin
+{$ifndef FV_UNICODE}
     Dispose(Text);
-    Text:=nil;
+{$endif}
+    Text:=Sw_PString_Empty;
   end;
   inherited Done;
 end;
@@ -598,7 +633,11 @@ begin
     for iI:=1 to numItems do
     begin
       New(R);
+{$ifdef FV_UNICODE}
+      R^.Name:=S.ReadUnicodeString;
+{$else FV_UNICODE}
       R^.Name:=S.ReadStr;
+{$endif FV_UNICODE}
       S.Read(R^.Index, SizeOf(R^.Index));
       R^.Next:=nil;
       if assigned(Q) then
@@ -607,7 +646,11 @@ begin
       if iI=1 then x^.Items:=R;
     end;
     {read group}
+{$ifdef FV_UNICODE}
+    x^.Name:=S.ReadUnicodeString;
+{$else FV_UNICODE}
     x^.Name:=S.ReadStr;
+{$endif FV_UNICODE}
     S.Read(x^.Index, SizeOf(x^.Index));
     x^.Next:=nil;
     if assigned(z) then
@@ -640,12 +683,20 @@ begin
     S.Write(numItems,Sizeof(numItems)); {  write Item count }
     {write items}
     while Assigned(R) do begin
+{$ifdef FV_UNICODE}
+      S.WriteUnicodeString(R^.Name);
+{$else FV_UNICODE}
       S.WriteStr(R^.Name);
+{$endif FV_UNICODE}
       S.Write(R^.Index,Sizeof(R^.Index));
       R := R^.Next;
     end;
     {write gropu}
+{$ifdef FV_UNICODE}
+    S.WriteUnicodeString(x^.Name);
+{$else FV_UNICODE}
     S.WriteStr(x^.Name);
+{$endif FV_UNICODE}
     S.Write(x^.Index,Sizeof(x^.Index));
     x := x^.Next;
   end;
@@ -663,7 +714,7 @@ begin
   end;
 end;
 
-function TColorGroupList.GetText(Item: Sw_Integer; MaxLen: Sw_Integer): String;
+function TColorGroupList.GetText(Item: Sw_Integer; MaxLen: Sw_Integer): Sw_String;
 var x: PColorGroup;
     Num : sw_integer;
 begin
@@ -673,7 +724,7 @@ begin
   while Assigned(x) do begin
     if Num = Item then
     begin
-      GetText:=x^.Name^;
+      GetText:=x^.Name Sw_PString_DeRef;
       exit;
     end;
     inc(Num);
@@ -754,12 +805,20 @@ begin
   while Assigned(x) do begin
     R:=x^.Items;
     while Assigned(R) do begin
+{$ifdef FV_UNICODE}
+      R^.Name:=Sw_PString_Empty;
+{$else}
       Dispose(R^.Name);
+{$endif}
       Q:=R;
       R := R^.Next;
       Dispose(Q);
     end;
+{$ifdef FV_UNICODE}
+    x^.Name:=Sw_PString_Empty;
+{$else}
     Dispose(x^.Name);
+{$endif}
     z:=x;
     x := x^.Next;
     Dispose(z);
@@ -793,7 +852,7 @@ begin
   end;
 end;
 
-function TColorItemList.GetText(Item: Sw_Integer; MaxLen: Sw_Integer): String;
+function TColorItemList.GetText(Item: Sw_Integer; MaxLen: Sw_Integer): Sw_String;
 var count : sw_integer;
     x :PColorItem;
 begin
@@ -806,7 +865,7 @@ begin
     begin
       if count=Item then
       begin
-        GetText:=x^.Name^;
+        GetText:=x^.Name Sw_PString_DeRef;
         {SetLength(GetText,Min(Length(GetText),MaxLen));}
         exit;
       end;
@@ -936,7 +995,7 @@ begin
   Insert(BakLabel);
   {-- Color Display --}
   R.Assign(45, 12, 59, 15);
-  Display:=New(PColorDisplay,Init(R,NewStr(label_colorsel_displaytext)));
+  Display:=New(PColorDisplay,Init(R,Sw_NewStr(label_colorsel_displaytext)));
   Insert(Display);
   {-- Buttons --}
   R.Assign(37, 16, 47, 18);

+ 27 - 8
packages/fv/src/colortxt.inc

@@ -1,6 +1,3 @@
-{$IFNDEF FPC_DOTTEDUNITS}
-unit ColorTxt;
-{$ENDIF FPC_DOTTEDUNITS}
 {
     This file is part of the Free Vision package
 
@@ -24,6 +21,14 @@ unit ColorTxt;
   the constructor has an extra Byte parameter specifying the attribute
   desired.  (Do not use a 0 attribute, black on black).
 }
+{$IFNDEF FPC_DOTTEDUNITS}
+{$ifdef FV_UNICODE}
+unit UColorTxt;
+{$else FV_UNICODE}
+unit ColorTxt;
+{$endif FV_UNICODE}
+{$ENDIF FPC_DOTTEDUNITS}
+
 
 {$i platform.inc}
 
@@ -41,17 +46,31 @@ interface
 
 {$IFDEF FPC_DOTTEDUNITS}
 uses
-  System.Objects, FreeVision.Drivers, FreeVision.Views, FreeVision.Dialogs, FreeVision.App, FreeVision.Fvconsts;
+  System.Objects,
+{$ifdef FV_UNICODE}
+  FreeVision.Ufvcommon, FreeVision.Udrivers, FreeVision.Uviews,
+  FreeVision.Udialogs, FreeVision.Uapp,
+{$else}
+  FreeVision.Fvcommon, FreeVision.Drivers, FreeVision.Views,
+  FreeVision.Dialogs, FreeVision.App,
+{$endif}
+  FreeVision.Fvconsts;
 {$ELSE FPC_DOTTEDUNITS}
 uses
-  objects, drivers, views, dialogs, app, fvconsts;
+  Objects,
+{$ifdef FV_UNICODE}
+  UFvcommon, UDrivers, UViews, Udialogs, UApp,
+{$else}
+  Fvcommon, Drivers, Views, Dialogs, App,
+{$endif}
+  Fvconsts;
 {$ENDIF FPC_DOTTEDUNITS}
 
 type
   PColoredText = ^TColoredText;
   TColoredText = object(TStaticText)
     Attr : Byte;
-    constructor Init(var Bounds: TRect; const AText: String; Attribute : Byte);
+    constructor Init(var Bounds: TRect; const AText: Sw_String; Attribute : Byte);
     constructor Load(var S: TStream);
     function GetTheColor : byte; virtual;
     procedure Draw; virtual;
@@ -68,7 +87,7 @@ const
 
 implementation
 
-constructor TColoredText.Init(var Bounds: TRect; const AText: String;
+constructor TColoredText.Init(var Bounds: TRect; const AText: Sw_String;
                                   Attribute : Byte);
 begin
 TStaticText.Init(Bounds, AText);
@@ -101,7 +120,7 @@ var
   Center: Boolean;
   I, J, L, P, Y: Sw_Integer;
   B: TDrawBuffer;
-  S: String;
+  S: Sw_String;
 begin
   Color := GetTheColor;
   GetText(S);

文件差异内容过多而无法显示
+ 651 - 29
packages/fv/src/editors.inc


+ 30 - 10
packages/fv/src/gadgets.inc

@@ -64,7 +64,11 @@
 {**********************************************************}
 
 {$IFNDEF FPC_DOTTEDUNITS}
+{$ifdef FV_UNICODE}
+UNIT UGadgets;
+{$else FV_UNICODE}
 UNIT Gadgets;
+{$endif FV_UNICODE}
 {$ENDIF FPC_DOTTEDUNITS}
 
 {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
@@ -99,9 +103,21 @@ UNIT Gadgets;
 {====================================================================}
 
 {$IFDEF FPC_DOTTEDUNITS}
-USES FreeVision.Fvconsts, FreeVision.Time, System.Objects,FreeVision.Drivers, FreeVision.Views, FreeVision.App;      { Standard GFV units }
+USES FreeVision.Fvconsts,  System.Objects,
+  {$ifdef FV_UNICODE}
+  FreeVision.Ufvcommon,FreeVision.Udrivers,FreeVision.Uviews,FreeVision.Uapp,     { Standard GFV units }
+  {$else}
+  FreeVision.fvcommon, FreeVision.Drivers, FreeVision.Views, FreeVision.App,      { Standard GFV units }
+  {$endif}
+  FreeVision.Time;
 {$ELSE FPC_DOTTEDUNITS}
-USES FVConsts, Time, Objects, Drivers, Views, App;      { Standard GFV units }
+USES FVConsts, Objects,
+  {$ifdef FV_UNICODE}
+  ufvcommon, uDrivers, uViews, uApp,     { Standard GFV units }
+  {$else}
+  fvcommon, Drivers, Views, App,         { Standard GFV units }
+  {$endif}
+  Time;
 {$ENDIF FPC_DOTTEDUNITS}
 
 {***************************************************************************}
@@ -123,7 +139,7 @@ TYPE
       constructor InitMb(var Bounds: TRect);
       PROCEDURE Update;
       PROCEDURE Draw; Virtual;
-      Function  Comma ( N : LongInt ) : String;
+      Function  Comma ( N : LongInt ) : Sw_String;
    END;
    PHeapView = ^THeapView;                            { Heapview pointer }
 
@@ -135,9 +151,13 @@ TYPE
          am : AnsiChar;
          Refresh : Byte;                              { Refresh rate }
          LastTime: Longint;                           { Last time displayed }
+{$ifdef FV_UNICODE}
+         TimeStr : Sw_String;                         { Time string }
+{$else}
          TimeStr : String[10];                        { Time string }
+{$endif}
       CONSTRUCTOR Init (Var Bounds: TRect);
-      FUNCTION FormatTimeStr (H, M, S: Word): String; Virtual;
+      FUNCTION FormatTimeStr (H, M, S: Word): Sw_String; Virtual;
       PROCEDURE Update; Virtual;
       PROCEDURE Draw; Virtual;
    END;
@@ -226,7 +246,7 @@ END;
 PROCEDURE THeapView.Draw;
 VAR
   C : Byte;
-  S : String;
+  S : Sw_String;
   B : TDrawBuffer;
 begin
   case mode of
@@ -251,11 +271,11 @@ begin
   WriteLine(0,0,Size.X,1,B);
 END;
 
-Function THeapView.Comma ( n : LongInt) : String;
+Function THeapView.Comma ( n : LongInt) : Sw_String;
 Var
   num, loc : Byte;
-  s : String;
-  t : String;
+  s : Sw_String;
+  t : Sw_String;
 Begin
   Str (n,s);
   Str (n:Size.X,t);
@@ -294,8 +314,8 @@ END;
 {--TClockView---------------------------------------------------------------}
 {  FormatTimeStr -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 12Nov99 LdB     }
 {---------------------------------------------------------------------------}
-FUNCTION TClockView.FormatTimeStr (H, M, S: Word): String;
-VAR Hs, Ms, Ss: String;
+FUNCTION TClockView.FormatTimeStr (H, M, S: Word): Sw_String;
+VAR Hs, Ms, Ss: String[7];
 BEGIN
    Str(H, Hs);                                        { Convert hour string }
    While (Length(Hs) < 2) Do Hs := '0' + Hs;          { Add lead zero's }

+ 44 - 9
packages/fv/src/statuses.inc

@@ -1,6 +1,10 @@
 {$V-}
 {$IFNDEF FPC_DOTTEDUNITS}
+{$ifdef FV_UNICODE}
+unit UStatuses;
+{$else FV_UNICODE}
 unit Statuses;
+{$endif FV_UNICODE}
 {$ENDIF FPC_DOTTEDUNITS}
 
 {$CODEPAGE cp437}
@@ -68,11 +72,24 @@ interface
 
 {$IFDEF FPC_DOTTEDUNITS}
 uses
-  FreeVision.Fvcommon, FreeVision.Fvconsts, System.Objects, FreeVision.Drivers, 
-  FreeVision.Views, FreeVision.Dialogs;
+  System.Objects,
+{$ifdef FV_UNICODE}
+  FreeVision.Ufvcommon, FreeVision.Udrivers, FreeVision.Udialogs,
+  FreeVision.Uviews,
+{$else}
+  FreeVision.Fvcommon, FreeVision.Drivers, FreeVision.Dialogs,
+  FreeVision.Views,
+{$endif}
+  FreeVision.Fvconsts;
 {$ELSE FPC_DOTTEDUNITS}
 uses
-  FVCommon, FVConsts, Objects, Drivers, Views, Dialogs;
+  Objects,
+{$ifdef FV_UNICODE}
+  UFVCommon,UDrivers, UDialogs, UViews,
+{$else}
+  FVCommon,Drivers, Dialogs, Views,
+{$endif}
+  FVConsts;
 {$ENDIF FPC_DOTTEDUNITS}
 {  Resource;}
 
@@ -207,7 +224,7 @@ type
         the status view receives an evStatus event it checks the value of the
         Event.Command field against Command before handling the event. }
       {#X HandleEvent }
-    constructor Init (R : TRect; ACommand : Word; AText : String;
+    constructor Init (R : TRect; ACommand : Word; AText : Sw_String;
                       AParamCount : SmallInt);
       { Init calls the inherited constructor then sets #Command# to ACommand.
 
@@ -338,7 +355,7 @@ type
       All status views that are to be inserted into a window or dialog should
       descend from #TStatus# for proper color mapping. }
     constructor Init (ATitle : TTitleStr; AStatus : PStatus; AFlags : Word;
-                      AMessage : String);
+                      AMessage : Sw_String);
       { Init calls the inherited constructor then inserts a TStaticText view
         containing AMessage at the top line of the dialog.
 
@@ -689,10 +706,18 @@ implementation
 
 {$IFDEF FPC_DOTTEDUNITS}
 uses
+{$ifdef FV_UNICODE}
+  FreeVision.Umsgbox, FreeVision.Uapp;
+{$else}
   FreeVision.Msgbox, FreeVision.App;
+{$endif}
 {$ELSE FPC_DOTTEDUNITS}
 uses
+{$ifdef FV_UNICODE}
+  uMsgBox, uApp;
+{$else}
   MsgBox, App;
+{$endif}
 {$ENDIF FPC_DOTTEDUNITS}
 
 {****************************************************************************}
@@ -803,7 +828,12 @@ var
   C : Word;
   FillSize : Word;
   PercentDone : PtrInt;
+{$ifdef FV_UNICODE}
+  S : Sw_String;
+{$else}
   S : String[4];
+{$endif}
+
 begin
   { fill entire view }
   MoveChar(B,' ',GetColor(4),Size.X);
@@ -868,7 +898,7 @@ end;
 {****************************************************************************}
 procedure TGauge.Draw;
 var
-  S : String;
+  S : Sw_String;
   B : TDrawBuffer;
 begin
   { Blank the gauge }
@@ -1006,7 +1036,7 @@ procedure TPercentGauge.Draw;
 var
   B : TDrawBuffer;
   C : Word;
-  S : String;
+  S : Sw_String;
   PercentDone : LongInt;
   FillSize : SmallInt;
 begin
@@ -1083,7 +1113,7 @@ end;
 {****************************************************************************}
 { TStatus.Init                                                               }
 {****************************************************************************}
-constructor TStatus.Init (R : TRect; ACommand : Word; AText : String;
+constructor TStatus.Init (R : TRect; ACommand : Word; AText : Sw_String;
                           AParamCount : SmallInt);
 begin
   if (not TParamText.Init(R,AText,AParamCount)) then
@@ -1207,8 +1237,13 @@ end;
 {****************************************************************************}
 procedure TStatus.Update (Data : Pointer);
 begin
+{$ifdef FV_UNICODE}
+  Text := Sw_PString_Empty;
+  Text := UnicodeString(Data);
+{$else}
   DisposeStr(Text);
   Text := NewStr(String(Data^));
+{$endif}
   DrawView;
 end;
 
@@ -1368,7 +1403,7 @@ end;
 { TStatusMessageDlg.Init                                                     }
 {****************************************************************************}
 constructor TStatusMessageDlg.Init (ATitle : TTitleStr; AStatus : PStatus;
-                                    AFlags : Word; AMessage : String);
+                                    AFlags : Word; AMessage : Sw_String);
 var
   P : PStaticText;
   X, Y : SmallInt;

文件差异内容过多而无法显示
+ 331 - 89
packages/fv/src/stddlg.inc


部分文件因为文件数量过多而无法显示