diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-12-12 22:02:31 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-12-12 22:02:31 +0000 |
commit | 2c7a29c7fd2e51236a00435ed37e280cb98a2131 (patch) | |
tree | 7092861773ca79e23c98bfb41a434a75adc85b02 /src | |
parent | 5b962cf71c87f5d23408bac83c8a526b901daa3f (diff) |
updated for version 7.0168
Diffstat (limited to 'src')
-rw-r--r-- | src/gui_mac.c | 1317 | ||||
-rw-r--r-- | src/ops.c | 11 | ||||
-rw-r--r-- | src/option.c | 3 | ||||
-rw-r--r-- | src/option.h | 1 | ||||
-rw-r--r-- | src/version.h | 4 |
5 files changed, 340 insertions, 996 deletions
diff --git a/src/gui_mac.c b/src/gui_mac.c index 52a24d70dd..8f8358c8bf 100644 --- a/src/gui_mac.c +++ b/src/gui_mac.c @@ -13,14 +13,9 @@ */ /* - * NOTE: Comment mentionning FAQ refer to the book: - * "Macworld Mac Programming FAQs" from "IDG Books" - */ - -/* - * WARNING: Vim must be able to compile without Carbon - * As the desired minimum requirement are circa System 7 - * (I want to run it on my Mac Classic) (Dany) + * NOTES: - Vim 7+ does not support classic MacOS. Please use Vim 6.x + * - Comments mentioning FAQ refer to the book: + * "Macworld Mac Programming FAQs" from "IDG Books" */ /* @@ -33,143 +28,61 @@ * */ -/* TODO: find the best place for this (Dany) */ -#if 0 -# if ! TARGET_API_MAC_CARBON -/* Enable the new API functions even when not compiling for Carbon */ -/* Apple recomends Universal Interface 3.3.2 or later */ -# define OPAQUE_TOOLBOX_STRUCTS 1 -# define ACCESSOR_CALLS_ARE_FUNCTIONS 1 -/* Help Menu not supported by Carbon */ -# define USE_HELPMENU -# endif -#endif + /* TODO (Jussi) + * * Clipboard does not work (at least some cases) + * * ATSU font rendering has some problems + * * Investigate and remove dead code (there is still lots of that) + */ #include <Devices.h> /* included first to avoid CR problems */ #include "vim.h" -/* Enable Contextual Menu Support */ -#if UNIVERSAL_INTERFACES_VERSION >= 0x0320 -# define USE_CTRLCLICKMENU -#endif - -/* Put Vim Help in MacOS Help */ -#define USE_HELPMENU - -/* Enable AEVENT */ -#define USE_AEVENT +#define USE_CARBONIZED +#define USE_AEVENT /* Enable AEVENT */ +#undef USE_OFFSETED_WINDOW /* Debugging feature: start Vim window OFFSETed */ /* Compile as CodeWarior External Editor */ #if defined(FEAT_CW_EDITOR) && !defined(USE_AEVENT) # define USE_AEVENT /* Need Apple Event Support */ #endif -/* The VIM creator is CodeWarior specific */ -#if !(defined(__MRC__) || defined(__SC__) || defined(__APPLE_CC__)) -# define USE_VIM_CREATOR_ID -#else -# if 0 /* Was this usefull for some compiler? (Dany) */ -static OSType _fcreator = 'VIM!'; -static OSType _ftype = 'TEXT'; -# endif -#endif - /* Vim's Scrap flavor. */ #define VIMSCRAPFLAVOR 'VIM!' -/* CARBON version only tested with Project Builder under MacOS X */ -#undef USE_CARBONIZED -#if (defined(__APPLE_CC__) || defined(__MRC__)) && defined(TARGET_API_MAC_CARBON) -# if TARGET_API_MAC_CARBON -# define USE_CARBONIZED -# endif -#endif - -#undef USE_MOUSEWHEEL -#if defined(MACOS_X) && defined(USE_CARBONIZED) -# define USE_MOUSEWHEEL static EventHandlerUPP mouseWheelHandlerUPP = NULL; -#endif +SInt32 gMacSystemVersion; -#if defined(USE_CARBONIZED) && defined(FEAT_MBYTE) -# define USE_CARBONKEYHANDLER +#if defined(FEAT_MBYTE) +#define USE_CARBONKEYHANDLER static EventHandlerUPP keyEventHandlerUPP = NULL; #endif -#ifdef MACOS_X -SInt32 gMacSystemVersion; -#endif - -/* Debugging feature: start Vim window OFFSETed */ -#undef USE_OFFSETED_WINDOW - -/* Debugging feature: use CodeWarior SIOUX */ -#undef USE_SIOUX - /* Include some file. TODO: move into os_mac.h */ #include <Menus.h> #include <Resources.h> -#if !TARGET_API_MAC_CARBON -#include <StandardFile.h> -#include <Traps.h> -#endif -#include <Balloons.h> #include <Processes.h> #ifdef USE_AEVENT # include <AppleEvents.h> # include <AERegistry.h> #endif -#ifdef USE_CTRLCLICKMENU # include <Gestalt.h> -#endif -#ifdef USE_SIOUX -# include <stdio.h> -# include <sioux.h> -# include <console.h> -#endif #if UNIVERSAL_INTERFACES_VERSION >= 0x0330 # include <ControlDefinitions.h> # include <Navigation.h> /* Navigation only part of ?? */ #endif -#if TARGET_API_MAC_CARBON && 0 +/* Help Manager (balloon.h, HM prefixed functions) are not supported + * under Carbon (Jussi) */ +# if 0 /* New Help Interface for Mac, not implemented yet.*/ -# include <MacHelp.h> -#endif +# include <MacHelp.h> +# endif /* - * Translate new name to old ones - * New function only available in MacOS 8.5, - * So use old one to be compatible back to System 7 + * These seem to be rectangle options. Why are they not found in + * headers? (Jussi) */ -#ifndef USE_CARBONIZED -# undef EnableMenuItem -# define EnableMenuItem EnableItem -# undef DisableMenuItem -# define DisableMenuItem DisableItem -#endif - -/* Carbon does not support the Get/SetControll functions, - * use Get/SetControl32Bit instead and rename for non-carbon - * systems. - */ - -#ifndef USE_CARBONIZED -# undef SetControl32BitMaximum -# define SetControl32BitMaximum SetControlMaximum -# undef SetControl32BitMinimum -# define SetControl32BitMinimum SetControlMinimum -# undef SetControl32BitValue -# define SetControl32BitValue SetControlValue -# undef GetControl32BitValue -# define GetControl32BitValue GetControlValue -#endif - -/* - * ??? - */ - #define kNothing 0 #define kCreateEmpty 2 /*1*/ #define kCreateRect 2 @@ -178,7 +91,6 @@ SInt32 gMacSystemVersion; /* * Dany: Don't like those... */ - #define topLeft(r) (((Point*)&(r))[0]) #define botRight(r) (((Point*)&(r))[1]) @@ -201,9 +113,7 @@ static short dragRectControl; static int allow_scrollbar = FALSE; /* Last mouse click caused contextual menu, (to provide proper release) */ -#ifdef USE_CTRLCLICKMENU static short clickIsPopup; -#endif /* Feedback Action for Scrollbar */ ControlActionUPP gScrollAction; @@ -212,7 +122,6 @@ ControlActionUPP gScrollDrag; /* Keeping track of which scrollbar is being dragged */ static ControlHandle dragged_sb = NULL; -#if defined(USE_CARBONIZED) && defined(MACOS_X) static struct { FMFontFamily family; @@ -220,24 +129,13 @@ static struct FMFontStyle style; Boolean isPanelVisible; } gFontPanelInfo = { 0, 0, 0, false }; -#endif -#if defined(USE_CARBONIZED) && defined(FEAT_MBYTE) +#if defined(FEAT_MBYTE) # define USE_ATSUI_DRAWING ATSUStyle gFontStyle; Boolean gIsFontFallbackSet; #endif -/* - * The Quickdraw global is predefined in CodeWarior - * but is not in Apple MPW - */ -#if (defined(__MRC__) || defined(__SC__)) -# if !(defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON) -QDGlobals qd; -# endif -#endif - /* Colors Macros */ #define RGB(r,g,b) ((r) << 16) + ((g) << 8) + (b) #define Red(c) ((c & 0x00FF0000) >> 16) @@ -371,7 +269,8 @@ OSErr HandleUnusedParms(const AppleEvent *theAEvent); * */ -char_u *C2Pascal_save(char_u *Cstring) + char_u * +C2Pascal_save(char_u *Cstring) { char_u *PascalString; int len; @@ -402,7 +301,8 @@ char_u *C2Pascal_save(char_u *Cstring) * */ -char_u *C2Pascal_save_and_remove_backslash(char_u *Cstring) + char_u * +C2Pascal_save_and_remove_backslash(char_u *Cstring) { char_u *PascalString; int len; @@ -519,15 +419,14 @@ points_to_pixels(char_u *str, char_u **end, int vertical) return pixels; } -#if defined(USE_CARBONIZED) && defined(FEAT_MBYTE) +#if defined(FEAT_MBYTE) /* * Deletes all traces of any Windows-style mnemonic text (including any * parentheses) from a menu item and returns the cleaned menu item title. * The caller is responsible for releasing the returned string. */ static CFStringRef -menu_title_removing_mnemonic(menu) - vimmenu_T *menu; +menu_title_removing_mnemonic(vimmenu_T *menu) { CFStringRef name; size_t menuTitleLen; @@ -581,7 +480,8 @@ menu_title_removing_mnemonic(menu) * character strings. */ -char_u **new_fnames_from_AEDesc(AEDesc *theList, long *numFiles, OSErr *error) + char_u ** +new_fnames_from_AEDesc(AEDesc *theList, long *numFiles, OSErr *error) { char_u **fnames = NULL; OSErr newError; @@ -595,9 +495,6 @@ char_u **new_fnames_from_AEDesc(AEDesc *theList, long *numFiles, OSErr *error) *error = AECountItems(theList, numFiles); if (*error) { -#ifdef USE_SIOUX - printf("fname_from_AEDesc: AECountItems error: %d\n", error); -#endif return(fnames); } @@ -619,9 +516,6 @@ char_u **new_fnames_from_AEDesc(AEDesc *theList, long *numFiles, OSErr *error) { /* Caller is able to clean up */ /* TODO: Should be clean up or not? For safety. */ -#ifdef USE_SIOUX - printf("aevt_odoc: AEGetNthPtr error: %ld\n", (long)newError); -#endif return(fnames); } @@ -663,21 +557,18 @@ char_u **new_fnames_from_AEDesc(AEDesc *theList, long *numFiles, OSErr *error) * */ -#if defined(__MWERKS__) /* only in Codewarrior */ -# pragma options align=mac68k -#endif typedef struct WindowSearch WindowSearch; struct WindowSearch /* for handling class 'KAHL', event 'SRCH', keyDirectObject typeChar*/ { FSSpec theFile; // identifies the file long *theDate; // where to put the modification date/time }; -#if defined(__MWERKS__) /* only in Codewarrior */ -# pragma options align=reset -#endif pascal OSErr -Handle_KAHL_SRCH_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon) +Handle_KAHL_SRCH_AE( + const AppleEvent *theAEvent, + AppleEvent *theReply, + long refCon) { OSErr error = noErr; buf_T *buf; @@ -689,18 +580,12 @@ Handle_KAHL_SRCH_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refC error = AEGetParamPtr(theAEvent, keyDirectObject, typeChar, &typeCode, (Ptr) &SearchData, sizeof(WindowSearch), &actualSize); if (error) { -#ifdef USE_SIOUX - printf("KAHL_SRCH: AEGetParamPtr error: %d\n", error); -#endif return(error); } error = HandleUnusedParms(theAEvent); if (error) { -#ifdef USE_SIOUX - printf("KAHL_SRCH: HandleUnusedParms error: %d\n", error); -#endif return(error); } @@ -719,13 +604,6 @@ Handle_KAHL_SRCH_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refC else *SearchData.theDate = buf->b_mtime; -#ifdef USE_SIOUX - printf("KAHL_SRCH: file \"%#s\" {%d}", SearchData.theFile.name,SearchData.theFile.parID); - if (foundFile == false) - printf(" NOT"); - printf(" found. [date %lx, %lx]\n", *SearchData.theDate, buf->b_mtime_read); -#endif - return error; }; @@ -756,9 +634,6 @@ Handle_KAHL_SRCH_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refC * */ -#if defined(__MWERKS__) /* only in Codewarrior */ -# pragma options align=mac68k -#endif typedef struct ModificationInfo ModificationInfo; struct ModificationInfo /* for replying to class 'KAHL', event 'MOD ', keyDirectObject typeAEList*/ { @@ -766,12 +641,12 @@ struct ModificationInfo /* for replying to class 'KAHL', event 'MOD ', keyDirect long theDate; // the date/time the file was last modified short saved; // set this to zero when replying, unused }; -#if defined(__MWERKS__) /* only in Codewarrior */ -# pragma options align=reset -#endif pascal OSErr -Handle_KAHL_MOD_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon) +Handle_KAHL_MOD_AE( + const AppleEvent *theAEvent, + AppleEvent *theReply, + long refCon) { OSErr error = noErr; AEDescList replyList; @@ -784,9 +659,6 @@ Handle_KAHL_MOD_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCo error = HandleUnusedParms(theAEvent); if (error) { -#ifdef USE_SIOUX - printf("KAHL_MOD: HandleUnusedParms error: %d\n", error); -#endif return(error); } @@ -798,18 +670,11 @@ Handle_KAHL_MOD_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCo error = AECreateList(nil, 0, false, &replyList); if (error) { -#ifdef USE_SIOUX - printf("KAHL_MOD: AECreateList error: %d\n", error); -#endif return(error); } #if 0 error = AECountItems(&replyList, &numFiles); -#ifdef USE_SIOUX - printf("KAHL_MOD ReplyList: %x %x\n", replyList.descriptorType, replyList.dataHandle); - printf("KAHL_MOD ItemInList: %d\n", numFiles); -#endif /* AEPutKeyDesc(&replyList, keyAEPnject, &aDesc) * AEPutKeyPtr(&replyList, keyAEPosition, typeChar, (Ptr)&theType, @@ -828,37 +693,15 @@ Handle_KAHL_MOD_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCo theFile.theDate = buf->b_mtime; /* theFile.theDate = time(NULL) & (time_t) 0xFFFFFFF0; */ error = AEPutPtr(&replyList, numFiles, typeChar, (Ptr) &theFile, sizeof(theFile)); -#ifdef USE_SIOUX - if (numFiles == 0) - printf("KAHL_MOD: "); - else - printf(", "); - printf("\"%#s\" {%d} [date %lx, %lx]", theFile.theFile.name, theFile.theFile.parID, theFile.theDate, buf->b_mtime_read); - if (error) - printf(" (%d)", error); - numFiles++; -#endif }; -#ifdef USE_SIOUX - printf("\n"); -#endif - #if 0 error = AECountItems(&replyList, &numFiles); -#ifdef USE_SIOUX - printf("KAHL_MOD ItemInList: %d\n", numFiles); -#endif #endif /* We can add data only if something to reply */ error = AEPutParamDesc(theReply, keyDirectObject, &replyList); -#ifdef USE_SIOUX - if (error) - printf("KAHL_MOD: AEPutParamDesc error: %d\n", error); -#endif - if (replyList.dataHandle) AEDisposeDesc(&replyList); @@ -891,9 +734,6 @@ Handle_KAHL_MOD_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCo * */ -#if defined(__MWERKS__) /* only in Codewarrior */ -# pragma options align=mac68k -#endif typedef struct CW_GetText CW_GetText; struct CW_GetText /* for handling class 'KAHL', event 'GTTX', keyDirectObject typeChar*/ { @@ -902,12 +742,12 @@ struct CW_GetText /* for handling class 'KAHL', event 'GTTX', keyDirectObject ty long *unused; /* 0 (not used) */ long *theDate; /* where to put the modification date/time */ }; -#if defined(__MWERKS__) /* only in Codewarrior */ -# pragma options align=reset -#endif pascal OSErr -Handle_KAHL_GTTX_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon) +Handle_KAHL_GTTX_AE( + const AppleEvent *theAEvent, + AppleEvent *theReply, + long refCon) { OSErr error = noErr; buf_T *buf; @@ -926,9 +766,6 @@ Handle_KAHL_GTTX_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refC if (error) { -#ifdef USE_SIOUX - printf("KAHL_GTTX: AEGetParamPtr error: %d\n", error); -#endif return(error); } @@ -954,10 +791,6 @@ Handle_KAHL_GTTX_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refC SetHandleSize(GetTextData.theText, BufferSize); if (GetHandleSize(GetTextData.theText) != BufferSize) { - #ifdef USE_SIOUX - printf("KAHL_GTTX: SetHandleSize increase: %d, size %d\n", - linesize, BufferSize); - #endif break; /* Simple handling for now */ } else @@ -981,19 +814,10 @@ Handle_KAHL_GTTX_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refC /* *GetTextData.theDate = time(NULL) & (time_t) 0xFFFFFFF0;*/ *GetTextData.theDate = buf->b_mtime; } -#ifdef USE_SIOUX - printf("KAHL_GTTX: file \"%#s\" {%d} [date %lx, %lx]", GetTextData.theFile.name, GetTextData.theFile.parID, *GetTextData.theDate, buf->b_mtime_read); - if (foundFile == false) - printf(" NOT"); - printf(" found. (BufferSize = %d)\n", BufferSize); -#endif error = HandleUnusedParms(theAEvent); if (error) { -#ifdef USE_SIOUX - printf("KAHL_GTTX: HandleUnusedParms error: %d\n", error); -#endif return(error); } @@ -1005,9 +829,11 @@ Handle_KAHL_GTTX_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refC */ /* Taken from MoreAppleEvents:ProcessHelpers*/ -pascal OSErr FindProcessBySignature(const OSType targetType, - const OSType targetCreator, - ProcessSerialNumberPtr psnPtr) + pascal OSErr +FindProcessBySignature( + const OSType targetType, + const OSType targetCreator, + ProcessSerialNumberPtr psnPtr) { OSErr anErr = noErr; Boolean lookingForProcess = true; @@ -1053,12 +879,6 @@ Send_KAHL_MOD_AE(buf_T *buf) anErr = FindProcessBySignature('APPL', 'CWIE', &psn); -#ifdef USE_SIOUX - printf("CodeWarrior is"); - if (anErr != noErr) - printf(" NOT"); - printf(" running\n"); -#endif if (anErr == noErr) { anErr = AECreateDesc(typeProcessSerialNumber, &psn, @@ -1088,9 +908,6 @@ Send_KAHL_MOD_AE(buf_T *buf) anErr = AESend(&theEvent, &theReply, sendMode, kAENormalPriority, kNoTimeOut, idleProcUPP, nil); if (anErr == noErr && sendMode == kAEWaitReply) { -#ifdef USE_SIOUX - printf("KAHL_MOD: Send error: %d\n", anErr); -#endif /* anErr = AEHGetHandlerError(&theReply);*/ } (void) AEDisposeDesc(&theReply); @@ -1147,9 +964,6 @@ HandleUnusedParms(const AppleEvent *theAEvent) * */ -#if defined(__MWERKS__) /* only in Codewarrior */ -# pragma options align=mac68k -#endif typedef struct SelectionRange SelectionRange; struct SelectionRange /* for handling kCoreClassEvent:kOpenDocuments:keyAEPosition typeChar */ { @@ -1160,9 +974,6 @@ struct SelectionRange /* for handling kCoreClassEvent:kOpenDocuments:keyAEPositi long unused2; // 0 (not used) long theDate; // modification date/time }; -#if defined(__MWERKS__) /* only in Codewarrior */ -# pragma options align=reset -#endif /* The IDE uses the optional keyAEPosition parameter to tell the ed- itor the selection range. If lineNum is zero or greater, scroll the text @@ -1193,17 +1004,10 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon) short gotPosition = false; long lnum; -#ifdef USE_SIOUX - printf("aevt_odoc:\n"); -#endif - /* the direct object parameter is the list of aliases to files (one or more) */ error = AEGetParamDesc(theAEvent, keyDirectObject, typeAEList, &theList); if (error) { -#ifdef USE_SIOUX - printf("aevt_odoc: AEGetParamDesc error: %ld\n", (long)error); -#endif return(error); } @@ -1215,18 +1019,9 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon) error = noErr; if (error) { -#ifdef USE_SIOUX - printf("aevt_odoc: AEGetParamPtr error: %ld\n", (long)error); -#endif return(error); } -#ifdef USE_SIOUX - printf("aevt_odoc: lineNum: %d, startRange %ld, endRange %ld, [date %lx]\n", - (int)thePosition.lineNum, - (long)thePosition.startRange, (long)thePosition.endRange, - (long)thePosition.theDate); -#endif /* error = AEGetParamDesc(theAEvent, keyAEPosition, typeChar, &thePosition); @@ -1330,9 +1125,6 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon) error = HandleUnusedParms(theAEvent); if (error) { -#ifdef USE_SIOUX - printf("aevt_odoc: HandleUnusedParms error: %ld\n", (long)error); -#endif return(error); } return(error); @@ -1343,14 +1135,13 @@ HandleODocAE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon) */ pascal OSErr -Handle_aevt_oapp_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon) +Handle_aevt_oapp_AE( + const AppleEvent *theAEvent, + AppleEvent *theReply, + long refCon) { OSErr error = noErr; -#ifdef USE_SIOUX - printf("aevt_oapp:\n"); -#endif - error = HandleUnusedParms(theAEvent); if (error) { @@ -1365,14 +1156,13 @@ Handle_aevt_oapp_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refC */ pascal OSErr -Handle_aevt_quit_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon) +Handle_aevt_quit_AE( + const AppleEvent *theAEvent, + AppleEvent *theReply, + long refCon) { OSErr error = noErr; -#ifdef USE_SIOUX - printf("aevt_quit\n"); -#endif - error = HandleUnusedParms(theAEvent); if (error) { @@ -1390,14 +1180,13 @@ Handle_aevt_quit_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refC */ pascal OSErr -Handle_aevt_pdoc_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon) +Handle_aevt_pdoc_AE( + const AppleEvent *theAEvent, + AppleEvent *theReply, + long refCon) { OSErr error = noErr; -#ifdef USE_SIOUX - printf("aevt_pdoc:\n"); -#endif - error = HandleUnusedParms(theAEvent); if (error) { @@ -1413,14 +1202,13 @@ Handle_aevt_pdoc_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refC * (Just get rid of all the parms) */ pascal OSErr -Handle_unknown_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon) +Handle_unknown_AE( + const AppleEvent *theAEvent, + AppleEvent *theReply, + long refCon) { OSErr error = noErr; -#ifdef USE_SIOUX - printf("Unknown Event: %x\n", theAEvent->descriptorType); -#endif - error = HandleUnusedParms(theAEvent); if (error) { @@ -1431,11 +1219,6 @@ Handle_unknown_AE(const AppleEvent *theAEvent, AppleEvent *theReply, long refCon } - -#if TARGET_API_MAC_CARBON -# define NewAEEventHandlerProc(x) NewAEEventHandlerUPP(x) -#endif - /* * Install the various AppleEvent Handlers */ @@ -1446,7 +1229,7 @@ InstallAEHandlers(void) /* install open application handler */ error = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, - NewAEEventHandlerProc(Handle_aevt_oapp_AE), 0, false); + NewAEEventHandlerUPP(Handle_aevt_oapp_AE), 0, false); if (error) { return error; @@ -1454,7 +1237,7 @@ InstallAEHandlers(void) /* install quit application handler */ error = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, - NewAEEventHandlerProc(Handle_aevt_quit_AE), 0, false); + NewAEEventHandlerUPP(Handle_aevt_quit_AE), 0, false); if (error) { return error; @@ -1462,7 +1245,7 @@ InstallAEHandlers(void) /* install open document handler */ error = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, - NewAEEventHandlerProc(HandleODocAE), 0, false); + NewAEEventHandlerUPP(HandleODocAE), 0, false); if (error) { return error; @@ -1470,47 +1253,47 @@ InstallAEHandlers(void) /* install print document handler */ error = AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, - NewAEEventHandlerProc(Handle_aevt_pdoc_AE), 0, false); + NewAEEventHandlerUPP(Handle_aevt_pdoc_AE), 0, false); /* Install Core Suite */ /* error = AEInstallEventHandler(kAECoreSuite, kAEClone, - NewAEEventHandlerProc(Handle_unknown_AE), nil, false); + NewAEEventHandlerUPP(Handle_unknown_AE), nil, false); error = AEInstallEventHandler(kAECoreSuite, kAEClose, - NewAEEventHandlerProc(Handle_unknown_AE), nil, false); + NewAEEventHandlerUPP(Handle_unknown_AE), nil, false); error = AEInstallEventHandler(kAECoreSuite, kAECountElements, - NewAEEventHandlerProc(Handle_unknown_AE), nil, false); + NewAEEventHandlerUPP(Handle_unknown_AE), nil, false); error = AEInstallEventHandler(kAECoreSuite, kAECreateElement, - NewAEEventHandlerProc(Handle_unknown_AE), nil, false); + NewAEEventHandlerUPP(Handle_unknown_AE), nil, false); error = AEInstallEventHandler(kAECoreSuite, kAEDelete, - NewAEEventHandlerProc(Handle_unknown_AE), nil, false); + NewAEEventHandlerUPP(Handle_unknown_AE), nil, false); error = AEInstallEventHandler(kAECoreSuite, kAEDoObjectsExist, - NewAEEventHandlerProc(Handle_unknown_AE), nil, false); + NewAEEventHandlerUPP(Handle_unknown_AE), nil, false); error = AEInstallEventHandler(kAECoreSuite, kAEGetData, - NewAEEventHandlerProc(Handle_unknown_AE), kAEGetData, false); + NewAEEventHandlerUPP(Handle_unknown_AE), kAEGetData, false); error = AEInstallEventHandler(kAECoreSuite, kAEGetDataSize, - NewAEEventHandlerProc(Handle_unknown_AE), kAEGetDataSize, false); + NewAEEventHandlerUPP(Handle_unknown_AE), kAEGetDataSize, false); error = AEInstallEventHandler(kAECoreSuite, kAEGetClassInfo, - NewAEEventHandlerProc(Handle_unknown_AE), nil, false); + NewAEEventHandlerUPP(Handle_unknown_AE), nil, false); error = AEInstallEventHandler(kAECoreSuite, kAEGetEventInfo, - NewAEEventHandlerProc(Handle_unknown_AE), nil, false); + NewAEEventHandlerUPP(Handle_unknown_AE), nil, false); error = AEInstallEventHandler(kAECoreSuite, kAEMove, - NewAEEventHandlerProc(Handle_unknown_AE), nil, false); + NewAEEventHandlerUPP(Handle_unknown_AE), nil, false); error = AEInstallEventHandler(kAECoreSuite, kAESave, - NewAEEventHandlerProc(Handle_unknown_AE), nil, false); + NewAEEventHandlerUPP(Handle_unknown_AE), nil, false); error = AEInstallEventHandler(kAECoreSuite, kAESetData, - NewAEEventHandlerProc(Handle_unknown_AE), nil, false); + NewAEEventHandlerUPP(Handle_unknown_AE), nil, false); */ #ifdef FEAT_CW_EDITOR @@ -1518,19 +1301,19 @@ InstallAEHandlers(void) * Bind codewarrior support handlers */ error = AEInstallEventHandler('KAHL', 'GTTX', - NewAEEventHandlerProc(Handle_KAHL_GTTX_AE), 0, false); + NewAEEventHandlerUPP(Handle_KAHL_GTTX_AE), 0, false); if (error) { return error; } error = AEInstallEventHandler('KAHL', 'SRCH', - NewAEEventHandlerProc(Handle_KAHL_SRCH_AE), 0, false); + NewAEEventHandlerUPP(Handle_KAHL_SRCH_AE), 0, false); if (error) { return error; } error = AEInstallEventHandler('KAHL', 'MOD ', - NewAEEventHandlerProc(Handle_KAHL_MOD_AE), 0, false); + NewAEEventHandlerUPP(Handle_KAHL_MOD_AE), 0, false); if (error) { return error; @@ -1543,14 +1326,15 @@ InstallAEHandlers(void) #endif /* USE_AEVENT */ -#if defined(USE_CARBONIZED) && defined(MACOS_X) /* * Callback function, installed by InstallFontPanelHandler(), below, * to handle Font Panel events. */ static OSStatus -FontPanelHandler(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, - void *inUserData) +FontPanelHandler( + EventHandlerCallRef inHandlerCallRef, + EventRef inEvent, + void *inUserData) { if (GetEventKind(inEvent) == kEventFontPanelClosed) { @@ -1590,7 +1374,7 @@ FontPanelHandler(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, static void -InstallFontPanelHandler() +InstallFontPanelHandler(void) { EventTypeSpec eventTypes[2]; EventHandlerUPP handlerUPP; @@ -1654,7 +1438,6 @@ GetFontPanelSelection(char_u *outName) *outName = NUL; } } -#endif /* @@ -1669,8 +1452,7 @@ GetFontPanelSelection(char_u *outName) * Returns the index inside the menu wher */ short /* Shoulde we return MenuItemIndex? */ -gui_mac_get_menu_item_index(pMenu) - vimmenu_T *pMenu; +gui_mac_get_menu_item_index(vimmenu_T *pMenu) { short index; short itemIndex = -1; @@ -1695,21 +1477,12 @@ gui_mac_get_menu_item_index(pMenu) index++; pBrother = pBrother->next; } -#ifdef USE_HELPMENU - /* Adjust index in help menu (for predefined ones) */ - if (itemIndex != -1) - if (pMenu->parent->submenu_id == kHMHelpMenuID) - itemIndex += gui.MacOSHelpItems; -#endif } return itemIndex; } static vimmenu_T * -gui_mac_get_vim_menu(menuID, itemIndex, pMenu) - short menuID; - short itemIndex; - vimmenu_T *pMenu; +gui_mac_get_vim_menu(short menuID, short itemIndex, vimmenu_T *pMenu) { short index; vimmenu_T *pChildMenu; @@ -1726,11 +1499,6 @@ gui_mac_get_vim_menu(menuID, itemIndex, pMenu) if ((pElder) && (pElder->submenu_id == menuID)) { -#ifdef USE_HELPMENU - if (menuID == kHMHelpMenuID) - itemIndex -= gui.MacOSHelpItems; -#endif - for (index = 1; (index != itemIndex) && (pMenu != NULL); index++) pMenu = pMenu->next; } @@ -1879,9 +1647,7 @@ gui_mac_scroll_action(ControlHandle theControl, short partCode) * TODO: Add support for potential TOOLBAR */ void -gui_mac_doInContentClick(theEvent, whichWindow) - EventRecord *theEvent; - WindowPtr whichWindow; +gui_mac_doInContentClick(EventRecord *theEvent, WindowPtr whichWindow) { Point thePoint; int_u vimModifiers; @@ -1930,8 +1696,8 @@ gui_mac_doInContentClick(theEvent, whichWindow) /* Defaults to MOUSE_LEFT as there's only one mouse button */ vimMouseButton = MOUSE_LEFT; -#ifdef USE_CTRLCLICKMENU /* Convert the CTRL_MOUSE_LEFT to MOUSE_RIGHT */ + /* TODO: NEEDED? */ clickIsPopup = FALSE; if ((gui.MacOSHaveCntxMenu) && (mouse_model_popup())) @@ -1941,26 +1707,23 @@ gui_mac_doInContentClick(theEvent, whichWindow) vimModifiers &= ~MOUSE_CTRL; clickIsPopup = TRUE; } -#endif /* Is it a double click ? */ dblClick = ((theEvent->when - lastMouseTick) < GetDblTime()); - /* Send the mouse clicj to Vim */ + /* Send the mouse click to Vim */ gui_send_mouse_event(vimMouseButton, thePoint.h, thePoint.v, dblClick, vimModifiers); /* Create the rectangle around the cursor to detect * the mouse dragging */ -#ifdef USE_CTRLCLICKMENU #if 0 /* TODO: Do we need to this even for the contextual menu? * It may be require for popup_setpos, but for popup? */ if (vimMouseButton == MOUSE_LEFT) #endif -#endif { SetRect(&dragRect, FILL_X(X_2_COL(thePoint.h)), FILL_Y(Y_2_ROW(thePoint.v)), @@ -1977,19 +1740,13 @@ gui_mac_doInContentClick(theEvent, whichWindow) * Handle the click in the titlebar (to move the window) */ void -gui_mac_doInDragClick(where, whichWindow) - Point where; - WindowPtr whichWindow; +gui_mac_doInDragClick(Point where, WindowPtr whichWindow) { Rect movingLimits; Rect *movingLimitsPtr = &movingLimits; /* TODO: may try to prevent move outside screen? */ -#ifdef USE_CARBONIZED movingLimitsPtr = GetRegionBounds(GetGrayRgn(), &movingLimits); -#else - movingLimitsPtr = &(*GetGrayRgn())->rgnBBox; -#endif DragWindow(whichWindow, where, movingLimitsPtr); } @@ -1997,9 +1754,7 @@ gui_mac_doInDragClick(where, whichWindow) * Handle the click in the grow box */ void -gui_mac_doInGrowClick(where, whichWindow) - Point where; - WindowPtr whichWindow; +gui_mac_doInGrowClick(Point where, WindowPtr whichWindow) { long newSize; @@ -2007,71 +1762,28 @@ gui_mac_doInGrowClick(where, whichWindow) unsigned short newHeight; Rect resizeLimits; Rect *resizeLimitsPtr = &resizeLimits; -#ifdef USE_CARBONIZED Rect NewContentRect; resizeLimitsPtr = GetRegionBounds(GetGrayRgn(), &resizeLimits); -#else - resizeLimits = qd.screenBits.bounds; -#endif /* Set the minimun size */ /* TODO: Should this come from Vim? */ resizeLimits.top = 100; resizeLimits.left = 100; -#ifdef USE_CARBONIZED newSize = ResizeWindow(whichWindow, where, &resizeLimits, &NewContentRect); newWidth = NewContentRect.right - NewContentRect.left; newHeight = NewContentRect.bottom - NewContentRect.top; gui_resize_shell(newWidth, newHeight); gui_mch_set_bg_color(gui.back_pixel); gui_set_shellsize(TRUE, FALSE); -#else - newSize = GrowWindow(whichWindow, where, &resizeLimits); - if (newSize != 0) - { - newWidth = newSize & 0x0000FFFF; - newHeight = (newSize >> 16) & 0x0000FFFF; - - gui_mch_set_bg_color(gui.back_pixel); - - gui_resize_shell(newWidth, newHeight); - - /* - * We need to call gui_set_shellsize as the size - * used by Vim may be smaller than the size selected - * by the user. This cause some overhead - * TODO: add a check inside gui_resize_shell? - */ - gui_set_shellsize(TRUE, FALSE); - - /* - * Origin of the code below is unknown. - * Functionality is unknown. - * Time of commented out is unknown. - */ -/* SetPort(wp); - InvalRect(&wp->portRect); - if (isUserWindow(wp)) { - DrawingWindowPeek aWindow = (DrawingWindowPeek)wp; - - if (aWindow->toolRoutines.toolWindowResizedProc) - CallToolWindowResizedProc(aWindow->toolRoutines.toolWindowResizedProc, wp); - }*/ - }; -#endif - } /* * Handle the click in the zoom box */ -#ifdef USE_CARBONIZED static void -gui_mac_doInZoomClick(theEvent, whichWindow) - EventRecord *theEvent; - WindowPtr whichWindow; +gui_mac_doInZoomClick(EventRecord *theEvent, WindowPtr whichWindow) { Rect r; Point p; @@ -2110,7 +1822,6 @@ gui_mac_doInZoomClick(theEvent, whichWindow) gui_mch_set_bg_color(gui.back_pixel); gui_set_shellsize(TRUE, FALSE); } -#endif /* defined(USE_CARBONIZED) */ /* * ------------------------------------------------------------ @@ -2123,26 +1834,21 @@ gui_mac_doInZoomClick(theEvent, whichWindow) */ void -gui_mac_doUpdateEvent(event) - EventRecord *event; +gui_mac_doUpdateEvent(EventRecord *event) { WindowPtr whichWindow; GrafPtr savePort; RgnHandle updateRgn; -#ifdef USE_CARBONIZED Rect updateRect; -#endif Rect *updateRectPtr; Rect rc; Rect growRect; RgnHandle saveRgn; -#ifdef USE_CARBONIZED updateRgn = NewRgn(); if (updateRgn == NULL) return; -#endif /* This could be done by the caller as we * don't require anything else out of the event @@ -2153,18 +1859,13 @@ gui_mac_doUpdateEvent(event) |