Browse Source

* FV fixes from trunk

git-svn-id: branches/fixes_2_0@3575 -
daniel 19 years ago
parent
commit
8f5088546e
12 changed files with 326 additions and 72 deletions
  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 svneol=native#text/plain
 fv/test/Makefile.fpc svneol=native#text/plain
 fv/test/Makefile.fpc svneol=native#text/plain
 fv/test/platform.inc 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/test/testapp.pas svneol=native#text/plain
 fv/time.pas svneol=native#text/plain
 fv/time.pas svneol=native#text/plain
 fv/timeddlg.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 Run; Virtual;
       PROCEDURE Idle; Virtual;
       PROCEDURE Idle; Virtual;
       PROCEDURE InitScreen; Virtual;
       PROCEDURE InitScreen; Virtual;
-      procedure DoneScreen; virtual;
+{      procedure DoneScreen; virtual;}
       PROCEDURE InitDeskTop; Virtual;
       PROCEDURE InitDeskTop; Virtual;
       PROCEDURE OutOfMemory; Virtual;
       PROCEDURE OutOfMemory; Virtual;
       PROCEDURE InitMenuBar; Virtual;
       PROCEDURE InitMenuBar; Virtual;
@@ -789,11 +789,15 @@ END;
 {  InitScreen -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 12Sep97 LdB        }
 {  InitScreen -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 12Sep97 LdB        }
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
 PROCEDURE TProgram.InitScreen;
 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
 BEGIN
   { the orginal code can't be used here because of the limited
   { the orginal code can't be used here because of the limited
     video unit capabilities, the mono modus can't be handled
     video unit capabilities, the mono modus can't be handled
   }
   }
-  Drivers.InitVideo;
+{  Drivers.InitVideo;}
   if (ScreenMode.Col div ScreenMode.Row<2) then
   if (ScreenMode.Col div ScreenMode.Row<2) then
     ShadowSize.X := 1
     ShadowSize.X := 1
   else
   else
@@ -809,11 +813,11 @@ BEGIN
 END;
 END;
 
 
 
 
-procedure TProgram.DoneScreen;
+{procedure TProgram.DoneScreen;
 begin
 begin
   Drivers.DoneVideo;
   Drivers.DoneVideo;
   Buffer:=nil;
   Buffer:=nil;
-end;
+end;}
 
 
 
 
 {--TProgram-----------------------------------------------------------------}
 {--TProgram-----------------------------------------------------------------}
@@ -965,14 +969,15 @@ END;
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
 CONSTRUCTOR TApplication.Init;
 CONSTRUCTOR TApplication.Init;
 BEGIN
 BEGIN
-{   InitMemory;}                                        { Start memory up }
+{   InitMemory;}                                              { Start memory up }
+   initkeyboard;
    Drivers.InitVideo;                                         { Start video up }
    Drivers.InitVideo;                                         { Start video up }
    Drivers.InitEvents;                                        { Start event drive }
    Drivers.InitEvents;                                        { Start event drive }
    Drivers.InitSysError;                                      { Start system error }
    Drivers.InitSysError;                                      { Start system error }
-   InitHistory;                                       { Start history up }
+   InitHistory;                                               { Start history up }
    InitResource;
    InitResource;
    InitMsgBox;
    InitMsgBox;
-   Inherited Init;                                    { Call ancestor }
+   Inherited Init;                                            { Call ancestor }
    { init mouse and cursor }
    { init mouse and cursor }
    Video.SetCursorType(crHidden);
    Video.SetCursorType(crHidden);
    Mouse.SetMouseXY(1,1);
    Mouse.SetMouseXY(1,1);
@@ -988,8 +993,9 @@ BEGIN
    DoneResource;
    DoneResource;
    Drivers.DoneSysError;                                      { Close system error }
    Drivers.DoneSysError;                                      { Close system error }
    Drivers.DoneEvents;                                        { Close event drive }
    Drivers.DoneEvents;                                        { Close event drive }
-   DoneScreen;
+   drivers.donevideo;
 {   DoneMemory;}                                       { Close memory }
 {   DoneMemory;}                                       { Close memory }
+   donekeyboard;
 END;
 END;
 
 
 {--TApplication-------------------------------------------------------------}
 {--TApplication-------------------------------------------------------------}
@@ -1016,17 +1022,48 @@ END;
 {  DosShell -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 25Oct99 LdB          }
 {  DosShell -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 25Oct99 LdB          }
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
 PROCEDURE TApplication.DosShell;
 PROCEDURE TApplication.DosShell;
+
+{$ifdef unix}
+var s:string;
+{$endif}
+
 BEGIN                                                 { Compatability only }
 BEGIN                                                 { Compatability only }
   DoneSysError;
   DoneSysError;
   DoneEvents;
   DoneEvents;
+<<<<<<< .working
+  drivers.donevideo;
+  drivers.donekeyboard;
+{  DoneDosMem;}
+=======
   DoneScreen;
   DoneScreen;
 {  DoneDosMem;}
 {  DoneDosMem;}
+>>>>>>> .merge-right.r2720
   WriteShellMsg;
   WriteShellMsg;
+{$ifdef Unix}
+  s:=getenv('SHELL');
+  if s='' then
+    s:='/bin/sh';
+  exec(s,'');
+{$else}
   SwapVectors;
   SwapVectors;
   Exec(GetEnv('COMSPEC'), '');
   Exec(GetEnv('COMSPEC'), '');
   SwapVectors;
   SwapVectors;
+<<<<<<< .working
+<<<<<<< .working
+=======
+{$endif}
+>>>>>>> .merge-right.r3452
+{  InitDosMem;}
+  drivers.initkeyboard;
+  drivers.initvideo;
+<<<<<<< .working
+=======
 {  InitDosMem;}
 {  InitDosMem;}
   InitScreen;
   InitScreen;
+>>>>>>> .merge-right.r2720
+=======
+  InitScreen;
+>>>>>>> .merge-right.r3455
   InitEvents;
   InitEvents;
   InitSysError;
   InitSysError;
   Redraw;
   Redraw;
@@ -1059,8 +1096,9 @@ BEGIN
 END;
 END;
 
 
 procedure TApplication.WriteShellMsg;
 procedure TApplication.WriteShellMsg;
+
 begin
 begin
-  PrintStr(Strings^.Get(sTypeExitOnReturn));
+  writeln(Strings^.Get(sTypeExitOnReturn));
 end;
 end;
 
 
 
 

+ 1 - 0
fv/buildfv.pas

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

+ 29 - 21
fv/dialogs.pas

@@ -1831,7 +1831,16 @@ BEGIN
            Bc := GetColor($0703) Else                 { Set selected colour }
            Bc := GetColor($0703) Else                 { Set selected colour }
              If AmDefault Then Bc := GetColor($0602); { Set is default colour }
              If AmDefault Then Bc := GetColor($0602); { Set is default colour }
      End;
      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 }
      If (Flags AND bfLeftJust = 0) Then Begin         { Not left set title }
        I := CTextWidth(Title^);                        { Fetch title width }
        I := CTextWidth(Title^);                        { Fetch title width }
        I := (Size.X - I) DIV 2;                    { Centre in button }
        I := (Size.X - I) DIV 2;                    { Centre in button }
@@ -1850,26 +1859,25 @@ BEGIN
      MoveCStr(Db[I+pos], Title^, Bc);                        { Move title to buffer }
      MoveCStr(Db[I+pos], Title^, Bc);                        { Move title to buffer }
      For j:=pos+CStrLen(Title^)+I to size.X-2 do
      For j:=pos+CStrLen(Title^)+I to size.X-2 do
        MoveChar(Db[j],' ',Bc,1);
        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;
 END;
 
 
 {--TButton------------------------------------------------------------------}
 {--TButton------------------------------------------------------------------}

+ 43 - 2
fv/drivers.pas

@@ -57,6 +57,10 @@ UNIT Drivers;
   {$DEFINE ENDIAN_BIG}
   {$DEFINE ENDIAN_BIG}
 {$endif CPU68K}
 {$endif CPU68K}
 
 
+{$ifdef FPC}
+  {$INLINE ON}
+{$endif}
+
 USES
 USES
    {$IFDEF OS_WINDOWS}                                { WIN/NT CODE }
    {$IFDEF OS_WINDOWS}                                { WIN/NT CODE }
          Windows,                                     { Standard unit }
          Windows,                                     { Standard unit }
@@ -464,6 +468,21 @@ PROCEDURE DoneEvents;
 {                           VIDEO CONTROL ROUTINES                          }
 {                           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---------------------------------------------------------
 {-InitVideo---------------------------------------------------------
 Initializes the video manager, Saves the current screen mode in
 Initializes the video manager, Saves the current screen mode in
 StartupMode, and switches to the mode indicated by ScreenMode.
 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
 BEGIN
    DoneSysError;                                      { Relase error trap }
    DoneSysError;                                      { Relase error trap }
    DoneEvents;                                        { Close event driver }
    DoneEvents;                                        { Close event driver }
-   DoneKeyboard;
+{   DoneKeyboard;}
    DoneVideo;
    DoneVideo;
    ExitProc := SaveExit;                              { Restore old exit }
    ExitProc := SaveExit;                              { Restore old exit }
 END;
 END;
@@ -1169,6 +1188,8 @@ begin
    end
    end
   else
   else
    FillChar(Event,sizeof(TEvent),0);
    FillChar(Event,sizeof(TEvent),0);
+  if MouseReverse and ((Event.Buttons and 3) in [1,2]) then
+    Event.Buttons := Event.Buttons xor 3;
 end;
 end;
 
 
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
@@ -1260,6 +1281,26 @@ END;
 const
 const
   VideoInitialized : boolean = false;
   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         }
 {  InitVideo -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Nov99 LdB         }
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
@@ -1521,7 +1562,7 @@ END;
 BEGIN
 BEGIN
    ButtonCount := DetectMouse;                        { Detect mouse }
    ButtonCount := DetectMouse;                        { Detect mouse }
    DetectVideo;                                       { Detect video }
    DetectVideo;                                       { Detect video }
-   InitKeyboard;
+{   InitKeyboard;}
    InitSystemMsg;
    InitSystemMsg;
 {$ifdef win32}
 {$ifdef win32}
    SetFileApisToOEM;
    SetFileApisToOEM;

+ 10 - 4
fv/editors.pas

@@ -1069,9 +1069,14 @@ Var
   c      : char;
   c      : char;
 begin
 begin
   len:=length(str);
   len:=length(str);
+  if (len=0) or (len>size) then
+  begin
+    IScan := NotFoundValue;
+    exit;
+  end;
   { create uppercased string }
   { create uppercased string }
   s[0]:=chr(len);
   s[0]:=chr(len);
-  for x:=1to len do
+  for x:=1 to len do
    begin
    begin
      if str[x] in ['a'..'z'] then
      if str[x] in ['a'..'z'] then
       s[x]:=chr(ord(str[x])-32)
       s[x]:=chr(ord(str[x])-32)
@@ -1114,8 +1119,8 @@ begin
     IScan := NotFoundValue
     IScan := NotFoundValue
   else
   else
     IScan := numb - pred(len);
     IScan := numb - pred(len);
-end;
-
+end; 
+  
 
 
 {****************************************************************************
 {****************************************************************************
                                  TIndicator
                                  TIndicator
@@ -2946,7 +2951,8 @@ end; { TEditor.SetBufLen }
 
 
 function TEditor.SetBufSize (NewSize : Sw_Word) : Boolean;
 function TEditor.SetBufSize (NewSize : Sw_Word) : Boolean;
 begin
 begin
-  SetBufSize := NewSize <= BufSize;
+//  SetBufSize := NewSize <= BufSize;
+  SetBufSize := SetBufferSize(Buffer, NewSize);
 end; { TEditor.SetBufSize }
 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.
 Change the size of buffer given by pointer P to the size requested.
 01Oct99 LdB
 01Oct99 LdB
 ---------------------------------------------------------------------}
 ---------------------------------------------------------------------}
-FUNCTION SetBufferSize (P: Pointer; Size: Word): Boolean;
+FUNCTION SetBufferSize (var P: Pointer; Size: Word): Boolean;
 
 
 {-DisposeBuffer------------------------------------------------------
 {-DisposeBuffer------------------------------------------------------
 Dispose of buffer given by pointer P.
 Dispose of buffer given by pointer P.
@@ -753,7 +753,7 @@ END;
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
 {  SetBufferSize -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 01Oct99 LdB     }
 {  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;
 VAR NewSize: Word;
 BEGIN
 BEGIN
    SetBufferSize := False;                            { Preset failure }
    SetBufferSize := False;                            { Preset failure }
@@ -767,7 +767,13 @@ BEGIN
      SetBufferSize := True;                           { Return success }
      SetBufferSize := True;                           { Return success }
    End;
    End;
    {$ELSE}                                            { DPMI/WIN/NT/OS2 CODE }
    {$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}
    {$ENDIF}
 END;
 END;
 
 

+ 1 - 1
fv/strtxt.inc

@@ -211,5 +211,5 @@ var i:word;
 
 
 begin
 begin
   for i:=0 to standard_label_count-1 do
   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;
 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}
 { $UNDEF OS2PM}
 
 
@@ -40,7 +40,7 @@ PROGRAM TestApp;
 {$IFDEF OS2PM}
 {$IFDEF OS2PM}
      {$IFDEF OS_OS2} Os2Def, os2PmApi,  {$ENDIF}
      {$IFDEF OS_OS2} Os2Def, os2PmApi,  {$ENDIF}
 {$ENDIF OS2PM}
 {$ENDIF OS2PM}
-     Objects, Drivers, Views, Menus, Dialogs, App,             { Standard GFV units }
+     Objects, Drivers, Views, Editors, Menus, Dialogs, App,             { Standard GFV units }
      FVConsts,
      FVConsts,
      {$ifdef TEST}
      {$ifdef TEST}
      AsciiTab,
      AsciiTab,
@@ -48,7 +48,7 @@ PROGRAM TestApp;
      {$ifdef DEBUG}
      {$ifdef DEBUG}
      Gfvgraph,
      Gfvgraph,
      {$endif DEBUG}
      {$endif DEBUG}
-     Gadgets, TimedDlg, MsgBox;
+     Gadgets, TimedDlg, MsgBox, StdDlg;
 
 
 
 
 CONST cmAppToolbar = 1000;
 CONST cmAppToolbar = 1000;
@@ -61,12 +61,17 @@ CONST cmAppToolbar = 1000;
       cmCloseWindow2    = 1102;
       cmCloseWindow2    = 1102;
       cmCloseWindow3    = 1103;
       cmCloseWindow3    = 1103;
 
 
+
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
 {          TTestAppp OBJECT - STANDARD APPLICATION WITH MENU                }
 {          TTestAppp OBJECT - STANDARD APPLICATION WITH MENU                }
 {---------------------------------------------------------------------------}
 {---------------------------------------------------------------------------}
 TYPE
 TYPE
    PTVDemo = ^TTVDemo;
    PTVDemo = ^TTVDemo;
+
+   { TTVDemo }
+
    TTVDemo = OBJECT (TApplication)
    TTVDemo = OBJECT (TApplication)
+        ClipboardWindow: PEditWindow;
         Clock: PClockView;
         Clock: PClockView;
         Heap: PHeapView;
         Heap: PHeapView;
         P1,P2,P3 : PGroup;
         P1,P2,P3 : PGroup;
@@ -78,11 +83,15 @@ TYPE
       PROCEDURE HandleEvent(var Event : TEvent);virtual;
       PROCEDURE HandleEvent(var Event : TEvent);virtual;
       PROCEDURE InitMenuBar; Virtual;
       PROCEDURE InitMenuBar; Virtual;
       PROCEDURE InitDeskTop; Virtual;
       PROCEDURE InitDeskTop; Virtual;
+      PROCEDURE InitStatusLine; Virtual;
       PROCEDURE Window1;
       PROCEDURE Window1;
       PROCEDURE Window2;
       PROCEDURE Window2;
       PROCEDURE Window3;
       PROCEDURE Window3;
       PROCEDURE TimedBox;
       PROCEDURE TimedBox;
       PROCEDURE AsciiWindow;
       PROCEDURE AsciiWindow;
+      PROCEDURE ShowAboutBox;
+      PROCEDURE NewEditWindow;
+      PROCEDURE OpenFile;
       PROCEDURE CloseWindow(var P : PGroup);
       PROCEDURE CloseWindow(var P : PGroup);
     End;
     End;
 
 
@@ -93,6 +102,7 @@ TYPE
 CONSTRUCTOR TTvDemo.Init;
 CONSTRUCTOR TTvDemo.Init;
 VAR R: TRect;
 VAR R: TRect;
 BEGIN
 BEGIN
+  EditorDialog := @StdEditorDialog;
   Inherited Init;
   Inherited Init;
   { Initialize demo gadgets }
   { Initialize demo gadgets }
 
 
@@ -102,10 +112,14 @@ BEGIN
   Insert(Clock);
   Insert(Clock);
 
 
   GetExtent(R);
   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;
 END;
 
 
 procedure TTVDemo.Idle;
 procedure TTVDemo.Idle;
@@ -149,6 +163,13 @@ BEGIN
    Inherited HandleEvent(Event);                      { Call ancestor }
    Inherited HandleEvent(Event);                      { Call ancestor }
    If (Event.What = evCommand) Then Begin
    If (Event.What = evCommand) Then Begin
      Case Event.Command Of
      Case Event.Command Of
+       cmClipBoard:
+         begin
+           ClipboardWindow^.Select;
+           ClipboardWindow^.Show;
+         end;
+       cmNew     : NewEditWindow;
+       cmOpen    : OpenFile;
        cmWindow1 : Window1;
        cmWindow1 : Window1;
        cmWindow2 : Window2;
        cmWindow2 : Window2;
        cmWindow3 : Window3;
        cmWindow3 : Window3;
@@ -157,6 +178,7 @@ BEGIN
        cmCloseWindow1 : CloseWindow(P1);
        cmCloseWindow1 : CloseWindow(P1);
        cmCloseWindow2 : CloseWindow(P2);
        cmCloseWindow2 : CloseWindow(P2);
        cmCloseWindow3 : CloseWindow(P3);
        cmCloseWindow3 : CloseWindow(P3);
+       cmAbout: ShowAboutBox;
        Else Exit;                                     { Unhandled exit }
        Else Exit;                                     { Unhandled exit }
      End;
      End;
    End;
    End;
@@ -175,19 +197,27 @@ BEGIN
     NewSubMenu('~F~ile', 0, NewMenu(
     NewSubMenu('~F~ile', 0, NewMenu(
       StdFileMenuItems(Nil)),                         { Standard file menu }
       StdFileMenuItems(Nil)),                         { Standard file menu }
     NewSubMenu('~E~dit', 0, NewMenu(
     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(
     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 1','',kbNoKey,cmCloseWindow1,hcNoContext,
       NewItem('Close Window 2','',kbNoKey,cmCloseWindow2,hcNoContext,
       NewItem('Close Window 2','',kbNoKey,cmCloseWindow2,hcNoContext,
       NewItem('Close Window 3','',kbNoKey,cmCloseWindow3,hcNoContext,
       NewItem('Close Window 3','',kbNoKey,cmCloseWindow3,hcNoContext,
       Nil))))))))),
       Nil))))))))),
     NewSubMenu('~W~indow', 0, NewMenu(
     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;
 END;
 
 
 {--TTvDemo------------------------------------------------------------------}
 {--TTvDemo------------------------------------------------------------------}
@@ -218,6 +248,31 @@ BEGIN
    Desktop := New(PDeskTop, Init(R));
    Desktop := New(PDeskTop, Init(R));
 END;
 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;
 PROCEDURE TTvDemo.Window1;
 VAR R: TRect; P: PGroup;
 VAR R: TRect; P: PGroup;
 BEGIN
 BEGIN
@@ -253,6 +308,38 @@ begin
 {$endif TEST}
 {$endif TEST}
 end;
 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;
 PROCEDURE TTvDemo.TimedBox;
 var
 var
@@ -280,6 +367,7 @@ BEGIN
       P:=Nil;
       P:=Nil;
     END;
     END;
 END;
 END;
+
 PROCEDURE TTvDemo.Window2;
 PROCEDURE TTvDemo.Window2;
 VAR R: TRect; P: PGroup;
 VAR R: TRect; P: PGroup;
 BEGIN
 BEGIN
@@ -362,8 +450,6 @@ BEGIN
    End;*)
    End;*)
 
 
    MyApp.Init;                                        { Initialize app }
    MyApp.Init;                                        { Initialize app }
-
-
    MyApp.Run;                                         { Run the app }
    MyApp.Run;                                         { Run the app }
 {$IFDEF OS2PM}
 {$IFDEF OS2PM}
    {$IFDEF OS_OS2}
    {$IFDEF OS_OS2}

+ 4 - 13
fv/validate.pas

@@ -302,15 +302,6 @@ USES MsgBox;                                          { GFV standard unit }
 {                              PRIVATE ROUTINES                             }
 {                              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          }
 {  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 }
              ';': Inc(I);                             { Next character }
              '*': Begin
              '*': Begin
                  Inc(I);                              { Next character }
                  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 }
                  ToGroupEnd(I);                       { Move to group end }
                  Continue;                            { Now continue }
                  Continue;                            { Now continue }
                End;
                End;
@@ -554,7 +545,7 @@ VAR I, J: Byte; Rslt: TPicResult; Reprocess: Boolean;
        Itr := 0;                                      { Zero iteration }
        Itr := 0;                                      { Zero iteration }
        Iteration := prError;                          { Preset error result }
        Iteration := prError;                          { Preset error result }
        Inc(I);                                        { Skip '*' character }
        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 }
          Itr := Itr * 10 + Byte(Pic^[I]) - Byte('0'); { Convert to number }
          Inc(I);                                      { Next character }
          Inc(I);                                      { Next character }
        End;
        End;
@@ -606,7 +597,7 @@ VAR I, J: Byte; Rslt: TPicResult; Reprocess: Boolean;
          While True Do
          While True Do
            Case Pic^[J] Of
            Case Pic^[J] Of
              '[': ToGroupEnd(J);                      { Find name end }
              '[': ToGroupEnd(J);                      { Find name end }
-             '*': If (IsNumber(Pic^[J + 1]) = False)
+             '*': If not(Pic^[J + 1] in ['0'..'9'])
                Then Begin
                Then Begin
                  Inc(J);                              { Next name }
                  Inc(J);                              { Next name }
                  ToGroupEnd(J);                       { Find name end }
                  ToGroupEnd(J);                       { Find name end }
@@ -631,7 +622,7 @@ VAR I, J: Byte; Rslt: TPicResult; Reprocess: Boolean;
          End;
          End;
          Ch := Input[J];                              { Fetch character }
          Ch := Input[J];                              { Fetch character }
          Case Pic^[I] of
          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 }
                Else Consume(Ch);                      { Transfer number }
            '?': If (NOT IsLetter(Ch)) Then Exit       { Check is a letter }
            '?': If (NOT IsLetter(Ch)) Then Exit       { Check is a letter }
                Else Consume(Ch);                      { Transfer character }
                Else Consume(Ch);                      { Transfer character }

+ 12 - 3
fv/views.pas

@@ -2697,13 +2697,16 @@ const
   InitFrame: array[0..17] of Byte =
   InitFrame: array[0..17] of Byte =
     ($06, $0A, $0C, $05, $00, $05, $03, $0A, $09,
     ($06, $0A, $0C, $05, $00, $05, $03, $0A, $09,
      $16, $1A, $1C, $15, $00, $15, $13, $1A, $19);
      $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
 var
   FrameMask : array[0..MaxViewWidth-1] of Byte;
   FrameMask : array[0..MaxViewWidth-1] of Byte;
   ColorMask : word;
   ColorMask : word;
   i,j,k     : {Sw_  lo and hi are used !! }integer;
   i,j,k     : {Sw_  lo and hi are used !! }integer;
   CurrView  : PView;
   CurrView  : PView;
+  p         : Pchar;
 begin
 begin
   FrameMask[0]:=InitFrame[n];
   FrameMask[0]:=InitFrame[n];
   FillChar(FrameMask[1],Size.X-2,InitFrame[n+1]);
   FillChar(FrameMask[1],Size.X-2,InitFrame[n+1]);
@@ -2761,8 +2764,14 @@ begin
      CurrView:=CurrView^.Next;
      CurrView:=CurrView^.Next;
    end;
    end;
   ColorMask:=Color shl 8;
   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
   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;
 end;