//************************************************************************************** // Filename: CMPluginImpl.h // Part of Contextual Menu Workshop by Abracode Inc. // http://free.abracode.com/cmworkshop/ // Copyright © 2002-2003 Abracode, Inc. All rights reserved. // // Description: // //************************************************************************************** #ifndef __CMPluginImpl__ #define __CMPluginImpl__ #define kCMImplPluginFactoryID ( CFUUIDGetConstantUUIDWithBytes( NULL,\ 0xCD, 0xA5, 0x48, 0xCA, 0xC6, 0xE5, 0x11, 0xD6, 0x82, 0x21, 0x00, 0x30, 0x65, 0xEA, 0xE3, 0xBE ) ) // "CDA548CA-C6E5-11D6-8221-003065EAE3BE" #define CM_IMPL_PLUGIN_BUNDLE_INDENTIFIER "com.abracode.OnMyCommandCM" #define CM_IMPL_PLUGIN_PREFS_INDENTIFIER "com.abracode.OnMyCommandCMPrefs" typedef struct CommandDescription { CFStringRef name; CFArrayRef command;//array of CFStrings FileType * activationTypes; UInt32 activationTypeCount; CFArrayRef activationExtensions;//array of CFStrings UInt16 executionMode; UInt16 activationMode; UInt16 escapeSpecialCharsMode; UInt16 multipleObjectProcessing; CFStringRef mulObjPrefix; CFStringRef mulObjSuffix; CFStringRef mulObjSeparator; CFStringRef warningStr; CFStringRef warningExecuteStr; CFStringRef warningCancelStr; CFStringRef submenuName; Boolean bringTerminalToFront; Boolean openNewTerminalSession; Boolean containsPassword;//optimization, filled in prescan Boolean mayNeedClipboard;//optimization, filled in prescan Boolean containsInputText; Boolean containsSaveAsPath; UInt16 inputDialogType; CFStringRef inputDialogOK; CFStringRef inputDialogCancel; CFStringRef inputDialogMessage; CFStringRef inputDialogDefault; CFArrayRef inputDialogMenuItems;//array of name & value pairs CFArrayRef refresh;//a list of strings forming a path for Finder refresh } CommandDescription; enum { kExecSilent, kExecTerminal }; enum { kActiveAlways, kActiveFile, kActiveFolder, kActiveFileOrFolder, kActiveFinderWindow, kActiveSelectedText, kActiveClipboardText, kActiveSelectedOrClipboardText, kActiveFolderExcludeFinderWindow, kActiveFileOrFolderExcludeFinderWindow }; enum { kEscapeNone, kEscapeWithBackslash, kEscapeWithPercent }; enum { kMulObjProcessSeparately, kMulObjProcessTogether }; enum { kInputClearText, kInputPasswordText, kInputPopupMenu, kInputComboBox }; const CommandDescription kEmptyCommand = { NULL, //name NULL, //command NULL, //activationTypes 0, //activationTypeCount NULL, //activationExtensions kExecSilent, //executionMode kActiveAlways, //activationMode kEscapeWithBackslash, //escapeSpecialCharsMode kMulObjProcessSeparately, //multipleObjectProcessing NULL, //mulObjPrefix NULL, //mulObjSuffix NULL, //mulObjSeparator NULL, //warningStr NULL, //warningExecuteStr NULL, //warningCancelStr NULL, //submenuName true, //bringTerminalToFront true, //openNewTerminalSession false, //containsPassword false, //mayNeedClipboard false, //containsInputText false, //padding kInputClearText, //inputDialogType NULL, //inputDialogOK NULL, //inputDialogCancel NULL, //inputDialogMessage NULL, //inputDialogDefault NULL //inputDialogMenuItems }; typedef struct OneObjProperties { FSRef mRef; CFStringRef mExtension; FileType mType; LSItemInfoFlags mFlags;//we will request all flags except for application type flags which are not thread-safe. CFStringRef mRefreshPath;//refresh path is associated with object. this is one-to-one relationship } OneObjProperties; typedef struct CMPluginImplData { SInt32 sysVersion; //OS version we are running in (10.2 == 0x1020) CommandDescription *commandList; UInt32 commandCount; UInt32 currCommandIndex; OneObjProperties *objectList; UInt32 objectCount; UInt32 currObjectIndex; CFStringRef commonParentPath;//cached here for better performance CFStringRef inputText; CFURLRef saveAsPath; Boolean mIsTextInClipboard; Boolean mIsOpenFolder; Boolean mIsTextSelected; Boolean mRunningInFinder; } CMPluginImplData; //command ID - change it and use your command(s) enum { kCMImplCommand = 100, //arbitrary kCMCommandStart = 200 //command IDs start here }; #endif //__CMPluginImpl__