From 2a98bfbc8c83503326d7a42fcee2d426ca9aa16a Mon Sep 17 00:00:00 2001 From: elasota Date: Tue, 2 Jun 2020 20:01:16 -0400 Subject: [PATCH] Remove AppleEvents API --- GpApp/AppleEvents.cpp | 35 +-------- GpApp/Events.cpp | 1 - GpApp/House.cpp | 4 - PortabilityLayer/AEHandlerDesc.h | 20 ----- PortabilityLayer/AEManager.cpp | 73 ------------------- PortabilityLayer/AEManager.h | 24 ------ PortabilityLayer/PLAppleEvents.cpp | 49 ------------- PortabilityLayer/PLAppleEvents.h | 32 -------- PortabilityLayer/PLAppleEventsCommonTypes.h | 52 ------------- PortabilityLayer/PLCore.cpp | 2 - PortabilityLayer/PLNavigation.cpp | 13 ---- PortabilityLayer/PLNavigation.h | 26 ------- PortabilityLayer/PortabilityLayer.vcxproj | 8 -- .../PortabilityLayer.vcxproj.filters | 24 ------ 14 files changed, 4 insertions(+), 359 deletions(-) delete mode 100644 PortabilityLayer/AEHandlerDesc.h delete mode 100644 PortabilityLayer/AEManager.cpp delete mode 100644 PortabilityLayer/AEManager.h delete mode 100644 PortabilityLayer/PLAppleEvents.cpp delete mode 100644 PortabilityLayer/PLAppleEvents.h delete mode 100644 PortabilityLayer/PLAppleEventsCommonTypes.h delete mode 100644 PortabilityLayer/PLNavigation.cpp delete mode 100644 PortabilityLayer/PLNavigation.h diff --git a/GpApp/AppleEvents.cpp b/GpApp/AppleEvents.cpp index a826508..a71d29a 100644 --- a/GpApp/AppleEvents.cpp +++ b/GpApp/AppleEvents.cpp @@ -6,7 +6,6 @@ //============================================================================ -#include "PLAppleEvents.h" #include "AppEventHandler.h" #include "DialogManager.h" #include "Externs.h" @@ -15,6 +14,9 @@ #define kNoPrintingAlert 1031 +extern Boolean quitting; + +#if 0 PLError_t DoOpenAppAE (const AppleEvent *, AppleEvent *, UInt32); PLError_t DoOpenDocAE (const AppleEvent *, AppleEvent *, UInt32); @@ -28,7 +30,6 @@ AEEventHandlerUPP openAppAEUPP, openDocAEUPP, printDocAEUPP, quitAEUPP; extern VFileSpec *theHousesSpecs; extern long incrementModeTime; extern short thisHouseIndex, splashOriginH, splashOriginV; -extern Boolean quitting; //============================================================== Functions @@ -168,6 +169,7 @@ PLError_t MyGotRequiredParams (const AppleEvent *theAE) &returnedType, 0L, 0, &actualSize) == errAEDescNotFound) ? PLErrors::kNone : PLErrors::kInvalidParameter; } +#endif class SystemEventHandlerImpl : public PortabilityLayer::IAppEventHandler { @@ -201,34 +203,5 @@ void SetUpAppleEvents (void) PLError_t theErr; PortabilityLayer::AppEventHandler::SetInstance(SystemEventHandlerImpl::GetInstance()); - - openAppAEUPP = NewAEEventHandlerProc(DoOpenAppAE); - openDocAEUPP = NewAEEventHandlerProc(DoOpenDocAE); - printDocAEUPP = NewAEEventHandlerProc(DoPrintDocAE); - quitAEUPP = NewAEEventHandlerProc(DoQuitAE); - - theErr = AEInstallEventHandler(kCoreEventClass, // install oapp - kAEOpenApplication, openAppAEUPP, 0, false); - if (theErr != PLErrors::kNone) - YellowAlert(kYellowAppleEventErr, theErr); - - theErr = AEInstallEventHandler(kCoreEventClass, // install odoc - kAEOpenDocuments, openDocAEUPP, 0, false); - if (theErr != PLErrors::kNone) - YellowAlert(kYellowAppleEventErr, theErr); - - theErr = AEInstallEventHandler(kCoreEventClass, // install pdoc - kAEPrintDocuments, printDocAEUPP, 0, false); - if (theErr != PLErrors::kNone) - YellowAlert(kYellowAppleEventErr, theErr); - - theErr = AEInstallEventHandler(kCoreEventClass, // install quit - kAEQuitApplication, quitAEUPP, 0, false); - if (theErr != PLErrors::kNone) - YellowAlert(kYellowAppleEventErr, theErr); - - theErr = AESetInteractionAllowed(kAEInteractWithAll); - if (theErr != PLErrors::kNone) - YellowAlert(kYellowAppleEventErr, theErr); } diff --git a/GpApp/Events.cpp b/GpApp/Events.cpp index f820d1f..858efb4 100644 --- a/GpApp/Events.cpp +++ b/GpApp/Events.cpp @@ -6,7 +6,6 @@ //============================================================================ -#include "PLAppleEvents.h" #include "PLKeyEncoding.h" #include "PLTimeTaggedVOSEvent.h" #include "PLToolUtils.h" diff --git a/GpApp/House.cpp b/GpApp/House.cpp index 7358dc2..9b4f219 100644 --- a/GpApp/House.cpp +++ b/GpApp/House.cpp @@ -4,9 +4,7 @@ //---------------------------------------------------------------------------- //============================================================================ -#include "PLAppleEvents.h" #include "PLKeyEncoding.h" -#include "PLNavigation.h" #include "PLNumberFormatting.h" #include "PLPasStr.h" #include "PLResources.h" @@ -56,8 +54,6 @@ extern Boolean twoPlayerGame, wardBitSet, phoneBitSet; #ifndef COMPILEDEMO Boolean CreateNewHouse (void) { - AEKeyword theKeyword; - DescType actualType; size_t actualSize; VFileSpec tempSpec; VFileSpec theSpec; diff --git a/PortabilityLayer/AEHandlerDesc.h b/PortabilityLayer/AEHandlerDesc.h deleted file mode 100644 index d4639fe..0000000 --- a/PortabilityLayer/AEHandlerDesc.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#ifndef __PL_AE_HANDLER_DESC_H__ -#define __PL_AE_HANDLER_DESC_H__ - -#include "PLAppleEventsCommonTypes.h" - -#include - -namespace PortabilityLayer -{ - struct AEHandlerDesc - { - AEEventClass m_eventClass; - AEEventID m_eventID; - AEEventHandler m_handler; - uint32_t m_ref; - }; -} - -#endif diff --git a/PortabilityLayer/AEManager.cpp b/PortabilityLayer/AEManager.cpp deleted file mode 100644 index 1193083..0000000 --- a/PortabilityLayer/AEManager.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include "AEManager.h" -#include "AEHandlerDesc.h" - -#include - -namespace PortabilityLayer -{ - class AEManagerImpl final : public AEManager - { - public: - AEManagerImpl(); - - void Init() override; - void Shutdown() override; - - void InstallEventHandler(AEEventClass eventClass, AEEventID eventID, AEEventHandler handler, uint32_t ref, bool isSysHandler) override; - void SetInteractAllowed(AEInteractAllowed interactAllowed) override; - - static AEManagerImpl *GetInstance(); - - private: - std::vector m_handlers; - AEInteractAllowed m_interactAllowed; - - static AEManagerImpl ms_instance; - }; - - AEManagerImpl::AEManagerImpl() - : m_interactAllowed(kAEInteractUnknown) - { - } - - void AEManagerImpl::Init() - { - m_interactAllowed = kAEInteractUnknown; - } - - void AEManagerImpl::Shutdown() - { - m_handlers.clear(); - } - - void AEManagerImpl::InstallEventHandler(AEEventClass eventClass, AEEventID eventID, AEEventHandler handler, uint32_t ref, bool isSysHandler) - { - AEHandlerDesc desc; - desc.m_eventClass = eventClass; - desc.m_eventID = eventID; - desc.m_handler = handler; - desc.m_ref = ref; - - m_handlers.push_back(desc); - } - - void AEManagerImpl::SetInteractAllowed(AEInteractAllowed interactAllowed) - { - m_interactAllowed = interactAllowed; - } - - AEManagerImpl *AEManagerImpl::GetInstance() - { - return &ms_instance; - } - - AEManagerImpl AEManagerImpl::ms_instance; - - - AEManager *AEManager::GetInstance() - { - return AEManagerImpl::GetInstance(); - } -} - - diff --git a/PortabilityLayer/AEManager.h b/PortabilityLayer/AEManager.h deleted file mode 100644 index 572b75e..0000000 --- a/PortabilityLayer/AEManager.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once -#ifndef __PL_AE_MANAGER_H__ -#define __PL_AE_MANAGER_H__ - -#include "PLAppleEventsCommonTypes.h" - -#include - -namespace PortabilityLayer -{ - class AEManager - { - public: - virtual void Init() = 0; - virtual void Shutdown() = 0; - - virtual void InstallEventHandler(AEEventClass eventClass, AEEventID eventID, AEEventHandler handler, uint32_t ref, bool isSysHandler) = 0; - virtual void SetInteractAllowed(AEInteractAllowed interactAllowed) = 0; - - static AEManager *GetInstance(); - }; -} - -#endif diff --git a/PortabilityLayer/PLAppleEvents.cpp b/PortabilityLayer/PLAppleEvents.cpp deleted file mode 100644 index fd2897e..0000000 --- a/PortabilityLayer/PLAppleEvents.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "PLAppleEvents.h" -#include "AEManager.h" - -PLError_t AEGetParamDesc(const AppleEvent *evt, AEKeyword keyword, DescType desiredType, AEDescList *descList) -{ - PL_NotYetImplemented(); - return PLErrors::kNone; -} - -PLError_t AEDisposeDesc(AEDescList *descList) -{ - PL_NotYetImplemented(); - return PLErrors::kNone; -} - -PLError_t AECountItems(AEDescList *descList, long *count) -{ - PL_NotYetImplemented(); - return PLErrors::kNone; -} - -PLError_t AEGetNthPtr(AEDescList *descList, long index, DescType desiredType, AEKeyword *keyword, DescType *type, void *data, size_t maxSize, size_t *actualSize) -{ - PL_NotYetImplemented(); - return PLErrors::kNone; -} - -PLError_t AEGetAttributePtr(const AppleEvent *evt, AEKeyword keyword, DescType desiredType, DescType *type, void *data, size_t maxSize, size_t *actualSize) -{ - PL_NotYetImplemented(); - return PLErrors::kNone; -} - -PLError_t AEInstallEventHandler(AEEventClass eventClass, AEEventID eventID, AEEventHandlerUPP handler, UInt32 ref, bool isSysHandler) -{ - PortabilityLayer::AEManager::GetInstance()->InstallEventHandler(eventClass, eventID, handler, ref, isSysHandler); - return PLErrors::kNone; -} - -PLError_t AESetInteractionAllowed(AEInteractAllowed level) -{ - PortabilityLayer::AEManager::GetInstance()->SetInteractAllowed(level); - return PLErrors::kNone; -} - -AEEventHandlerUPP NewAEEventHandlerProc(AEEventHandler handler) -{ - return handler; -} diff --git a/PortabilityLayer/PLAppleEvents.h b/PortabilityLayer/PLAppleEvents.h deleted file mode 100644 index 1268abb..0000000 --- a/PortabilityLayer/PLAppleEvents.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once -#ifndef __PL_APPLEEVENTS_H__ -#define __PL_APPLEEVENTS_H__ - -#include "PLCore.h" -#include "PLAppleEventsCommonTypes.h" - -struct AppleEvent -{ -}; - -struct AEDescList -{ -}; - -struct AEDesc -{ -}; - -typedef AEEventHandler AEEventHandlerUPP; - -PLError_t AEGetParamDesc(const AppleEvent *evt, AEKeyword keyword, DescType desiredType, AEDescList *descList); -PLError_t AEDisposeDesc(AEDescList *descList); -PLError_t AECountItems(AEDescList *descList, long *count); -PLError_t AEGetNthPtr(AEDescList *descList, long index, DescType desiredType, AEKeyword *keyword, DescType *type, void *data, size_t maxSize, size_t *actualSize); -PLError_t AEGetAttributePtr(const AppleEvent *evt, AEKeyword keyword, DescType desiredType, DescType *type, void *data, size_t maxSize, size_t *actualSize); -PLError_t AEInstallEventHandler(AEEventClass eventClass, AEEventID eventID, AEEventHandlerUPP handler, UInt32 ref, bool isSysHandler); -PLError_t AESetInteractionAllowed(AEInteractAllowed level); - -AEEventHandlerUPP NewAEEventHandlerProc(AEEventHandler handler); - -#endif diff --git a/PortabilityLayer/PLAppleEventsCommonTypes.h b/PortabilityLayer/PLAppleEventsCommonTypes.h deleted file mode 100644 index 22be153..0000000 --- a/PortabilityLayer/PLAppleEventsCommonTypes.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once -#ifndef __PL_APPLE_EVENTS_COMMON_TYPES_H__ -#define __PL_APPLE_EVENTS_COMMON_TYPES_H__ - -#include "PLErrorCodes.h" - -#include - -struct AppleEvent; - -enum AEError -{ - errAEEventNotHandled = 1, - errAEDescNotFound, - errAEParamMissed, -}; - -enum AEKeyword -{ - keyDirectObject, - keyMissedKeywordAttr, -}; - -enum DescType -{ - typeAEList, - typeFSS, - typeWildCard, -}; - -enum AEEventID -{ - kAEOpenApplication, - kAEOpenDocuments, - kAEPrintDocuments, - kAEQuitApplication -}; - -enum AEEventClass -{ - kCoreEventClass -}; - -enum AEInteractAllowed -{ - kAEInteractUnknown, - kAEInteractWithAll -}; - -typedef PLError_t (*AEEventHandler)(const AppleEvent *theAE, AppleEvent *reply, uint32_t ref); - -#endif diff --git a/PortabilityLayer/PLCore.cpp b/PortabilityLayer/PLCore.cpp index ce8bc61..b810aa9 100644 --- a/PortabilityLayer/PLCore.cpp +++ b/PortabilityLayer/PLCore.cpp @@ -6,7 +6,6 @@ #include "PLKeyEncoding.h" #include "PLQDraw.h" -#include "AEManager.h" #include "DisplayDeviceManager.h" #include "FileManager.h" #include "FilePermission.h" @@ -644,7 +643,6 @@ void PL_Init() PortabilityLayer::MemoryManager::GetInstance()->Init(); PortabilityLayer::ResourceManager::GetInstance()->Init(); PortabilityLayer::DisplayDeviceManager::GetInstance()->Init(); - PortabilityLayer::AEManager::GetInstance()->Init(); PortabilityLayer::QDManager::GetInstance()->Init(); PortabilityLayer::MenuManager::GetInstance()->Init(); } diff --git a/PortabilityLayer/PLNavigation.cpp b/PortabilityLayer/PLNavigation.cpp deleted file mode 100644 index defc5ce..0000000 --- a/PortabilityLayer/PLNavigation.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "PLNavigation.h" - -PLError_t NavGetDefaultDialogOptions(NavDialogOptions *options) -{ - PL_NotYetImplemented(); - return PLErrors::kNone; -} - -PLError_t NavPutFile(AEDesc *defaultLocation, NavReplyRecord *reply, NavDialogOptions *dlgOptions, void *unknown, UInt32 fileType, UInt32 fileCreator, void *unknown2) -{ - PL_NotYetImplemented(); - return PLErrors::kNone; -} diff --git a/PortabilityLayer/PLNavigation.h b/PortabilityLayer/PLNavigation.h deleted file mode 100644 index 2f8ad16..0000000 --- a/PortabilityLayer/PLNavigation.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -#ifndef __PL_NAVIGATION_H__ -#define __PL_NAVIGATION_H__ - -#include "PLCore.h" -#include "PLAppleEvents.h" - -struct AEDesc; - -struct NavReplyRecord -{ - bool validRecord; - bool replacing; - int vRefNum; - long parID; // Directory? - AEDescList selection; -}; - -struct NavDialogOptions -{ -}; - -PLError_t NavGetDefaultDialogOptions(NavDialogOptions *options); -PLError_t NavPutFile(AEDesc *defaultLocation, NavReplyRecord *reply, NavDialogOptions *dlgOptions, void *unknown, UInt32 fileType, UInt32 fileCreator, void *unknown2); - -#endif diff --git a/PortabilityLayer/PortabilityLayer.vcxproj b/PortabilityLayer/PortabilityLayer.vcxproj index 398047c..897d501 100644 --- a/PortabilityLayer/PortabilityLayer.vcxproj +++ b/PortabilityLayer/PortabilityLayer.vcxproj @@ -143,8 +143,6 @@ - - @@ -204,8 +202,6 @@ - - @@ -265,7 +261,6 @@ - @@ -302,7 +297,6 @@ - @@ -337,7 +331,6 @@ - @@ -354,7 +347,6 @@ - diff --git a/PortabilityLayer/PortabilityLayer.vcxproj.filters b/PortabilityLayer/PortabilityLayer.vcxproj.filters index 3c054e7..a8b51e0 100644 --- a/PortabilityLayer/PortabilityLayer.vcxproj.filters +++ b/PortabilityLayer/PortabilityLayer.vcxproj.filters @@ -93,9 +93,6 @@ Header Files - - Header Files - Header Files @@ -105,9 +102,6 @@ Header Files - - Header Files - Header Files @@ -165,15 +159,6 @@ Header Files - - Header Files - - - Header Files - - - Header Files - Header Files @@ -521,9 +506,6 @@ Source Files - - Source Files - Source Files @@ -533,9 +515,6 @@ Source Files - - Source Files - Source Files @@ -569,9 +548,6 @@ Source Files - - Source Files - Source Files