📄 piglic.f
字号:
SUBROUTINE MainApp
****************************************************************************
* licence.for *
* *
* Purpose: To install and remove TriGrid licence files and users *
* *
* Conceived by Adrian Dolling, Channel Consulting Ltd., Victoria, BC *
* *
****************************************************************************
external LicenceInitialiser
external LicenceMenuEHandler
external LicenceMouseEHandler
external LicenceStringEHandler
integer LicenceInitialiser
integer LicenceMenuEHandler
integer LicenceMouseEHandler
integer LicenceStringEHandler
call PigMain(LicenceInitialiser, LicenceMenuEHandler,
+ LicenceMouseEHandler, LicenceStringEHandler)
End
C*--------------------------------------------------------------------------*
**********************************
*
* EVENT AND INITIALIZATION HANDLERS
*
* Note: In this example, all are in the same FORTRAN code block.
* This is NOT a requirement, but is used here as a device
* considered preferable to using FORTRAN COMMON blocks to
* share data among the entries.
*
**********************************
function LicenceEHandlers()
integer LicenceEhandlers
* Container for the event handlers
* entry points
integer LicenceMenuEHandler
integer LicenceMouseEHandler
integer LicenceStringEHandler
integer LicenceInitialiser
* holds returned action number for comparision with action list
integer CurChoice
* holds parameters for the mouse event handler
integer MouseButton
real MouseX
real MouseY
* and for the string event handler
integer Clen
character*(*) StringP
***** DATA DECLARATION SECTION ****
***** testmenu.def contains the test menu, only this menu will give
***** valid values back to be compared on the active list in the main line
INCLUDE 'pig.def'
* world coordinates for Main window,initialized below
REAL X_MainWorld_Min, X_MainWorld_Max,
+ Y_MainWorld_Min, Y_MainWorld_Max
* used for end condition
LOGICAL Quit
* used for DriverDraw to tell if any shapes have been drawn yet
LOGICAL DidDraw
integer NextEvent
integer Window
character*(80) String, Title
character*(1) ans
character*(160) Message
character*(160) Filename
character*(4) cursprompts(6)
integer Len
integer PigEndStr
character*(1) PigCursYesNo, PigCursPrompt
logical PigGetOpenFileName
logical PigGetSaveFileName
real px1,px2,py1,py2
integer INACTIVE_CW,
+ REGISTRATION_CW,
+ ABOUT_CW
PARAMETER (
+ INACTIVE_CW=-1,
+ REGISTRATION_CW=4,
+ ABOUT_CW=5)
integer HitNum, Active_CW
integer Win, MButton
real ipx, ipy
logical PigRegistered
logical PigRegister
logical PigShowRegistration
logical PigRegistration_EHandler
logical stat
integer bgcol
integer PigGetBackgroundColour
c Logical PigDebug
c Logical dbgstat, PigDebugOn, PigDebugOff
INCLUDE 'licmenu.def'
data Active_CW /ABOUT_CW/
call PigFatal('Cannot call LicenceEHandlers directly')
* next lines are to keep the compilers happy...
LicenceEHandlers = 1
return
**********************************
*
* INITIALIZER ENTRY
*
**********************************
entry LicenceInitialiser ()
* initialize Main Window world parameters,
X_MainWorld_Min = 10.0
X_MainWorld_Max = X_MainWorld_Min + 1.0
Y_MainWorld_Min = 10.0
Y_MainWorld_Max = Y_MainWorld_Min + 1.0
* used for end condition d
Quit = .FALSE.
* open graphics system and initialize
call PigSetWorldCoordinates (
+ X_MainWorld_Min, X_MainWorld_Max,
+ Y_MainWorld_Min, Y_MainWorld_Max)
c call About('Licence Program', '$Revision: 1.1 $', 0)
Active_CW = ABOUT_CW
call PigSetLineColour(FOREGR)
call PigSetFillColour(CYAN)
* initialize menu system
call PigInitMenu(MenuOpt, MenuTag, MenuMax, ItemMax)
call About('Licence Installer', '$Revision: 1.1 $', 0)
LicenceInitialiser = MOUSE_EVENT
return
**********************************
*
* STRING EVENT HANDLER ENTRY
*
**********************************
entry LicenceStringEHandler(Clen, StringP)
NextEvent = MOUSE_EVENT
LicenceStringEHandler = NextEvent
return
*******************************
*
* MOUSE EVENT HANDLER
*
*******************************
entry LicenceMouseEHandler(Window, MouseButton, MouseX, MouseY)
Hitnum = -1
if ( (Active_CW.ne.INACTIVE_CW)
+ .and.(Window.eq.CONTROLWIN)
+ ) then
call PanelGetHitnum(MouseX, MouseY, Hitnum)
endif
if (Hitnum.eq.0) then
else if (Hitnum.gt.0) then
if (Active_CW.eq.REGISTRATION_CW) then
if (PigRegistration_ehandler(Hitnum)) then
Active_CW = ABOUT_CW
call About('Licence Installer','$Revision: 1.1 $', 0)
endif
endif
else
endif
LicenceMouseEHandler = MOUSE_EVENT
return
**********************************
*
* MENU EVENT HANDLER ENTRY
*
**********************************
entry LicenceMenuEHandler(CurChoice)
NextEvent = MOUSE_EVENT
call DriverDoc(CurChoice)
IF (CurChoice .EQ. SHOW_ABOUT) THEN
Active_CW = ABOUT_CW
call About('Licence Installer','$Revision: 1.1 $', 0)
ELSEIF (CurChoice .EQ. REGISTER_USER) then
Active_CW = REGISTRATION_CW
call PigEditRegistration()
ELSEIF (CurChoice .EQ. UNREGISTER_USER) then
call PigUnLicence
Active_CW = ABOUT_CW
call About('Licence Installer','$Revision: 1.1 $', 0)
ELSEIF ( (CurChoice .EQ. REPAINT_ALL)
+ .or. (CurChoice .EQ. REPAINT_MAINWIN)
+ .or. (CurChoice .EQ. REPAINT_CONTROLWIN)
+ .or. (CurChoice .EQ. REPAINT_PROFILEWIN)
+ ) then
if (CurChoice .NE. REPAINT_MAINWIN) then
call PigErase(CONTROLWIN)
if(Active_CW.eq.REGISTRATION_CW) then
call PigShowRegistration()
elseif(Active_CW.eq.ABOUT_CW) then
call About('Licence Installer','$Revision: 1.1 $', 0)
elseif(Active_CW.eq.INACTIVE_CW) then
* leave it blank...
endif
endif
ELSEIF (CurChoice .EQ. EXIT) THEN
Quit = .TRUE.
ELSE
call DriverDoc(CurChoice)
call PigPutMessage('Not recognised in menu event handler')
ENDIF
if(Quit)then
NextEvent = QUIT_EVENT
endif
LicenceMenuEHandler = NextEvent
return
END
************************************************************************
* SUBROUTINE to alert user that an invalid choice has been encounted *
* *
* DRIVER EXCEPTION *
************************************************************************
SUBROUTINE DriverDoc(Choice)
integer Choice
character*(80) Message
write(Message,'(a,i8)') 'Requested action was ',Choice
call PigPutMessage (Message)
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -