home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-12-27 | 4.6 KB | 172 lines | [TEXT/CWIE] |
- // ===========================================================================
- // <PP Starter Source>.cp ©1994-1995 Metrowerks Inc. All rights reserved.
- // ===========================================================================
- //
- // This file contains the starter code for a PowerPlant application
-
- #include "CJugglerApp.h"
- #include "CQ3BoxesPane.h"
- #include "CPropPane.h"
- #include "StQD3DInitializer.h"
-
- #include "CQD3DErrorsDoc.h" // for reporting QD3D errors
-
- #include <LGrowZone.h>
- #include <LWindow.h>
- #include <PP_Messages.h>
- #include <PP_Resources.h>
- #include <PPobClasses.h>
- #include <UDrawingState.h>
- #include <UMemoryMgr.h>
- #include <URegistrar.h>
- #include <LEditField.h>
-
- // put declarations for resource ids (ResIDTs) here
-
- const ResIDT window_Boxes = 1;
- const ResIDT window_Prop = 2;
- #define window_Sample window_Prop // switch to set the window type
- const PaneIDT PaneID_PropPane = 200;
-
- const CommandT cmd_NewPropPane = 1200;
-
- // ===========================================================================
- // • Main Program
- // ===========================================================================
-
- void main(void)
- {
- // Set Debugging options
- SetDebugThrow_(debugAction_Alert);
- SetDebugSignal_(debugAction_Alert);
-
- InitializeHeap(4); // Initialize Memory Manager
- // Parameter is number of Master Pointer
- // blocks to allocate
-
- // Initialize standard Toolbox managers
- UQDGlobals::InitializeToolbox(&qd);
-
- new LGrowZone(20000); // Install a GrowZone function to catch
- // low memory situations.
-
- StQD3DInitializer q3; // Initalize QuickDraw 3D
- if (q3.GetStatus()==kQ3Success) {
- CJugglerApp theApp;
- // Make the QD3D Error Message window.
- CQD3DErrorsDoc * doc = new CQD3DErrorsDoc();
- theApp.Run();
- }
- }
-
-
- // ---------------------------------------------------------------------------
- // • CJugglerApp // replace this with your App type
- // ---------------------------------------------------------------------------
- // Constructor
-
- CJugglerApp::CJugglerApp()
- {
- // Register functions to create core PowerPlant classes
-
- RegisterAllPPClasses();
- URegistrar::RegisterClass(CQ3BoxesPane::class_ID, CQ3BoxesPane::CreateQ3BoxesPaneStream);
- URegistrar::RegisterClass(CPropPane::class_ID, CPropPane::CreatePropPaneStream);
-
- }
-
-
- // ---------------------------------------------------------------------------
- // • ~CJugglerApp // replace this with your App type
- // ---------------------------------------------------------------------------
- // Destructor
- //
-
- CJugglerApp::~CJugglerApp()
- {
- }
-
- // ---------------------------------------------------------------------------
- // • StartUp
- // ---------------------------------------------------------------------------
- // This function lets you do something when the application starts up.
- // For example, you could issue your own new command, or respond to a system
- // oDoc (open document) event.
-
- void
- CJugglerApp::StartUp()
- {
- ObeyCommand(cmd_New, nil); // EXAMPLE, create a new window
- }
-
- // ---------------------------------------------------------------------------
- // • ObeyCommand
- // ---------------------------------------------------------------------------
- // Respond to commands
-
- Boolean
- CJugglerApp::ObeyCommand(
- CommandT inCommand,
- void *ioParam)
- {
- Boolean cmdHandled = true;
- LWindow *theWindow;
-
- switch (inCommand) {
-
- // Deal with command messages (defined in PP_Messages.h).
- // Any that you don't handle will be passed to LApplication
-
- case cmd_New:
- theWindow = LWindow::CreateWindow(window_Boxes, this);
- break;
-
- case cmd_NewPropPane:
- theWindow = LWindow::CreateWindow(window_Prop, this);
-
- CPropPane *pane = (CPropPane*)theWindow->FindPaneByID(PaneID_PropPane);
- if (pane) {
- theWindow->SetLatentSub(pane);
- }
- break;
-
- default:
- cmdHandled = LApplication::ObeyCommand(inCommand, ioParam);
- break;
- }
-
- return cmdHandled;
- }
-
- // ---------------------------------------------------------------------------
- // • FindCommandStatus
- // ---------------------------------------------------------------------------
- // This function enables menu commands.
- //
-
- void
- CJugglerApp::FindCommandStatus(
- CommandT inCommand,
- Boolean &outEnabled,
- Boolean &outUsesMark,
- Char16 &outMark,
- Str255 outName)
- {
-
- switch (inCommand) {
-
- // Return menu item status according to command messages.
- // Any that you don't handle will be passed to LApplication
-
- case cmd_New: // enable the New command
- case cmd_NewPropPane:
- outEnabled = true;
- break;
-
- default:
- LApplication::FindCommandStatus(inCommand, outEnabled,
- outUsesMark, outMark, outName);
- break;
- }
- }
-