home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-09-12 | 3.0 KB | 142 lines | [TEXT/CWIE] |
- /*
- CLookupApplication.cp
-
- Copyright © 1995 Alastair Rankine.
- All Rights Reserved.
- */
-
- #include <StandardFile.h>
-
- #include <LApplication.h>
- #include <LGrowZone.h>
- #include <LWindow.h>
- #include <LScroller.h>
- #include <LPrintout.h>
- #include <LPlaceHolder.h>
-
- #include <UMemoryMgr.h>
- #include <UDrawingState.h>
- #include <URegistrar.h>
- #include <UDesktop.h>
-
- #include "CLookupApplication.h"
- #include "CLookupDocument.h"
- #include "CLookupWindow.h"
- #include "CEntryList.h"
-
- void main(void)
- {
- // Set Debugging options
- SetDebugThrow_(debugAction_SourceDebugger);
- SetDebugSignal_(debugAction_SourceDebugger);
-
- InitializeHeap(3); // 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.
- // Parameter is size of reserve memory
- // block to allocated. The first time
- // the GrowZone function is called,
- // there will be at least this much
- // memory left (so you'll have enough
- // memory to alert the user or finish
- // what you are doing).
-
- CLookupApplication theApp; // Create instance of your Application
- theApp.Run(); // class and run it
- }
-
-
- CLookupApplication::CLookupApplication()
- {
- // This is easier for the time being...
- RegisterAllPPClasses();
-
- CLookupWindow::Register();
- CEntryList::Register();
-
- AddAttachment(new LUndoer);
- }
-
-
- CLookupApplication::~CLookupApplication()
- {
- // +++ Add code here to cleanup (if necessary) before quitting
- }
-
-
- Boolean CLookupApplication::ObeyCommand(
- CommandT inCommand,
- void *ioParam)
- {
- Boolean cmdHandled = true;
-
- switch (inCommand) {
-
- // +++ Add cases here for the commands you handle
- // Remember to add same cases to FindCommandStatus below
- // to enable/disable the menu items for the commands
-
- default:
- cmdHandled = LDocApplication::ObeyCommand(inCommand, ioParam);
- break;
- }
-
- return cmdHandled;
- }
-
-
- void
- CLookupApplication::FindCommandStatus(
- CommandT inCommand,
- Boolean &outEnabled,
- Boolean &outUsesMark,
- Char16 &outMark,
- Str255 outName)
- {
- outUsesMark = false;
-
- switch (inCommand) {
-
- // +++ Add cases here for the commands you handle
-
- default:
- LDocApplication::FindCommandStatus(inCommand, outEnabled, outUsesMark,
- outMark, outName);
- break;
- }
- }
-
- void CLookupApplication::OpenDocument(FSSpec * inMacFSSpec)
- {
- CLookupDocument * theDoc = new CLookupDocument(this, inMacFSSpec);
- }
-
-
- LModelObject * CLookupApplication::MakeNewDocument()
- {
- CLookupDocument * theDoc = new CLookupDocument(this, nil);
- return theDoc;
- }
-
-
- void
- CLookupApplication::ChooseDocument()
- {
- StandardFileReply macFileReply;
- SFTypeList typeList;
-
- UDesktop::Deactivate();
- typeList[0] = CLookupDocument::kFileType;
- ::StandardGetFile(nil, 1, typeList, &macFileReply);
- UDesktop::Activate();
- if (macFileReply.sfGood) {
- OpenDocument(&macFileReply.sfFile);
- }
- }
-