From d7cea06a2ed88307396bf8f44440feaa058766b7 Mon Sep 17 00:00:00 2001 From: hobbs Date: Tue, 7 Dec 1999 03:51:05 +0000 Subject: added TkMacPreprocessMenu --- generic/tkInt.decls | 6 +++++- generic/tkIntPlatDecls.h | 9 ++++++++- generic/tkStubInit.c | 3 ++- mac/tkMacMenu.c | 29 ++++++++++++++++++++--------- mac/tkMacWindowMgr.c | 9 +++++---- 5 files changed, 40 insertions(+), 16 deletions(-) diff --git a/generic/tkInt.decls b/generic/tkInt.decls index da74ef5..244798f 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: tkInt.decls,v 1.11 1999/08/10 16:58:37 hobbs Exp $ +# RCS: @(#) $Id: tkInt.decls,v 1.12 1999/12/07 03:51:05 hobbs Exp $ library tk @@ -1032,6 +1032,10 @@ declare 64 mac { MacDrawable * TkMacGetHostToplevel (TkWindow *winPtr) } +declare 65 mac { + void TkMacPreprocessMenu (void) +} + ############################################################################## diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index 670e5e9..410b1c6 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -9,7 +9,7 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tkIntPlatDecls.h,v 1.6 1999/05/25 01:31:06 stanton Exp $ + * RCS: @(#) $Id: tkIntPlatDecls.h,v 1.7 1999/12/07 03:51:05 hobbs Exp $ */ #ifndef _TKINTPLATDECLS @@ -290,6 +290,8 @@ EXTERN Tk_Window Tk_TopCoordsToWindow _ANSI_ARGS_((Tk_Window tkwin, EXTERN MacDrawable * TkMacContainerId _ANSI_ARGS_((TkWindow * winPtr)); /* 64 */ EXTERN MacDrawable * TkMacGetHostToplevel _ANSI_ARGS_((TkWindow * winPtr)); +/* 65 */ +EXTERN void TkMacPreprocessMenu _ANSI_ARGS_((void)); #endif /* MAC_TCL */ typedef struct TkIntPlatStubs { @@ -408,6 +410,7 @@ typedef struct TkIntPlatStubs { Tk_Window (*tk_TopCoordsToWindow) _ANSI_ARGS_((Tk_Window tkwin, int rootX, int rootY, int * newX, int * newY)); /* 62 */ MacDrawable * (*tkMacContainerId) _ANSI_ARGS_((TkWindow * winPtr)); /* 63 */ MacDrawable * (*tkMacGetHostToplevel) _ANSI_ARGS_((TkWindow * winPtr)); /* 64 */ + void (*tkMacPreprocessMenu) _ANSI_ARGS_((void)); /* 65 */ #endif /* MAC_TCL */ } TkIntPlatStubs; @@ -825,6 +828,10 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr; #define TkMacGetHostToplevel \ (tkIntPlatStubsPtr->tkMacGetHostToplevel) /* 64 */ #endif +#ifndef TkMacPreprocessMenu +#define TkMacPreprocessMenu \ + (tkIntPlatStubsPtr->tkMacPreprocessMenu) /* 65 */ +#endif #endif /* MAC_TCL */ #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */ diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 278e1bf..06f9e9a 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkStubInit.c,v 1.12 1999/08/10 16:58:38 hobbs Exp $ + * RCS: @(#) $Id: tkStubInit.c,v 1.13 1999/12/07 03:51:05 hobbs Exp $ */ #include "tkInt.h" @@ -456,6 +456,7 @@ TkIntPlatStubs tkIntPlatStubs = { Tk_TopCoordsToWindow, /* 62 */ TkMacContainerId, /* 63 */ TkMacGetHostToplevel, /* 64 */ + TkMacPreprocessMenu, /* 65 */ #endif /* MAC_TCL */ }; diff --git a/mac/tkMacMenu.c b/mac/tkMacMenu.c index c9fb7c5..507d258 100644 --- a/mac/tkMacMenu.c +++ b/mac/tkMacMenu.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacMenu.c,v 1.15 1999/12/07 03:09:58 hobbs Exp $ + * RCS: @(#) $Id: tkMacMenu.c,v 1.16 1999/12/07 03:51:10 hobbs Exp $ */ #include "tkMacInt.h" @@ -4204,7 +4204,8 @@ RecursivelyClearActiveMenu( */ void -InvalidateMDEFRgns(void) { +InvalidateMDEFRgns(void) +{ GDHandle saveDevice; GWorldPtr saveWorld, destPort; Point scratch; @@ -4252,7 +4253,8 @@ InvalidateMDEFRgns(void) { */ void -TkMacClearMenubarActive(void) { +TkMacClearMenubarActive(void) +{ TkMenuReferences *menuBarRefPtr; if (currentMenuBarName != NULL) { @@ -4443,15 +4445,24 @@ TkpMenuThreadInit() */ void -TkpPreprocessMacMenu() +TkMacPreprocessMenu() { - TkMenuReferences *menuBarRefPtr; + TkMenuReferences *mbRefPtr; + int code; - if ( currentMenuBarName != NULL ) { - menuBarRefPtr = TkFindMenuReferences(currentMenuBarInterp, + if ((currentMenuBarName != NULL) && (currentMenuBarInterp != NULL)) { + mbRefPtr = TkFindMenuReferences(currentMenuBarInterp, currentMenuBarName); - if ( (menuBarRefPtr != NULL) && (menuBarRefPtr->menuPtr != NULL) ) { - TkPreprocessMenu(menuBarRefPtr->menuPtr->masterMenuPtr); + if ((mbRefPtr != NULL) && (mbRefPtr->menuPtr != NULL)) { + Tcl_Preserve((ClientData)currentMenuBarInterp); + code = TkPreprocessMenu(mbRefPtr->menuPtr->masterMenuPtr); + if ((code != TCL_OK) && (code != TCL_CONTINUE) + && (code != TCL_BREAK)) { + Tcl_AddErrorInfo(currentMenuBarInterp, + "\n (menu preprocess)"); + Tcl_BackgroundError(currentMenuBarInterp); + } + Tcl_Release((ClientData)currentMenuBarInterp); } } } diff --git a/mac/tkMacWindowMgr.c b/mac/tkMacWindowMgr.c index 81bda7a..0644847 100644 --- a/mac/tkMacWindowMgr.c +++ b/mac/tkMacWindowMgr.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacWindowMgr.c,v 1.5 1999/12/07 03:04:52 hobbs Exp $ + * RCS: @(#) $Id: tkMacWindowMgr.c,v 1.6 1999/12/07 03:51:11 hobbs Exp $ */ #include @@ -207,13 +207,14 @@ WindowManagerMouse( { int oldMode; KeyMap theKeys; - void TkpPreprocessMacMenu(void); GetKeys(theKeys); oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); TkMacClearMenubarActive(); - /* POSTCOMMAND??? */ - TkpPreprocessMacMenu(); + /* + * Handle -postcommand + */ + TkMacPreprocessMenu(); TkMacHandleMenuSelect(MenuSelect(eventPtr->where), theKeys[1] & 4); Tcl_SetServiceMode(oldMode); -- cgit v0.12