summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2020-11-18 14:53:26 (GMT)
committerculler <culler>2020-11-18 14:53:26 (GMT)
commit1ba04ba305622a60b6975ce3780696310b158ec5 (patch)
tree1fb1e4b7d07814ff304922513734133482b3081f
parent611b219cbd36c037048c5cce30fd6b32474495cf (diff)
downloadtk-1ba04ba305622a60b6975ce3780696310b158ec5.zip
tk-1ba04ba305622a60b6975ce3780696310b158ec5.tar.gz
tk-1ba04ba305622a60b6975ce3780696310b158ec5.tar.bz2
Back out accidental commit
-rw-r--r--generic/tkMenu.c4
-rw-r--r--macosx/tkMacOSXMenu.c75
2 files changed, 35 insertions, 44 deletions
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 1d7c38d..1cd7a16 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -1492,7 +1492,6 @@ MenuWorldChanged(
for (i = 0; i < menuPtr->numEntries; i++) {
TkMenuConfigureEntryDrawOptions(menuPtr->entries[i],
menuPtr->entries[i]->index);
- fprintf(stderr, "MenuWorldChanged: calling TkpConfigureMenuEntry %d\n", i);
TkpConfigureMenuEntry(menuPtr->entries[i]);
}
TkEventuallyRecomputeMenu(menuPtr);
@@ -1874,7 +1873,6 @@ PostProcessEntry(
}
}
- fprintf(stderr, "PostProcessEntry: calling TkpConfigureMenuEntry\n");
if (TkpConfigureMenuEntry(mePtr) != TCL_OK) {
return TCL_ERROR;
}
@@ -2536,7 +2534,6 @@ MenuVarProc(
Tcl_TraceVar2(interp, name, NULL,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
MenuVarProc, clientData);
- fprintf(stderr, "MenuVarProc: Calling TkpConfigureMenuEntry\n");
TkpConfigureMenuEntry(mePtr);
TkEventuallyRedrawMenu(menuPtr, NULL);
return NULL;
@@ -2566,7 +2563,6 @@ MenuVarProc(
} else {
return NULL;
}
- fprintf(stderr, "MenuVarProc: Calling TkpConfigureMenuEntry (2)\n");
TkpConfigureMenuEntry(mePtr);
TkEventuallyRedrawMenu(menuPtr, mePtr);
return NULL;
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index e42ae3e..ee05eb5 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -409,7 +409,7 @@ TKBackgroundLoop *backgroundLoop = nil;
(void)menu;
if (_tkMenu) {
- // RecursivelyClearActiveMenu(_tkMenu);
+ //RecursivelyClearActiveMenu(_tkMenu);
GenerateMenuSelectEvent((TKMenu *)[self supermenu],
[self itemInSupermenu]);
}
@@ -472,8 +472,8 @@ TKBackgroundLoop *backgroundLoop = nil;
}
backgroundLoop = [[TKBackgroundLoop alloc] init];
[backgroundLoop start];
- // TkMacOSXClearMenubarActive();
- // TkMacOSXPreprocessMenu();
+ //TkMacOSXClearMenubarActive();
+ //TkMacOSXPreprocessMenu();
}
- (void) menuEndTracking: (NSNotification *) notification
@@ -725,49 +725,45 @@ TkpConfigureMenuEntry(
[title substringToIndex:[title length] - 3], 0x2026];
}
}
- if ([title length]) {
- fontAttributes = TkMacOSXNSFontAttributesForFont(Tk_GetFontFromObj(
- mePtr->menuPtr->tkwin, fontPtr));
- attributes = [fontAttributes mutableCopy];
- if (gc->foreground != defaultFg) {
+ [menuItem setTitle:title];
+ fontAttributes = TkMacOSXNSFontAttributesForFont(Tk_GetFontFromObj(
+ mePtr->menuPtr->tkwin, fontPtr));
+ attributes = [fontAttributes mutableCopy];
+ if (gc->foreground != defaultFg) {
- /*
- * Apple's default foreground color changes to white when the menuitem is
- * selected. If a custom foreground color is used then the color will be
- * the same for selected and unselected menu items.
- */
+ /*
+ * Apple's default foreground color changes to white when the menuitem is
+ * selected. If a custom foreground color is used then the color will be
+ * the same for selected and unselected menu items.
+ */
- NSColor *fgcolor = TkMacOSXGetNSColor(gc, gc->foreground);
- [attributes setObject:fgcolor
- forKey:NSForegroundColorAttributeName];
- }
- if (gc->background != defaultBg) {
+ NSColor *fgcolor = TkMacOSXGetNSColor(gc, gc->foreground);
+ [attributes setObject:fgcolor
+ forKey:NSForegroundColorAttributeName];
+ }
+ if (gc->background != defaultBg) {
- /*
- * Setting a background color looks awful. But setting the background should
- * not be the same as setting the foreground. As a compromise, if the background
- * color is set we draw an underline in that color.
- */
- NSColor *bgcolor = TkMacOSXGetNSColor(gc, gc->background);
- [attributes setObject:bgcolor
- forKey:NSUnderlineColorAttributeName];
- [attributes setObject:[NSNumber numberWithInt:NSUnderlineStyleDouble]
- forKey:NSUnderlineStyleAttributeName];
- }
- attributedTitle = [[NSAttributedString alloc]
- initWithString:title
- attributes:attributes];
- [menuItem setAttributedTitle:attributedTitle];
+ /*
+ * Setting a background color looks awful. But setting the background should
+ * not be the same as setting the foreground. As a compromise, if the background
+ * color is set we draw an underline in that color.
+ */
+ NSColor *bgcolor = TkMacOSXGetNSColor(gc, gc->background);
+ [attributes setObject:bgcolor
+ forKey:NSUnderlineColorAttributeName];
+ [attributes setObject:[NSNumber numberWithInt:NSUnderlineStyleDouble]
+ forKey:NSUnderlineStyleAttributeName];
}
- fprintf(stderr, "Item %s has tk state %x apple enabled %d\n",
- title.UTF8String, mePtr->state, [menuItem isEnabled]);
- [menuItem setEnabled:(mePtr->state & ENTRY_DISABLED) == 0 || [title length] == 0];
+ attributedTitle = [[[NSAttributedString alloc]
+ initWithString:title attributes:attributes] autorelease];
+ [menuItem setAttributedTitle:attributedTitle];
+ [menuItem setEnabled:!(mePtr->state == ENTRY_DISABLED)];
[menuItem setState:((mePtr->type == CHECK_BUTTON_ENTRY ||
- mePtr->type == RADIO_BUTTON_ENTRY) && mePtr->indicatorOn &&
- (mePtr->entryFlags & ENTRY_SELECTED) ? NSOnState : NSOffState)];
+ mePtr->type == RADIO_BUTTON_ENTRY) && mePtr->indicatorOn &&
+ (mePtr->entryFlags & ENTRY_SELECTED) ? NSOnState : NSOffState)];
if (mePtr->type != CASCADE_ENTRY && mePtr->accelPtr && mePtr->accelLength) {
keyEquivalent = ParseAccelerator(Tcl_GetString(mePtr->accelPtr),
- &modifierMask);
+ &modifierMask);
}
[menuItem setKeyEquivalent:keyEquivalent];
[menuItem setKeyEquivalentModifierMask:modifierMask];
@@ -780,7 +776,6 @@ TkpConfigureMenuEntry(
CheckForSpecialMenu(menuRefPtr->menuPtr);
submenu = (TKMenu *) menuRefPtr->menuPtr->platformData;
if ([submenu supermenu] && [menuItem submenu] != submenu) {
-
/*
* This happens during a clone, where the parent menu is
* cloned before its children, so just ignore this temprary