Explorar o código

Split BRL.System. Added BRL.SystemDefault.

woollybah %!s(int64=11) %!d(string=hai) anos
pai
achega
86165f2d77

+ 5 - 0
system.mod/driver.bmx

@@ -16,6 +16,11 @@ Type TSystemDriver
 	Method RequestDir$( text$,path$ ) Abstract
 	Method RequestDir$( text$,path$ ) Abstract
 
 
 	Method OpenURL( url$ ) Abstract	
 	Method OpenURL( url$ ) Abstract	
+
+	Method DesktopWidth:Int() Abstract
+	Method DesktopHeight:Int() Abstract
+	Method DesktopDepth:Int() Abstract
+	Method DesktopHertz:Int() Abstract
 	
 	
 End Type
 End Type
 
 

+ 16 - 22
system.mod/system.bmx

@@ -6,12 +6,14 @@ bbdoc: System/System
 End Rem
 End Rem
 Module BRL.System
 Module BRL.System
 
 
-ModuleInfo "Version: 1.28"
+ModuleInfo "Version: 1.29"
 ModuleInfo "Author: Mark Sibly, Simon Armstrong"
 ModuleInfo "Author: Mark Sibly, Simon Armstrong"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Modserver: BRL"
 ModuleInfo "Modserver: BRL"
 
 
+ModuleInfo "History: 1.29"
+ModuleInfo "History: Split out into BRL.System and BRL.SystemDefault modules."
 ModuleInfo "History: 1.28"
 ModuleInfo "History: 1.28"
 ModuleInfo "History: Added custom format option to CurrentDate()."
 ModuleInfo "History: Added custom format option to CurrentDate()."
 ModuleInfo "History: 1.27"
 ModuleInfo "History: 1.27"
@@ -74,21 +76,6 @@ Import Pub.StdC
 
 
 Import "driver.bmx"
 Import "driver.bmx"
 
 
-Import "system.c"
-
-?MacOS
-Import "system.macos.bmx"
-Driver=New TMacOSSystemDriver
-?Win32
-Import "system.win32.bmx"
-Import "-lcomdlg32"
-Driver=New TWin32SystemDriver
-?Linux
-Import "-lX11"
-Import "system.linux.bmx"
-Driver=New TLinuxSystemDriver
-?
-
 Private
 Private
 
 
 Global _busy
 Global _busy
@@ -305,19 +292,22 @@ Function OpenURL( url$ )
 	Return Driver.OpenURL( url )
 	Return Driver.OpenURL( url )
 End Function
 End Function
 
 
-Extern
 
 
 Rem
 Rem
 bbdoc: Get desktop width
 bbdoc: Get desktop width
 returns: Width of the desktop, in pixels
 returns: Width of the desktop, in pixels
 End Rem
 End Rem
-Function DesktopWidth()="bbSystemDesktopWidth"
+Function DesktopWidth()
+	Return Driver.DesktopWidth()
+End Function
 
 
 Rem
 Rem
 bbdoc: Get desktop height
 bbdoc: Get desktop height
 returns: Height of the desktop, in pixels
 returns: Height of the desktop, in pixels
 End Rem
 End Rem
-Function DesktopHeight()="bbSystemDesktopHeight"
+Function DesktopHeight()
+	Return Driver.DesktopHeight()
+End Function
 
 
 Rem
 Rem
 bbdoc: Get desktop depth
 bbdoc: Get desktop depth
@@ -327,7 +317,9 @@ The depth of the desktop is the number of bits per pixel.
 
 
 Note that on some platforms this function may return 0 if the desktop depth cannot be determined.
 Note that on some platforms this function may return 0 if the desktop depth cannot be determined.
 End Rem
 End Rem
-Function DesktopDepth()="bbSystemDesktopDepth"
+Function DesktopDepth()
+	Return Driver.DesktopDepth()
+End Function
 
 
 Rem
 Rem
 bbdoc: Get desktop refresh rate
 bbdoc: Get desktop refresh rate
@@ -335,6 +327,8 @@ returns: Refresh rate, in cycles per second, of the desktop
 about:
 about:
 Note that on some platforms this function may return 0 if the desktop refresh rate cannot be determined.
 Note that on some platforms this function may return 0 if the desktop refresh rate cannot be determined.
 End Rem
 End Rem
-Function DesktopHertz()="bbSystemDesktopHertz"
+Function DesktopHertz()
+	Return Driver.DesktopHertz()
+End Function
 
 
-End Extern
+'End Extern

+ 5 - 0
systemdefault.mod/doc/confirm.bmx

@@ -0,0 +1,5 @@
+' confirm.bmx
+
+result=Confirm("Are you sure?")
+
+print result

+ 14 - 0
systemdefault.mod/doc/createtimer.bmx

@@ -0,0 +1,14 @@
+Rem
+The following BlitzMax program prints a new line to the console 5 times a second.
+End Rem
+
+' testtimer.bmx
+
+t=createtimer(5)
+frame=0
+
+for i=1 to 10
+	waittimer(t)
+	print frame
+	frame:+1
+next

+ 3 - 0
systemdefault.mod/doc/currentdate.bmx

@@ -0,0 +1,3 @@
+' currentdate.bmx
+
+Print "The date is "+CurrentDate$()

+ 3 - 0
systemdefault.mod/doc/currenttime.bmx

@@ -0,0 +1,3 @@
+' currenttime.bmx
+
+Print "The time is "+CurrentTime$()

+ 11 - 0
systemdefault.mod/doc/delay.bmx

@@ -0,0 +1,11 @@
+Rem
+The following BlitzMax program prints a new line to the console 10 times a second.
+End Rem
+
+' testtimer.bmx
+
+for i=1 to 10
+	print frame
+	frame:+1
+	delay 100
+next

+ 8 - 0
systemdefault.mod/doc/intro.bbdoc

@@ -0,0 +1,8 @@
+
+The system module's primary function is to provide synchronization with the operating system.
+
+This achieved through the #PollSystem and #WaitSystem commands. However, you don't usually 
+have to call these commands yourself as other BlitzMax commands will call them when necessary.
+
+In addition, the system module also provides commands for checking the date and time, for moving
+the mouse pointer and for generating simple system requesters.

+ 9 - 0
systemdefault.mod/doc/millisecs.bmx

@@ -0,0 +1,9 @@
+Rem
+Millisecs is useful for seeding the random number generator.
+End Rem
+
+seedrnd(millisecs())
+
+for i=1 to 10
+	print rnd()
+next

+ 3 - 0
systemdefault.mod/doc/notify.bmx

@@ -0,0 +1,3 @@
+' notify.bmx
+
+Notify "Hello World"

+ 5 - 0
systemdefault.mod/doc/proceed.bmx

@@ -0,0 +1,5 @@
+' proceed.bmx
+
+result=Proceed("Are you sure you want to continue?")
+
+print result

+ 5 - 0
systemdefault.mod/doc/requestdir.bmx

@@ -0,0 +1,5 @@
+' requestdir.bmx
+
+path$=RequestDir("Select a Folder",CurrentDir())
+
+Print "directory selected was "+path

+ 6 - 0
systemdefault.mod/doc/requestfile.bmx

@@ -0,0 +1,6 @@
+' requestfile.bmx
+
+filter$="Image Files:png,jpg,bmp;Text Files:txt;All Files:*"
+filename$=RequestFile( "Select graphic file to open",filter$ )
+
+Print filename

+ 4 - 0
systemdefault.mod/doc/waittimer.bmx

@@ -0,0 +1,4 @@
+Rem
+ WaitTimer( timer:TSyncTimer )
+Waits for a timer to trigger.
+End Rem

+ 0 - 0
system.mod/system.c → systemdefault.mod/system.c


+ 0 - 0
system.mod/system.h → systemdefault.mod/system.h


+ 22 - 1
system.mod/system.linux.bmx → systemdefault.mod/system.linux.bmx

@@ -1,7 +1,7 @@
 
 
 Strict
 Strict
 
 
-Import "driver.bmx"
+Import BRL.System
 Import "system.linux.c"
 Import "system.linux.c"
 
 
 Import "-lXxf86vm"
 Import "-lXxf86vm"
@@ -25,6 +25,11 @@ Function bbSystemStartAsyncOp( asyncOp( asyncInfo ),asyncInfo,syncOp( syncInfo:O
 Function bbSystemAsyncFD()
 Function bbSystemAsyncFD()
 Function bbSystemFlushAsyncOps()
 Function bbSystemFlushAsyncOps()
 
 
+Function bbSystemDesktopWidth:Int()
+Function bbSystemDesktopHeight:Int()
+Function bbSystemDesktopDepth:Int()
+Function bbSystemDesktopHertz:Int()
+
 End Extern
 End Extern
 
 
 Const XKeyPress=2
 Const XKeyPress=2
@@ -97,4 +102,20 @@ Type TLinuxSystemDriver Extends TSystemDriver
 		EndIf
 		EndIf
 	End Method
 	End Method
 
 
+	Method DesktopWidth:Int()
+		Return bbSystemDesktopWidth()
+	End Method
+	
+	Method DesktopHeight:Int()
+		Return bbSystemDesktopHeight()
+	End Method
+	
+	Method DesktopDepth:Int()
+		Return bbSystemDesktopDepth()
+	End Method
+	
+	Method DesktopHertz:Int()
+		Return bbSystemDesktopHertz()
+	End Method
+
 End Type
 End Type

+ 0 - 0
system.mod/system.linux.c → systemdefault.mod/system.linux.c


+ 22 - 1
system.mod/system.macos.bmx → systemdefault.mod/system.macos.bmx

@@ -2,7 +2,7 @@ Strict
 
 
 Import BRL.Event
 Import BRL.Event
 
 
-Import "driver.bmx"
+Import BRL.System
 Import "system.macos.m"
 Import "system.macos.m"
 
 
 Extern
 Extern
@@ -23,6 +23,11 @@ Function bbOpenURL( url$ )
 Function bbSystemPostSyncOp( syncOp( syncInfo:Object,asyncRet ),syncInfo:Object,asyncRet )
 Function bbSystemPostSyncOp( syncOp( syncInfo:Object,asyncRet ),syncInfo:Object,asyncRet )
 Function bbSystemStartAsyncOp( asyncOp( asyncInfo ),asyncInfo,syncOp( syncInfo:Object,asyncRet ),syncInfo:Object )
 Function bbSystemStartAsyncOp( asyncOp( asyncInfo ),asyncInfo,syncOp( syncInfo:Object,asyncRet ),syncInfo:Object )
 
 
+Function bbSystemDesktopWidth:Int()
+Function bbSystemDesktopHeight:Int()
+Function bbSystemDesktopDepth:Int()
+Function bbSystemDesktopHertz:Int()
+
 End Extern
 End Extern
 
 
 Private
 Private
@@ -105,6 +110,22 @@ Type TMacOSSystemDriver Extends TSystemDriver
 '		Return system_( "open "" + url.Replace("~q","") + "~q" )
 '		Return system_( "open "" + url.Replace("~q","") + "~q" )
 		bbOpenURL( url )
 		bbOpenURL( url )
 	End Method
 	End Method
+
+	Method DesktopWidth:Int()
+		Return bbSystemDesktopWidth()
+	End Method
+	
+	Method DesktopHeight:Int()
+		Return bbSystemDesktopHeight()
+	End Method
 	
 	
+	Method DesktopDepth:Int()
+		Return bbSystemDesktopDepth()
+	End Method
+	
+	Method DesktopHertz:Int()
+		Return bbSystemDesktopHertz()
+	End Method
+
 End Type
 End Type
 
 

+ 1 - 1
system.mod/system.macos.m → systemdefault.mod/system.macos.m

@@ -1,5 +1,5 @@
 
 
-#import <brl.mod/system.mod/system.h>
+#import <brl.mod/systemdefault.mod/system.h>
 
 
 #include <AppKit/AppKit.h>
 #include <AppKit/AppKit.h>
 
 

+ 23 - 2
system.mod/system.win32.bmx → systemdefault.mod/system.win32.bmx

@@ -1,7 +1,7 @@
 
 
 Strict
 Strict
 
 
-Import "driver.bmx"
+Import BRL.System
 Import "system.win32.c"
 Import "system.win32.c"
 
 
 Import "-lshell32"
 Import "-lshell32"
@@ -24,11 +24,16 @@ Function bbSystemRequestFile$( text$,exts$,defext,save,file$,dir$ )
 Function bbSystemRequestDir$( text$,dir$ )
 Function bbSystemRequestDir$( text$,dir$ )
 Function bbOpenURL( url$ )
 Function bbOpenURL( url$ )
 
 
-Function bbSystemEmitOSEvent( hwnd:Byte Ptr,msg,wparam,lparam,source:Object )
+Function bbSystemEmitOSEvent( hwnd,msg,wparam,lparam,source:Object )
 
 
 Function bbSystemPostSyncOp( syncOp( syncInfo:Object,asyncRet ),syncInfo:Object,asyncRet )
 Function bbSystemPostSyncOp( syncOp( syncInfo:Object,asyncRet ),syncInfo:Object,asyncRet )
 Function bbSystemStartAsyncOp( asyncOp( asyncInfo ),asyncInfo,syncOp( syncInfo:Object,asyncRet ),syncInfo:Object )
 Function bbSystemStartAsyncOp( asyncOp( asyncInfo ),asyncInfo,syncOp( syncInfo:Object,asyncRet ),syncInfo:Object )
 
 
+Function bbSystemDesktopWidth:Int()
+Function bbSystemDesktopHeight:Int()
+Function bbSystemDesktopDepth:Int()
+Function bbSystemDesktopHertz:Int()
+
 End Extern
 End Extern
 
 
 Type TWin32SystemDriver Extends TSystemDriver
 Type TWin32SystemDriver Extends TSystemDriver
@@ -125,5 +130,21 @@ Type TWin32SystemDriver Extends TSystemDriver
 	Method OpenURL( url$ )
 	Method OpenURL( url$ )
 		bbOpenURL( url )
 		bbOpenURL( url )
 	End Method
 	End Method
+
+	Method DesktopWidth:Int()
+		Return bbSystemDesktopWidth()
+	End Method
+	
+	Method DesktopHeight:Int()
+		Return bbSystemDesktopHeight()
+	End Method
 	
 	
+	Method DesktopDepth:Int()
+		Return bbSystemDesktopDepth()
+	End Method
+	
+	Method DesktopHertz:Int()
+		Return bbSystemDesktopHertz()
+	End Method
+
 End Type
 End Type

+ 0 - 0
system.mod/system.win32.c → systemdefault.mod/system.win32.c


+ 88 - 0
systemdefault.mod/systemdefault.bmx

@@ -0,0 +1,88 @@
+
+Strict
+
+Rem
+bbdoc: System/System
+End Rem
+Module BRL.SystemDefault
+
+ModuleInfo "Version: 1.29"
+ModuleInfo "Author: Mark Sibly, Simon Armstrong"
+ModuleInfo "License: zlib/libpng"
+ModuleInfo "Copyright: Blitz Research Ltd"
+ModuleInfo "Modserver: BRL"
+
+ModuleInfo "History: 1.29"
+ModuleInfo "History: Split out into BRL.System and BRL.SystemDefault modules."
+ModuleInfo "History: 1.28"
+ModuleInfo "History: Added custom format option to CurrentDate()."
+ModuleInfo "History: 1.27"
+ModuleInfo "History: Moved event enums from system.h to event.mod/event.h"
+ModuleInfo "Histroy: Moved keycode enums from system.h to keycodes.mod/keycodes.h"
+ModuleInfo "History: 1.26 Release"
+ModuleInfo "History: Fixed win32 filerequester causing activewindow dramas"
+ModuleInfo "History: 1.25 Release"
+ModuleInfo "History: Fixed unretained object issue with mouse tracking"
+ModuleInfo "History: 1.24 Release"
+ModuleInfo "History: Fixed windowed mode HideMouse issue"
+ModuleInfo "History: 1.23 Release"
+ModuleInfo "History: Fixed win32 requestfile default extension bug#2"
+ModuleInfo "History: 1.22 Release"
+ModuleInfo "History: Fixed win32 requestfile default extension bug"
+ModuleInfo "History: 1.21 Release"
+ModuleInfo "History: New Linux implementation of OpenURL"
+ModuleInfo "History: 1.20 Release"
+ModuleInfo "History: RequestFile now adds extension to filename on Windows"
+ModuleInfo "History: 1.19 Release"
+ModuleInfo "History: Added EVENT_GADGETLOSTFOCUS handling"
+ModuleInfo "History: 1.18 Release"
+ModuleInfo "History: Added EVENT_KEYREPEAT handling"
+ModuleInfo "History: 1.17 Release"
+ModuleInfo "History: OpenURL now attempts to fully qualify file / http url supplied"
+ModuleInfo "History: 1.16 Release"
+ModuleInfo "History: Fixed MacOS RequestFile to respect wild card filter"
+ModuleInfo "History: 1.15 Release"
+ModuleInfo "History: Fixed mouse hidden by default"
+ModuleInfo "History: 1.14 Release"
+ModuleInfo "History: Fixed HideMouse causing mouse to disappear when in non-client areas"
+ModuleInfo "History: 1.13 Release"
+ModuleInfo "History: Fixed Linux MoveMouse to be relative to the origin of the current Graphics window"
+ModuleInfo "History: 1.12 Release"
+ModuleInfo "History: Added Linux X11 import to remove glgraphics.mod dependency"
+ModuleInfo "History: Fixed linux middle button crash"
+ModuleInfo "History: 1.11 Release"
+ModuleInfo "History: Fixed win32 clipboard glitches with QS_ALLINPUT bbSystemWait mod"
+ModuleInfo "History: 1.11 Release"
+ModuleInfo "History: CGSetLocalEventsSuppressionInterval fix for MacOS bbSystemMoveMouse"
+ModuleInfo "History: 1.10 Release"
+ModuleInfo "History: Ripped out input stuff and added hook"
+ModuleInfo "History: 1.09 Release"
+ModuleInfo "History: Tweaked MacOS GetChar()"
+ModuleInfo "History: 1.07 Release"
+ModuleInfo "History: Added AppTitle support for requesters"
+ModuleInfo "History: 1.06 Release"
+ModuleInfo "History: Fixed MacOS RequestDir ignoring initial path"
+ModuleInfo "History: 1.05 Release"
+ModuleInfo "History: Added RequestDir support for MacOS"
+ModuleInfo "History: 1.04 Release"
+ModuleInfo "History: Added mouse capture to Win32"
+ModuleInfo "History: Fixed C Compiler warnings"
+
+Import BRL.System
+Import BRL.KeyCodes
+Import BRL.Hook
+
+Import "system.c"
+
+?MacOS
+Import "system.macos.bmx"
+Driver=New TMacOSSystemDriver
+?Win32
+Import "system.win32.bmx"
+Import "-lcomdlg32"
+Driver=New TWin32SystemDriver
+?Linux
+Import "-lX11"
+Import "system.linux.bmx"
+Driver=New TLinuxSystemDriver
+?