From 589d0dde98f21d4046bf3fa2fb4112c90863b8ad Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 12 Aug 2020 07:24:55 +0000 Subject: Rename (internal) MAASTER_MENU to MAIN_MENU, but keep the original, just to be sure --- generic/tkMenu.c | 40 ++++++++++++++++++++-------------------- generic/tkMenu.h | 13 +++++++------ tests/menu.test | 2 +- unix/tkUnixMenu.c | 4 ++-- win/tkWinMenu.c | 4 ++-- 5 files changed, 32 insertions(+), 31 deletions(-) diff --git a/generic/tkMenu.c b/generic/tkMenu.c index f43bbe0..638139a 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -39,12 +39,12 @@ * right; they have a Tk window and pathname associated with them; they have a * TkMenu structure and array of entries. However, they are linked with the * original menu that they were cloned from. The reflect the attributes of the - * original, or "master", menu. So if an item is added to a menu, and that + * original, or "main", menu. So if an item is added to a menu, and that * menu has clones, then the item must be added to all of its clones also. * Menus are cloned when a menu is torn-off or when a menu is assigned as a * menubar using the "-menu" option of the toplevel's pathname configure * subcommand. When a clone is destroyed, only the clone is destroyed, but - * when the master menu is destroyed, all clones are also destroyed. This + * when the main menu is destroyed, all clones are also destroyed. This * allows the developer to just deal with one set of menus when creating and * destroying. * @@ -513,7 +513,7 @@ Tk_MenuObjCmd( nextCascadePtr = cascadeListPtr->nextCascadePtr; /* - * If we have a new master menu, and an existing cloned menu + * If we have a new main menu, and an existing cloned menu * points to this menu in a cascade entry, we have to clone the * new menu and point the entry to the clone instead of the menu * we are creating. Otherwise, ConfigureMenuEntry will hook up the @@ -1100,8 +1100,8 @@ DestroyMenuInstance( TkMenu *menuInstancePtr; TkMenuEntry *cascadePtr, *nextCascadePtr; Tcl_Obj *newObjv[2]; - TkMenu *parentMasterMenuPtr; - TkMenuEntry *parentMasterEntryPtr; + TkMenu *parentMainMenuPtr; + TkMenuEntry *parentMainEntryPtr; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -1110,11 +1110,11 @@ DestroyMenuInstance( * entries need to be told that the menu is going away. We need to clear * the menu ptr field in the menu reference at this point in the code so * that everything else can forget about this menu properly. We also need - * to reset -menu field of all entries that are not master menus back to - * this entry name if this is a master menu pointed to by another master + * to reset -menu field of all entries that are not main menus back to + * this entry name if this is a main menu pointed to by another main * menu. If there is a clone menu that points to this menu, then this menu * is itself a clone, so when this menu goes away, the -menu field of the - * pointing entry must be set back to this menu's master menu name so that + * pointing entry must be set back to this menu's main menu name so that * later if another menu is created the cascade hierarchy can be * maintained. */ @@ -1135,11 +1135,11 @@ DestroyMenuInstance( if (menuPtr->masterMenuPtr != menuPtr) { Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", -1); - parentMasterMenuPtr = cascadePtr->menuPtr->masterMenuPtr; - parentMasterEntryPtr = - parentMasterMenuPtr->entries[cascadePtr->index]; + parentMainMenuPtr = cascadePtr->menuPtr->masterMenuPtr; + parentMainEntryPtr = + parentMainMenuPtr->entries[cascadePtr->index]; newObjv[0] = menuNamePtr; - newObjv[1] = parentMasterEntryPtr->namePtr; + newObjv[1] = parentMainEntryPtr->namePtr; /* * It is possible that the menu info is out of sync, and these @@ -1169,7 +1169,7 @@ DestroyMenuInstance( } } } else if (menuPtr->nextInstancePtr != NULL) { - Tcl_Panic("Attempting to delete master menu when there are still clones"); + Tcl_Panic("Attempting to delete main menu when there are still clones"); } /* @@ -1209,8 +1209,8 @@ DestroyMenuInstance( * * This function is invoked by Tcl_EventuallyFree or Tcl_Release to clean * up the internal structure of a menu at a safe time (when no-one is - * using it anymore). If called on a master instance, destroys all of the - * slave instances. If called on a non-master instance, just destroys + * using it anymore). If called on a main instance, destroys all of the + * instances. If called on a non-main instance, just destroys * that instance. * * Results: @@ -1571,7 +1571,7 @@ ConfigureMenu( * menuTypeName field to tell that this is a menu bar. */ - if (menuListPtr->menuType == MASTER_MENU) { + if (menuListPtr->menuType == MAIN_MENU) { int typeFlag = TK_MAKE_MENU_POPUP; Tk_Window tkwin = menuPtr->tkwin; @@ -1982,7 +1982,7 @@ ConfigureMenuCloneEntries( /* * Cascades are kind of tricky here. This is special case #3 in the - * comment at the top of this file. Basically, if a menu is the master + * comment at the top of this file. Basically, if a menu is the main * menu of a clone chain, and has an entry with a cascade menu, the clones * of the menu will point to clones of the cascade menu. We have to * destroy the clones of the cascades, clone the new cascade menu, and @@ -2416,7 +2416,7 @@ MenuAddOrInsert( * If a menu has cascades, then every instance of the menu has to have * its own parallel cascade structure. So adding an entry to a menu * with clones means that the menu that the entry points to has to be - * cloned for every clone the master menu has. This is special case #2 + * cloned for every clone the main menu has. This is special case #2 * in the comment at the top of this file. */ @@ -2697,7 +2697,7 @@ CloneMenu( Tcl_Obj *menuDupCommandArray[4]; if (newMenuTypePtr == NULL) { - menuType = MASTER_MENU; + menuType = MAIN_MENU; } else { if (Tcl_GetIndexFromObjStruct(menuPtr->interp, newMenuTypePtr, menuTypeStrings, sizeof(char *), "menu type", 0, &menuType) != TCL_OK) { @@ -2752,7 +2752,7 @@ CloneMenu( } /* - * Add the master menu's window to the bind tags for this window after + * Add the main menu's window to the bind tags for this window after * this window's tag. This is so the user can bind to either this * clone (which may not be easy to do) or the entire menu clone * structure. diff --git a/generic/tkMenu.h b/generic/tkMenu.h index a0fa7ab..386b204 100644 --- a/generic/tkMenu.h +++ b/generic/tkMenu.h @@ -185,7 +185,7 @@ typedef struct TkMenuEntry { * the menu. */ /* - * Bookeeping for master menus and cascade menus. + * Bookeeping for main menus and cascade menus. */ struct TkMenuReferences *childMenuRefPtr; @@ -266,7 +266,7 @@ typedef struct TkMenu { int numEntries; /* Number of elements in entries. */ int active; /* Index of active entry. -1 means nothing * active. */ - int menuType; /* MASTER_MENU, TEAROFF_MENU, or MENUBAR. See + int menuType; /* MAIN_MENU, TEAROFF_MENU, or MENUBAR. See * below for definitions. */ Tcl_Obj *menuTypePtr; /* Used to control whether created tkwin is a * toplevel or not. "normal", "menubar", or @@ -354,7 +354,7 @@ typedef struct TkMenu { struct TkMenu *masterMenuPtr; /* A pointer to the original menu for this * clone chain. Points back to this structure - * if this menu is a master menu. */ + * if this menu is a main menu. */ void *reserved1; /* not used any more. */ Tk_Window parentTopLevelPtr;/* If this menu is a menubar, this is the * toplevel that owns the menu. Only @@ -433,7 +433,7 @@ typedef struct TkMenuReferences { * MENU_DELETION_PENDING Non-zero means that we are currently * destroying this menu's internal structures. * This is useful when we are in the middle of - * cleaning this master menu's chain of menus up + * cleaning this main menu's chain of menus up * when TkDestroyMenu was called again on this * menu (via a destroy binding or somesuch). * MENU_WIN_DESTRUCTION_PENDING Non-zero means we are in the middle of @@ -451,15 +451,16 @@ typedef struct TkMenuReferences { #define MENU_PLATFORM_FLAG3 (1 << 28) /* - * Each menu created by the user is a MASTER_MENU. When a menu is torn off, a + * Each menu created by the user is a MAIN_MENU. When a menu is torn off, a * TEAROFF_MENU instance is created. When a menu is assigned to a toplevel as * a menu bar, a MENUBAR instance is created. All instances have the same - * configuration information. If the master instance is deleted, all instances + * configuration information. If the main instance is deleted, all instances * are deleted. If one of the other instances is deleted, only that instance * is deleted. */ #define UNKNOWN_TYPE -1 +#define MAIN_MENU 0 #define MASTER_MENU 0 #define TEAROFF_MENU 1 #define MENUBAR 2 diff --git a/tests/menu.test b/tests/menu.test index a7f5956..6a3c6fe 100644 --- a/tests/menu.test +++ b/tests/menu.test @@ -2052,7 +2052,7 @@ test menu-5.8 {DestroyMenuInstance - multiple clones} -setup { set tearoff2 [tk::TearOffMenu .m1] list [destroy $tearoff1] [destroy .m1] } -returnCodes ok -result {{} {}} -test menu-5.9 {DestroyMenuInstace - master menu} -setup { +test menu-5.9 {DestroyMenuInstace - main menu} -setup { destroy .m1 } -body { menu .m1 diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index aa54897..fc8b4f2 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.c @@ -1057,7 +1057,7 @@ GetTearoffEntryGeometry( int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { - if (menuPtr->menuType != MASTER_MENU) { + if (menuPtr->menuType != MAIN_MENU) { *heightPtr = 0; *widthPtr = 0; } else { @@ -1281,7 +1281,7 @@ DrawTearoffEntry( int segmentWidth, maxX; Tk_3DBorder border; - if (menuPtr->menuType != MASTER_MENU) { + if (menuPtr->menuType != MAIN_MENU) { return; } diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 6c55164..67894c7 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -1689,7 +1689,7 @@ GetTearoffEntryGeometry( (void)mePtr; (void)tkfont; - if (menuPtr->menuType != MASTER_MENU) { + if (menuPtr->menuType != MAIN_MENU) { *heightPtr = 0; } else { *heightPtr = fmPtr->linespace; @@ -2597,7 +2597,7 @@ DrawTearoffEntry( (void)tkfont; (void)fmPtr; - if (menuPtr->menuType != MASTER_MENU) { + if (menuPtr->menuType != MAIN_MENU) { return; } -- cgit v0.12