text:
#include "tkMacOSXPrivate.h"
#include "tkMenubutton.h"
#include "tkMenu.h"
#include "tkColor.h"
#include "tkFont.h"
#include "tkMacOSXWm.h"
#include "tkMacOSXDebug.h"

/*
#ifdef TK_MAC_DEBUG
#define TK_MAC_DEBUG_MENUS
#endif
*/

#define ENTRY_HELP_MENU		ENTRY_PLATFORM_FLAG1
#define ENTRY_APPLE_MENU	ENTRY_PLATFORM_FLAG2
#define ENTRY_WINDOWS_MENU	ENTRY_PLATFORM_FLAG3

#define sl(s) ((int) (sizeof(s "") - 1))

#define SPECIALMENU(n, f) {.name = "." #n, .len = sl(#n) + 1, \
	.flag = ENTRY_##f##_MENU }
static const struct {
    const char *name; const size_t len; const int flag;
} specialMenus[] = {
    SPECIALMENU(help,	HELP),
    SPECIALMENU(apple,	APPLE),
    SPECIALMENU(window,	WINDOWS),
    {NULL}
};
#undef SPECIALMENU

#define MODIFIER(n, f) {.name = #n, .len = sl(#n), .mask = f }
static const struct {
    const char *name; const size_t len; const NSUInteger mask;
} modifiers[] = {
    MODIFIER(Control,	NSControlKeyMask),
    MODIFIER(Ctrl,	NSControlKeyMask),
    MODIFIER(Option,	NSAlternateKeyMask),
    MODIFIER(Opt,	NSAlternateKeyMask),
    MODIFIER(Alt,	NSAlternateKeyMask),
    MODIFIER(Shift,	NSShiftKeyMask),
    MODIFIER(Command,	NSCommandKeyMask),
    MODIFIER(Cmd,	NSCommandKeyMask),
    MODIFIER(Meta,	NSCommandKeyMask),
    {NULL}
};
#undef MODIFIER

#define ACCEL(n, c) {.name = #n, .len = sl(#n), .ch = c }
static const struct {
    const char *name; const size_t len; const UniChar ch;
} specialAccelerators[] = {
    ACCEL(PageUp,	NSPageUpFunctionKey),
    ACCEL(PageDown,	NSPageDownFunctionKey),
    ACCEL(Left,		NSLeftArrowFunctionKey),
    ACCEL(Right,	NSRightArrowFunctionKey),
    ACCEL(Up,		NSUpArrowFunctionKey),
    ACCEL(Down,		NSDownArrowFunctionKey),
    ACCEL(Escape,	0x001b),
    ACCEL(Clear,	NSClearDisplayFunctionKey),
    ACCEL(Enter,	NSEnterCharacter),
    ACCEL(Backspace,	NSBackspaceCharacter),
    ACCEL(Space,	' '),
    ACCEL(Tab,		NSTabCharacter),
    ACCEL(BackTab,	NSBackTabCharacter),
    ACCEL(Delete,	NSDeleteCharacter),
    ACCEL(Home,		NSHomeFunctionKey),
    ACCEL(End,		NSEndFunctionKey),
    ACCEL(Return,	NSCarriageReturnCharacter),
    ACCEL(Help,		NSHelpFunctionKey),
    ACCEL(Power,	0x233d),
    ACCEL(Eject,	0xf804),
    {NULL}
};
#undef ACCEL
#undef sl

static int gNoTkMenus = 0;	/* This is used by Tk_MacOSXTurnOffMenus as
				 * the flag that Tk is not to draw any
				 * menus. */
static int inPostMenu = 0;
static unsigned long defaultBg = 0, defaultFg = 0;
static SInt32 menuMarkColumnWidth = 0, menuIconTrailingEdgeMargin = 0;
static SInt32 menuTextLeadingEdgeMargin = 0, menuTextTrailingEdgeMargin = 0;
static SInt16 menuItemExtraHeight = 0, menuItemExtraWidth = 0;
static SInt16 menuSeparatorHeight = 0;

static void	CheckForSpecialMenu(TkMenu *menuPtr);
static NSString *ParseAccelerator(const char *accel, NSUInteger *maskPtr);
static int	GenerateMenuSelectEvent(TKMenu *menu, NSMenuItem *menuItem);
static void	MenuSelectEvent(TkMenu *menuPtr);
static void	RecursivelyClearActiveMenu(TkMenu *menuPtr);
static int	ModifierCharWidth(Tk_Font tkfont);

#pragma mark TKMenu

@interface TKMenu(TKMenuPrivate)
- (id) initWithTkMenu: (TkMenu *) tkMenu;
- (TkMenu *) tkMenu;
- (int) tkIndexOfItem: (NSMenuItem *) menuItem;
- (void) insertItem: (NSMenuItem *) newItem atTkIndex: (NSInteger) index;
@end

#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
#define TKMenu_NSMenuDelegate <NSMenuDelegate>
#else
#define TKMenu_NSMenuDelegate
#endif
@interface TKMenu(TKMenuDelegate) TKMenu_NSMenuDelegate
@end

@implementation TKMenu
- (void) setSpecial: (NSUInteger) special
{
    NSAssert(!_tkSpecial, @"Cannot change specialness of a special menu");
    _tkSpecial = special;
}
- (BOOL) isSpecial: (NSUInteger) special
{
    return (_tkSpecial == special);
}
@end

@implementation TKMenu(TKMenuPrivate)

- (id) initWithTitle: (NSString *) aTitle
{
    self = [super initWithTitle:aTitle];
    if (self) {
	_tkMenu = NULL;
	_tkOffset = 0;
	_tkItemCount = 0;
	_tkSpecial = 0;
	[self setDelegate:self];
    }
    return self;
}

- (id) initWithTkMenu: (TkMenu *) tkMenu
{
    NSString *title = [[NSString alloc] initWithUTF8String:
	    Tk_PathName(tkMenu->tkwin)];

    self = [self initWithTitle:title];
    [title release];
    if (self) {
	_tkMenu = tkMenu;
    }
    return self;
}

- (id) copyWithZone: (NSZone *) zone
{
    TKMenu *copy = [super copyWithZone:zone];

    NSAssert(_tkMenu == nil, @"Cannot copy tkMenu");
    copy->_tkMenu = _tkMenu;
    copy->_tkOffset = _tkOffset;
    copy->_tkItemCount = _tkItemCount;
    copy->_tkSpecial = _tkSpecial;
    return copy;
}

- (TkMenu *) tkMenu
{
    return _tkMenu;
}

- (int) tkIndexOfItem: (NSMenuItem *) menuItem
{
    return [self indexOfItem:menuItem] - _tkOffset;
}

- (void) insertItem: (NSMenuItem *) newItem atTkIndex: (NSInteger) index
{
    [super insertItem:newItem atIndex:index + _tkOffset];
    _tkItemCount++;
}

- (void) insertItem: (NSMenuItem *) newItem atIndex: (NSInteger) index
{
    if (_tkMenu && index >= 0) {
	if ((NSUInteger)index <= _tkOffset) {
	    _tkOffset++;
	} else {
	    NSAssert((NSUInteger)index >= _tkItemCount + _tkOffset,
		    @"Cannot insert in the middle of Tk menu");
	}
    }
    [super insertItem:newItem atIndex:index];
}

- (void) removeItemAtIndex: (NSInteger) index
{
    if (_tkMenu && index >= 0) {
	if ((NSUInteger)index < _tkOffset) {
	    _tkOffset--;
	} else if ((NSUInteger)index < _tkItemCount + _tkOffset) {
	    _tkItemCount--;
	}
    }
    [super removeItemAtIndex:index];
}

- (NSMenuItem *) newTkMenuItem: (TkMenuEntry *) mePtr
{
    NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:@""
	    action:@selector(tkMenuItemInvoke:) keyEquivalent:@""];

    [menuItem setTarget:self];
    [menuItem setTag:(NSInteger)mePtr];
    return menuItem;
}
@end

@implementation TKMenu(TKMenuActions)
// target methods

- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
{
    return [menuItem isEnabled];
}

// Workaround for bug 3572016; leaves menu items enabled during modal dialog.
- (BOOL)worksWhenModal
{
    return YES;
}

- (void) tkMenuItemInvoke: (id) sender
{
    /*
     * With the delegate matching key equivalents, when a menu action is sent
     * in response to a key equivalent, sender is the whole menu and not the
     * the specific menu item, use this to ignore key equivalents for our
     * menus (as Tk handles them directly via bindings).
     */

    if ([sender isKindOfClass:[NSMenuItem class]]) {
	NSMenuItem *menuItem = (NSMenuItem *)sender;
	TkMenu *menuPtr = (TkMenu *)_tkMenu;
	TkMenuEntry *mePtr = (TkMenuEntry *)[menuItem tag];

	if (menuPtr && mePtr) {
	    Tcl_Interp *interp = menuPtr->interp;
	    /*Add time for errors to fire if necessary. This is sub-optimal but avoids issues with Tcl/Cocoa event loop integration.*/
	    Tcl_Sleep(100);

	    NSAutoreleasePool *pool = [NSAutoreleasePool new];
	    Tcl_Preserve(interp);
	    Tcl_Preserve(menuPtr);

	    int result = TkInvokeMenu(interp, menuPtr, mePtr->index);

	    if (result != TCL_OK && result != TCL_CONTINUE &&
		    result != TCL_BREAK) {
		Tcl_AddErrorInfo(interp, "\n    (menu invoke)");
		Tcl_BackgroundException(interp, result);
	    }
	    Tcl_Release(menuPtr);
	    Tcl_Release(interp);
	    [pool drain];
	}
    }
}
@end

@implementation TKMenu(TKMenuDelegate)
#define keyEquivModifiersMatch(km, m) (( \
    ((km) & NSCommandKeyMask) != ((m) & NSCommandKeyMask) || \
    ((km) & NSAlternateKeyMask) != ((m) & NSAlternateKeyMask) || \
    ((km) & NSControlKeyMask) != ((m) & NSControlKeyMask) || \
    (((km) & NSShiftKeyMask) != ((m) & NSShiftKeyMask) && \
    ((m) & NSFunctionKeyMask))) ? NO : YES)

- (BOOL) menuHasKeyEquivalent: (NSMenu *) menu forEvent: (NSEvent *) event
	target: (id *) target action: (SEL *) action
{
    /*Use lowercaseString to keep "shift" from firing twice if bound to different procedure.*/
    NSString *key = [[event charactersIgnoringModifiers] lowercaseString];
    NSUInteger modifiers = [event modifierFlags] &
	    NSDeviceIndependentModifierFlagsMask;

    if (modifiers == (NSCommandKeyMask | NSShiftKeyMask) &&
	    [key compare:@"?"] == NSOrderedSame) {
	return NO;
    }

    // For command key, take input manager's word so things
    // like dvorak / qwerty layout work.
    if (([event modifierFlags] & NSCommandKeyMask) == NSCommandKeyMask) {
      key = [event characters];
    }

    NSArray *itemArray = [self itemArray];

    for (NSMenuItem *item in itemArray) {
	if ([item isEnabled] && [[item keyEquivalent] compare:key] ==
		NSOrderedSame) {
	    NSUInteger keyEquivModifiers = [item keyEquivalentModifierMask];

	    if (keyEquivModifiersMatch(keyEquivModifiers, modifiers)) {
		*target = [item target];
		*action = [item action];
		return YES;
	    }
	}
    }
    return NO;
}

- (void) menuWillOpen: (NSMenu *) menu
{
    if (_tkMenu) {
	//RecursivelyClearActiveMenu(_tkMenu);
	GenerateMenuSelectEvent((TKMenu *)[self supermenu],
		[self itemInSupermenu]);
    }
}

- (void) menuDidClose: (NSMenu *) menu
{
    if (_tkMenu) {
	RecursivelyClearActiveMenu(_tkMenu);
    }
}

- (void) menu: (NSMenu *) menu willHighlightItem: (NSMenuItem *) item
{
    if (_tkMenu) {
	GenerateMenuSelectEvent(self, item);
    }
}

- (void) menuNeedsUpdate: (NSMenu *) menu
{
    TkMenu *menuPtr = (TkMenu *) _tkMenu;

    if (menuPtr) {
	Tcl_Interp *interp = menuPtr->interp;

	Tcl_Preserve(interp);
	Tcl_Preserve(menuPtr);

	int result = TkPostCommand(_tkMenu);

	if (result!=TCL_OK && result!=TCL_CONTINUE && result!=TCL_BREAK) {
	      Tcl_AddErrorInfo(interp, "\n    (menu preprocess)");
	      Tcl_BackgroundException(interp, result);
	}
	Tcl_Release(menuPtr);
	Tcl_Release(interp);
    }
}
@end

#pragma mark TKApplication(TKMenu)

@interface NSApplication(TKMenu)
- (void) setAppleMenu: (NSMenu *) menu;
@end

@implementation TKApplication(TKMenu)

- (void) safeSetMainMenu: (NSMenu *) menu
{
    NSAutoreleasePool* pool = [NSAutoreleasePool new];
    [self setMainMenu: menu];
    [pool drain];
}

- (void) menuBeginTracking: (NSNotification *) notification
{
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
    TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
#endif
    //TkMacOSXClearMenubarActive();
    //TkMacOSXPreprocessMenu();
}

- (void) menuEndTracking: (NSNotification *) notification
{
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
    TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
#endif
    if (!inPostMenu) {
	TkMacOSXClearMenubarActive();
    }
}

- (void) tkSetMainMenu: (TKMenu *) menu
{
    if (gNoTkMenus) {
	return;
    }

    TKMenu *applicationMenu = nil;

    if (menu) {
	NSMenuItem *applicationMenuItem = [menu numberOfItems] ?
		[menu itemAtIndex:0] : nil;

	if (![menu isSpecial:tkMainMenu]) {
	    TkMenuEntry *mePtr = (TkMenuEntry *)[applicationMenuItem tag];

	    if (!mePtr || !(mePtr->entryFlags & ENTRY_APPLE_MENU)) {
		applicationMenuItem = [NSMenuItem itemWithSubmenu:
			[[_defaultApplicationMenu copy] autorelease]];
		[menu insertItem:applicationMenuItem atIndex:0];
	    }
	    [menu setSpecial:tkMainMenu];
	}
	applicationMenu = (TKMenu *)[applicationMenuItem submenu];
	if (![applicationMenu isSpecial:tkApplicationMenu]) {
	    for (NSMenuItem *item in _defaultApplicationMenuItems) {
		[applicationMenu addItem:[[item copy] autorelease]];
	    }
	    [applicationMenu setSpecial:tkApplicationMenu];
	}

	NSArray *itemArray = [menu itemArray];

	for (NSMenuItem *item in itemArray) {
	    TkMenuEntry *mePtr = (TkMenuEntry *)[item tag];
	    TKMenu *submenu = (TKMenu *)[item submenu];

	    if (mePtr && submenu) {
		if ((mePtr->entryFlags & ENTRY_WINDOWS_MENU) &&
			![submenu isSpecial:tkWindowsMenu]) {
		    NSInteger index = 0;

		    for (NSMenuItem *i in _defaultWindowsMenuItems) {
			[submenu insertItem:[[i copy] autorelease] atIndex:
				index++];
		    }
		    [self setWindowsMenu:submenu];
		    [submenu setSpecial:tkWindowsMenu];
		} else if ((mePtr->entryFlags & ENTRY_HELP_MENU) &&
			![submenu isSpecial:tkHelpMenu]) {
		    NSInteger index = 0;

		    for (NSMenuItem *i in _defaultHelpMenuItems) {
			[submenu insertItem:[[i copy] autorelease] atIndex:
				index++];
		    }
		    [submenu setSpecial:tkHelpMenu];
		}
	    }
	}
    } else {
	menu = _defaultMainMenu;
	applicationMenu = _defaultApplicationMenu;
    }

    NSMenuItem *servicesMenuItem =
	    [applicationMenu itemWithTitle:@"Services"];

    if (servicesMenuItem && [servicesMenuItem submenu] != _servicesMenu) {
	[[_servicesMenu itemInSupermenu] setSubmenu:nil];
	[servicesMenuItem setSubmenu:_servicesMenu];
    }
    [self setAppleMenu:applicationMenu];
    [self safeSetMainMenu:menu];
}
@end

#pragma mark -

/*
 *----------------------------------------------------------------------
 *
 * TkpNewMenu --
 *
 *	Gets a new blank menu. Only the platform specific options are filled
 *	in.
 *
 * Results:
 *	Returns a standard Tcl error.
 *
 * Side effects:
 *	Allocates a NSMenu and puts it into the platformData field of the
 *	menuPtr.
 *
 *----------------------------------------------------------------------
 */

int
TkpNewMenu(
    TkMenu *menuPtr)		/* The common structure we are making the
				 * platform structure for. */
{
    TKMenu *menu = [[TKMenu alloc] initWithTkMenu:menuPtr];
    menuPtr->platformData = (TkMenuPlatformData) menu;
    CheckForSpecialMenu(menuPtr);
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
 * TkpDestroyMenu --
 *
 *	Destroys platform-specific menu structures.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	All platform-specific allocations are freed up.
 *
 *----------------------------------------------------------------------
 */

void
TkpDestroyMenu(
    TkMenu *menuPtr)		/* The common menu structure */
{
    NSMenu* nsmenu = (NSMenu*)(menuPtr->platformData);

    [nsmenu release];
    menuPtr->platformData = NULL;
}

/*
 *----------------------------------------------------------------------
 *
 * TkpMenuNewEntry --
 *
 *	Adds a pointer to a new menu entry structure with the platform-
 *	specific fields filled in. The Macintosh uses the platformEntryData
 *	field of the TkMenuEntry record.
 *
 * Results:
 *	Standard TCL error.
 *
 * Side effects:
 *	Storage gets allocated. New menu entry data is put into the
 *	platformEntryData field of the mePtr.
 *
 *----------------------------------------------------------------------
 */

int
TkpMenuNewEntry(
    TkMenuEntry *mePtr)		/* The menu we are adding an entry to */
{
    TKMenu *menu = (TKMenu *) mePtr->menuPtr->platformData;
    NSMenuItem *menuItem;
    if (mePtr->type == SEPARATOR_ENTRY || mePtr->type == TEAROFF_ENTRY) {
	menuItem = [[NSMenuItem separatorItem] retain];
    } else {
	menuItem = [menu newTkMenuItem:mePtr];
    }
    mePtr->platformEntryData = (TkMenuPlatformEntryData) menuItem;

    /*
     * Caller TkMenuEntry() already did this same insertion into the generic
     * TkMenu so we just match it for the platform menu.
     */

    [menu insertItem:menuItem atTkIndex:mePtr->index];
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
 * TkpConfigureMenuEntry --
 *
 *	Processes configurations for menu entries.
 *
 * Results:
 *	Returns standard TCL result. If TCL_ERROR is returned, then the
 *	interp's result contains an error message.
 *
 * Side effects:
 *	Configuration information get set for mePtr; old resources get freed,
 *	if any need it.
 *
 *----------------------------------------------------------------------
 */

int
TkpConfigureMenuEntry(
    TkMenuEntry *mePtr) 	/* Information about menu entry; may or may
				 * not already have values for some fields. */
{
    NSMenuItem *menuItem = (NSMenuItem *) mePtr->platformEntryData;
    NSString *title = @"";
    NSAttributedString *attributedTitle = nil;
    NSImage *image = nil;
    NSString *keyEquivalent = @"";
    NSUInteger modifierMask = NSCommandKeyMask;
    NSMenu *submenu = nil;
    NSDictionary *attributes;
    int imageWidth, imageHeight;
    GC gc = (mePtr->textGC ? mePtr->textGC : mePtr->menuPtr->textGC);
    Tcl_Obj *fontPtr = (mePtr->fontPtr ? mePtr->fontPtr :
	    mePtr->menuPtr->fontPtr);

    if (mePtr->image) {
    	Tk_SizeOfImage(mePtr->image, &imageWidth, &imageHeight);
	image = TkMacOSXGetNSImageWithTkImage(mePtr->menuPtr->display,
		mePtr->image, imageWidth, imageHeight);
    } else if (mePtr->bitmapPtr != None) {
	Pixmap bitmap = Tk_GetBitmapFromObj(mePtr->menuPtr->tkwin,
		mePtr->bitmapPtr);

	Tk_SizeOfBitmap(mePtr->menuPtr->display, bitmap, &imageWidth,
		&imageHeight);
	image = TkMacOSXGetNSImageWithBitmap(mePtr->menuPtr->display, bitmap,
		gc, imageWidth, imageHeight);
    }
    [menuItem setImage:image];
    if ((!image || mePtr->compound != COMPOUND_NONE) && mePtr->labelPtr &&
	    mePtr->labelLength) {
	title = [[[NSString alloc] initWithBytes:Tcl_GetString(mePtr->labelPtr)
		length:mePtr->labelLength encoding:NSUTF8StringEncoding]
		autorelease];
	if ([title hasSuffix:@"..."]) {
	    title = [NSString stringWithFormat:@"%@%C",
		    [title substringToIndex:[title length] - 3], 0x2026];
	}
    }
    [menuItem setTitle:title];
    if (strcmp(Tcl_GetString(fontPtr), "menu") || gc->foreground != defaultFg
	    || gc->background != defaultBg) {
	attributes = TkMacOSXNSFontAttributesForFont(Tk_GetFontFromObj(
		mePtr->menuPtr->tkwin, fontPtr));
	if (gc->foreground != defaultFg || gc->background != defaultBg) {
	    NSColor *color = TkMacOSXGetNSColor(gc,
		    gc->foreground!=defaultFg? gc->foreground:gc->background);

	    attributes = [[attributes mutableCopy] autorelease];
	    [(NSMutableDictionary *)attributes setObject:color
		    forKey:NSForegroundColorAttributeName];
	}
	if (attributes) {
	    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)];
    if (mePtr->type != CASCADE_ENTRY && mePtr->accelPtr && mePtr->accelLength) {
	keyEquivalent = ParseAccelerator(Tcl_GetString(mePtr->accelPtr),
		&modifierMask);
    }
    [menuItem setKeyEquivalent:keyEquivalent];
    [menuItem setKeyEquivalentModifierMask:modifierMask];
    if (mePtr->type == CASCADE_ENTRY && mePtr->namePtr) {
	TkMenuReferences *menuRefPtr;

	menuRefPtr = TkFindMenuReferencesObj(mePtr->menuPtr->interp,
		mePtr->namePtr);
	if (menuRefPtr && menuRefPtr->menuPtr) {
	    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
		 * setting, it will be changed shortly (c.f. tkMenu.c
		 * CloneMenu())
		 */

		submenu = nil;
	    } else {
		[submenu setTitle:title];

    		if ([menuItem isEnabled]) {
		  /* This menuItem might have been previously disabled (XXX:
		     track this), which would have disabled entries; we must
		     re-enable the entries here. */
		  int i = 0;
		  NSArray *itemArray = [submenu itemArray];
		  for (NSMenuItem *item in itemArray) {
		    TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i];
		    /* Work around an apparent bug where itemArray can have
		       more items than the menu's entries[] array. */
		    if (i >= menuRefPtr->menuPtr->numEntries) break;
		    [item setEnabled: !(submePtr->state == ENTRY_DISABLED)];
		    i++;
		  }
		}

	    }
	}
    }
    [menuItem setSubmenu:submenu];

    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
 * TkpDestroyMenuEntry --
 *
 *	Cleans up platform-specific menu entry items.
 *
 * Results:
 *	None
 *
 * Side effects:
 *	All platform-specific allocations are freed up.
 *
 *----------------------------------------------------------------------
 */

void
TkpDestroyMenuEntry(
    TkMenuEntry *mePtr)
{
    NSMenuItem *menuItem;
    TKMenu *menu;
    NSInteger index;

    if (mePtr->platformEntryData && mePtr->menuPtr->platformData) {
	menu = (TKMenu *) mePtr->menuPtr->platformData;
	menuItem = (NSMenuItem *) mePtr->platformEntryData;
	index = [menu indexOfItem:menuItem];

	if (index > -1) {
	    [menu removeItemAtIndex:index];
	}
	[menuItem release];
	mePtr->platformEntryData = NULL;
    }
}

/*
 *----------------------------------------------------------------------
 *
 * TkpPostMenu --
 *
 *	Posts a menu on the screen
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The menu is posted and handled.
 *
 *----------------------------------------------------------------------
 */

int
TkpPostMenu(
    Tcl_Interp *interp,		/* The interpreter this menu lives in */
    TkMenu *menuPtr,		/* The menu we are posting */
    int x,			/* The global x-coordinate of the top, left-
				 * hand corner of where the menu is supposed
				 * to be posted. */
    int y)			/* The global y-coordinate */
{

    /* Get the object that holds this Tk Window.*/
    Tk_Window root;
    root = Tk_MainWindow(interp);
    if (root == NULL) {
	return TCL_ERROR;
    }

    Drawable d = Tk_WindowId(root);
    NSView *rootview = TkMacOSXGetRootControl(d);
    NSWindow *win = [rootview window];

    inPostMenu = 1;

    int oldMode = Tcl_SetServiceMode(TCL_SERVICE_NONE);
    NSView *view = [win contentView];
    NSRect frame = NSMakeRect(x + 9, tkMacOSXZeroScreenHeight - y - 9, 1, 1);

    frame.origin = [view convertPoint:
	    [win convertScreenToBase:frame.origin] fromView:nil];

    NSMenu *menu = (NSMenu *) menuPtr->platformData;
    NSPopUpButtonCell *popUpButtonCell = [[NSPopUpButtonCell alloc]
	    initTextCell:@"" pullsDown:NO];

    [popUpButtonCell setAltersStateOfSelectedItem:NO];
    [popUpButtonCell setMenu:menu];
    [popUpButtonCell selectItem:nil];
    [popUpButtonCell performClickWithFrame:frame inView:view];
    [popUpButtonCell release];
    Tcl_SetServiceMode(oldMode);
    inPostMenu = 0;
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
 * TkpSetWindowMenuBar --
 *
 *	Associates a given menu with a window.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	On Windows and UNIX, associates the platform menu with the platform
 *	window.
 *
 *----------------------------------------------------------------------
 */

void
TkpSetWindowMenuBar(
    Tk_Window tkwin,		/* The window we are setting the menu in */
    TkMenu *menuPtr)		/* The menu we are setting */
{
    TkWindow *winPtr = (TkWindow *) tkwin;

    if (winPtr->wmInfoPtr) {
	winPtr->wmInfoPtr->menuPtr = menuPtr;
    }
}

/*
 *----------------------------------------------------------------------
 *
 * TkpSetMainMenubar --
 *
 *	Puts the menu associated with a window into the menubar. Should only
 *	be called when the window is in front.
 *
 *      This is a no-op on all other platforms.  On OS X it is a no-op when
 *      passed a NULL menuName or a nonexistent menuName, with an exception
 *      for the first call in a new interpreter.  In that special case, passing a
 *      NULL menuName installs the default menu.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The menubar may be changed.
 *
 *----------------------------------------------------------------------
 */

void
TkpSetMainMenubar(
    Tcl_Interp *interp,		/* The interpreter of the application */
    Tk_Window tkwin,		/* The frame we are setting up */
    const char *menuName)	/* The name of the menu to put in front. */
{
    static Tcl_Interp *currentInterp = NULL;
    TKMenu *menu = nil;

    if (menuName) {
	TkWindow *winPtr = (TkWindow *) tkwin;

	if (winPtr->wmInfoPtr && winPtr->wmInfoPtr->menuPtr &&
		winPtr->wmInfoPtr->menuPtr->masterMenuPtr &&
		winPtr->wmInfoPtr->menuPtr->masterMenuPtr->tkwin &&
		!strcmp(menuName, Tk_PathName(
		winPtr->wmInfoPtr->menuPtr->masterMenuPtr->tkwin))) {
	    menu = (TKMenu *) winPtr->wmInfoPtr->menuPtr->platformData;
	} else {
	    TkMenuReferences *menuRefPtr = TkFindMenuReferences(interp,
		    menuName);

	    if (menuRefPtr && menuRefPtr->menuPtr &&
		    menuRefPtr->menuPtr->platformData) {
		menu = (TKMenu *) menuRefPtr->menuPtr->platformData;
	    }
	}
    }
    if (menu || interp != currentInterp) {
	[NSApp tkSetMainMenu:menu];
    }
    currentInterp = interp;
}

/*
 *----------------------------------------------------------------------
 *
 * CheckForSpecialMenu --
 *
 *	Given a menu, check to see whether or not it is a cascade in a menubar
 *	with one of the special names .apple, .help or .window If it is, the
 *	entry that points to this menu will be marked.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Will set entryFlags appropriately.
 *
 *----------------------------------------------------------------------
 */

static void
CheckForSpecialMenu(
    TkMenu *menuPtr)		/* The menu we are checking */
{
    if (!menuPtr->masterMenuPtr->tkwin) {
	return;
    }
    for (TkMenuEntry *cascadeEntryPtr = menuPtr->menuRefPtr->parentEntryPtr;
	    cascadeEntryPtr;
	    cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr) {
	if (cascadeEntryPtr->menuPtr->menuType == MENUBAR
		&& cascadeEntryPtr->menuPtr->masterMenuPtr->tkwin) {
	    TkMenu *masterMenuPtr = cascadeEntryPtr->menuPtr->masterMenuPtr;
	    int i = 0;
	    Tcl_DString ds;

	    Tcl_DStringInit(&ds);
	    Tcl_DStringAppend(&ds, Tk_PathName(masterMenuPtr->tkwin), -1);
	    while (specialMenus[i].name) {
		Tcl_DStringAppend(&ds, specialMenus[i].name,
			specialMenus[i].len);
		if (strcmp(Tcl_DStringValue(&ds),
			Tk_PathName(menuPtr->masterMenuPtr->tkwin)) == 0) {
		    cascadeEntryPtr->entryFlags |= specialMenus[i].flag;
		} else {
		    cascadeEntryPtr->entryFlags &= ~specialMenus[i].flag;
		}
		Tcl_DStringSetLength(&ds, Tcl_DStringLength(&ds) -
			specialMenus[i].len);
		i++;
	    }
	    Tcl_DStringFree(&ds);
	}
    }
}

/*
 *----------------------------------------------------------------------
 *
 * ParseAccelerator --
 *
 *	Parse accelerator string.
 *
 * Results:
 *	Accelerator string & flags.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

static NSString *
ParseAccelerator(
    const char *accel,
    NSUInteger *maskPtr)
{
    unichar ch = 0;
    size_t len;
    int i;

    *maskPtr = 0;
    while (1) {
	i = 0;
	while (modifiers[i].name) {
	    int l = modifiers[i].len;

	    if (!strncasecmp(accel, modifiers[i].name, l) &&
		    (accel[l] == '-' || accel[l] == '+')) {
		*maskPtr |= modifiers[i].mask;
		accel += l+1;
		break;
	    }
	    i++;
	}
	if (!modifiers[i].name || !*accel) {
	    break;
	}
    }
    len = strlen(accel);
    if (len > 1) {
	i = 0;
	if (accel[0] == 'F' && len < 4 && accel[1] > '0' && accel[1] <= '9') {
	    int fkey = accel[1] - '0';

	    if (len == 3) {
		if (accel[2] >= '0' && accel[2] <= '9') {
		    fkey = 10 * fkey + (accel[2] - '0');
		} else {
		    fkey = 0;
		}
	    }
	    if (fkey >= 1 && fkey <= 15) {
		ch = NSF1FunctionKey + fkey - 1;
	    }
	} else while (specialAccelerators[i].name) {
	    if (accel[0] == specialAccelerators[i].name[0] &&
		    len == specialAccelerators[i].len && !strncasecmp(accel,
		    specialAccelerators[i].name, specialAccelerators[i].len)) {
		ch = specialAccelerators[i].ch;
		break;
	    }
	    i++;
	}
    }
    if (ch) {
	return [[[NSString alloc] initWithCharacters:&ch length:1] autorelease];
    } else {
	return [[[[NSString alloc] initWithUTF8String:accel] autorelease]
		lowercaseString];
    }
}

/*
 *--------------------------------------------------------------
 *
 * ModifierCharWidth --
 *
 *	Helper mesuring width of command char in given font.
 *
 * Results:
 *	Width of command char.
 *
 * Side effects:
 *	None.
 *
 *--------------------------------------------------------------
 */

static int
ModifierCharWidth(
    Tk_Font tkfont)
{
    static NSString *cmdChar = nil;

    if (!cmdChar) {
	unichar cmd = kCommandUnicode;

	cmdChar = [[NSString alloc] initWithCharacters:&cmd length:1];
    }
    return [cmdChar sizeWithAttributes:
	    TkMacOSXNSFontAttributesForFont(tkfont)].width;
}

/*
 *--------------------------------------------------------------
 *
 * TkpComputeStandardMenuGeometry --
 *
 *	This procedure is invoked to recompute the size and layout of a menu
 *	that is not a menubar clone.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Fields of menu entries are changed to reflect their current positions,
 *	and the size of the menu window itself may be changed.
 *
 *--------------------------------------------------------------
 */

void
TkpComputeStandardMenuGeometry(
    TkMenu *menuPtr)		/* Structure describing menu. */
{
    Tk_Font tkfont, menuFont;
    Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr;
    int modifierCharWidth, menuModifierCharWidth;
    int x, y, modifierWidth, labelWidth, indicatorSpace;
    int windowWidth, windowHeight, accelWidth;
    int i, j, lastColumnBreak, maxWidth;
    int entryWidth, maxIndicatorSpace, borderWidth, activeBorderWidth;
    TkMenuEntry *mePtr, *columnEntryPtr;
    int haveAccel = 0;

    if (menuPtr->tkwin == NULL) {
	return;
    }

    Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
	    &borderWidth);
    Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr,
	    &activeBorderWidth);
    x = y = borderWidth;
    windowHeight = maxWidth = lastColumnBreak = 0;
    maxIndicatorSpace = 0;

    /*
     * On the Mac especially, getting font metrics can be quite slow, so we
     * want to do it intelligently. We are going to precalculate them and pass
     * them down to all of the measuring and drawing routines. We will measure
     * the font metrics of the menu once. If an entry does not have its own
     * font set, then we give the geometry/drawing routines the menu's font
     * and metrics. If an entry has its own font, we will measure that font
     * and give all of the geometry/drawing the entry's font and metrics.
     */

    menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
    Tk_GetFontMetrics(menuFont, &menuMetrics);
    menuModifierCharWidth = ModifierCharWidth(menuFont);

    for (i = 0; i < menuPtr->numEntries; i++) {
	mePtr = menuPtr->entries[i];
	if (mePtr->type == CASCADE_ENTRY || mePtr->accelLength > 0) {
	    haveAccel = 1;
	    break;
	}
    }

    for (i = 0; i < menuPtr->numEntries; i++) {
	mePtr = menuPtr->entries[i];
	if (mePtr->fontPtr == NULL) {
	    tkfont = menuFont;
	    fmPtr = &menuMetrics;
	    modifierCharWidth = menuModifierCharWidth;
	} else {
	    tkfont = Tk_GetFontFromObj(menuPtr->tkwin, mePtr->fontPtr);
	    Tk_GetFontMetrics(tkfont, &entryMetrics);
	    fmPtr = &entryMetrics;
	    modifierCharWidth = ModifierCharWidth(tkfont);
	}

	if ((i > 0) && mePtr->columnBreak) {
	    if (maxIndicatorSpace != 0) {
		maxIndicatorSpace += 2;
	    }
	    for (j = lastColumnBreak; j < i; j++) {
		columnEntryPtr = menuPtr->entries[j];
		columnEntryPtr->indicatorSpace = maxIndicatorSpace;
		columnEntryPtr->width = maxIndicatorSpace + maxWidth
			+ 2 * activeBorderWidth;
		columnEntryPtr->x = x;
		columnEntryPtr->entryFlags &= ~ENTRY_LAST_COLUMN;
	    }
	    x += maxIndicatorSpace + maxWidth + 2 * borderWidth;
	    maxWidth = maxIndicatorSpace = 0;
	    lastColumnBreak = i;
	    y = borderWidth;
	}
	accelWidth = modifierWidth = indicatorSpace = 0;
	if (mePtr->type == SEPARATOR_ENTRY || mePtr->type == TEAROFF_ENTRY) {
	    mePtr->height = menuSeparatorHeight;
	} else {
	    /*
	     * For each entry, compute the height required by that particular
	     * entry, plus three widths: the width of the label, the width to
	     * allow for an indicator to be displayed to the left of the label
	     * (if any), and the width of the accelerator to be displayed to
	     * the right of the label (if any). These sizes depend, of course,
	     * on the type of the entry.
	     */

	    NSMenuItem *menuItem = (NSMenuItem *) mePtr->platformEntryData;
	    int haveImage = 0, width = 0, height = 0;

	    if (mePtr->image) {
		Tk_SizeOfImage(mePtr->image, &width, &height);
		haveImage = 1;
	    } else if (mePtr->bitmapPtr) {
		Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin,
			mePtr->bitmapPtr);

		Tk_SizeOfBitmap(menuPtr->display, bitmap, &width, &height);
		haveImage = 1;
	    }
	    if (!haveImage || (mePtr->compound != COMPOUND_NONE)) {
		NSAttributedString *attrTitle = [menuItem attributedTitle];
		NSSize size;

		if (attrTitle) {
		    size = [attrTitle size];
		} else {
		    size = [[menuItem title] sizeWithAttributes:
			TkMacOSXNSFontAttributesForFont(tkfont)];
		}
		size.width += menuTextLeadingEdgeMargin +
			menuTextTrailingEdgeMargin;
		if (size.height < fmPtr->linespace) {
		    size.height = fmPtr->linespace;
		}
		if (haveImage && (mePtr->compound != COMPOUND_NONE)) {
		    int margin = width + menuIconTrailingEdgeMargin;

		    if (margin > menuTextLeadingEdgeMargin) {
			margin = menuTextLeadingEdgeMargin;
		    }
		    width += size.width + menuIconTrailingEdgeMargin - margin;
		    if (size.height > height) {
			height = size.height;
		    }
		} else {
		    width = size.width;
		    height = size.height;
		}
	    }
	    labelWidth = width + menuItemExtraWidth;
	    mePtr->height = height + menuItemExtraHeight;

	    if (mePtr->type == CASCADE_ENTRY) {
		modifierWidth = modifierCharWidth;
	    } else if (mePtr->accelLength == 0) {
		if (haveAccel && !mePtr->hideMargin) {
		    modifierWidth = modifierCharWidth;
		}
	    } else {
		NSUInteger modifMask = [menuItem keyEquivalentModifierMask];
		int i = 0;

		while (modifiers[i].name) {
		    if (modifMask & modifiers[i].mask) {
			modifMask &= ~modifiers[i].mask;
			modifierWidth += modifierCharWidth;
		    }
		    i++;
		}
		accelWidth = [[menuItem keyEquivalent] sizeWithAttributes:
			TkMacOSXNSFontAttributesForFont(tkfont)].width;
	    }
	    if (!mePtr->hideMargin) {
		indicatorSpace = menuMarkColumnWidth;
	    }
	    if (indicatorSpace > maxIndicatorSpace) {
		maxIndicatorSpace = indicatorSpace;
	    }
	    entryWidth = labelWidth + modifierWidth + accelWidth;
	    if (entryWidth > maxWidth) {
		maxWidth = entryWidth;
	    }
	    mePtr->height += 2 * activeBorderWidth;
	}
	mePtr->y = y;
	y += menuPtr->entries[i]->height + borderWidth;
	if (y > windowHeight) {
	    windowHeight = y;
	}
    }

    for (j = lastColumnBreak; j < menuPtr->numEntries; j++) {
	columnEntryPtr = menuPtr->entries[j];
	columnEntryPtr->indicatorSpace = maxIndicatorSpace;
	columnEntryPtr->width = maxIndicatorSpace + maxWidth
		+ 2 * activeBorderWidth;
	columnEntryPtr->x = x;
	columnEntryPtr->entryFlags |= ENTRY_LAST_COLUMN;
    }
    windowWidth = x + maxIndicatorSpace + maxWidth
	    + 2 * activeBorderWidth + borderWidth;
    windowHeight += borderWidth;

    if (windowWidth <= 0) {
	windowWidth = 1;
    }
    if (windowHeight <= 0) {
	windowHeight = 1;
    }
    menuPtr->totalWidth = windowWidth;
    menuPtr->totalHeight = windowHeight;
}

/*
 *----------------------------------------------------------------------
 *
 * GenerateMenuSelectEvent --
 *
 *	Respond to a menu item being selected.
 *
 * Results:
 *	True if event(s) are generated - false otherwise.
 *
 * Side effects:
 *	Places a virtual event on the event queue.
 *
 *----------------------------------------------------------------------
 */

int
GenerateMenuSelectEvent(
    TKMenu *menu,
    NSMenuItem *menuItem)
{
    TkMenu *menuPtr = [menu tkMenu];

    if (menuPtr) {
	int index = [menu tkIndexOfItem:menuItem];

	if (index < 0 || index >= menuPtr->numEntries ||
		(menuPtr->entries[index])->state == ENTRY_DISABLED) {
	    TkActivateMenuEntry(menuPtr, -1);
	} else {
	    TkActivateMenuEntry(menuPtr, index);
	    MenuSelectEvent(menuPtr);
	    return true;
	}
    }
    return false;
}

/*
 *----------------------------------------------------------------------
 *
 * MenuSelectEvent --
 *
 *	Generates a "MenuSelect" virtual event. This can be used to do
 *	context-sensitive menu help.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Places a virtual event on the event queue.
 *
 *----------------------------------------------------------------------
 */

void
MenuSelectEvent(
    TkMenu *menuPtr)		/* the menu we have selected. */
{
    XVirtualEvent event;

    bzero(&event, sizeof(XVirtualEvent));
    event.type = VirtualEvent;
    event.serial = LastKnownRequestProcessed(menuPtr->display);
    event.send_event = false;
    event.display = menuPtr->display;
    event.event = Tk_WindowId(menuPtr->tkwin);
    event.root = XRootWindow(menuPtr->display, 0);
    event.subwindow = None;
    event.time = TkpGetMS();
    XQueryPointer(NULL, None, NULL, NULL, &event.x_root, &event.y_root, NULL,
	    NULL, &event.state);
    event.same_screen = true;
    event.name = Tk_GetUid("MenuSelect");
    Tk_MakeWindowExist(menuPtr->tkwin);
    if (Tcl_GetServiceMode() != TCL_SERVICE_NONE) {
	Tk_HandleEvent((XEvent *) &event);
    } else {
	Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL);
    }
}

/*
 *----------------------------------------------------------------------
 *
 * RecursivelyClearActiveMenu --
 *
 *	Recursively clears the active entry in the menu's cascade hierarchy.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Generates <<MenuSelect>> virtual events.
 *
 *----------------------------------------------------------------------
 */

void
RecursivelyClearActiveMenu(
    TkMenu *menuPtr)		/* The menu to reset. */
{
    int i;

    TkActivateMenuEntry(menuPtr, -1);
    for (i = 0; i < menuPtr->numEntries; i++) {
	TkMenuEntry *mePtr = menuPtr->entries[i];

	if (mePtr->type == CASCADE_ENTRY
		&& (mePtr->childMenuRefPtr != NULL)
		&& (mePtr->childMenuRefPtr->menuPtr != NULL)) {
	    RecursivelyClearActiveMenu(mePtr->childMenuRefPtr->menuPtr);
	}
    }
}

/*
 *----------------------------------------------------------------------
 *
 * TkMacOSXClearMenubarActive --
 *
 *	Recursively clears the active entry in the current menubar hierarchy.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Generates <<MenuSelect>> virtual events.
 *
 *----------------------------------------------------------------------
 */

void
TkMacOSXClearMenubarActive(void)
{
    NSMenu *mainMenu = [NSApp mainMenu];

    if (mainMenu && [mainMenu isKindOfClass:[TKMenu class]]) {
	TkMenu *menuPtr = [(TKMenu *) mainMenu tkMenu];

	if (menuPtr && menuPtr->numEntries && menuPtr->entries) {
	    RecursivelyClearActiveMenu(menuPtr);
	}
    }
}

/*
 *----------------------------------------------------------------------
 *
 * Tk_MacOSXTurnOffMenus --
 *
 *	Turns off all the menu drawing code. This is more than just disabling
 *	the "menu" command, this means that Tk will NEVER touch the menubar.
 *	It is needed in the Plugin, where Tk does not own the menubar.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	A flag is set which will disable all menu drawing.
 *
 *----------------------------------------------------------------------
 */

void
Tk_MacOSXTurnOffMenus(void)
{
    gNoTkMenus = 1;
}

/*
 *----------------------------------------------------------------------
 *
 * TkpMenuInit --
 *
 *	Initializes Mac-specific menu data.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Allocates a hash table.
 *
 *----------------------------------------------------------------------
 */

void
TkpMenuInit(void)
{
    TkColor *tkColPtr;

    NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];

#define observe(n, s) \
	[nc addObserver:NSApp selector:@selector(s) name:(n) object:nil]
    observe(NSMenuDidBeginTrackingNotification, menuBeginTracking:);
    observe(NSMenuDidEndTrackingNotification, menuEndTracking:);
#undef observe

    [NSMenuItem setUsesUserKeyEquivalents:NO];
    tkColPtr = TkpGetColor(None, DEF_MENU_BG_COLOR);
    defaultBg = tkColPtr->color.pixel;
    ckfree(tkColPtr);
    tkColPtr = TkpGetColor(None, DEF_MENU_FG);
    defaultFg = tkColPtr->color.pixel;
    ckfree(tkColPtr);

    ChkErr(GetThemeMetric, kThemeMetricMenuMarkColumnWidth,
	    &menuMarkColumnWidth);
    ChkErr(GetThemeMetric, kThemeMetricMenuTextLeadingEdgeMargin,
	    &menuTextLeadingEdgeMargin);
    ChkErr(GetThemeMetric, kThemeMetricMenuTextTrailingEdgeMargin,
	    &menuTextTrailingEdgeMargin);
    ChkErr(GetThemeMetric, kThemeMetricMenuIconTrailingEdgeMargin,
	    &menuIconTrailingEdgeMargin);
    ChkErr(GetThemeMenuItemExtra, kThemeMenuItemPlain, &menuItemExtraHeight,
	    &menuItemExtraWidth);
    ChkErr(GetThemeMenuSeparatorHeight, &menuSeparatorHeight);
}

#pragma mark -
#pragma mark NOPs

/*
 *----------------------------------------------------------------------
 *
 * TkpMenuThreadInit --
 *
 *	Does platform-specific initialization of thread-specific menu state.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

void
TkpMenuThreadInit(void)
{
    /*
     * Nothing to do.
     */
}

/*
 *----------------------------------------------------------------------
 *
 * TkpMenuNotifyToplevelCreate --
 *
 *	This routine reconfigures the menu and the clones indicated by
 *	menuName because a toplevel has been created and any system menus need
 *	to be created. Only applicable to Windows.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	An idle handler is set up to do the reconfiguration.
 *
 *----------------------------------------------------------------------
 */

void
TkpMenuNotifyToplevelCreate(
    Tcl_Interp *interp,		/* The interp the menu lives in. */
    const char *menuName)	/* The name of the menu to reconfigure. */
{
    /*
     * Nothing to do.
     */
}

/*
 *--------------------------------------------------------------
 *
 * TkpInitializeMenuBindings --
 *
 *	For every interp, initializes the bindings for Windows menus. Does
 *	nothing on Mac or XWindows.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	C-level bindings are setup for the interp which will handle Alt-key
 *	sequences for menus without beeping or interfering with user-defined
 *	Alt-key bindings.
 *
 *--------------------------------------------------------------
 */

void
TkpInitializeMenuBindings(
    Tcl_Interp *interp,		/* The interpreter to set. */
    Tk_BindingTable bindingTable)
				/* The table to add to. */
{
    /*
     * Nothing to do.
     */
}

/*
 *--------------------------------------------------------------
 *
 * TkpComputeMenubarGeometry --
 *
 *	This procedure is invoked to recompute the size and layout of a menu
 *	that is a menubar clone.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Fields of menu entries are changed to reflect their current positions,
 *	and the size of the menu window itself may be changed.
 *
 *--------------------------------------------------------------
 */

void
TkpComputeMenubarGeometry(
    TkMenu *menuPtr)		/* Structure describing menu. */
{
    TkpComputeStandardMenuGeometry(menuPtr);
}

/*
 *----------------------------------------------------------------------
 *
 * TkpDrawMenuEntry --
 *
 *	Draws the given menu entry at the given coordinates with the given
 *	attributes.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	X Server commands are executed to display the menu entry.
 *
 *----------------------------------------------------------------------
 */

void
TkpDrawMenuEntry(
    TkMenuEntry *mePtr,		/* The entry to draw */
    Drawable d,			/* What to draw into */
    Tk_Font tkfont,		/* Precalculated font for menu */
    const Tk_FontMetrics *menuMetricsPtr,
				/* Precalculated metrics for menu */
    int x,			/* X-coordinate of topleft of entry */
    int y,			/* Y-coordinate of topleft of entry */
    int width,			/* Width of the entry rectangle */
    int height,			/* Height of the current rectangle */
    int strictMotif,		/* Boolean flag */
    int drawArrow)		/* Whether or not to draw the cascade arrow
				 * for cascade items. Only applies to
				 * Windows. */
{
}

#pragma mark Obsolete

/*
 *----------------------------------------------------------------------
 *
 * TkMacOSXPreprocessMenu --
 *
 *    Handle preprocessing of menubar if it exists.
 *
 * Results:
 *    None.
 *
 * Side effects:
 *    All post commands for the current menubar get executed.
 *
 *----------------------------------------------------------------------
 */

void
TkMacOSXPreprocessMenu(void)
{
}

/*
 *----------------------------------------------------------------------
 *
 * TkMacOSXUseID --
 *
 *	Take the ID out of the available list for new menus. Used by the
 *	default menu bar's menus so that they do not get created at the tk
 *	level. See TkMacOSXGetNewMenuID for more information.
 *
 * Results:
 *	Returns TCL_OK if the id was not in use. Returns TCL_ERROR if the id
 *	was in use.
 *
 * Side effects:
 *	A hash table entry in the command table is created with a NULL value.
 *
 *----------------------------------------------------------------------
 */

int
TkMacOSXUseMenuID(
    short macID)		/* The id to take out of the table */
{
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
 * TkMacOSXDispatchMenuEvent --
 *
 *	Given a menu id and an item, dispatches the command associated with
 *	it.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Commands for the event are scheduled for execution at idle time.
 *
 *----------------------------------------------------------------------
 */

int
TkMacOSXDispatchMenuEvent(
    int menuID,			/* The menu id of the menu we are invoking */
    int index)			/* The one-based index of the item that was
				 * selected. */
{
    return TCL_ERROR;
}

/*
 *----------------------------------------------------------------------
 *
 * TkMacOSXHandleTearoffMenu() --
 *
 *	This routine sees if the MDEF has set a menu and a mouse position for
 *	tearing off and makes a tearoff menu if it has.
 *
 * Results:
 *	menuPtr->interp will have the result of the tearoff command.
 *
 * Side effects:
 *	A new tearoff menu is created if it is supposed to be.
 *
 *----------------------------------------------------------------------
 */

void
TkMacOSXHandleTearoffMenu(void)
{
    /*
     * Obsolete: Nothing to do.
     */
}

/*
 *----------------------------------------------------------------------
 *
 * TkMacOSXSetHelpMenuItemCount --
 *
 *	Has to be called after the first call to InsertMenu. Sets up the
 *	global variable for the number of items in the unmodified help menu.
 *	NB. Nobody uses this any more, since you can get the number of system
 *	help items from HMGetHelpMenu trivially. But it is in the stubs
 *	table...
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Nothing.
 *
 *----------------------------------------------------------------------
 */

void
TkMacOSXSetHelpMenuItemCount(void)
{
}

/*
 *----------------------------------------------------------------------
 *
 * TkMacOSXMenuClick --
 *
 *	Prepares a menubar for MenuSelect or MenuKey.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Any pending configurations of the menubar are completed.
 *
 *----------------------------------------------------------------------
 */

void
TkMacOSXMenuClick(void)
{
}

/*
 * Local Variables:
 * mode: objc
 * c-basic-offset: 4
 * fill-column: 79
 * coding: utf-8
 * End:
 */

redpajama_set_name: RedPajamaGithub


text:
CAUGHT BETWEEN A LIE AND TRUE LOVE BY SHEILA SEABROOK
4:22 pm 31 August 2015
OUT NOW!!!
READ AND REVIEW
Welcome to Serendipity Island and the Caught Between romance series.
Paige Calhoun has spent years concealing the truth about her family. She's got a new life now, centered around her daughter and her career, and there's no room in it for anything—or anyone—else. But when instincts honed at the side of her con-artist dad warn her that her grandma is in trouble, she returns to Serendipity Island...where every single lie she once told to protect her tender heart could be blown to smithereens.
Brody Jackson always thought of Paige Calhoun as the little girl next door. Three years her senior, his sights were set on a football scholarship, and fame and fortune as a pro quarterback. But now he's back home, his career down the tubes, battling the grandma from hell for permanent custody of his teenage daughter…all because of one careless mistake.
Brody's got no time for one hot woman who's messing with his mind and his future. And Paige can't afford to let one gorgeous man distract her from saving the residents of the island from her dad's latest scam. All they both want is a life free from the past. Instead, they're caught between the truth and true love…
This book includes a family-phobic heroine, a hunky hero whose luck—and love life—are about to change, lies, romance, chocolate chip cookies, nighttime shenanigans, a con-artist who swears he's gone straight, and a battle-of-the-sexes secondary romance.
Book 1 - Caught Between a Lie and True Love
Book 2 - Caught Between an Oops and a Hard Body
Amazon: http://www.amazon.com/Caught-Between-Lie-True-Love-ebook/dp/B00WOW1LK0/
REVIEW: CAUGHT BETWEEN A LIE AND TRUE LOVE BY SHEILA SEABROOK
Caught Between a Lie and True Love focuses on two people who are trying to make a fresh start. Brody and Paige are each working on making better decisions for the sake of those they love. The problem? Everything they are trying to distance themselves from is pulling them right back in. Sheila Seabrook did a good job of humanizing the main characters by showing emotional turmoil and growth throughout the story. My one irritant is that the story move along somewhat slow. I received a copy of this novel in exchange for and honest review.

redpajama_set_name: RedPajamaCommonCrawl


If you have been hurt in a car accident or other accident, you need more than just legal representation. You need to work with a lawyer you can trust, someone who truly cares about your situation and who knows how to get you the compensation you deserve.
At Kazerouni Law Group, APC, we fight aggressively on behalf of injured clients in Orange County and throughout California. From our Costa Mesa office, we combine experience, knowledge and an aggressive approach with a strong dedication to personalized service. When you work with Kazerouni Law Group, you will work with your attorney throughout your case, not an inexperienced associate or paralegal. We will walk you through every step of your case to make sure you get the results you need.
Motor vehicle accidents: We handle car accidents, truck accidents and any other type of accident involving a motor vehicle. Our lawyers take cases involving traumatic brain injuries, other serious injuries and wrongful death.
Dog bites: In most cases, pet owners are responsible for the actions of their pets. When a dog or other animal attacks, the pet owner is liable for the injuries and damages that result.
Premises liability: If there are dangerous conditions on a property that cause physical injuries or other damages to others on the property, the property owner is liable to cover the costs of those injuries and losses. This is true whether the property is a private residence or restaurant or other public establishment.
Product liability: Products are supposed to be reasonably safe when they enter the marketplace. If you have been harmed by a defective car, power tool or other product, our attorneys will fight to get you the compensation you need.
Talk with an attorney from our firm by calling 949-404-4228 or contact us online to schedule your free case evaluation with Kazerouni Law Group.
You will receive personal service and attention throughout your case from experienced attorneys. Learn about your rights and how we can protect you. Call 949-404-4228 to arrange a free evaluation with our lawyers or contact us online.


Jan 20 contacted Microsoft via chat , · FYI I have just had the same problem with Project today they attached a Project license to my account. The essentials to get it all done. How can I remove that program. Saw some bad reviews with download/ install issues so thought long hard before I took the plunge. It was released to manufacturing on August 27 reached general availability on October 17 about a year after the retail release of its predecessor.
Now see how you can get the Windows Photo Viewer in Windows 10. Problems installing microsoft office 2013 on windows 8 1.
Jul 07, · Step by Step Installing Lync Server Standard Edition Front End on Windows – Part 1. Office mail merge will not recognise an Excel data source. SharePoint Foundation is technically free ( well included in your existing Windows licenses) can do a whole lot for you without needing to spend significant amounts of money on Server editions. We sure wish Microsoft had official easy- to- read compatibility charts!
We are pretty sure we have found the resolution to this issue. Problems installing microsoft office 2013 on windows 8 1.
This item: Microsoft Office Home Business | 1 device Windows 10 PC/ Mac Key Card by Microsoft. Mar 09, · Office mail merge will not recognise an Excel data source.
Office Professional is for growing small businesses who want the classic Office apps plus Outlook OneDrive, Publisher Access 1. Aug 16 · Office is one of the best products ever released by Microsoft it can even be considered as a must- have for millions of users out there. Office 365 is a subscription that comes with premium apps like Word. A one- time purchase installed on 1 PC Mac for use at home school.
Problems installing microsoft office 2013 on windows 8 1. It was released to manufacturing on August 27 reached general availability on October 17 about a year after the retail release of its e along with me on a small adventure into the world of free SharePoint. Other people will be able to purchase download it in first quarter of ( most probably in end of January first week of February. Microsoft Office XP Professional and Microsoft Office XP Excel SP3.
I don' t use it and want stop it from running. 2 the problem was resolved.
Recently ( not sure exactly when) Microsoft release a MS Office update that removed support for RC4 ciphers in TLS1. Learn more about Windows installing upgrading with these comprehensive ction: Microsoft Windows Tutorial: Windows / Office Version Compatibility Chart Microsoft Office Version Windows Version Compatibility Chart. Read our Microsoft Office system requirements , · We understand that some users are having trouble installing Windows 7 by USB drive on their systems that have a GIGABYTE 100 series motherboard this article I will demonstrate the step by step process for installing cumulative updates , Office 365 Home FAQs for info on suitable devices service packs for Exchange Server. Windows Installing & Upgrading.
However some Office XP programs suites were shown to be compatible in the Windows Compatibility Center; e. Office Software Component Maximum Security Impact Aggregate Severity Rating Updates Replaced Microsoft Office Suites and Components Microsoft Office Service Pack 3.
There' s some really important fixes and some very interesting fixes that I' ve been waiting for. The first article in this series on Exchange Server Database Availability Groups provided an overview of Exchange DAG concepts. Step by step guide to installing an Exchange Server Database Availability v 18, · Hello.
1 is a personal computer operating system that was produced by Microsoft and released as part of the Windows NT family of operating systems. Learn more about Windows installing and upgrading with these comprehensive guides. He' s a Microsoft Certified Professional and works at Slalom Consulting as a SharePoint Architect.
What is Office 365 Home all about? A one- time purchase installed on one PC for use at work. Microsoft Security Bulletin MSCritical Vulnerabilities in Microsoft XML Core Services Could Allow Remote Code Execution.
10/ 11/ ; 123 minutes to read Contributors. We often hear: " Will Office run on my Windows 7 PC? Problems installing microsoft office 2013 on windows 8 1.
This type of installation utilizes a technology called Click- to- Run which in short, uses streaming technology to install Office over the Internet. Your Microsoft account is the combination of an email address Xbox LIVE, OneDrive, password that you use to sign in to services like Hotmail, Windows Phone . In this post we' ll take a look at the first Office Web Apps ( WAC) update.
The system requirements in the table below apply to Office 365 ProPlus education, as well as all business government plans. Download this article I will demonstrate the step by step process for installing cumulative updates and service packs for Exchange Server. Plenty of users have experienced issues when they attempt to install a Product Key Card version of Microsoft Office. We understand that some users are having trouble installing Windows 7 by USB drive on their systems that have a GIGABYTE 100 series motherboard inside.
Generally speaking, Click- to- Run installations of Office will work just fine. We know that Microsoft has finalized its latest Office suite " Office " which was codenamed as Office 15 the final RTM version of Office is available for download to MSDN TechNet subscribers. Windows 10 Excel , where products like Word PowerPoint will not [. If Excel starts in Safe mode, begin disabling add- ins one at a time. It is related to cipher support within MS Office itself.
Finally had to upgrade from my trusty old Office, as it won' t play well with Mojave. With Microsoft Office 20 Microsoft Office Upload Center runs automatically shows up in the system tray. Enjoy using Microsoft Office Picture Manager, even if you have Office installed on your Windows 10 computer. Security Bulletin. Office Home Excel , families who want classic Office apps including Word, Student is for students PowerPoint for Windows 10. " or " Can I install Office on Window 10? 1 was made available as a free upgrade for retail copies of Windows 8.
[ Direct Download Links] Microsoft Office Professional Plus Visio Project Free Trial - Recently we posted about the free 60- day trial version of Microsoft Office Professional Plus which was released by Microsoft for public. Applications such as Exchange Online Yammer, SharePoint Online, Project Online, Skype for Business Online, Visio Online Power BI are also covered.
The steps for installing cumulative updates and service packs on Exchange are:. FYI I have just had the same problem with Project today contacted Microsoft via chat they attached a Project license to my account so seems like they are still offering the free upgrades. We understand that some users are having trouble installing Windows 7 by USB drive on their systems that have a GIGABYTE 100 series motherboard this article I will demonstrate the step by step process for installing cumulative updates and service packs for Exchange Server. Troubleshoot startup problems in Excel. Should you upgrade to Windows 10? When we forced our server to use TLS1.
In this article we' ll go through the installation of a simple Exchange DAG with two members. Problems installing microsoft office 2013 on windows 8 1.
David is a lucky husband and proud father of 4 beautiful children. Office 365 is a subscription that comes with premium. Click on the File tab and then click Options. 1 They also apply to standalone plans for individual services such as email- only online meetings- only plans.
I' m really glad to see some patches being rolled out for Office SharePoint Office Web Apps.
Troubleshoot installing Office. check Office 365 service health Exchange end of support roadmap The issues you encounter when trying to install Office 365, or Office, or and how you fix them depends on whether your product is part of an Office for home or Office for business plan.
In addition, with Office for business plans only admins responsible for managing Office 365 in. microsoft office got uninstalled from my laptop, so when trying to download it, it is asking to sign in, but when i am sign in then it is asking to install it and when i am installing it the problem appears it shows that could not download it due to some network issue/ your internet connection is not p 17, · OK.
This is how to install Windows RT 8. 1 on the Surface RT.
Google ' DRIVERS FOR SURFACE RT ONLY_ _ _ MICROSOFT WINDOWS RT 8 1 WITH OFFICE RT RTM WOA ENGLISH DVD- WZT' and use a torrent program to download. [ Review] What' s New in Microsoft Office?


text:
package com.covoex.qarvox.Application;

import com.covoex.qarvox.Logic.Person;

import java.util.ArrayList;
import java.util.Collections;

import static com.covoex.qarvox.Application.Input.s;
import static com.covoex.qarvox.Application.Input.worldInput;
import static com.covoex.qarvox.Application.Tutorial.tutorial;

/**
 * @author Myeongjun Kim
 */

public class BasicFunction {
    public static Person mainCharacter = new Person();

    public static void programStart() {
        System.out.println("--------------------------------------------------------------");
        System.out.println("Qarvox is a text-based java RPG Game created by Myeongjun Kim.");
        System.out.println("--------------------------------------------------------------");
        System.out.println();
        System.out.print("Type in your character's name" + ": ");
        mainCharacter.setName(s.nextLine());
        System.out.println();
        System.out.print(
                "Do you want to play the tutorial? Press [y] or [n] and [Enter]" + ": ");

        if (yesOrNo()) {
            tutorial();
        } else {
            System.out.println();
            System.out.print("What world do you want to go? World: ");
            worldInput();
        }

    }

    public static boolean yesOrNo() {
        String string = s.nextLine();
        if (string.contains("y")) {
            return true;
        } else if (string.contains("n")) {
            return false;
        } else {
            System.out.print("Press [y] or [n] and [Enter]: ");
            yesOrNo();
        }
        return false;
    }

    /**
     * get random int between [-1 - 1]
     */
    public static int getRandomInt() {
        ArrayList<Integer> arrayList = new ArrayList<>();
        arrayList.add(-1);
        arrayList.add(0);
        arrayList.add(1);
        Collections.shuffle(arrayList);
        return arrayList.get(0);
    }

    public static boolean fiftyFifty() {
        ArrayList<Integer> arrayList = new ArrayList<>();
        arrayList.add(0);
        arrayList.add(1);
        Collections.shuffle(arrayList);
        return arrayList.get(0).equals(0);
    }
}


I just finished a mural at Three Chairs Co., a prominent furniture store in downtown Ann Arbor (they have an additional showroom across the street as well). I was excited to do one here because my concept matches the mid-century aesthetic of their pieces with designers like Ray and Charles Eames, George Nelson and Isamu Noguchi. My design of the Modern Rorschach inkblot came easily as I was sketching in Adobe Illustrator and the owner thought it would be perfect for the front window during the Herman Miller winter sale.
After I printed it out, I labeled each color and shape by section and dimension.
Now comes the real work. I measured each section (or color) to scale and translated it to hand-drawn illustrations on paper.
Then I cut each section out and labeled it.
I laid out the area for the "canvas" and blocked it in using Behr primer and paint in one. Great stuff!
Then I could start taping and tracing.
And cutting in the colors by hand.
And filling them in. Using vibrant colors together is always a gamble. But after double and some triple coats, I think it paid off nicely.
Thank you, Three Chairs Co. for your cooperation and wall space. Special thanks to Genui Forma for sponsoring the materials! And a big thank you to -N- for being a great partner in crime.


text:
world news 300518
Abramovich granted Israeli citizenship – Punch Newspapers
Russian billionaire Roman Abramovich has been granted Israeli citizenship and will move to Tel Aviv where he bought a property, according to media reports. According to Aljazeera.com, the move by the owner of Chelsea comes as he finds himself without a visa to Britain. The Kremlin said on …...
Forum: World News
Papua New Guinea bans Facebook for a month – BBC News
Papua New Guinea will ban Facebook for a month while it identifies fake profiles and considers the website's effect on the country. Communication minister Sam Basil said users posting pornography and false information … Read more via BBC News – https://ift.tt/2LHieDE Get more World News
Suspected terrorist attack kills 4 in Belgium – PressTV Media RSS
A suspected terrorist attack in the Belgian city of Liege has left a total of four people dead, including the attacker. Authorities on Tuesday confirmed the toll from the shooting in d'Avroy central boulevard which left two policewomen and a passer-by dead. The man who carried … Read more...
Here's The Reason Why Diseases Like Ebola Are So Much Worse in Isolated Communitie – Theconversation
This article is the first of a three-part package exploring immunity and infectious diseases around the world. Sadly, as I write this piece, three isolated rural communities in the Democratic Republic of the Congo are being "invaded" by an infectious disease, Ebola. Such infectious disease...


Livingston is the historic train town from the late 1880's that will keep you coming back. Livingston was the "Original Gateway City to Yellowstone National Park" now it's where adventure, beautiful scenery and authentic friendly folk await you at the edge of the Yellowstone River. The town is surrounded by four beautiful wild mountain ranges that offer an abundance of outdoor activities year round. Whether it's fly fishing, dogsledding or cross-country skiing, horseback riding, river rafting or just taking it easy at our many museums, art galleries and restaurants we have it here in Livingston.


Combating plagiarism: a shared responsibility.
Indian Journal of Medical Ethics. 2010; 7:173-75.
Cut, copy, paste – is so easy to do that many people do it! We once had a journal editor sharing with us, how an author had taken one of his publications, simply reordered the paragraphs and submitted the same! While most authors do not go to this extreme, we still do see many instances of plagiarism, which we suspect are mostly due to ignorance of details. This article by Dr. Rathod specially highlights the responsibilities of the scientific community as well as observers and readers of articles to tackle this problem. He recommends steps that we need to take and specially highlights the need for awareness promotion right from the student level.
This entry was posted in 3 - Interesting Articles and tagged Plagiarism. Bookmark the permalink.
← Research oriented medical education. ROME scheme: From reorientation to research oriented medical education, a new beginning.


The Real-Time Dashboard is a BeyondTrust Middleware Engine plugin. To install the BeyondTrust Middleware Engine, follow the instructions in the BeyondTrust Middleware Engine Configuration document.
The host computer must be a fully patched Windows Server 2012 R2 or later.
Microsoft IIS must be setup as described in Microsoft IIS Setup for Real-Time Dashboard Integration.
For best results, the Secure Remote Access Appliance and the server hosting the BeyondTrust Middleware Engine should have synchronized clocks. Clock drift between the servers could cause inaccurate time durations to appear on the dashboard.
CA-signed SSL certificates are recommended for production deployments. While self-signed certificates can be used for product staging and test deployments, a self-signed certificate is NOT recommended for production use.


text:
Public Release: 26-Apr-2012
First evaluation of the Clean Water Act's effects on coastal waters reveals major successes
Landmark legislation helped clean up LA's coastal waters over the past 40 years, study indicates
Levels of copper, cadmium, lead and other metals in Southern California's coastal waters have plummeted over the past four decades, according to new research from USC.
Samples taken off the coast reveal that the waters have seen a 100-fold decrease in lead and a 400-fold decrease in copper and cadmium. Concentrations of metals in the surface waters off Los Angeles are now comparable to levels found in surface waters along a remote stretch of Mexico's Baja Peninsula.
Sergio Sañudo-Wilhelmy, who led the research team, attributed the cleaner water to sewage treatment regulations that were part of the Clean Water Act of 1972 and to the phase-out of leaded gasoline in the 1970s and 1980s.
"For the first time, we have evaluated the impact of the Clean Water Act in the waters of a coastal environment as extensive as Southern California," said Sañudo-Wilhelmy, professor of Biological and Earth sciences at the USC Dornsife College of Letters, Arts and Sciences.
"We can see that if we remove the contaminants from wastewater, eventually the ocean responds and cleans itself. The system is resilient to some extent," he said.
The USC researchers compared water samples from roughly 30 locations between Point Dume to the north and Long Beach to the south to samples taken in the exact same locations in 1976 by two researchers at the University of California, Santa Cruz: Kenneth Bruland and Robert Franks.
"We wanted to assume that the Clean Water Act was working, but we needed good data to allow us to compare water conditions 'before and after,'" he said. "Fortunately for us, we have the data generated by Bruland and Franks. That gave us a rare opportunity to see the impact of cleaning our sewage and see the effect on the coastal ocean. The population of Southern California has increased in the last 40 years, the sewage treatment has been improved, and the levels of metals in the coastal ocean have declined."
Sañudo-Wilhelmy's team--which includes USC doctoral researcher Emily A. Smail and Eric A. Webb, associate professor at USC Dornsife--published its findings this month in Environmental Science and Technology.
This research was funded by the USC Sea Grant program.
Robert Perkins
perkinsr@usc.edu
@USC
http://www.usc.edu
University of Southern California/Sea Grant program
GUIDELINES/TREATIES/AGREEMENTS
MARINE/FRESHWATER BIOLOGY
POLICY/ETHICS
POLLUTION/REMEDIATION
SCIENCE/HEALTH AND THE LAW


text:
SDCC 2015: Watch The 'Star Wars: The Force Awakens' Panel
Posted July 11th, 2015 by Ben Silverio
If you ask anyone about the highlight of Friday at this year's San Diego Comic-Con, I think that you'll have a hard time finding someone who doesn't say the 'Star Wars: The Force Awakens' panel. Despite not bringing any new footage from the film, director J.J. Abrams and company brought the house down with an excellent behind the scenes featurette showing off all the physical sets, animatronics, and practical effects utilized in filming 'Episode VII.' And then after the panel, the 7,000 attendees in Hall H were invited to an insanely awesome outdoor 'Star Wars' concert with free lightsabers and a fireworks display. However, there were some pretty awesome moments during the presentation itself and now you can check it out in it's entirety.
For yesterday's proceedings, Abrams was joined at SDCC by Lucasfilm President Kathleen Kennedy, the film's screenwriter Lawrence Kasdan, and a number of cast members including Peter Mayhew, John Boyega, Daisy Ridley, Oscar Isaac, Adam Driver, Domhnall Gleeson, Gwendolyn Christie, Carrie Fisher, Mark Hamill, and Harrison Ford, who was recovering from his recent plane crash. Aside from everyone sharing their excitement for the upcoming film, Boyega shared some surreal moments from shooting, Christie talked about her character Captain Phasma and her place among the Dark Side, and Ford revealed how easy it was to step back into the role of Han Solo. Gleeson even dropped a little bit of a spoiler that revealed an homage in their film to the original version of George Lucas' script. For the complete panel discussion moderated by Nerdist's Chris Hardwick, check out the video below courtesy of Geek Tyrant:
This con marks the first time that the Dark Side has come out in full force (no pun intended). By the sounds of things, Gleeson, Christie, and Driver should be interesting new additions to the 'Star Wars' mythology. I for one am very much looking forward to finding out more about them. But what aspects of 'Star Wars: The Force Awakens' are you most excited for? Let us know in the comment section.
Chris Hardwick
domhnall gleeson
Gwendolyn Christie
John Boyega
Peter Mayhew
Ben Silverio
Ben F. Silverio received a degree from Drexel University in the Screenwriting and Playwriting Program with a minor in Television Production. While at Drexel, Ben co-founded and co-hosted a film review show called The Pretentious Film Majors, which has evolved into a multi-format form of entertainment including blogs, podcasts on iTunes, articles in the school paper, and a potential tv show. Now armed with an extremely expensive piece of paper, Ben can begin climbing the treacherous ladder of the entertainment industry, which he hopes to do while streaming WWE wrestling matches, reading Marvel comics, and blogging about the excessive amount of movies and tv shows that he watches, all on the iPhone that is permanently attached to his hand.
Marvel & Netflix Release First Official 'Jessica Jones' Stills
Is It Bad News For 'Fantastic Four' That The 3D Version Has Been Scrubbed?
Steven S. DeKnight Had Two Demands To Direct 'Pacific Rim: Uprising'
Betrayed Direction: 'Suicide Squad' Cast Comments On David Ayers Twisted Directorial Methods
SUPER BOWL 2017:'Transformers: The Last Knight' Pits Bumblebee Against Optimus Prime?!
Kevin Feige Teases The Connection Between 'Ant-Man And The Wasp' And 'Avengers 4'


In the area where I live, the winter season is the priority. The cold weather tends to last about eight months, with temperatures frequently dropping into the negative digits and a tremendous amount of snow. Having a powerful, reliable and energy efficient heating system is a priority. My home is outfitted with a condensing boiler, which easily handles the most severe winter conditions. The boiler is a compact unit located in the basement that is linked to a series of pipes hidden beneath the floor of the home. The pipes create a closed system that loops and carries heated water to every room. The heat is spread evenly across the floor, from wall to wall and corner to corner. Rather than blowing heated air, the heat is infused into the air, keeping the highest temperatures closest to the floor. There is very little temperature stratification between the floor and the ceiling. Plus, the heated floors avoid the problem of drafts, cold spots and the influx of air contaminants. The equipment is entirely hidden beneath the floor, taking up no living space and never detracting from aesthetics. I don't need to arrange my furniture to accommodate vents. The heated floors are entirely silent, require no maintenance and allow lower thermostat settings than a conventional forced air furnace. They also accommodate zoned heating, so that I can customize comfort room to room. It is such a pleasure to get out of bed on a cold winter morning and set my bare feet on warm floors. The only drawback of the system is that it doesn't offer cooling capability. In my local area, I've never needed air conditioning.


text:
Spirituality & Beliefs > Philosophy > Epistemology & theory of knowledge
Deflationary Truth (Paperback)
J.C. Beall (editor), Bradley C. Armour-Garb (editor)
Paperback 320 Pages / Published: 16/06/2005
Publisher out of stock
Currently unavailable to order
This book is a collection of important writings on deflationism, with a detailed introduction and an exhaustive annotated bibliography. Among philosophers concerned with the theory of truth, deflationist positions have quickly gained ground and have become the most popular. Yet heretofore there has been no single book to which the readers can go for a detailed, overall view of the entire phenomenon of deflationism. This is the only available map of the whole terrain of deflationism.
Deflationism is a comparatively new approach, though it has its roots in the thinking of some philosophers in the early twentieth century. Deflationism rejects all the traditional theories of truth: the correspondence theory (truth corresponds with facts), the coherence theory (truth is membership of a coherent set of beliefs), the pragmatist theory is provability or verifiability).
This book gives complete coverage to all the different varieties of deflationism, and to earlier philosophers who anticipated deflationism. The articles and exerpts include classic works by Frege, Ayer, Ramsey, Tarsk, and Quine, and recent works by the leading deflationist authors of today: Paul Horwich, Hartry Field, Stephen Schiffer, Robert Brandom, and Stephen Leeds.
Publisher: Open Court Publishing Co ,U.S.
A Monk's Guide to a Clean House and Mind
Shoukei Matsumoto
The Art of Logic
Rebel Ideas
A Little History of Philosophy
Nigel Warburton
Paul Dolan
12 Rules for Life
The Daily Stoic
Derren Brown


text:
CMT Insider Interview: Tim McGraw Reminisces About Early Career
He Tells Mark McGraw About "Indian Outlaw," "Don't Take the Girl"
Tim McGraw and his half-brother, Mark McGraw, played tourist in Philadelphia last week, allowing the CMT Insider crew to tag along. During their visit, the country superstar reminisced about his early days on the road, the first time he heard "Indian Outlaw" and the realization that "Don't Take the Girl" was a turning point in his career.
Editor's Note: CMT Insider will feature the first of a two-part series with Tim McGraw in Philadelphia on Saturday (July 17) at 1:30 p.m. ET.
Mark McGraw: Tell me about some of those early days on the road.
Tim McGraw: Well, it's been a great ride. I think that for me, what cut my teeth and made me a better artist and made me a better singer and made me a better performer were those years I spent on the road in a van, pulling the trailer. We'd show up at a gig and we'd play Monday through Sunday, seven nights a week most of the time. Sometimes we'd play two or three weeks at a place. It would be great to go to a place you'd never been before. On a Monday night, you set up and you're playing and there are 30 or 40 people there. Then word would get out about our band being there. By the weekend, it would just be jampacked and it would stay that way for the next two weeks that we were there. It was kind of cool to build a following and sort of build a reputation as sort of a bar band.
That's where "Indian Outlaw" started, your first single that really took off.
It was. "Indian Outlaw," from '89 when I put my first band together and started touring — well, not "touring." We called it "touring" then, but when we started traveling, [it was] from gas station to gas station back then. … We played everybody else's song and the one song of ours that we played was "Indian Outlaw." I heard that song the first night I moved to Nashville. Tommy Barnes played that song in a hotel for me, and I've played it ever since.
And the record label didn't particularly like that song.
Nobody liked that song when I cut my first album [released in 1993]. I wanted to do the song for my first album, but I couldn't talk the record label into letting me do it. But I did it for the second one for sure. I was going to make sure I did it the second time.
But the fans liked it and that's how you knew it came off, right?
The fans loved it. When we played clubs, we were just a small house band — a four-piece house band that did a lot of cover songs. There were a lot better bands than us around, that's for sure. But for a song that nobody knew from a grab-yourself-up-from-your-bootstraps kind of band, and to be in there playing a new song and have to play it three or four or five times a night, it was a pretty good sign that it was a song that people liked.
If you could look back and compare yourself as an artist then to this day now, how do you see your career? How do you see how things have gone?
Well, they've gone better than I ever would have thought they would have gone. I've always felt like I was the kind of person who learned really fast. If there was something that I wanted to do, then I would pay attention and learn really fast. Music has always been a love of mine. I knew that this was what I wanted to make my career out of, and I knew this is what I wanted to do. I always felt like, given the opportunity to succeed, that I would succeed if I just had the chance to succeed. I've just tried to improve and get better every step along the way. Every time, I've tried to make a better record the next time around.
When did you realize that this was going to work for you?
I think there's always that little piece of that — a little bit in your mind that tomorrow you're gonna wake up and be digging in the couch to pay for that pizza at the door. There's always a little bit of that. I don't ever want to lose that. … There was one specific moment that I can recall when "Don't Take the Girl" had just come out. "Indian Outlaw" was a big hit, but we always had that thought in our mind that it was going to be one of those kind of songs — if we didn't follow up with it, we would be gone tomorrow.
It might be a one-hit wonder.
Exactly, exactly. "Don't Take the Girl" had just come out, and we were playing this club in Houston. We played "Don't Take the Girl" and the club was packed. It was so packed that there were big-screen TVs out in the parking lot because they oversold the club. They had bars and everything set up in the parking lot. Darran (Smith, his lead guitarist) and I had started playing "Don't Take the Girl" and halfway through the song we had realized that the crowd was singing it louder than we were. I stopped singing and we just let the crowd sing the entire song. (We) looked at each other, and we thought, well, we might be able to pay our bar tab from here on out — for a little while, anyway.
Mark McGraw is a CMT Insider correspondent.
Tags: Tim McGraw


[share_ebook] 57.Genghis Khan, The Mongol Conquests [Complete Series List] | Free eBooks Download - EBOOKEE!
Posted on 2011-10-05, by kashani90.
Hi Dears! If You Want download 57.Genghis Khan, The Mongol Conquests [Complete Series List] after clicking On Download Link(In Code Section), Please Wait For 5-8 Second. Then You Can Click On Skip Ads! Button.
The history of the Mongol conquests is a catalogue of superlatives. No army in the world has ever conquered so much territory, and few armies have provoked such terror as the Mongol hordes. So vast was the extent of the Mongol Empire that the samurai of Japan and the Teutonic Knights of Prussia had each fought the same enemy while being unaware of each other's existence. This book provides a concise yet thorough account of the Mongol conquests, including the rise of Genghis Khan and the unification of the tribes with up to date information on campaign logistics, tactics and horse breeding.
No comments for "[share_ebook] 57.Genghis Khan, The Mongol Conquests [Complete Series List]".


text:
package online.dinghuiye.core.validation;

import online.dinghuiye.api.validation.Validator;

import java.lang.reflect.Field;
import java.util.HashSet;
import java.util.Set;

/**
 * @author Strangeen on 2017/08/16
 */
public class PhoneUniqueValidator implements Validator {

    private static Set<Object> phoneCache;

    /*
     创建时写入数据库已有数据缓存,这里模拟从数据库里读出来的数据
     值得注意的是:
        1. 并发操作数据库时,需要同步缓存,并更新缓存
        2. 成功添加一条数据后,需要更新缓存
      */
    public PhoneUniqueValidator() {

        // 模拟数据库查询的数据
        resetCache();
    }

    public static void resetCache() {
        phoneCache = new HashSet<>();
        phoneCache.add("12345678901");
        phoneCache.add("12345678902");
        phoneCache.add("12345678903");
        phoneCache.add("123456789014");
    }

    @Override
    public <SchoolMan> boolean validate(Object fieldValue, Field field, SchoolMan obj) {

        if (phoneCache.contains(fieldValue)) return false;
        phoneCache.add(fieldValue);
        return true;
    }
}


Fiat Chrysler is reporting a sales decrease in March.
Overall U.S. sales were down 7% in March compared to March of 2018, with 200,307 vehicles sold last month across the U.S.
Sales of the Windsor-built Dodge Caravan were down just 3% compared to March of 2018 with 15,806 minivans sold last month.
In Canada, sales of the Caravan were up 13% in March compared to the same time a year ago. 3,370 Caravans were sold last month.
Sales of the Chrysler Pacifica were down on both sides of the border in March compared to March of 2018.
In the U.S.. 8,457 Pacificas were sold, a 35% drop over March of last year. Year-to-date sales are also off 29% compared to the same time frame a year ago.
In Canada, sales of the Pacifica were down 66%, with just 304 sold last month compared to March of 2018. Year-to-date sales in this country are also down 59%.
The Windsor Assembly Plant is currently on a two week shutdown after the company announced it plans to eliminate the third shift at the plant due to lagging sales of the Pacifica. That will take effect September 30th, impacting an estimated 1,500 employees.


Dolls feel their limbs and sides have fused.
Beyond their wrappers, candies merge.
for us, is order; we are All Good Things.
and plush in a larger, jellied sweetness.
we're glad that smell is there for you.
of the universe, as beige is the color.
must hang, a motley donkey, there.
or greedy laughter would be proper.
And whether joy is one or many.
somewhere in nature swarms your virus.


text:
The Grenfell Tower tragedy raises raw political questions – and the Tories better have some answers
Fraser Nelson 15 June 2017 • 7:09pm
Theresa May at the site of the disaster Credit: Dan Kitwood Source:	Getty Images Europe/Dan Kitwood Source:	Getty Images Europe
When I was young, I used to dream of living in a high-rise flat. The council accommodation built in Sixties Glasgow was warm, clean and futuristic; families who were moved into it, like my father's, felt like they'd won the lottery. That he ended up in a two-storey house seemed like the short straw to me, but no one complained.
The schemes, as they came to be known, were to acquire a reputation for social malaise a generation later. But they were safe, structurally sound and affordable. The idea of them going up in flames, with their tenants unable to escape, is a very modern nightmare.
Jeremy Corbyn was premature with his attempts to politicise the tragedy when the dead were still being counted at Grenfell Tower. But what else can this be, other than political? These tower blocks exist because politicians wanted them. They went from des-res to clusters of deprivation due to calamitous political and social policies.
The decision to sell off these flats, with a new façade to improve their market value, was political. Politicians subcontracted the management. Those who live in council houses usually depend, more than anyone else in Britain, on a political system that works properly. Their lives are in politicians' hands.
Theresa May didn't meet any residents when she visited yesterday, which is unfortunate. The general election campaign made her look like someone who avoids awkward questions, and she is living down to this reputation. Jeremy Corbyn did far better, listening to residents' complaints about Mrs May and promising to "speak up" for all of them.
When he said that Tory cuts left tenants more exposed, it was ruthlessly political – but it seemed to make sense. Hadn't £8.6 million been spent making the flats look like less of an eyesore for the local residents of Kensington? And didn't this cladding turn out to be combustible?
It would be dangerous for the Tories to think the public inquiry will depoliticise all this. The Grenfell Tower disaster is a powerful metaphor for the inequality that Mr Corbyn talks about so regularly and it would be tragic if Labour asks the questions while the Tories – panicked and effectively leaderless – hide behind an inquiry.
Answers are needed now: how many more might be living in firetraps? Why were the repeated complaints of those in the towers not heeded? Why had a serious fire never taken hold of any high-rise flat in Britain until recently? Might the gentrification process, with its recladding, have introduced a fire risk that wasn't taken seriously by the authorities?
There is no more visible manifestation of inequality than seeing high-rise council tower blocks next door to £3 million houses. Kensington is the richest part of Britain's richest city and Grenfell Tower is an oasis of deprivation. The people who live there are among the poorest in the land, while those who live a few streets away have underground swimming pools.
Kensington is one of those parts of Britain where life expectancy falls by about 10 years when you cross a road, a place that seems to embody the failure of wealth to spread. Or, for those with an eye to see it, the failure of capitalism and austerity.
When Kensington turned Labour in last week's election, it was a stunning display of the progress that Jeremy Corbyn was making. Only a third of residents there own their own home: for the rest, it's rent – at extortionate rates, in buildings that (we now know) may be fatally unsafe.
It's no surprise that so many young people find Corbyn's message so appealing if they struggle to claim a stake in capitalism, and feel they have no hope of joining the propertied classes. The stories of the way that Grenfell Tower lodgers were treated – threatened by lawyers if they complained, or simply ignored – suggests a situation that is simply indefensible.
So it would be deeply unwise for the Tories to seek to defend it. You don't need to be a Corbyn voter to suspect that the high-rise penthouses popping up on the banks of the Thames are rather less likely to go up in flames. When we learn about the dead we're likely to see the most vulnerable, isolated people in society. That these people are being scandalously neglected is not in doubt. The question is who should provide help, who listens to their concerns.
A few years ago, Iain Duncan Smith said that the Conservatives are the natural ally of the poorest, and will help them fight back against an unresponsive bureaucracy. His welfare reforms were designed to dismantle the benefits trap, saving lives rather than saving money. Two years ago, Michael Gove called for the Tories to become "warriors for the dispossessed".
But instead, the Tories chose to become the party of Brexit and have been steadily losing interest in the social justice agenda, which is now being seized by a jubilant Labour party.
So what, now, do the Tories offer people like the residents of Grenfell Tower? Grammar schools? Even its "affordable home" plans are reserved for those with serious amounts of money. Soon, the so-called Starter Homes will be affordable only to those on £50,000, double the average salary.
The "shared ownership" initiative is accessible to an estimated 3 per cent of people moving into council houses. Even the 2015 election pledge to let people buy their housing association property has turned out to be a dud; only one in 10 residents, it transpires, can afford to do so.
Ronan Point
It is now half a century since the Ronan Point disaster, where four people died – enough, at the time, to be treated as a national disaster and its dead the victims of poor government policy. The far greater death toll this time means we are looking at one of the greatest disasters in our modern history.
The culpability is perhaps greater, given how much more is now known about building safety. This calamity cannot help but raise fundamental questions about our society, our politicians and the way those at the bottom are treated. And about why, when residents repeatedly raised their concerns, no one seemed to listen.
Fundamentally, the Grenfell Tower disaster raises a simple question: whose side are you on? The Conservatives had better have an answer.
Oasis,
Dreams,
Iain Duncan Smith,
Grenfell Tower,
Grammar Schools,
Pound,
Labour Party,
Roads,
Brexit,
Jeremy Corbyn,
Michael Gove,
Buy to let,
Benefit,
Affordable Homes


Advise the person with dementia (PwD) on the importance of making a will.
Patients should be encouraged to plan for their future. New legislation called The Assisted Decision Making (Capacity) Act 2015 will come into effect by the end of 2016. This legislation allows people to put an Advanced Healthcare Directive and/or an Enduring Power of Attorney in place. See the link below to our explanation of these documents.


text:
h-index (December 2019): 11
i10-index (December 2019): 14
h5-index (December 2019): 7
h5-median (December 2019): 11
Index/List/Archive
Other Redfame Journals
—Applied Economics and Finance
Applied Finance and Accounting
—Business and Management Studies
Journal of Education and Training Studies
—International Journal of Contemporary Education
—International Journal of English and Cultural Studies
—International Journal of Law and Public Administration
—International Journal of Social Science Studies
—Studies in Engineering and Technology
Home > About the Journal > Editorial Policies
SMC aims to promote excellence through dissemination of high-quality research findings, specialist knowledge, and discussion of professional issues that reflect the diversity of this field.
Encourage and publish research and studies in the following fields:
newspaper, magazine, radio, television, internet, advertising, animal communication, communication design, environmental communication, information theory, intercultural communication, marketing, mass communication, nonverbal communication, organizational communication, propaganda, public relations, speech communication, technical writing, and translation.
Original full-length research papers, clearly state their objective or hypothesis, the experimental design and methods used, the essential features of any interventions, the main outcome measures, the result from the study, and a section placing the results in the context of published literature.
Provide a summary of evidence derived from primary studies that have been selected and synthesized according to the author's personal and professional perspective.
Report of a single case
Report results of a pilot study or preliminary findings from a study. The scope of this section is intended to be wide and to encompass methodology and experimental data on subjects of interest to the readers of the Journal.
Open Submissions Indexed Peer Reviewed
The journal uses double-blind system for peer-review; both reviewers and authors' identities remain anonymous. The paper will be peer-reviewed by three experts; two reviewers from outside and one editor from the journal typically involve in reviewing a submission.
2013-2020 Semiannual, published in June and December
This journal provides immediate open access to its content on the principle that making research freely available to the public supports a greater global exchange of knowledge.
This journal utilizes the LOCKSS system to create a distributed archiving system among participating libraries and permits those libraries to create permanent archives of the journal for purposes of preservation and restoration. More...
BASE (Bielefeld Academic Search Engine)
Beardslee Library
CNKI Scholar
Genamics JournalSeek
IE Library
Infotrieve
Open Access Library (OALib)
Open J-Gate
PKP Open Archives Harvester
Publication Forum (JUFO)
SocioRePEc
Ulrich's
The h-index is an author-level metric that attempts to measure both the productivity and citation impact of the publications of a scientist or scholar.
h-index is the largest number h such that h publications have at least h citations.
The data was calculated based on Google Scholar Citations
i10-index is the number of publications with at least 10 citations.
h5-index is the h-index for articles published in the last 5 complete years. It is the largest number h such that h articles published in 2014-2018 have at least h citations each.
The data was calculated based on Google Scholar Metrics
h5-median for a publication is the median number of citations for the articles that make up its h5-index.
Studies in Media and Communication ISSN 2325-8071 (Print) ISSN 2325-808X (Online)
Copyright © Redfame Publishing Inc.
To make sure that you can receive messages from us, please add the 'redfame.com' domain to your e-mail 'safe list'. If you do not receive e-mail in your 'inbox', check your 'bulk mail' or 'junk mail' folders.