Przeglądaj źródła

+ initial version of Amiga sysmsgs support

git-svn-id: trunk@11980 -
Károly Balogh 17 lat temu
rodzic
commit
df8fa326cd
3 zmienionych plików z 125 dodań i 0 usunięć
  1. 1 0
      .gitattributes
  2. 115 0
      packages/fv/src/amismsg.inc
  3. 9 0
      packages/fv/src/sysmsg.pas

+ 1 - 0
.gitattributes

@@ -1694,6 +1694,7 @@ packages/fv/examples/platform.inc svneol=native#text/plain
 packages/fv/examples/testapp.lpi svneol=native#text/plain
 packages/fv/examples/testapp.pas svneol=native#text/plain
 packages/fv/fpmake.pp svneol=native#text/plain
+packages/fv/src/amismsg.inc svneol=native#text/plain
 packages/fv/src/app.pas svneol=native#text/plain
 packages/fv/src/asciitab.pas svneol=native#text/plain
 packages/fv/src/buildfv.pas svneol=native#text/plain

+ 115 - 0
packages/fv/src/amismsg.inc

@@ -0,0 +1,115 @@
+{
+   System dependent system messages for AmigaOS/MorphOS
+
+   Copyright (c) 2008 by Karoly Balogh
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this library; if not, write to the Free
+   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+}
+
+
+
+uses
+  video;
+
+Const
+  SystemEventActive : Boolean = false;
+
+var
+  lastxsize,lastysize : longint;
+
+procedure InitSystemMsg;
+//var
+//  WinSize : TWinSize;
+begin
+  If SystemEventActive then
+    exit;
+  { Code to enable size tracking should go here }
+  PendingSystemHead:=@PendingSystemEvent;
+  PendingSystemTail:=@PendingSystemEvent;
+  PendingSystemEvents:=0;
+  FillChar(LastSystemEvent,sizeof(TSystemEvent),0);
+//  FillChar(WinSize,sizeof(WinSize),0);
+//  fpioctl(stdinputhandle,TIOCGWINSZ,@winsize);
+//  LastXSize:=WinSize.ws_row;
+//  LastYSize:=WinSize.ws_col;
+//  If LastXSize=0 then
+    LastXSize:=80;
+//  If LastYSize=0 then
+    LastYSize:=25;
+
+  SystemEventActive:=true;
+end;
+
+
+procedure DoneSystemMsg;
+begin
+  if not SystemEventActive then
+    exit;
+  { Code to disable size tracking should go here }
+  SystemEventActive:=false;
+end;
+
+procedure GetSystemEvent(var SystemEvent: TSystemEvent);
+begin
+  if PendingSystemEvents=0 then
+    PollSystemEvent(SystemEvent);
+  if PendingSystemEvents=0 then
+    exit;
+  SystemEvent:=PendingSystemHead^;
+  inc(PendingSystemHead);
+  if longint(PendingSystemHead)=longint(@PendingSystemEvent)+sizeof(PendingSystemEvent) then
+   PendingSystemHead:=@PendingSystemEvent;
+  dec(PendingSystemEvents);
+  LastSystemEvent:=SystemEvent;
+end;
+
+
+function PollSystemEvent(var SystemEvent: TSystemEvent):boolean;
+begin
+  SystemEvent.typ:=SysNothing;
+  if not SystemEventActive then
+    exit(false);
+  if PendingSystemEvents>0 then
+   begin
+     SystemEvent:=PendingSystemHead^;
+     PollSystemEvent:=true;
+   end
+  else
+   begin
+     PollSystemEvent:=false;
+     if Video.HasCloseWindow then begin
+       SystemEvent.typ:=SysClose;
+       SystemEvent.CloseTyp:=0;
+       PutSystemEvent(SystemEvent);
+       PollSystemEvent:=true;
+     end;
+{
+     FillChar(WinSize,sizeof(WinSize),0);
+     fpioctl(stdinputhandle,TIOCGWINSZ,@winsize);
+     if (winsize.ws_col<>0) and (winsize.ws_row<>0) and
+        ((winsize.ws_row<>lastxsize) or (winsize.ws_col<>lastysize)) then
+       begin
+         SystemEvent.typ:=SysResize;
+         SystemEvent.x:=WinSize.ws_col;
+         SystemEvent.y:=WinSize.ws_row;
+         PutSystemEvent(SystemEvent);
+         LastXSize:=WinSize.ws_row;
+         LastYSize:=WinSize.ws_col;
+         PollSystemEvent:=true;
+       end}
+    end;
+end;
+

+ 9 - 0
packages/fv/src/sysmsg.pas

@@ -83,6 +83,15 @@ implementation
 {$define HAS_SYSMSG}
 {$endif unix}
 
+{$ifdef amiga}
+{$i amismsg.inc}
+{$define HAS_SYSMSG}
+{$endif amiga}
+{$ifdef morphos}
+{$i amismsg.inc}
+{$define HAS_SYSMSG}
+{$endif morphos}
+
 {$ifdef HAS_SYSMSG}
 
 procedure PutSystemEvent(const SystemEvent: TSystemEvent);