1 /******************************************************************************
*
* Palm Interactive Boardroom ( PIB )
* Handheld presentation tool using a networked projector as a display.
*
* This source code is based on default IDE source as well as royalty-free
* samples provided with the IDE. This file shell was generated by the Palm OS
* Developer Suite IDE.
*
* Other royalty-free source code from HelloNetLib.c ( provided by
* Palm at www.palmsource.com ) to send TCP and UDP traffic to an IP
* address + port number was modified significanlty in support of
* the PIB requirements.
*
* Programming environment: Palm OS Developer Suite
*
* Created by Scott Armstrong for UIUC CS-427/428, Group 30
* based on UML and requirements outlined by Group 30 members.
*
* File: AppMain.cpp
*
* Notes:
* - This version is a complete re-write ( tossed theold stuff out )
* now that we've learned a bit more about PalmOS
*
* Version 5.0.0
* - Each feature, menu and form should be its own object
*
*****************************************************************************/
#include <PalmOS.h>
#include "AppResources.h"
#include "AppHandleEvt.h"
/***********************************************************************
*
* Entry Points
*
***********************************************************************/
/***********************************************************************
*
* Internal Constants
*
***********************************************************************/
#define appFileCreator 'cPIB' // register your own at http://www.palmos.com/dev/creatorid/
#define appVersionNum 0x01
#define appPrefID 0x00
#define appPrefVersionNum 0x01
/***********************************************************************
*
* Internal Functions
*
***********************************************************************/
/***********************************************************************
*
* FUNCTION: AppStart
*
* DESCRIPTION: Get the current application's preferences.
*
* PARAMETERS: nothing
*
* RETURNED: Err value errNone if nothing went wrong
*
* REVISION HISTORY:
*
*
***********************************************************************/
76 static Err AppStart( void )
{
FrmGotoForm( MainForm );
return errNone;
}
/***********************************************************************
*
* FUNCTION: AppStop
*
* DESCRIPTION: Save the current state of the application.
*
* PARAMETERS: nothing
*
* RETURNED: nothing
*
* REVISION HISTORY:
*
*
***********************************************************************/
97 static void AppStop( void )
{
// Close all the open forms.
FrmCloseAllForms( );
}
/***********************************************************************
*
* FUNCTION: AppEventLoop
*
* DESCRIPTION: This routine is the event loop for the application
* and is a default function.
*
* PARAMETERS: nothing
*
* RETURNED: nothing
*
* REVISION HISTORY:
*
*
***********************************************************************/
119 static void AppEventLoop( void )
{
Err error;
EventType event;
do {
EvtGetEvent( &event, evtWaitForever );
if ( SysHandleEvent( &event ) )
continue;
if ( MenuHandleEvent( 0, &event, &error ) )
continue;
if ( AppHandleEvt::AppHandleEvent( &event ) )
continue;
FrmDispatchEvent( &event );
} while ( event.eType != appStopEvent );
}
/***********************************************************************
*
* FUNCTION: PilotMain
*
* DESCRIPTION: This is the main entry point for the application.
*
* PARAMETERS: cmd - word value specifying the launch code.
* cmdPB - pointer to a structure that is associated with the launch code.
* launchFlags - word value providing extra information about the launch.
* RETURNED: Result of launch
*
* REVISION HISTORY:
*
*
***********************************************************************/
157 UInt32 PilotMain( UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags )
{
Err error = errNone;
switch ( cmd ) {
case sysAppLaunchCmdNormalLaunch:
if ( ( error = AppStart( ) ) == 0 ) {
AppEventLoop( );
AppStop( );
}
break;
default:
break;
}
return error;
}