Browse Source

* renamed text.inc -> gtext.inc to avoid conflict with system unit
* fixed textwidth
* isgraphmode now gets properly updated, so mode restoring works
again

Jonas Maebe 26 years ago
parent
commit
47b14faf20
4 changed files with 80 additions and 13 deletions
  1. 24 4
      rtl/inc/graph/graph.inc
  2. 12 2
      rtl/inc/graph/graph.pp
  3. 13 6
      rtl/inc/graph/gtext.inc
  4. 31 1
      rtl/inc/graph/modes.inc

+ 24 - 4
rtl/inc/graph/graph.inc

@@ -1407,6 +1407,7 @@ const CrtAddress: word = 0;
     end;
     if SaveSupported then
       begin
+
 {$ifndef fpc}
         PtrLong:=GlobalDosAlloc(64*StateSize);  { values returned in 64-byte blocks }
 {$else fpc}
@@ -1493,7 +1494,7 @@ const CrtAddress: word = 0;
       {**************************************************************}
 
 
- Procedure SaveStateVGA; far; 
+ Procedure SaveStateVGA; far;
   begin
     SavePtr := nil;
     SaveSupported := FALSE;
@@ -1635,14 +1636,21 @@ const CrtAddress: word = 0;
         _graphresult := grnoinitgraph;
         exit
       end;
+{$ifdef logging}
+    LogLn('calling RestoreVideoState at '+strf(longint(RestoreVideoState)));
+{$endif logging}
     if not assigned(RestoreVideoState) then
       RunError(216);
+{$ifdef logging}
+    LogLn('actual call of RestoreVideoState');
+{$endif logging}
     RestoreVideoState;
 {$IFDEF DPMI}
     { We had copied the buffer of mode information }
     { and allocated it dynamically... now free it  }
     { Warning: if GetVESAInfo returned false, this buffer is not allocated!
       (JM)}
+    isgraphmode := false;
     If hasVesa then
       Dispose(VESAInfo.ModeList);
 {$ENDIF}
@@ -1724,10 +1732,12 @@ const CrtAddress: word = 0;
 {$endif logging}
      if VGADetected then
        begin
-
+{$ifdef logging}
          SaveVideoState := SaveStateVGA;
+         LogLn('Setting VGA SaveVideoState to '+strf(longint(SaveVideoState)));
          RestoreVideoState := RestoreStateVGA;
-
+         LogLn('Setting VGA RestoreVideoState to '+strf(longint(RestoreVideoState)));
+{$endif logging}
 
          InitMode(mode);
          { now add all standard VGA modes...       }
@@ -1915,8 +1925,12 @@ const CrtAddress: word = 0;
          { otherwise, if we use the VGA BIOS only function  }
          { there might be a crash under DPMI, such as in the}
          { ATI Mach64                                       }
+{$ifdef logging}
          SaveVideoState := SaveStateVESA;
+         LogLn('Setting SaveVideoState to '+strf(longint(SaveVideoState)));
          RestoreVideoState := RestoreStateVESA;
+         LogLn('Setting RestoreVideoState to '+strf(longint(RestoreVideoState)));
+{$endif logging}
          { now check all supported modes...}
          if SearchVESAModes(m320x200x32k) then
            begin
@@ -2608,7 +2622,13 @@ const CrtAddress: word = 0;
 
 {
 $Log$
-Revision 1.14  1999-09-18 22:21:09  jonas
+Revision 1.15  1999-09-22 13:13:34  jonas
+  * renamed text.inc -> gtext.inc to avoid conflict with system unit
+  * fixed textwidth
+  * isgraphmode now gets properly updated, so mode restoring works
+    again
+
+Revision 1.14  1999/09/18 22:21:09  jonas
   + hlinevesa256 and vlinevesa256
   + support for not/xor/or/andput in vesamodes with 32k/64k colors
   * lots of changes to avoid warnings under FPC

+ 12 - 2
rtl/inc/graph/graph.pp

@@ -2754,7 +2754,7 @@ end;
   end;
 
 {$i fills.inc}
-{$i text.inc}
+{$i gtext.inc}
 
 
   procedure InitGraph(var GraphDriver:Integer;var GraphMode:Integer;
@@ -2773,6 +2773,9 @@ end;
     QueryAdapterInfo;
     if not assigned(SaveVideoState) then
       RunError(216);
+{$ifdef logging}
+    LogLn('Calling SaveVideoState at '+strf(longint(savevideostate)));
+{$endif logging}
     SaveVideoState;
     InitVars;
     DriverName:=InternalDriverName;   { DOS Graphics driver }
@@ -2844,6 +2847,7 @@ begin
  rewrite(debuglog);
  close(debuglog);
 {$endif logging}
+ isgraphmode := false;
  ModeList := nil;
  SaveVideoState := nil;
  RestoreVideoState := nil;
@@ -2876,7 +2880,13 @@ DetectGraph
 
 {
   $Log$
-  Revision 1.25  1999-09-18 22:21:10  jonas
+  Revision 1.26  1999-09-22 13:13:35  jonas
+    * renamed text.inc -> gtext.inc to avoid conflict with system unit
+    * fixed textwidth
+    * isgraphmode now gets properly updated, so mode restoring works
+      again
+
+  Revision 1.25  1999/09/18 22:21:10  jonas
     + hlinevesa256 and vlinevesa256
     + support for not/xor/or/andput in vesamodes with 32k/64k colors
     * lots of changes to avoid warnings under FPC

+ 13 - 6
rtl/inc/graph/text.inc → rtl/inc/graph/gtext.inc

@@ -275,7 +275,7 @@
               move(hp[i+1],FHeader,sizeof(TFHeader));
               move(hp[Prefix_Size],header,sizeof(THeader));
               { check if the font name is already allocated? }
-              i:=Prefix_Size+sizeof(THeader);
+              i:=Prefix_Size+sizeof(THeader)+1;
               for b:=1 to installedfonts do
                 begin
                    if fonts[b].name=FHeader.Font_name then
@@ -323,8 +323,8 @@
          if Currenttextinfo.font=DefaultFont
             then TextHeight:=8*CurrentTextInfo.CharSize
             else
-              TextHeight:=fonts[Currenttextinfo.font].header.org_to_cap-
-                round(fonts[Currenttextinfo.font].header.org_to_base * CurrentYRatio) ;
+              TextHeight:=Trunc((fonts[Currenttextinfo.font].header.org_to_cap-
+                fonts[Currenttextinfo.font].header.org_to_base) * CurrentYRatio);
       end;
 
     function TextWidth(const TextString : string) : word;
@@ -340,8 +340,9 @@
                for i:=1 to length(TextString) do
                 begin
                    c:=byte(textstring[i]);
-                   dec(c,fonts[Currenttextinfo.font].header.first_char);
-                   if (c<0) or (c>=fonts[Currenttextinfo.font].header.nr_chars) then
+{                   dec(c,fonts[Currenttextinfo.font].header.first_char);}
+                   if (c-fonts[Currenttextinfo.font].header.first_char>=
+                       fonts[Currenttextinfo.font].header.nr_chars) then
                      continue;
                    x:=x+byte(fonts[Currenttextinfo.font].widths[c]);
                end;
@@ -690,7 +691,13 @@
 
 {
 $Log$
-Revision 1.7  1999-09-12 17:29:00  jonas
+Revision 1.1  1999-09-22 13:13:36  jonas
+  * renamed text.inc -> gtext.inc to avoid conflict with system unit
+  * fixed textwidth
+  * isgraphmode now gets properly updated, so mode restoring works
+    again
+
+Revision 1.7  1999/09/12 17:29:00  jonas
   * several changes to internalellipse to make it faster
     and to make sure it updates the ArcCall correctly
     (not yet done for width = 3)

+ 31 - 1
rtl/inc/graph/modes.inc

@@ -33,10 +33,18 @@
     if not assigned(ModeList) then
       begin
         new(ModeList);
+{$ifdef logging}
+        LogLn('Modelist = '+strf(Longint(modelist)));
+        LogLn('Adding mode 1 and modelist^.next = '+strf(Longint(mode.next)));
+{$endif logging}
         move(mode, ModeList^, sizeof(TModeInfo));
       end
     else
       begin
+{$ifdef logging}
+        LogLn('Adding another mode, modelist = '+strf(Longint(modelist)));
+        LogLn('and modelist^.next = '+strf(Longint(modelist^.next)));
+{$endif logging}
         list := ModeList;
         { go to the end of the list }
         while assigned(list^.next) do
@@ -97,13 +105,26 @@
     var
       list: PModeInfo;
       tmp : PModeInfo;
+{$ifdef logging}
+      c: word;
+{$endif logging}
     begin
+      exit;
+{$ifdef logging}
+      LogLn('Modelist at exit: '+strf(longint(modelist)));
+      LogLn('Modelist^.next at exit: '+strf(longint(modelist^.next)));
+      c := 1;
+{$endif logging}
         list := ModeList;
         { go to the end of the list }
         while assigned(list) do
         begin
           tmp := list;
           list:=list^.next;
+{$ifdef logging}
+          LogLn('disposing mode '+strf(c));
+          inc(c);
+{$endif logging}
           dispose(tmp);
         end;
     end;
@@ -291,6 +312,7 @@
         end;
       modeinfo^.InitMode;
       if _GraphResult <> grOk then exit;
+      isgraphmode := true;
       { It is very important that this call be made }
       { AFTER the other variables have been setup.  }
       { Since it calls some routines which rely on  }
@@ -312,12 +334,20 @@
   {       -                                                }
   {********************************************************}
      begin
+       isgraphmode := false;
        RestoreVideoState;
+       isgraphmode := true;
      end;
 
 {
 $Log$
-Revision 1.8  1999-09-18 22:21:11  jonas
+Revision 1.9  1999-09-22 13:13:36  jonas
+  * renamed text.inc -> gtext.inc to avoid conflict with system unit
+  * fixed textwidth
+  * isgraphmode now gets properly updated, so mode restoring works
+    again
+
+Revision 1.8  1999/09/18 22:21:11  jonas
   + hlinevesa256 and vlinevesa256
   + support for not/xor/or/andput in vesamodes with 32k/64k colors
   * lots of changes to avoid warnings under FPC