Просмотр исходного кода

* FV fixes from trunk

git-svn-id: branches/fixes_2_0@3575 -
daniel 19 лет назад
Родитель
Сommit
8f5088546e
12 измененных файлов с 326 добавлено и 72 удалено
  1. 1 0
      .gitattributes
  2. 47 9
      fv/app.pas
  3. 1 0
      fv/buildfv.pas
  4. 29 21
      fv/dialogs.pas
  5. 43 2
      fv/drivers.pas
  6. 10 4
      fv/editors.pas
  7. 9 3
      fv/memory.pas
  8. 1 1
      fv/strtxt.inc
  9. 67 0
      fv/test/testapp.lpi
  10. 102 16
      fv/test/testapp.pas
  11. 4 13
      fv/validate.pas
  12. 12 3
      fv/views.pas

+ 1 - 0
.gitattributes

@@ -988,6 +988,7 @@ fv/tabs.pas svneol=native#text/plain
 fv/test/Makefile svneol=native#text/plain
 fv/test/Makefile.fpc svneol=native#text/plain
 fv/test/platform.inc svneol=native#text/plain
+fv/test/testapp.lpi -text
 fv/test/testapp.pas svneol=native#text/plain
 fv/time.pas svneol=native#text/plain
 fv/timeddlg.pas svneol=native#text/plain

+ 47 - 9
fv/app.pas

@@ -230,7 +230,7 @@ TYPE
       PROCEDURE Run; Virtual;
       PROCEDURE Idle; Virtual;
       PROCEDURE InitScreen; Virtual;
-      procedure DoneScreen; virtual;
+{      procedure DoneScreen; virtual;}
       PROCEDURE InitDeskTop; Virtual;
       PROCEDURE OutOfMemory; Virtual;
       PROCEDURE InitMenuBar; Virtual;
@@ -789,11 +789,15 @@ END;
 {  InitScreen -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 12Sep97 LdB        }
 {---------------------------------------------------------------------------}
 PROCEDURE TProgram.InitScreen;
+
+{Initscreen is passive only, i.e. it detects the video size and capabilities
+ after initalization. Active video initalization is the task of Tapplication.}
+
 BEGIN
   { the orginal code can't be used here because of the limited
     video unit capabilities, the mono modus can't be handled
   }
-  Drivers.InitVideo;
+{  Drivers.InitVideo;}
   if (ScreenMode.Col div ScreenMode.Row<2) then
     ShadowSize.X := 1
   else
@@ -809,11 +813,11 @@ BEGIN
 END;
 
 
-procedure TProgram.DoneScreen;
+{procedure TProgram.DoneScreen;
 begin
   Drivers.DoneVideo;
   Buffer:=nil;
-end;
+end;}
 
 
 {--TProgram-----------------------------------------------------------------}
@@ -965,14 +969,15 @@ END;
 {---------------------------------------------------------------------------}
 CONSTRUCTOR TApplication.Init;
 BEGIN
-{   InitMemory;}                                        { Start memory up }
+{   InitMemory;}                                              { Start memory up }
+   initkeyboard;
    Drivers.InitVideo;                                         { Start video up }
    Drivers.InitEvents;                                        { Start event drive }
    Drivers.InitSysError;                                      { Start system error }
-   InitHistory;                                       { Start history up }
+   InitHistory;                                               { Start history up }
    InitResource;
    InitMsgBox;
-   Inherited Init;                                    { Call ancestor }
+   Inherited Init;                                            { Call ancestor }
    { init mouse and cursor }
    Video.SetCursorType(crHidden);
    Mouse.SetMouseXY(1,1);
@@ -988,8 +993,9 @@ BEGIN
    DoneResource;
    Drivers.DoneSysError;                                      { Close system error }
    Drivers.DoneEvents;                                        { Close event drive }
-   DoneScreen;
+   drivers.donevideo;
 {   DoneMemory;}                                       { Close memory }
+   donekeyboard;
 END;
 
 {--TApplication-------------------------------------------------------------}
@@ -1016,17 +1022,48 @@ END;
 {  DosShell -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 25Oct99 LdB          }
 {---------------------------------------------------------------------------}
 PROCEDURE TApplication.DosShell;
+
+{$ifdef unix}
+var s:string;
+{$endif}
+
 BEGIN                                                 { Compatability only }
   DoneSysError;
   DoneEvents;
+<<<<<<< .working
+  drivers.donevideo;
+  drivers.donekeyboard;
+{  DoneDosMem;}
+=======
   DoneScreen;
 {  DoneDosMem;}
+>>>>>>> .merge-right.r2720
   WriteShellMsg;
+{$ifdef Unix}
+  s:=getenv('SHELL');
+  if s='' then
+    s:='/bin/sh';
+  exec(s,'');
+{$else}
   SwapVectors;
   Exec(GetEnv('COMSPEC'), '');
   SwapVectors;
+<<<<<<< .working
+<<<<<<< .working
+=======
+{$endif}
+>>>>>>> .merge-right.r3452
+{  InitDosMem;}
+  drivers.initkeyboard;
+  drivers.initvideo;
+<<<<<<< .working
+=======
 {  InitDosMem;}
   InitScreen;
+>>>>>>> .merge-right.r2720
+=======
+  InitScreen;
+>>>>>>> .merge-right.r3455
   InitEvents;
   InitSysError;
   Redraw;
@@ -1059,8 +1096,9 @@ BEGIN
 END;
 
 procedure TApplication.WriteShellMsg;
+
 begin
-  PrintStr(Strings^.Get(sTypeExitOnReturn));
+  writeln(Strings^.Get(sTypeExitOnReturn));
 end;
 
 

+ 1 - 0
fv/buildfv.pas

@@ -20,6 +20,7 @@ uses
   stddlg,
   asciitab,
   tabs,
+  memory,
   colortxt,
   statuses,
   histlist,

+ 29 - 21
fv/dialogs.pas

@@ -1831,7 +1831,16 @@ BEGIN
            Bc := GetColor($0703) Else                 { Set selected colour }
              If AmDefault Then Bc := GetColor($0602); { Set is default colour }
      End;
-   If (Title <> Nil) Then Begin                       { We have a title }
+   if title=nil then
+    begin
+      MoveChar(Db[0],' ',GetColor(8),1);
+      {No title, draw an empty button.}
+      for j:=sw_integer(downflag) to size.x-2 do
+        MoveChar(Db[j],' ',Bc,1);
+    end
+   else
+    {We have a title.}
+    begin
      If (Flags AND bfLeftJust = 0) Then Begin         { Not left set title }
        I := CTextWidth(Title^);                        { Fetch title width }
        I := (Size.X - I) DIV 2;                    { Centre in button }
@@ -1850,26 +1859,25 @@ BEGIN
      MoveCStr(Db[I+pos], Title^, Bc);                        { Move title to buffer }
      For j:=pos+CStrLen(Title^)+I to size.X-2 do
        MoveChar(Db[j],' ',Bc,1);
-     If not DownFlag then
-       Bc:=GetColor(8);
-     MoveChar(Db[Size.X-1],' ',Bc,1);
-     WriteLine(0, 0, Size.X,
-       1, Db);                  { Write the title }
-     If Size.Y>1 then Begin
-       Bc:=GetColor(8);
-       if not DownFlag then
-         begin
-           c:='Ü';
-           MoveChar(Db,c,Bc,1);
-           WriteLine(Size.X-1, 0, 1, 1, Db);
-         end;
-       MoveChar(Db,' ',Bc,1);
-       if DownFlag then c:=' '
-       else c:='ß';
-       MoveChar(Db[1],c,Bc,Size.X-1);
-       WriteLine(0, 1, Size.X, 1, Db);
-     End;
-   End;
+    end;
+    If not DownFlag then
+      Bc:=GetColor(8);
+    MoveChar(Db[Size.X-1],' ',Bc,1);
+    WriteLine(0, 0, Size.X,1, Db);                  { Write the title }
+    If Size.Y>1 then Begin
+      Bc:=GetColor(8);
+      if not DownFlag then
+        begin
+          c:='Ü';
+          MoveChar(Db,c,Bc,1);
+          WriteLine(Size.X-1, 0, 1, 1, Db);
+        end;
+      MoveChar(Db,' ',Bc,1);
+      if DownFlag then c:=' '
+      else c:='ß';
+      MoveChar(Db[1],c,Bc,Size.X-1);
+      WriteLine(0, 1, Size.X, 1, Db);
+    End;
 END;
 
 {--TButton------------------------------------------------------------------}

+ 43 - 2
fv/drivers.pas

@@ -57,6 +57,10 @@ UNIT Drivers;
   {$DEFINE ENDIAN_BIG}
 {$endif CPU68K}
 
+{$ifdef FPC}
+  {$INLINE ON}
+{$endif}
+
 USES
    {$IFDEF OS_WINDOWS}                                { WIN/NT CODE }
          Windows,                                     { Standard unit }
@@ -464,6 +468,21 @@ PROCEDURE DoneEvents;
 {                           VIDEO CONTROL ROUTINES                          }
 {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
 
+{-Initkeyboard-------------------------------------------------------
+Initializes the keyboard. Before it is called read(ln)/write(ln)
+are functional, after it is called FV's keyboard routines are
+functional.
+---------------------------------------------------------------------}
+
+procedure initkeyboard;
+
+{-Donekeyboard-------------------------------------------------------
+Restores keyboard to original state. FV's keyboard routines may not
+be used after a call to this. Read(ln)/write(ln) can be used again.
+---------------------------------------------------------------------}
+
+procedure donekeyboard;
+
 {-InitVideo---------------------------------------------------------
 Initializes the video manager, Saves the current screen mode in
 StartupMode, and switches to the mode indicated by ScreenMode.
@@ -830,7 +849,7 @@ PROCEDURE ExitDrivers; {$IFNDEF PPC_FPC}{$IFNDEF OS_UNIX} FAR; {$ENDIF}{$ENDIF}
 BEGIN
    DoneSysError;                                      { Relase error trap }
    DoneEvents;                                        { Close event driver }
-   DoneKeyboard;
+{   DoneKeyboard;}
    DoneVideo;
    ExitProc := SaveExit;                              { Restore old exit }
 END;
@@ -1169,6 +1188,8 @@ begin
    end
   else
    FillChar(Event,sizeof(TEvent),0);
+  if MouseReverse and ((Event.Buttons and 3) in [1,2]) then
+    Event.Buttons := Event.Buttons xor 3;
 end;
 
 {---------------------------------------------------------------------------}
@@ -1260,6 +1281,26 @@ END;
 const
   VideoInitialized : boolean = false;
 
+{---------------------------------------------------------------------------}
+{  InitKeyboard -> Platforms ALL - 07May06 DM                               }
+{---------------------------------------------------------------------------}
+
+procedure initkeyboard;inline;
+
+begin
+  keyboard.initkeyboard;
+end;
+
+{---------------------------------------------------------------------------}
+{  DoneKeyboard -> Platforms ALL - 07May06 DM                               }
+{---------------------------------------------------------------------------}
+
+procedure donekeyboard;inline;
+
+begin
+  keyboard.donekeyboard;
+end;
+
 {---------------------------------------------------------------------------}
 {  InitVideo -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Nov99 LdB         }
 {---------------------------------------------------------------------------}
@@ -1521,7 +1562,7 @@ END;
 BEGIN
    ButtonCount := DetectMouse;                        { Detect mouse }
    DetectVideo;                                       { Detect video }
-   InitKeyboard;
+{   InitKeyboard;}
    InitSystemMsg;
 {$ifdef win32}
    SetFileApisToOEM;

+ 10 - 4
fv/editors.pas

@@ -1069,9 +1069,14 @@ Var
   c      : char;
 begin
   len:=length(str);
+  if (len=0) or (len>size) then
+  begin
+    IScan := NotFoundValue;
+    exit;
+  end;
   { create uppercased string }
   s[0]:=chr(len);
-  for x:=1to len do
+  for x:=1 to len do
    begin
      if str[x] in ['a'..'z'] then
       s[x]:=chr(ord(str[x])-32)
@@ -1114,8 +1119,8 @@ begin
     IScan := NotFoundValue
   else
     IScan := numb - pred(len);
-end;
-
+end; 
+  
 
 {****************************************************************************
                                  TIndicator
@@ -2946,7 +2951,8 @@ end; { TEditor.SetBufLen }
 
 function TEditor.SetBufSize (NewSize : Sw_Word) : Boolean;
 begin
-  SetBufSize := NewSize <= BufSize;
+//  SetBufSize := NewSize <= BufSize;
+  SetBufSize := SetBufferSize(Buffer, NewSize);
 end; { TEditor.SetBufSize }
 
 

+ 9 - 3
fv/memory.pas

@@ -145,7 +145,7 @@ FUNCTION GetBufferSize (P: Pointer): Word;
 Change the size of buffer given by pointer P to the size requested.
 01Oct99 LdB
 ---------------------------------------------------------------------}
-FUNCTION SetBufferSize (P: Pointer; Size: Word): Boolean;
+FUNCTION SetBufferSize (var P: Pointer; Size: Word): Boolean;
 
 {-DisposeBuffer------------------------------------------------------
 Dispose of buffer given by pointer P.
@@ -753,7 +753,7 @@ END;
 {---------------------------------------------------------------------------}
 {  SetBufferSize -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 01Oct99 LdB     }
 {---------------------------------------------------------------------------}
-FUNCTION SetBufferSize (P: Pointer; Size: Word): Boolean;
+FUNCTION SetBufferSize (var P: Pointer; Size: Word): Boolean;
 VAR NewSize: Word;
 BEGIN
    SetBufferSize := False;                            { Preset failure }
@@ -767,7 +767,13 @@ BEGIN
      SetBufferSize := True;                           { Return success }
    End;
    {$ELSE}                                            { DPMI/WIN/NT/OS2 CODE }
-   SetBufferSize := False;                            { No block resizing }
+ {$ifdef fpc}
+   Dec(Pointer(P),SizeOf(TBuffer));                 { Correct to buffer }
+   SetBufferSize := ReAllocMem(P, Size + SizeOf(TBuffer)) <> nil;
+   if SetBufferSize then
+      TBuffer(P^).Size := Size + SizeOf(TBuffer);
+   Inc(Pointer(P), SizeOf(TBuffer));                 { Correct to buffer }
+{$endif fpc}
    {$ENDIF}
 END;
 

+ 1 - 1
fv/strtxt.inc

@@ -211,5 +211,5 @@ var i:word;
 
 begin
   for i:=0 to standard_label_count-1 do
-    strings^.put(standard_labels[i].nr,strpas(standard_labels[i].text));
+    labels^.put(standard_labels[i].nr,strpas(standard_labels[i].text));
 end;

+ 67 - 0
fv/test/testapp.lpi

@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<CONFIG>
+  <ProjectOptions>
+    <PathDelim Value="\"/>
+    <Version Value="5"/>
+    <General>
+      <Flags>
+        <MainUnitHasUsesSectionForAllUnits Value="False"/>
+        <MainUnitHasCreateFormStatements Value="False"/>
+        <MainUnitHasTitleStatement Value="False"/>
+      </Flags>
+      <MainUnit Value="0"/>
+      <IconPath Value="./"/>
+      <TargetFileExt Value=".exe"/>
+      <ActiveEditorIndexAtStart Value="0"/>
+    </General>
+    <LazDoc Paths=""/>
+    <PublishOptions>
+      <Version Value="2"/>
+      <IgnoreBinaries Value="False"/>
+      <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
+      <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
+    </PublishOptions>
+    <RunParams>
+      <local>
+        <FormatVersion Value="1"/>
+        <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
+      </local>
+    </RunParams>
+    <Units Count="1">
+      <Unit0>
+        <Filename Value="testapp.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="testapp"/>
+        <CursorPos X="1" Y="1"/>
+        <TopLine Value="1"/>
+        <EditorIndex Value="0"/>
+        <UsageCount Value="20"/>
+        <Loaded Value="True"/>
+      </Unit0>
+    </Units>
+    <JumpHistory Count="0" HistoryIndex="-1"/>
+  </ProjectOptions>
+  <CompilerOptions>
+    <Version Value="5"/>
+    <PathDelim Value="\"/>
+    <SearchPaths>
+      <OtherUnitFiles Value="..\"/>
+    </SearchPaths>
+    <CodeGeneration>
+      <Generate Value="Faster"/>
+    </CodeGeneration>
+    <Other>
+      <CompilerPath Value="$(CompPath)"/>
+    </Other>
+  </CompilerOptions>
+  <Debugging>
+    <Exceptions Count="2">
+      <Item1>
+        <Name Value="ECodetoolError"/>
+      </Item1>
+      <Item2>
+        <Name Value="EFOpenError"/>
+      </Item2>
+    </Exceptions>
+  </Debugging>
+</CONFIG>

+ 102 - 16
fv/test/testapp.pas

@@ -1,4 +1,4 @@
-PROGRAM TestApp;
+PROGRAM testapp;
 
 { $UNDEF OS2PM}
 
@@ -40,7 +40,7 @@ PROGRAM TestApp;
 {$IFDEF OS2PM}
      {$IFDEF OS_OS2} Os2Def, os2PmApi,  {$ENDIF}
 {$ENDIF OS2PM}
-     Objects, Drivers, Views, Menus, Dialogs, App,             { Standard GFV units }
+     Objects, Drivers, Views, Editors, Menus, Dialogs, App,             { Standard GFV units }
      FVConsts,
      {$ifdef TEST}
      AsciiTab,
@@ -48,7 +48,7 @@ PROGRAM TestApp;
      {$ifdef DEBUG}
      Gfvgraph,
      {$endif DEBUG}
-     Gadgets, TimedDlg, MsgBox;
+     Gadgets, TimedDlg, MsgBox, StdDlg;
 
 
 CONST cmAppToolbar = 1000;
@@ -61,12 +61,17 @@ CONST cmAppToolbar = 1000;
       cmCloseWindow2    = 1102;
       cmCloseWindow3    = 1103;
 
+
 {---------------------------------------------------------------------------}
 {          TTestAppp OBJECT - STANDARD APPLICATION WITH MENU                }
 {---------------------------------------------------------------------------}
 TYPE
    PTVDemo = ^TTVDemo;
+
+   { TTVDemo }
+
    TTVDemo = OBJECT (TApplication)
+        ClipboardWindow: PEditWindow;
         Clock: PClockView;
         Heap: PHeapView;
         P1,P2,P3 : PGroup;
@@ -78,11 +83,15 @@ TYPE
       PROCEDURE HandleEvent(var Event : TEvent);virtual;
       PROCEDURE InitMenuBar; Virtual;
       PROCEDURE InitDeskTop; Virtual;
+      PROCEDURE InitStatusLine; Virtual;
       PROCEDURE Window1;
       PROCEDURE Window2;
       PROCEDURE Window3;
       PROCEDURE TimedBox;
       PROCEDURE AsciiWindow;
+      PROCEDURE ShowAboutBox;
+      PROCEDURE NewEditWindow;
+      PROCEDURE OpenFile;
       PROCEDURE CloseWindow(var P : PGroup);
     End;
 
@@ -93,6 +102,7 @@ TYPE
 CONSTRUCTOR TTvDemo.Init;
 VAR R: TRect;
 BEGIN
+  EditorDialog := @StdEditorDialog;
   Inherited Init;
   { Initialize demo gadgets }
 
@@ -102,10 +112,14 @@ BEGIN
   Insert(Clock);
 
   GetExtent(R);
-  Dec(R.B.X);
-  R.A.X := R.B.X - 12; R.A.Y := R.B.Y - 1;
-  Heap := New(PHeapView, Init(R));
-  Insert(Heap);
+  ClipboardWindow := New(PEditWindow, Init(R, '', wnNoNumber));
+  if ValidView(ClipboardWindow) <> nil then
+  begin
+    ClipboardWindow^.Hide;
+    ClipboardWindow^.Editor^.CanUndo := False;
+    InsertWindow(ClipboardWindow);
+    Clipboard := ClipboardWindow^.Editor;
+  end;
 END;
 
 procedure TTVDemo.Idle;
@@ -149,6 +163,13 @@ BEGIN
    Inherited HandleEvent(Event);                      { Call ancestor }
    If (Event.What = evCommand) Then Begin
      Case Event.Command Of
+       cmClipBoard:
+         begin
+           ClipboardWindow^.Select;
+           ClipboardWindow^.Show;
+         end;
+       cmNew     : NewEditWindow;
+       cmOpen    : OpenFile;
        cmWindow1 : Window1;
        cmWindow2 : Window2;
        cmWindow3 : Window3;
@@ -157,6 +178,7 @@ BEGIN
        cmCloseWindow1 : CloseWindow(P1);
        cmCloseWindow2 : CloseWindow(P2);
        cmCloseWindow3 : CloseWindow(P3);
+       cmAbout: ShowAboutBox;
        Else Exit;                                     { Unhandled exit }
      End;
    End;
@@ -175,19 +197,27 @@ BEGIN
     NewSubMenu('~F~ile', 0, NewMenu(
       StdFileMenuItems(Nil)),                         { Standard file menu }
     NewSubMenu('~E~dit', 0, NewMenu(
-      StdEditMenuItems(Nil)),                         { Standard edit menu }
+      StdEditMenuItems(
+      NewLine(
+      NewItem('~V~iew Clipboard', '', kbNoKey, cmClipboard, hcNoContext,
+      nil)))),                 { Standard edit menu plus view clipboard}
     NewSubMenu('~T~est', 0, NewMenu(
-      NewItem('Ascii Chart','',kbNoKey,cmAscii,hcNoContext,
-      NewItem('Window 1','',kbNoKey,cmWindow1,hcNoContext,
-      NewItem('Window 2','',kbNoKey,cmWindow2,hcNoContext,
-      NewItem('Window 3','',kbNoKey,cmWindow3,hcNoContext,
-      NewItem('Timed Box','',kbNoKey,cmTimedBox,hcNoContext,
+      NewItem('~A~scii Chart','',kbNoKey,cmAscii,hcNoContext,
+      NewItem('Window ~1~','',kbNoKey,cmWindow1,hcNoContext,
+      NewItem('Window ~2~','',kbNoKey,cmWindow2,hcNoContext,
+      NewItem('Window ~3~','',kbNoKey,cmWindow3,hcNoContext,
+      NewItem('~T~imed Box','',kbNoKey,cmTimedBox,hcNoContext,
       NewItem('Close Window 1','',kbNoKey,cmCloseWindow1,hcNoContext,
       NewItem('Close Window 2','',kbNoKey,cmCloseWindow2,hcNoContext,
       NewItem('Close Window 3','',kbNoKey,cmCloseWindow3,hcNoContext,
       Nil))))))))),
     NewSubMenu('~W~indow', 0, NewMenu(
-      StdWindowMenuItems(Nil)), Nil)))))));            { Standard window  menu }
+      StdWindowMenuItems(Nil)),        { Standard window  menu }
+    NewSubMenu('~H~elp', hcNoContext, NewMenu(
+      NewItem('~A~bout...','',kbNoKey,cmAbout,hcNoContext,
+      nil)),
+    nil))))) //end NewSubMenus
+   ))); //end MenuBar
 END;
 
 {--TTvDemo------------------------------------------------------------------}
@@ -218,6 +248,31 @@ BEGIN
    Desktop := New(PDeskTop, Init(R));
 END;
 
+procedure TTVDemo.InitStatusLine;
+var
+   R: TRect;
+begin
+  GetExtent(R);
+  R.A.Y := R.B.Y - 1;
+  R.B.X := R.B.X - 12;
+  New(StatusLine,
+    Init(R,
+      NewStatusDef(0, $EFFF,
+        NewStatusKey('~F3~ Open', kbF3, cmOpen,
+        NewStatusKey('~F4~ New', kbF4, cmNew,
+        NewStatusKey('~Alt+F3~ Close', kbAltF3, cmClose,
+        StdStatusKeys(nil
+        )))),nil
+      )
+    )
+  );
+
+  GetExtent(R);
+  R.A.X := R.B.X - 12; R.A.Y := R.B.Y - 1;
+  Heap := New(PHeapView, Init(R));
+  Insert(Heap);
+end;
+
 PROCEDURE TTvDemo.Window1;
 VAR R: TRect; P: PGroup;
 BEGIN
@@ -253,6 +308,38 @@ begin
 {$endif TEST}
 end;
 
+PROCEDURE TTVDemo.ShowAboutBox;
+begin
+  MessageBox(#3'Free Vision TUI Framework'#13 +
+    #3'Test/Demo Application'#13+
+    #3'(www.freepascal.org)',
+    nil, mfInformation or mfOKButton);
+end;
+
+PROCEDURE TTVDemo.NewEditWindow;
+var
+  R: TRect;
+begin
+  R.Assign(0, 0, 60, 20);
+  InsertWindow(New(PEditWindow, Init(R, '', wnNoNumber)));
+end;
+
+PROCEDURE TTVDemo.OpenFile;
+var
+  R: TRect;
+  FileDialog: PFileDialog;
+  FileName: FNameStr;
+const
+  FDOptions: Word = fdOKButton or fdOpenButton;
+begin
+  FileName := '*.*';
+  New(FileDialog, Init(FileName, 'Open file', '~F~ile name', FDOptions, 1));
+  if ExecuteDialog(FileDialog, @FileName) <> cmCancel then
+  begin
+    R.Assign(0, 0, 75, 20);
+    InsertWindow(New(PEditWindow, Init(R, FileName, wnNoNumber)));
+  end;
+end;
 
 PROCEDURE TTvDemo.TimedBox;
 var
@@ -280,6 +367,7 @@ BEGIN
       P:=Nil;
     END;
 END;
+
 PROCEDURE TTvDemo.Window2;
 VAR R: TRect; P: PGroup;
 BEGIN
@@ -362,8 +450,6 @@ BEGIN
    End;*)
 
    MyApp.Init;                                        { Initialize app }
-
-
    MyApp.Run;                                         { Run the app }
 {$IFDEF OS2PM}
    {$IFDEF OS_OS2}

+ 4 - 13
fv/validate.pas

@@ -302,15 +302,6 @@ USES MsgBox;                                          { GFV standard unit }
 {                              PRIVATE ROUTINES                             }
 {***************************************************************************}
 
-{---------------------------------------------------------------------------}
-{  IsNumber -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 18May98 LdB          }
-{---------------------------------------------------------------------------}
-FUNCTION IsNumber (Chr: Char): Boolean;
-BEGIN
-   If (Chr >= '0') AND (Chr <= '9') Then              { Check if '0..9' }
-     IsNumber := True Else IsNumber := False;         { Return result }
-END;
-
 {---------------------------------------------------------------------------}
 {  IsLetter -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 18May98 LdB          }
 {---------------------------------------------------------------------------}
@@ -520,7 +511,7 @@ VAR I, J: Byte; Rslt: TPicResult; Reprocess: Boolean;
              ';': Inc(I);                             { Next character }
              '*': Begin
                  Inc(I);                              { Next character }
-                 While IsNumber(Pic^[I]) Do Inc(I);   { Search for text }
+                 While Pic^[I] in ['0'..'9'] Do Inc(I);   { Search for text }
                  ToGroupEnd(I);                       { Move to group end }
                  Continue;                            { Now continue }
                End;
@@ -554,7 +545,7 @@ VAR I, J: Byte; Rslt: TPicResult; Reprocess: Boolean;
        Itr := 0;                                      { Zero iteration }
        Iteration := prError;                          { Preset error result }
        Inc(I);                                        { Skip '*' character }
-       While (IsNumber(Pic^[I])) Do Begin             { Entry is a number }
+       While Pic^[I] in ['0'..'9'] Do Begin           { Entry is a number }
          Itr := Itr * 10 + Byte(Pic^[I]) - Byte('0'); { Convert to number }
          Inc(I);                                      { Next character }
        End;
@@ -606,7 +597,7 @@ VAR I, J: Byte; Rslt: TPicResult; Reprocess: Boolean;
          While True Do
            Case Pic^[J] Of
              '[': ToGroupEnd(J);                      { Find name end }
-             '*': If (IsNumber(Pic^[J + 1]) = False)
+             '*': If not(Pic^[J + 1] in ['0'..'9'])
                Then Begin
                  Inc(J);                              { Next name }
                  ToGroupEnd(J);                       { Find name end }
@@ -631,7 +622,7 @@ VAR I, J: Byte; Rslt: TPicResult; Reprocess: Boolean;
          End;
          Ch := Input[J];                              { Fetch character }
          Case Pic^[I] of
-           '#': If (NOT IsNumber(Ch)) Then Exit       { Check is a number }
+           '#': If NOT (Ch in ['0'..'9']) Then Exit   { Check is a number }
                Else Consume(Ch);                      { Transfer number }
            '?': If (NOT IsLetter(Ch)) Then Exit       { Check is a letter }
                Else Consume(Ch);                      { Transfer character }

+ 12 - 3
fv/views.pas

@@ -2697,13 +2697,16 @@ const
   InitFrame: array[0..17] of Byte =
     ($06, $0A, $0C, $05, $00, $05, $03, $0A, $09,
      $16, $1A, $1C, $15, $00, $15, $13, $1A, $19);
-  FrameChars: array[0..31] of Char =
-    '   À ³Úà ÙÄÁ¿´ÂÅ   È ºÉÇ ¼ÍÏ»¶Ñ ';
+  FrameChars_437: array[0..31] of Char =
+    '   À ³Úà ÙÄÁ¿´ÂÅ   È ºÉÇ ¼ÍÏ»¶ÑÎ';
+  FrameChars_850: array[0..31] of Char =
+    '   À ³Úà ÙÄÁ¿´ÂÅ   È ºÉº ¼ÍÍ»ºÍÎ';
 var
   FrameMask : array[0..MaxViewWidth-1] of Byte;
   ColorMask : word;
   i,j,k     : {Sw_  lo and hi are used !! }integer;
   CurrView  : PView;
+  p         : Pchar;
 begin
   FrameMask[0]:=InitFrame[n];
   FillChar(FrameMask[1],Size.X-2,InitFrame[n+1]);
@@ -2761,8 +2764,14 @@ begin
      CurrView:=CurrView^.Next;
    end;
   ColorMask:=Color shl 8;
+  p:=framechars_437;
+  {$ifdef unix}
+  {Codepage variables are currently Unix only.}
+  if internal_codepage<>cp437 then
+    p:=framechars_850;
+  {$endif}
   for i:=0 to Size.X-1 do
-    TVideoBuf(FrameBuf)[i]:=ord(FrameChars[FrameMask[i]]) or ColorMask;
+    TVideoBuf(FrameBuf)[i]:=ord(p[FrameMask[i]]) or ColorMask;
 end;