Browse Source

* fix several problems, try to get the graph version to compile

pierre 24 năm trước cách đây
mục cha
commit
33d411b2dc
10 tập tin đã thay đổi với 338 bổ sung52 xóa
  1. 29 2
      fv/app.pas
  2. 28 13
      fv/drivers.pas
  3. 6 1
      fv/gfvgraph.pas
  4. 9 1
      fv/platform.inc
  5. 97 9
      fv/views.pas
  6. 29 2
      fvision/app.pas
  7. 28 13
      fvision/drivers.pas
  8. 6 1
      fvision/gfvgraph.pas
  9. 9 1
      fvision/platform.inc
  10. 97 9
      fvision/views.pas

+ 29 - 2
fv/app.pas

@@ -56,8 +56,10 @@ USES
      Os2Def, Os2Base, OS2PmApi,                       { Standard units }
    {$ENDIF}
    Dos,
+{$ifdef USE_VIDEO_API}
    Video,
-   GFVGraph,                                          { GFV standard unit }
+{$endif USE_VIDEO_API}
+   GFVGraph,                                            { GFV standard unit }
    FVCommon, Memory,                                    { GFV standard units }
    Objects, Drivers, Views, Menus, HistList, Dialogs,
    MsgBox;
@@ -682,9 +684,11 @@ END;
 DESTRUCTOR TProgram.Done;
 VAR I: Integer;
 BEGIN
+{$ifdef USE_VIDEO_API}
    { Do not free the Buffer of Video Unit }
    If Buffer = Views.PVideoBuf(VideoBuf) then
      Buffer:=nil;
+{$endif USE_VIDEO_API}
    If (Desktop <> Nil) Then Dispose(Desktop, Done);   { Destroy desktop }
    If (MenuBar <> Nil) Then Dispose(MenuBar, Done);   { Destroy menu bar }
    If (StatusLine <> Nil) Then
@@ -794,18 +798,28 @@ BEGIN
   { the orginal code can't be used here because of the limited
     video unit capabilities, the mono modus can't be handled
   }
+{$ifdef USE_VIDEO_API}
   if (ScreenMode.Col div ScreenMode.Row<2) then
+{$else not USE_VIDEO_API}
+  if (GetMaxX(true) div GetMaxY(true) <2) then
+{$endif USE_VIDEO_API}
     ShadowSize.X := 1
   else
     ShadowSize.X := 2;
 
   ShadowSize.Y := 1;
   ShowMarkers := False;
+{$ifdef USE_VIDEO_API}
   if ScreenMode.color then
+{$else not USE_VIDEO_API}
+  if ScreenMode<>smMono then
+{$endif USE_VIDEO_API}
     AppPalette := apColor
   else
     AppPalette := apBlackWhite;
+{$ifdef USE_VIDEO_API}
   Buffer := Views.PVideoBuf(VideoBuf);
+{$endif USE_VIDEO_API}
 END;
 
 
@@ -873,7 +887,9 @@ begin
      DoneMemory;
      InitMemory;
      InitScreen;
+{$ifdef USE_VIDEO_API}
      Buffer := Views.PVideoBuf(VideoBuf);
+{$endif USE_VIDEO_API}
      R.Assign(0, 0, ScreenWidth, ScreenHeight);
      ChangeBounds(R);
      ShowMouse;
@@ -887,11 +903,17 @@ begin
   DoneMouse;
   DoneMemory;
   ScreenMode:=Mode;
+{$ifdef USE_VIDEO_API}
   Video.SetVideoMode(Mode);
+{$else USE_VIDEO_API}
+  SetVideoMode(Mode);
+{$endif USE_VIDEO_API}
   InitMouse;
   InitMemory;
   InitScreen;
+{$ifdef USE_VIDEO_API}
   Buffer := Views.PVideoBuf(VideoBuf);
+{$endif USE_VIDEO_API}
   R.Assign(0, 0, ScreenWidth, ScreenHeight);
   ChangeBounds(R);
   ShowMouse;
@@ -978,7 +1000,9 @@ BEGIN
    if (TextModeGFV) then
     begin
       { init mouse and cursor }
+{$ifdef USE_VIDEO_API}
       Video.SetCursorType(crHidden);
+{$endif USE_VIDEO_API}
       Mouse.SetMouseXY(1,1);
     end;
 END;
@@ -1159,7 +1183,10 @@ END;
 END.
 {
  $Log$
- Revision 1.13  2001-08-05 02:03:13  peter
+ Revision 1.14  2001-10-02 16:35:50  pierre
+  * fix several problems, try to get the graph version to compile
+
+ Revision 1.13  2001/08/05 02:03:13  peter
    * view redrawing and small cursor updates
    * merged some more FV extensions
 

+ 28 - 13
fv/drivers.pas

@@ -77,6 +77,9 @@ USES
    {$ENDIF}
 
    video,
+{$IFDEF GRAPH_API}                                    { GRAPH CODE }
+  Graph,                                           { Standard unit }
+{$ENDIF}
    GFVGraph,                                          { GFV graphics unit }
    FVCommon, Objects;                                 { GFV standard units }
 
@@ -258,6 +261,12 @@ TYPE
    END;
    PEvent = ^TEvent;
 
+{$ifdef USE_VIDEO_API}
+   TVideoMode = Video.TVideoMode;                     { Screen mode }
+{$else not USE_VIDEO_API}
+   TVideoMode = Sw_Word;                              { Screen mode }
+{$endif USE_VIDEO_API}
+
 {---------------------------------------------------------------------------}
 {                    ERROR HANDLER FUNCTION DEFINITION                      }
 {---------------------------------------------------------------------------}
@@ -575,7 +584,8 @@ VAR
                                IMPLEMENTATION
 {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
 { API Units }
-  USES Keyboard,Mouse;
+  USES
+  Keyboard,Mouse;
 
 {***************************************************************************}
 {                        PRIVATE INTERNAL CONSTANTS                         }
@@ -735,7 +745,7 @@ END;
 {---------------------------------------------------------------------------}
 {  DetectVideo -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 19May98 LdB       }
 {---------------------------------------------------------------------------}
-{$ifdef Use_API}
+{$IFDEF Use_Video_API}
 
 procedure DetectVideo;
 VAR
@@ -745,7 +755,7 @@ begin
   GetVideoMode(CurrMode);
   ScreenMode:=CurrMode;
 end;
-{$else not Use_API}
+{$else not Use_Video_API}
 PROCEDURE DetectVideo;
 {$IFDEF OS_DOS}                                       { DOS/DPMI CODE }
 ASSEMBLER;
@@ -845,7 +855,7 @@ BEGIN
    WinReleasePS(Ps);                                  { Release desktop PS }
 END;
 {$ENDIF}
-{$endif not Use_API}
+{$endif not Use_Video_API}
 
 {---------------------------------------------------------------------------}
 {  DetectMouse -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 19May98 LdB       }
@@ -1205,9 +1215,9 @@ END;
 {  InitVideo -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Nov99 LdB         }
 {---------------------------------------------------------------------------}
 PROCEDURE InitVideo;
-VAR {$ifdef Use_API}I, J: Sw_Integer;
-    {$else not Use_API}
-    {$IFDEF OS_DOS} I, J: Sw_Integer;Ts: TextSettingsType;{$ENDIF}
+VAR {$ifdef Use_Video_API}I, J: Sw_Integer;
+    {$else not Use_Video_API}
+    {$IFDEF OS_DOS} I, J: Integer;Ts: TextSettingsType;{$ENDIF}
     {$IFDEF OS_WINDOWS} Dc, Mem: HDc; TempFont: TLogFont; Tm: TTextmetric; {$ENDIF}
     {$IFDEF OS_OS2} Ts, Fs: Sw_Integer; Ps: HPs; Tm: FontMetrics; {$ENDIF}
     {$ENDIF}
@@ -1216,10 +1226,10 @@ BEGIN
     I := Detect;                                   { Detect video card }
     J := 0;                                        { Zero select mode }
     InitGraph(I, J, '');                           { Initialize graphics }
-    I := GetMaxX;                                  { Fetch max x size }
-    J := GetMaxY;                                  { Fetch max y size }
+    I := Graph.GetMaxX;                            { Fetch max x size }
+    J := Graph.GetMaxY;                            { Fetch max y size }
        If (DefFontHeight = 0) Then                    { Font height not set }
-         J := (GetMaxY+1) DIV DefLineNum              { Approx font height }
+         J := (Graph.GetMaxY+1) DIV DefLineNum        { Approx font height }
          Else J := DefFontHeight;                     { Use set font height }
        I := J DIV (TextHeight('H')+4);                { Approx magnification }
        If (I < 1) Then I := 1;                        { Must be 1 or above }
@@ -1253,9 +1263,11 @@ PROCEDURE DoneVideo;
 BEGIN
    {$ifdef GRAPH_API}
     CloseGraph;
-   {$else not Use_API}
+   {$else not GRAPH_API}
+   {$ifdef USE_video_api}
    Video.DoneVideo;
-   {$endif not Use_API}
+   {$endif USE_video_api}
+   {$endif not GRAPH_API}
 END;
 
 {---------------------------------------------------------------------------}
@@ -1474,7 +1486,10 @@ BEGIN
 END.
 {
  $Log$
- Revision 1.12  2001-08-05 02:03:13  peter
+ Revision 1.13  2001-10-02 16:35:50  pierre
+  * fix several problems, try to get the graph version to compile
+
+ Revision 1.12  2001/08/05 02:03:13  peter
    * view redrawing and small cursor updates
    * merged some more FV extensions
 

+ 6 - 1
fv/gfvgraph.pas

@@ -131,6 +131,8 @@ CONST
 {---------------------------------------------------------------------------}
 CONST
    SolidFill = Graph.SolidFill;
+   LowAscii : boolean = true;
+
 {$ELSE not GRAPH_API }
 CONST
    SolidFill = 0;
@@ -407,7 +409,10 @@ END;
 END.
 {
  $Log$
- Revision 1.9  2001-05-31 21:40:10  pierre
+ Revision 1.10  2001-10-02 16:35:51  pierre
+  * fix several problems, try to get the graph version to compile
+
+ Revision 1.9  2001/05/31 21:40:10  pierre
   * some debug stuff changed
 
  Revision 1.8  2001/05/10 16:46:28  pierre

+ 9 - 1
fv/platform.inc

@@ -164,14 +164,19 @@ FOR FPC THESE ARE THE TRANSLATIONS
   {$DEFINE ASM_FPC}
   {$UNDEF BP_VMTLink}
   {$DEFINE Use_API}
+  {$DEFINE Use_Video_API}
   {$DEFINE NO_WINDOW}
 {$ENDIF}
 
 {$IFDEF NoAPI}
 {$UNDEF Use_API}
+{$UNDEF Use_Video_API}
 {$UNDEF NO_WINDOW}
 {$ENDIF UseAPI}
 
+{$ifdef GRAPH_API}
+{$undef Use_Video_API}
+{$endif GRAPH_API}
 
 {---------------------------------------------------------------------------}
 {  FPC LINUX COMPILER changes operating system - Updated 27Aug98 LdB        }
@@ -369,7 +374,10 @@ FOR FPC THESE ARE THE TRANSLATIONS
 
 {
  $Log$
- Revision 1.5  2001-05-03 22:32:52  pierre
+ Revision 1.6  2001-10-02 16:35:51  pierre
+  * fix several problems, try to get the graph version to compile
+
+ Revision 1.5  2001/05/03 22:32:52  pierre
   new bunch of changes, displays something for dos at least
 
  Revision 1.4  2001/04/10 21:57:56  pierre

+ 97 - 9
fv/views.pas

@@ -497,6 +497,7 @@ TYPE
       FUNCTION Valid (Command: Word): Boolean; Virtual;
       FUNCTION FocusNext (Forwards: Boolean): Boolean;
       PROCEDURE Draw; Virtual;
+      PROCEDURE DrawBackGround; Virtual;
       PROCEDURE Lock;
       PROCEDURE UnLock;
       PROCEDURE Awaken; Virtual;
@@ -621,6 +622,7 @@ TYPE
       FUNCTION IsSelected (Item: Sw_Integer): Boolean; Virtual;
       FUNCTION GetText (Item: Sw_Integer; MaxLen: Sw_Integer): String; Virtual;
       PROCEDURE DrawFocus; Virtual;
+      PROCEDURE DrawLoseFocus; Virtual;
       PROCEDURE DrawBackGround; Virtual;
       PROCEDURE FocusItem (Item: Sw_Integer); Virtual;
       PROCEDURE SetTopItem (Item: Sw_Integer);
@@ -844,10 +846,10 @@ CONST
 {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
                              IMPLEMENTATION
 {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
-{$IFNDEF GRAPH_API}
+{$IFDEF USE_VIDEO_API}
 USES
   Video;
-{$ENDIF GRAPH_API}
+{$ENDIF USE_VIDEO_API}
 
 {***************************************************************************}
 {                       PRIVATE TYPE DEFINITIONS                            }
@@ -902,12 +904,14 @@ CONST
 
 procedure DrawScreenBuf;
 begin
-  if (LockUpdateScreen=0) then
+{$ifdef USE_VIDEO_API}
+  if (GetLockScreenCount=0) then
    begin
      HideMouse;
      UpdateScreen(false);
      ShowMouse;
    end;
+{$endif USE_VIDEO_API}
 end;
 
 {***************************************************************************}
@@ -1275,6 +1279,7 @@ var
 begin
   if (not TextModeGFV) then
    exit;
+{$ifdef USE_VIDEO_API}
   if ((state and sfV_CV_F) = sfV_CV_F) then
    begin
      p:=@Self;
@@ -1307,6 +1312,7 @@ begin
       end; { while }
    end; { if }
   Video.SetCursorType(crHidden);
+{$endif USE_VIDEO_API}
 end;
 
 
@@ -1353,7 +1359,9 @@ BEGIN
              End;
            Parent:=Parent^.Owner;
          End;
-         inc(LockUpdateScreen); { don't update the screen yet }
+{$ifdef USE_VIDEO_API}
+         LockScreenUpdate;                            { don't update the screen yet }
+{$endif USE_VIDEO_API}
          HideMouseCursor;                             { Hide mouse cursor }
          If (DrawMask = 0) OR (DrawMask = vdNoChild)  { No special masks set }
             { OR Assigned(LimitsLocked) }
@@ -1413,8 +1421,10 @@ BEGIN
              End;
 {$endif ndef NoShadow}
          End;
-         ShowMouseCursor;                             { Show mouse cursor }
-     dec(LockUpdateScreen);
+     ShowMouseCursor;                             { Show mouse cursor }
+{$ifdef USE_VIDEO_API}
+     UnlockScreenUpdate;
+{$endif USE_VIDEO_API}
      if TextModeGFV then
       begin
         DrawScreenBuf;
@@ -1817,6 +1827,8 @@ END;
 {  ReDrawArea -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 05May98 LdB        }
 {---------------------------------------------------------------------------}
 PROCEDURE TView.ReDrawArea (X1, Y1, X2, Y2: Sw_Integer);
+var
+  StoreDrawMask : Byte;
 VAR HLimit: PView; ViewPort: ViewPortType;
 BEGIN
 {$ifdef DEBUG}
@@ -1837,7 +1849,10 @@ BEGIN
    SetViewPort(X1, Y1, X2, Y2, ClipOn, TextModeGFV);  { Set new clip limits }
    HLimit := LimitsLocked;                            { Hold lock limits }
    LimitsLocked := @Self;                             { We are the lock view }
+   StoreDrawMask:=DrawMask;
+   DrawMask:=vdAll;
    DrawView;                                          { Redraw the area }
+   DrawMask:=StoreDrawMask;
    LimitsLocked := HLimit;                            { Release our lock }
    SetViewPort(ViewPort.X1, ViewPort.Y1,
      ViewPort.X2, ViewPort.Y2, ClipOn, TextModeGFV);  { Reset old limits }
@@ -2547,6 +2562,22 @@ BEGIN
      WriteBuf(0,0,Size.X,Size.Y,Buffer);
 END;
 
+{--TGroup-------------------------------------------------------------------}
+{  DrawBackground                                                           }
+{---------------------------------------------------------------------------}
+PROCEDURE TGroup.DrawBackground;
+var
+   P : PView;
+BEGIN
+   Inherited DrawBackground;
+   P:=Last;
+     While (P <> Nil) Do Begin
+       If P^.Exposed then
+         P^.SetDrawMask(vdAll);                       { Redraw each exposed subview }
+       P := P^.PrevView;                              { Move to prior view }
+     End;
+END;
+
 {--TGroup-------------------------------------------------------------------}
 {  SelectDefaultView -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 22Oct99 LdB }
 {---------------------------------------------------------------------------}
@@ -3791,8 +3822,60 @@ BEGIN
              WordRec(B[CurCol+ColWidth-2]).Lo := Byte(SpecialChars[SCOff+1]);
            end;
          end;
-         MoveChar(B[CurCol+ColWidth-1], #179, GetColor(5), 1);
-         WriteLine(CurCol, I, Min(Size.X-1,CurCol+ColWidth-1), 1, B[CurCol]);
+         { MoveChar(B[CurCol+ColWidth-1], #179, GetColor(5), 1);}
+         WriteLine(CurCol, I, Min(Size.X-1,CurCol+ColWidth-2), 1, B[CurCol]);
+       End;
+     End;
+   End;
+END;
+
+{--TListViewer--------------------------------------------------------------}
+{  DrawLoseFocus -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 27Oct99 LdB         }
+{---------------------------------------------------------------------------}
+PROCEDURE TListViewer.DrawLoseFocus;
+VAR DrawIt: Boolean; SCOff: Byte; I, J, Item, CurCol, ColWidth: Sw_Integer;
+    Color: Word;
+
+  Indent: Sw_Integer;
+  B: TDrawBuffer;
+  Text: String;
+BEGIN
+   ColWidth := Size.X DIV NumCols + 1;                { Calc column width }
+   If (HScrollBar = Nil) Then Indent := 0 Else        { Set indent to zero }
+     Indent := HScrollBar^.Value;                     { Fetch any indent }
+   For I := 0 To Size.Y - 1 Do Begin                  { For each line }
+     For J := 0 To NumCols-1 Do Begin                 { For each column }
+       Item := J*Size.Y + I + TopItem;                { Process this item }
+       CurCol := J*ColWidth;                          { Current column }
+       DrawIt := False;                               { Preset false }
+       If (State AND (sfSelected + sfActive) =
+       (sfSelected + sfActive)) AND (Focused = Item)  { Focused item }
+       AND (Range > 0) Then Begin
+         DrawIt := True;                              { Draw this item }
+         Color := GetColor(2);                        { Focused colour }
+         SetCursor(CurCol+1,I);                       { Set the cursor }
+         SCOff := 2;                                  { Zero colour offset }
+       End Else If (Item < Range) AND IsSelected(Item){ Selected item }
+       Then Begin
+         DrawIt := True;                              { Draw this item }
+         Color := GetColor(2);                        { Remove focus }
+         SCOff := 2;                                  { Colour offset=2 }
+       End;
+       If DrawIt Then Begin                           { We are drawing item }
+         ClearArea(CurCol*FontWidth, I*FontHeight, (CurCol+ColWidth-1)*FontWidth,
+           (I+1)*FontHeight-1, Color AND $F0 SHR 4);  { Draw the bar }
+         MoveChar(B[CurCol], ' ', Color, ColWidth);
+         if Item < Range then begin
+           Text := GetText(Item, ColWidth + Indent);
+           Text := Copy(Text,Indent,ColWidth);
+           MoveStr(B[CurCol+1], Text, Color);
+           if ShowMarkers then begin
+             WordRec(B[CurCol]).Lo := Byte(SpecialChars[SCOff]);
+             WordRec(B[CurCol+ColWidth-2]).Lo := Byte(SpecialChars[SCOff+1]);
+           end;
+         end;
+         { MoveChar(B[CurCol+ColWidth-1], #179, GetColor(5), 1);}
+         WriteLine(CurCol, I, Min(Size.X-1,CurCol+ColWidth-2), 1, B[CurCol]);
        End;
      End;
    End;
@@ -3804,6 +3887,8 @@ END;
 {---------------------------------------------------------------------------}
 PROCEDURE TListViewer.FocusItem (Item: Sw_Integer);
 BEGIN
+   If Focused<>Item then
+     DrawLoseFocus;
    Focused := Item;                                   { Set focus to item }
    If (VScrollBar <> Nil) Then
      VScrollBar^.SetValue(Item);                      { Scrollbar to value }
@@ -5436,7 +5521,10 @@ END.
 
 {
  $Log$
- Revision 1.17  2001-08-05 23:54:33  pierre
+ Revision 1.18  2001-10-02 16:35:51  pierre
+  * fix several problems, try to get the graph version to compile
+
+ Revision 1.17  2001/08/05 23:54:33  pierre
   * some improovements for TListViewer
 
  Revision 1.16  2001/08/05 02:03:14  peter

+ 29 - 2
fvision/app.pas

@@ -56,8 +56,10 @@ USES
      Os2Def, Os2Base, OS2PmApi,                       { Standard units }
    {$ENDIF}
    Dos,
+{$ifdef USE_VIDEO_API}
    Video,
-   GFVGraph,                                          { GFV standard unit }
+{$endif USE_VIDEO_API}
+   GFVGraph,                                            { GFV standard unit }
    FVCommon, Memory,                                    { GFV standard units }
    Objects, Drivers, Views, Menus, HistList, Dialogs,
    MsgBox;
@@ -682,9 +684,11 @@ END;
 DESTRUCTOR TProgram.Done;
 VAR I: Integer;
 BEGIN
+{$ifdef USE_VIDEO_API}
    { Do not free the Buffer of Video Unit }
    If Buffer = Views.PVideoBuf(VideoBuf) then
      Buffer:=nil;
+{$endif USE_VIDEO_API}
    If (Desktop <> Nil) Then Dispose(Desktop, Done);   { Destroy desktop }
    If (MenuBar <> Nil) Then Dispose(MenuBar, Done);   { Destroy menu bar }
    If (StatusLine <> Nil) Then
@@ -794,18 +798,28 @@ BEGIN
   { the orginal code can't be used here because of the limited
     video unit capabilities, the mono modus can't be handled
   }
+{$ifdef USE_VIDEO_API}
   if (ScreenMode.Col div ScreenMode.Row<2) then
+{$else not USE_VIDEO_API}
+  if (GetMaxX(true) div GetMaxY(true) <2) then
+{$endif USE_VIDEO_API}
     ShadowSize.X := 1
   else
     ShadowSize.X := 2;
 
   ShadowSize.Y := 1;
   ShowMarkers := False;
+{$ifdef USE_VIDEO_API}
   if ScreenMode.color then
+{$else not USE_VIDEO_API}
+  if ScreenMode<>smMono then
+{$endif USE_VIDEO_API}
     AppPalette := apColor
   else
     AppPalette := apBlackWhite;
+{$ifdef USE_VIDEO_API}
   Buffer := Views.PVideoBuf(VideoBuf);
+{$endif USE_VIDEO_API}
 END;
 
 
@@ -873,7 +887,9 @@ begin
      DoneMemory;
      InitMemory;
      InitScreen;
+{$ifdef USE_VIDEO_API}
      Buffer := Views.PVideoBuf(VideoBuf);
+{$endif USE_VIDEO_API}
      R.Assign(0, 0, ScreenWidth, ScreenHeight);
      ChangeBounds(R);
      ShowMouse;
@@ -887,11 +903,17 @@ begin
   DoneMouse;
   DoneMemory;
   ScreenMode:=Mode;
+{$ifdef USE_VIDEO_API}
   Video.SetVideoMode(Mode);
+{$else USE_VIDEO_API}
+  SetVideoMode(Mode);
+{$endif USE_VIDEO_API}
   InitMouse;
   InitMemory;
   InitScreen;
+{$ifdef USE_VIDEO_API}
   Buffer := Views.PVideoBuf(VideoBuf);
+{$endif USE_VIDEO_API}
   R.Assign(0, 0, ScreenWidth, ScreenHeight);
   ChangeBounds(R);
   ShowMouse;
@@ -978,7 +1000,9 @@ BEGIN
    if (TextModeGFV) then
     begin
       { init mouse and cursor }
+{$ifdef USE_VIDEO_API}
       Video.SetCursorType(crHidden);
+{$endif USE_VIDEO_API}
       Mouse.SetMouseXY(1,1);
     end;
 END;
@@ -1159,7 +1183,10 @@ END;
 END.
 {
  $Log$
- Revision 1.13  2001-08-05 02:03:13  peter
+ Revision 1.14  2001-10-02 16:35:50  pierre
+  * fix several problems, try to get the graph version to compile
+
+ Revision 1.13  2001/08/05 02:03:13  peter
    * view redrawing and small cursor updates
    * merged some more FV extensions
 

+ 28 - 13
fvision/drivers.pas

@@ -77,6 +77,9 @@ USES
    {$ENDIF}
 
    video,
+{$IFDEF GRAPH_API}                                    { GRAPH CODE }
+  Graph,                                           { Standard unit }
+{$ENDIF}
    GFVGraph,                                          { GFV graphics unit }
    FVCommon, Objects;                                 { GFV standard units }
 
@@ -258,6 +261,12 @@ TYPE
    END;
    PEvent = ^TEvent;
 
+{$ifdef USE_VIDEO_API}
+   TVideoMode = Video.TVideoMode;                     { Screen mode }
+{$else not USE_VIDEO_API}
+   TVideoMode = Sw_Word;                              { Screen mode }
+{$endif USE_VIDEO_API}
+
 {---------------------------------------------------------------------------}
 {                    ERROR HANDLER FUNCTION DEFINITION                      }
 {---------------------------------------------------------------------------}
@@ -575,7 +584,8 @@ VAR
                                IMPLEMENTATION
 {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
 { API Units }
-  USES Keyboard,Mouse;
+  USES
+  Keyboard,Mouse;
 
 {***************************************************************************}
 {                        PRIVATE INTERNAL CONSTANTS                         }
@@ -735,7 +745,7 @@ END;
 {---------------------------------------------------------------------------}
 {  DetectVideo -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 19May98 LdB       }
 {---------------------------------------------------------------------------}
-{$ifdef Use_API}
+{$IFDEF Use_Video_API}
 
 procedure DetectVideo;
 VAR
@@ -745,7 +755,7 @@ begin
   GetVideoMode(CurrMode);
   ScreenMode:=CurrMode;
 end;
-{$else not Use_API}
+{$else not Use_Video_API}
 PROCEDURE DetectVideo;
 {$IFDEF OS_DOS}                                       { DOS/DPMI CODE }
 ASSEMBLER;
@@ -845,7 +855,7 @@ BEGIN
    WinReleasePS(Ps);                                  { Release desktop PS }
 END;
 {$ENDIF}
-{$endif not Use_API}
+{$endif not Use_Video_API}
 
 {---------------------------------------------------------------------------}
 {  DetectMouse -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 19May98 LdB       }
@@ -1205,9 +1215,9 @@ END;
 {  InitVideo -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Nov99 LdB         }
 {---------------------------------------------------------------------------}
 PROCEDURE InitVideo;
-VAR {$ifdef Use_API}I, J: Sw_Integer;
-    {$else not Use_API}
-    {$IFDEF OS_DOS} I, J: Sw_Integer;Ts: TextSettingsType;{$ENDIF}
+VAR {$ifdef Use_Video_API}I, J: Sw_Integer;
+    {$else not Use_Video_API}
+    {$IFDEF OS_DOS} I, J: Integer;Ts: TextSettingsType;{$ENDIF}
     {$IFDEF OS_WINDOWS} Dc, Mem: HDc; TempFont: TLogFont; Tm: TTextmetric; {$ENDIF}
     {$IFDEF OS_OS2} Ts, Fs: Sw_Integer; Ps: HPs; Tm: FontMetrics; {$ENDIF}
     {$ENDIF}
@@ -1216,10 +1226,10 @@ BEGIN
     I := Detect;                                   { Detect video card }
     J := 0;                                        { Zero select mode }
     InitGraph(I, J, '');                           { Initialize graphics }
-    I := GetMaxX;                                  { Fetch max x size }
-    J := GetMaxY;                                  { Fetch max y size }
+    I := Graph.GetMaxX;                            { Fetch max x size }
+    J := Graph.GetMaxY;                            { Fetch max y size }
        If (DefFontHeight = 0) Then                    { Font height not set }
-         J := (GetMaxY+1) DIV DefLineNum              { Approx font height }
+         J := (Graph.GetMaxY+1) DIV DefLineNum        { Approx font height }
          Else J := DefFontHeight;                     { Use set font height }
        I := J DIV (TextHeight('H')+4);                { Approx magnification }
        If (I < 1) Then I := 1;                        { Must be 1 or above }
@@ -1253,9 +1263,11 @@ PROCEDURE DoneVideo;
 BEGIN
    {$ifdef GRAPH_API}
     CloseGraph;
-   {$else not Use_API}
+   {$else not GRAPH_API}
+   {$ifdef USE_video_api}
    Video.DoneVideo;
-   {$endif not Use_API}
+   {$endif USE_video_api}
+   {$endif not GRAPH_API}
 END;
 
 {---------------------------------------------------------------------------}
@@ -1474,7 +1486,10 @@ BEGIN
 END.
 {
  $Log$
- Revision 1.12  2001-08-05 02:03:13  peter
+ Revision 1.13  2001-10-02 16:35:50  pierre
+  * fix several problems, try to get the graph version to compile
+
+ Revision 1.12  2001/08/05 02:03:13  peter
    * view redrawing and small cursor updates
    * merged some more FV extensions
 

+ 6 - 1
fvision/gfvgraph.pas

@@ -131,6 +131,8 @@ CONST
 {---------------------------------------------------------------------------}
 CONST
    SolidFill = Graph.SolidFill;
+   LowAscii : boolean = true;
+
 {$ELSE not GRAPH_API }
 CONST
    SolidFill = 0;
@@ -407,7 +409,10 @@ END;
 END.
 {
  $Log$
- Revision 1.9  2001-05-31 21:40:10  pierre
+ Revision 1.10  2001-10-02 16:35:51  pierre
+  * fix several problems, try to get the graph version to compile
+
+ Revision 1.9  2001/05/31 21:40:10  pierre
   * some debug stuff changed
 
  Revision 1.8  2001/05/10 16:46:28  pierre

+ 9 - 1
fvision/platform.inc

@@ -164,14 +164,19 @@ FOR FPC THESE ARE THE TRANSLATIONS
   {$DEFINE ASM_FPC}
   {$UNDEF BP_VMTLink}
   {$DEFINE Use_API}
+  {$DEFINE Use_Video_API}
   {$DEFINE NO_WINDOW}
 {$ENDIF}
 
 {$IFDEF NoAPI}
 {$UNDEF Use_API}
+{$UNDEF Use_Video_API}
 {$UNDEF NO_WINDOW}
 {$ENDIF UseAPI}
 
+{$ifdef GRAPH_API}
+{$undef Use_Video_API}
+{$endif GRAPH_API}
 
 {---------------------------------------------------------------------------}
 {  FPC LINUX COMPILER changes operating system - Updated 27Aug98 LdB        }
@@ -369,7 +374,10 @@ FOR FPC THESE ARE THE TRANSLATIONS
 
 {
  $Log$
- Revision 1.5  2001-05-03 22:32:52  pierre
+ Revision 1.6  2001-10-02 16:35:51  pierre
+  * fix several problems, try to get the graph version to compile
+
+ Revision 1.5  2001/05/03 22:32:52  pierre
   new bunch of changes, displays something for dos at least
 
  Revision 1.4  2001/04/10 21:57:56  pierre

+ 97 - 9
fvision/views.pas

@@ -497,6 +497,7 @@ TYPE
       FUNCTION Valid (Command: Word): Boolean; Virtual;
       FUNCTION FocusNext (Forwards: Boolean): Boolean;
       PROCEDURE Draw; Virtual;
+      PROCEDURE DrawBackGround; Virtual;
       PROCEDURE Lock;
       PROCEDURE UnLock;
       PROCEDURE Awaken; Virtual;
@@ -621,6 +622,7 @@ TYPE
       FUNCTION IsSelected (Item: Sw_Integer): Boolean; Virtual;
       FUNCTION GetText (Item: Sw_Integer; MaxLen: Sw_Integer): String; Virtual;
       PROCEDURE DrawFocus; Virtual;
+      PROCEDURE DrawLoseFocus; Virtual;
       PROCEDURE DrawBackGround; Virtual;
       PROCEDURE FocusItem (Item: Sw_Integer); Virtual;
       PROCEDURE SetTopItem (Item: Sw_Integer);
@@ -844,10 +846,10 @@ CONST
 {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
                              IMPLEMENTATION
 {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
-{$IFNDEF GRAPH_API}
+{$IFDEF USE_VIDEO_API}
 USES
   Video;
-{$ENDIF GRAPH_API}
+{$ENDIF USE_VIDEO_API}
 
 {***************************************************************************}
 {                       PRIVATE TYPE DEFINITIONS                            }
@@ -902,12 +904,14 @@ CONST
 
 procedure DrawScreenBuf;
 begin
-  if (LockUpdateScreen=0) then
+{$ifdef USE_VIDEO_API}
+  if (GetLockScreenCount=0) then
    begin
      HideMouse;
      UpdateScreen(false);
      ShowMouse;
    end;
+{$endif USE_VIDEO_API}
 end;
 
 {***************************************************************************}
@@ -1275,6 +1279,7 @@ var
 begin
   if (not TextModeGFV) then
    exit;
+{$ifdef USE_VIDEO_API}
   if ((state and sfV_CV_F) = sfV_CV_F) then
    begin
      p:=@Self;
@@ -1307,6 +1312,7 @@ begin
       end; { while }
    end; { if }
   Video.SetCursorType(crHidden);
+{$endif USE_VIDEO_API}
 end;
 
 
@@ -1353,7 +1359,9 @@ BEGIN
              End;
            Parent:=Parent^.Owner;
          End;
-         inc(LockUpdateScreen); { don't update the screen yet }
+{$ifdef USE_VIDEO_API}
+         LockScreenUpdate;                            { don't update the screen yet }
+{$endif USE_VIDEO_API}
          HideMouseCursor;                             { Hide mouse cursor }
          If (DrawMask = 0) OR (DrawMask = vdNoChild)  { No special masks set }
             { OR Assigned(LimitsLocked) }
@@ -1413,8 +1421,10 @@ BEGIN
              End;
 {$endif ndef NoShadow}
          End;
-         ShowMouseCursor;                             { Show mouse cursor }
-     dec(LockUpdateScreen);
+     ShowMouseCursor;                             { Show mouse cursor }
+{$ifdef USE_VIDEO_API}
+     UnlockScreenUpdate;
+{$endif USE_VIDEO_API}
      if TextModeGFV then
       begin
         DrawScreenBuf;
@@ -1817,6 +1827,8 @@ END;
 {  ReDrawArea -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 05May98 LdB        }
 {---------------------------------------------------------------------------}
 PROCEDURE TView.ReDrawArea (X1, Y1, X2, Y2: Sw_Integer);
+var
+  StoreDrawMask : Byte;
 VAR HLimit: PView; ViewPort: ViewPortType;
 BEGIN
 {$ifdef DEBUG}
@@ -1837,7 +1849,10 @@ BEGIN
    SetViewPort(X1, Y1, X2, Y2, ClipOn, TextModeGFV);  { Set new clip limits }
    HLimit := LimitsLocked;                            { Hold lock limits }
    LimitsLocked := @Self;                             { We are the lock view }
+   StoreDrawMask:=DrawMask;
+   DrawMask:=vdAll;
    DrawView;                                          { Redraw the area }
+   DrawMask:=StoreDrawMask;
    LimitsLocked := HLimit;                            { Release our lock }
    SetViewPort(ViewPort.X1, ViewPort.Y1,
      ViewPort.X2, ViewPort.Y2, ClipOn, TextModeGFV);  { Reset old limits }
@@ -2547,6 +2562,22 @@ BEGIN
      WriteBuf(0,0,Size.X,Size.Y,Buffer);
 END;
 
+{--TGroup-------------------------------------------------------------------}
+{  DrawBackground                                                           }
+{---------------------------------------------------------------------------}
+PROCEDURE TGroup.DrawBackground;
+var
+   P : PView;
+BEGIN
+   Inherited DrawBackground;
+   P:=Last;
+     While (P <> Nil) Do Begin
+       If P^.Exposed then
+         P^.SetDrawMask(vdAll);                       { Redraw each exposed subview }
+       P := P^.PrevView;                              { Move to prior view }
+     End;
+END;
+
 {--TGroup-------------------------------------------------------------------}
 {  SelectDefaultView -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 22Oct99 LdB }
 {---------------------------------------------------------------------------}
@@ -3791,8 +3822,60 @@ BEGIN
              WordRec(B[CurCol+ColWidth-2]).Lo := Byte(SpecialChars[SCOff+1]);
            end;
          end;
-         MoveChar(B[CurCol+ColWidth-1], #179, GetColor(5), 1);
-         WriteLine(CurCol, I, Min(Size.X-1,CurCol+ColWidth-1), 1, B[CurCol]);
+         { MoveChar(B[CurCol+ColWidth-1], #179, GetColor(5), 1);}
+         WriteLine(CurCol, I, Min(Size.X-1,CurCol+ColWidth-2), 1, B[CurCol]);
+       End;
+     End;
+   End;
+END;
+
+{--TListViewer--------------------------------------------------------------}
+{  DrawLoseFocus -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 27Oct99 LdB         }
+{---------------------------------------------------------------------------}
+PROCEDURE TListViewer.DrawLoseFocus;
+VAR DrawIt: Boolean; SCOff: Byte; I, J, Item, CurCol, ColWidth: Sw_Integer;
+    Color: Word;
+
+  Indent: Sw_Integer;
+  B: TDrawBuffer;
+  Text: String;
+BEGIN
+   ColWidth := Size.X DIV NumCols + 1;                { Calc column width }
+   If (HScrollBar = Nil) Then Indent := 0 Else        { Set indent to zero }
+     Indent := HScrollBar^.Value;                     { Fetch any indent }
+   For I := 0 To Size.Y - 1 Do Begin                  { For each line }
+     For J := 0 To NumCols-1 Do Begin                 { For each column }
+       Item := J*Size.Y + I + TopItem;                { Process this item }
+       CurCol := J*ColWidth;                          { Current column }
+       DrawIt := False;                               { Preset false }
+       If (State AND (sfSelected + sfActive) =
+       (sfSelected + sfActive)) AND (Focused = Item)  { Focused item }
+       AND (Range > 0) Then Begin
+         DrawIt := True;                              { Draw this item }
+         Color := GetColor(2);                        { Focused colour }
+         SetCursor(CurCol+1,I);                       { Set the cursor }
+         SCOff := 2;                                  { Zero colour offset }
+       End Else If (Item < Range) AND IsSelected(Item){ Selected item }
+       Then Begin
+         DrawIt := True;                              { Draw this item }
+         Color := GetColor(2);                        { Remove focus }
+         SCOff := 2;                                  { Colour offset=2 }
+       End;
+       If DrawIt Then Begin                           { We are drawing item }
+         ClearArea(CurCol*FontWidth, I*FontHeight, (CurCol+ColWidth-1)*FontWidth,
+           (I+1)*FontHeight-1, Color AND $F0 SHR 4);  { Draw the bar }
+         MoveChar(B[CurCol], ' ', Color, ColWidth);
+         if Item < Range then begin
+           Text := GetText(Item, ColWidth + Indent);
+           Text := Copy(Text,Indent,ColWidth);
+           MoveStr(B[CurCol+1], Text, Color);
+           if ShowMarkers then begin
+             WordRec(B[CurCol]).Lo := Byte(SpecialChars[SCOff]);
+             WordRec(B[CurCol+ColWidth-2]).Lo := Byte(SpecialChars[SCOff+1]);
+           end;
+         end;
+         { MoveChar(B[CurCol+ColWidth-1], #179, GetColor(5), 1);}
+         WriteLine(CurCol, I, Min(Size.X-1,CurCol+ColWidth-2), 1, B[CurCol]);
        End;
      End;
    End;
@@ -3804,6 +3887,8 @@ END;
 {---------------------------------------------------------------------------}
 PROCEDURE TListViewer.FocusItem (Item: Sw_Integer);
 BEGIN
+   If Focused<>Item then
+     DrawLoseFocus;
    Focused := Item;                                   { Set focus to item }
    If (VScrollBar <> Nil) Then
      VScrollBar^.SetValue(Item);                      { Scrollbar to value }
@@ -5436,7 +5521,10 @@ END.
 
 {
  $Log$
- Revision 1.17  2001-08-05 23:54:33  pierre
+ Revision 1.18  2001-10-02 16:35:51  pierre
+  * fix several problems, try to get the graph version to compile
+
+ Revision 1.17  2001/08/05 23:54:33  pierre
   * some improovements for TListViewer
 
  Revision 1.16  2001/08/05 02:03:14  peter