head	1.7;
access;
symbols
	core-8-4-19:1.6
	core-8-4-18:1.6
	core-8-4-17:1.6
	core-8-4-16:1.6
	core-8-4-15:1.6
	core-8-4-14:1.6
	core-8-4-13:1.6
	core-8-4-12:1.6
	core-8-4-11:1.6
	core-8-4-10:1.6
	core-8-4-9-branch:1.6.0.22
	core-8-4-9:1.6
	core-8-4-8:1.6
	core-8-4-7:1.6
	core-8-5-a1:1.6
	core-8-4-6:1.6
	core-8-4-5:1.6
	mistachkin-dev-branch:1.6.0.20
	core-8-4-4:1.6
	core-8-4-3:1.6
	core-8-4-branch:1.6.0.18
	core-8-4-2:1.6
	core-8-4-1:1.6
	core-8-3-5:1.6
	core-8-4-0:1.6
	macosx-8-4-merge-2002-08-31-trunk:1.6
	macosx-8-4-premerge-2002-08-31-branch:1.6
	macosx-8-4-premerge-2002-08-31-trunk:1.6
	macosx-8-4-merge-2002-08-30-branch:1.6
	macosx-8-4-merge-2002-08-30-trunk:1.6
	macosx-8-4-merge-2002-08-20-branch:1.6
	macosx-8-4-merge-2002-08-20-trunk:1.6
	core-8-4-b2:1.6
	core-8-4-b1:1.6
	macosx-premerge-6-9-02:1.6
	core-8-4-a4:1.6
	core-8-3-4:1.6
	macosx-8-4-branch:1.6.0.16
	macosx-8-4-branchpoint:1.6
	core-8-4-a3:1.6
	core-8-3-3:1.6
	dgp-privates-into-namespace:1.6.0.14
	tclpro-1-5-0:1.6
	core-8-4-win-speedup:1.6.0.12
	core-8-4-a2:1.6
	tclpro-1-4-1:1.6
	tclpro-1-4-0:1.6
	core-8-3-2:1.6
	ajuba-ajuba2-2-1-base:1.6
	ajuba-ajuba2-2-0:1.6
	core-8-4-a1:1.6
	core-8-3-1-branch:1.6.0.10
	core-8-3-1:1.6
	scriptics-sc-2-0-b5:1.6
	scriptics-sc-2-0-fixed:1.6
	scriptics-sc-2-0-b2:1.6
	scriptics-sc-2-0-b1:1.6
	core-8-3-0:1.6
	core-8-3-b2:1.6
	core-8-3-b1:1.6
	scriptics-sc-1-1:1.6
	scriptics-sc-1-1-b1:1.6
	core-8-2-3:1.6
	scriptics-sc-1-1-branch:1.6.0.8
	scriptics-sc-1-1-base:1.6
	scriptics-sc-1-0:1.6
	scriptics-sc-1-0-branch:1.6.0.6
	scriptics-sc-1-0-base:1.6
	core-8-2-2:1.6
	core-8-2-1:1.6
	scriptics-bc-1-0-b1:1.6
	core-8-2-1-branch:1.6.0.4
	scriptics-tclpro-1-3-0:1.6
	core-8-2-0:1.6
	core-8-2-b3-branch:1.6.0.2
	core-8-2-b3-base:1.6
	scriptics-tclpro-1-3-b4:1.6
	core-8-2-b2:1.6
	scriptics-tclpro-1-3-b3:1.6
	core-8-2-b1:1.6
	scriptics-tclpro-1-3-b2:1.5
	merge-to-mainline-5/21/99:1.5
	scriptics-tclpro-1-3-b2-branch:1.5.0.2
	core-8-1-1:1.5
	scriptics-tclpro-1-3-b1:1.5
	core-8-1-1-base:1.5
	core-8-1-0:1.5
	merge-to-mainline-4-29-99:1.5
	merge-to-mainline-4-23-99:1.5
	core-8-1-branch-old:1.1.0.4
	core-8-0-6-branch:1.4.0.2
	core-8-0-6-base:1.4
	core-8-0-5:1.3.2.2
	core-8-1-b3:1.1.4.2
	core-8-1-b2:1.1.4.2
	dev-8-1-stubs-branch:1.1.4.2.0.2
	dev-stubs-branch:1.3.0.4
	scriptics-tclpro-1-2:1.3
	scriptics-tclpro-1-2-b2:1.3
	core-8-1-merge-2/10/99:1.3
	core-8-0-5-branch:1.3.0.2
	core-8-0-5-base:1.3
	scriptics-tclpro-1-2-b1:1.3
	scriptics-tclpro-1-2-a1:1.3
	core-8-1-b1:1.1.4.2
	core-8-0-4:1.3
	core-8-1-a2:1.1
	core-8-0-2:1.1
	core-8-0-3:1.2;
locks; strict;
comment	@ * @;


1.7
date	2004.03.17.18.15.45;	author das;	state dead;
branches;
next	1.6;

1.6
date	99.05.22.06.32.36;	author jingham;	state Exp;
branches;
next	1.5;

1.5
date	99.04.16.01.51.30;	author stanton;	state Exp;
branches;
next	1.4;

1.4
date	99.04.16.01.25.54;	author stanton;	state Exp;
branches;
next	1.3;

1.3
date	98.11.11.17.29.57;	author jingham;	state Exp;
branches
	1.3.2.1;
next	1.2;

1.2
date	98.09.14.18.23.34;	author stanton;	state Exp;
branches;
next	1.1;

1.1
date	98.04.01.09.57.00;	author rjohnson;	state Exp;
branches
	1.1.4.1;
next	;

1.1.4.1
date	98.09.30.02.18.03;	author stanton;	state Exp;
branches;
next	1.1.4.2;

1.1.4.2
date	98.11.25.21.16.36;	author stanton;	state Exp;
branches;
next	;

1.3.2.1
date	99.03.22.06.43.25;	author jingham;	state Exp;
branches;
next	1.3.2.2;

1.3.2.2
date	99.03.24.07.32.52;	author jingham;	state Exp;
branches;
next	;


desc
@@


1.7
log
@Removed support for Mac OS Classic platform [Patch 918139]
@
text
@/* 
 * tkMacColor.c --
 *
 *	This file maintains a database of color values for the Tk
 *	toolkit, in order to avoid round-trips to the server to
 *	map color names to pixel values.
 *
 * Copyright (c) 1990-1994 The Regents of the University of California.
 * Copyright (c) 1994-1996 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @@(#) $Id: tkMacColor.c,v 1.6 1999/05/22 06:32:36 jingham Exp $
 */

#include <tkColor.h>
#include "tkMacInt.h"

#include <LowMem.h>
#include <Palettes.h>
#include <Quickdraw.h>

/*
 * Default Auxillary Control Record for all controls.  This is cached once
 * and is updated by the system.  We use this to get the default system
 * colors used by controls.
 */
static AuxCtlHandle defaultAuxCtlHandle = NULL;

/*
 * Forward declarations for procedures defined later in this file:
 */

static int	GetControlPartColor _ANSI_ARGS_((short part, RGBColor *macColor));
static int	GetMenuPartColor _ANSI_ARGS_((int part, RGBColor *macColor));
static int	GetWindowPartColor _ANSI_ARGS_((short part, RGBColor *macColor));

/*
 *----------------------------------------------------------------------
 *
 * TkSetMacColor --
 *
 *	Populates a Macintosh RGBColor structure from a X style
 *	pixel value.
 *
 * Results:
 *	Returns false if not a real pixel, true otherwise.
 *
 * Side effects:
 *	The variable macColor is updated to the pixels value.
 *
 *----------------------------------------------------------------------
 */

int
TkSetMacColor(
    unsigned long pixel,	/* Pixel value to convert. */
    RGBColor *macColor)		/* Mac color struct to modify. */
{
    switch (pixel >> 24) {
	case HIGHLIGHT_PIXEL:
	    LMGetHiliteRGB(macColor);
	    return true;
	case HIGHLIGHT_TEXT_PIXEL:
	    LMGetHiliteRGB(macColor);
	    if ((macColor->red == 0) && (macColor->green == 0)
		    && (macColor->blue == 0)) {
		macColor->red = macColor->green = macColor->blue = 0xFFFFFFFF;
	    } else {
		macColor->red = macColor->green = macColor->blue = 0;
	    }
	    return true;
	case CONTROL_TEXT_PIXEL:
	    GetControlPartColor(cTextColor, macColor);
	    return true;
	case CONTROL_BODY_PIXEL:
	    GetControlPartColor(cBodyColor, macColor);
	    return true;
	case CONTROL_FRAME_PIXEL:
	    GetControlPartColor(cFrameColor, macColor);
	    return true;
	case WINDOW_BODY_PIXEL:
	    GetWindowPartColor(wContentColor, macColor);
	    return true;
	case MENU_ACTIVE_PIXEL:
	case MENU_ACTIVE_TEXT_PIXEL:
	case MENU_BACKGROUND_PIXEL:
	case MENU_DISABLED_PIXEL:
	case MENU_TEXT_PIXEL:
	    return GetMenuPartColor((pixel >> 24), macColor);
	case APPEARANCE_PIXEL:
	    return false;
	case PIXEL_MAGIC:
	default:
	    macColor->blue = (unsigned short) ((pixel & 0xFF) << 8);
	    macColor->green = (unsigned short) (((pixel >> 8) & 0xFF) << 8);
	    macColor->red = (unsigned short) (((pixel >> 16) & 0xFF) << 8);
	    return true;
    }
}

/*
 *----------------------------------------------------------------------
 *
 * Stub functions --
 *
 *	These functions are just stubs for functions that either
 *	don't make sense on the Mac or have yet to be implemented.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	These calls do nothing - which may not be expected.
 *
 *----------------------------------------------------------------------
 */

Status
XAllocColor(
    Display *display,		/* Display. */
    Colormap map,		/* Not used. */
    XColor *colorPtr)		/* XColor struct to modify. */
{
    display->request++;
    colorPtr->pixel = TkpGetPixel(colorPtr);
    return 1;
}

Colormap
XCreateColormap(
    Display *display,		/* Display. */
    Window window,		/* X window. */
    Visual *visual,		/* Not used. */
    int alloc)			/* Not used. */
{
    static Colormap index = 1;
    
    /*
     * Just return a new value each time.
     */
    return index++;
}

void
XFreeColormap(
    Display* display,		/* Display. */
    Colormap colormap)		/* Colormap. */
{
}

void
XFreeColors(
    Display* display,		/* Display. */
    Colormap colormap,		/* Colormap. */
    unsigned long* pixels,	/* Array of pixels. */
    int npixels,		/* Number of pixels. */
    unsigned long planes)	/* Number of pixel planes. */
{
    /*
     * The Macintosh version of Tk uses TrueColor.  Nothing
     * needs to be done to release colors as there really is
     * no colormap in the Tk sense.
     */
}

/*
 *----------------------------------------------------------------------
 *
 * TkpGetColor --
 *
 *	Allocate a new TkColor for the color with the given name.
 *
 * Results:
 *	Returns a newly allocated TkColor, or NULL on failure.
 *
 * Side effects:
 *	May invalidate the colormap cache associated with tkwin upon
 *	allocating a new colormap entry.  Allocates a new TkColor
 *	structure.
 *
 *----------------------------------------------------------------------
 */

TkColor *
TkpGetColor(
    Tk_Window tkwin,		/* Window in which color will be used. */
    Tk_Uid name)		/* Name of color to allocated (in form
				 * suitable for passing to XParseColor). */
{
    Display *display = Tk_Display(tkwin);
    Colormap colormap = Tk_Colormap(tkwin);
    TkColor *tkColPtr;
    XColor color;

    /*
     * Check to see if this is a system color.  Otherwise, XParseColor
     * will do all the work.
     */
    if (strncasecmp(name, "system", 6) == 0) {
	int foundSystemColor = false;
	RGBColor rgbValue;
	char pixelCode;
	
	if (!strcasecmp(name+6, "Highlight")) {
	    LMGetHiliteRGB(&rgbValue);
	    pixelCode = HIGHLIGHT_PIXEL;
	    foundSystemColor = true;
	} else if (!strcasecmp(name+6, "HighlightText")) {
	    LMGetHiliteRGB(&rgbValue);
	    if ((rgbValue.red == 0) && (rgbValue.green == 0)
		    && (rgbValue.blue == 0)) {
		rgbValue.red = rgbValue.green = rgbValue.blue = 0xFFFFFFFF;
	    } else {
		rgbValue.red = rgbValue.green = rgbValue.blue = 0;
	    }
	    pixelCode = HIGHLIGHT_TEXT_PIXEL;
	    foundSystemColor = true;
	} else if (!strcasecmp(name+6, "ButtonText")) {
	    GetControlPartColor(cTextColor, &rgbValue);
	    pixelCode = CONTROL_TEXT_PIXEL;
	    foundSystemColor = true;
	} else if (!strcasecmp(name+6, "ButtonFace")) {
	    GetControlPartColor(cBodyColor, &rgbValue);
	    pixelCode = CONTROL_BODY_PIXEL;
	    foundSystemColor = true;
	} else if (!strcasecmp(name+6, "ButtonFrame")) {
	    GetControlPartColor(cFrameColor, &rgbValue);
	    pixelCode = CONTROL_FRAME_PIXEL;
	    foundSystemColor = true;
	} else if (!strcasecmp(name+6, "WindowBody")) {
	    GetWindowPartColor(wContentColor, &rgbValue);
	    pixelCode = WINDOW_BODY_PIXEL;
	    foundSystemColor = true;
	} else if (!strcasecmp(name+6, "MenuActive")) {
	    GetMenuPartColor(MENU_ACTIVE_PIXEL, &rgbValue);
	    pixelCode = MENU_ACTIVE_PIXEL;
	    foundSystemColor = true;
	} else if (!strcasecmp(name+6, "MenuActiveText")) {
	    GetMenuPartColor(MENU_ACTIVE_TEXT_PIXEL, &rgbValue);
	    pixelCode = MENU_ACTIVE_TEXT_PIXEL;
	    foundSystemColor = true;
	} else if (!strcasecmp(name+6, "Menu")) {
	    GetMenuPartColor(MENU_BACKGROUND_PIXEL, &rgbValue);
	    pixelCode = MENU_BACKGROUND_PIXEL;
	    foundSystemColor = true;
	} else if (!strcasecmp(name+6, "MenuDisabled")) {
	    GetMenuPartColor(MENU_DISABLED_PIXEL, &rgbValue);
	    pixelCode = MENU_DISABLED_PIXEL;
	    foundSystemColor = true;
	} else if (!strcasecmp(name+6, "MenuText")) {
	    GetMenuPartColor(MENU_TEXT_PIXEL, &rgbValue);
	    pixelCode = MENU_TEXT_PIXEL;
	    foundSystemColor = true;
	} else if (!strcasecmp(name+6, "AppearanceColor")) {
	    color.red = 0;
	    color.green = 0;
	    color.blue = 0;
	    pixelCode = APPEARANCE_PIXEL;
	    foundSystemColor = true;
	}
	
	if (foundSystemColor) {
	    color.red = rgbValue.red;
	    color.green = rgbValue.green;
	    color.blue = rgbValue.blue;
	    color.pixel = ((((((pixelCode << 8)
		| ((color.red >> 8) & 0xff)) << 8)
		| ((color.green >> 8) & 0xff)) << 8)
		| ((color.blue >> 8) & 0xff));
	    
	    tkColPtr = (TkColor *) ckalloc(sizeof(TkColor));
	    tkColPtr->color = color;
	    return tkColPtr;
	}
    }
    
    if (XParseColor(display, colormap, name, &color) == 0) {
	return (TkColor *) NULL;
    }
    
    tkColPtr = (TkColor *) ckalloc(sizeof(TkColor));
    tkColPtr->color = color;

    return tkColPtr;
}

/*
 *----------------------------------------------------------------------
 *
 * TkpGetColorByValue --
 *
 *	Given a desired set of red-green-blue intensities for a color,
 *	locate a pixel value to use to draw that color in a given
 *	window.
 *
 * Results:
 *	The return value is a pointer to an TkColor structure that
 *	indicates the closest red, blue, and green intensities available
 *	to those specified in colorPtr, and also specifies a pixel
 *	value to use to draw in that color.
 *
 * Side effects:
 *	May invalidate the colormap cache for the specified window.
 *	Allocates a new TkColor structure.
 *
 *----------------------------------------------------------------------
 */

TkColor *
TkpGetColorByValue(
    Tk_Window tkwin,		/* Window in which color will be used. */
    XColor *colorPtr)		/* Red, green, and blue fields indicate
				 * desired color. */
{
    TkColor *tkColPtr = (TkColor *) ckalloc(sizeof(TkColor));

    tkColPtr->color.red = colorPtr->red;
    tkColPtr->color.green = colorPtr->green;
    tkColPtr->color.blue = colorPtr->blue;
    tkColPtr->color.pixel = TkpGetPixel(&tkColPtr->color);
    return tkColPtr;
}

/*
 *----------------------------------------------------------------------
 *
 * GetControlPartColor --
 *
 *	Given a part number this function will return the standard
 *	system default color for that part.  It does this by looking
 *	in the system's 'cctb' resource.
 *
 * Results:
 *	True if a color is found, false otherwise.
 *
 * Side effects:
 *	If a color is found then the RGB variable will be changed to
 *	the parts color.
 *
 *----------------------------------------------------------------------
 */

static int 
GetControlPartColor(
    short part, 		/* Part code. */
    RGBColor *macColor)		/* Pointer to Mac color. */
{
    short index;
    CCTabHandle ccTab;

    if (defaultAuxCtlHandle == NULL) {
	GetAuxiliaryControlRecord(NULL, &defaultAuxCtlHandle);
    }
    ccTab = (**defaultAuxCtlHandle).acCTable;
    if(ccTab && (ResError() == noErr)) {
	for(index = 0; index <= (**ccTab).ctSize; index++) {
	    if((**ccTab).ctTable[index].value == part) {
		*macColor = (**ccTab).ctTable[index].rgb;
		return true;
	    }
	}
    }
    return false;
}

/*
 *----------------------------------------------------------------------
 *
 * GetWindowPartColor --
 *
 *	Given a part number this function will return the standard
 *	system default color for that part.  It does this by looking
 *	in the system's 'wctb' resource.
 *
 * Results:
 *	True if a color is found, false otherwise.
 *
 * Side effects:
 *	If a color is found then the RGB variable will be changed to
 *	the parts color.
 *
 *----------------------------------------------------------------------
 */

static int 
GetWindowPartColor(
    short part, 		/* Part code. */
    RGBColor *macColor)		/* Pointer to Mac color. */
{
    short index;
    WCTabHandle wcTab;
	
    wcTab = (WCTabHandle) GetResource('wctb', 0);
    if(wcTab && (ResError() == noErr)) {
	for(index = 0; index <= (**wcTab).ctSize; index++) {
	    if((**wcTab).ctTable[index].value == part) {
		*macColor = (**wcTab).ctTable[index].rgb;
		return true;
	    }
	}
    }
    return false;
}

/*
 *----------------------------------------------------------------------
 *
 * GetMenuPartColor --
 *
 *	Given a magic pixel value, returns the RGB color associated
 *	with it by looking the value up in the system's 'mctb' resource.
 *
 * Results:
 *	True if a color is found, false otherwise.
 *
 * Side effects:
 *	If a color is found then the RGB variable will be changed to
 *	the parts color.
 *
 *----------------------------------------------------------------------
 */

static int
GetMenuPartColor(
    int pixel,			/* The magic pixel value */
    RGBColor *macColor)		/* Pointer to Mac color */
{
    RGBColor backColor, foreColor;
    GDHandle maxDevice;
    Rect globalRect;
    MCEntryPtr mcEntryPtr;
    
    /* Under Appearance, we don't want to set any menu colors when we
       are asked for the standard menu colors.  So we return false (which
       means don't use this color... */
       
    if (TkMacHaveAppearance()) {
        macColor->red = 0xFFFF;
        macColor->green = 0;
        macColor->blue = 0;
        return false;
    } else {
        mcEntryPtr = GetMCEntry(0, 0);
    switch (pixel) {
    	case MENU_ACTIVE_PIXEL:
    	    if (mcEntryPtr == NULL) {
    		macColor->red = macColor->blue = macColor->green = 0;
    	    } else {
    	    	*macColor = mcEntryPtr->mctRGB3;
    	    }
    	    return true;
    	case MENU_ACTIVE_TEXT_PIXEL:
    	    if (mcEntryPtr == NULL) {
    		macColor->red = macColor->blue = macColor->green = 0xFFFF;
    	    } else {
    	        *macColor = mcEntryPtr->mctRGB2;
    	    }
    	    return true;
    	case MENU_BACKGROUND_PIXEL:
    	    if (mcEntryPtr == NULL) {
    		macColor->red = macColor->blue = macColor->green = 0xFFFF;
    	    } else {
    	        *macColor = mcEntryPtr->mctRGB2;
    	    }
    	    return true;
    	case MENU_DISABLED_PIXEL:
    	    if (mcEntryPtr == NULL) {
    		backColor.red = backColor.blue = backColor.green = 0xFFFF;
    		foreColor.red = foreColor.blue = foreColor.green = 0x0000;
    	    } else {
    	    	backColor = mcEntryPtr->mctRGB2;
    	    	foreColor = mcEntryPtr->mctRGB3;
    	    }
    	    SetRect(&globalRect, SHRT_MIN, SHRT_MIN, SHRT_MAX, SHRT_MAX);
    	    maxDevice = GetMaxDevice(&globalRect);
    	    if (GetGray(maxDevice, &backColor, &foreColor)) {
    	    	*macColor = foreColor;
    	    } else {
    	    
    	    	/*
    	    	 * Pointer may have been moved by GetMaxDevice or GetGray.
    	    	 */
    	    	 
    	    	mcEntryPtr = GetMCEntry(0,0);
    	    	if (mcEntryPtr == NULL) {
    	   	    macColor->red = macColor->green = macColor->blue = 0x7777;
    	   	} else {
    	    	    *macColor = mcEntryPtr->mctRGB2;
    	    	}
    	    }
    	    return true;
    	case MENU_TEXT_PIXEL:
    	    if (mcEntryPtr == NULL) {
    	    	macColor->red = macColor->green = macColor->blue = 0;
    	    } else {
    	    	*macColor = mcEntryPtr->mctRGB3;
    	    }
    	    return true;
    }
    return false;
}
}
@


1.6
log
@Copied changes over from Tk8.0.5 to support Themed menus
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacColor.c,v 1.5 1999/04/16 01:51:30 stanton Exp $
@


1.5
log
@* Merged 8.1 branch into the main trunk
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id$
d91 1
a91 2
	    GetMenuPartColor((pixel >> 24), macColor);
	    return true;
d433 1
a433 1
    MCEntryPtr mcEntryPtr = GetMCEntry(0, 0);
d435 11
d453 1
a453 1
    	    return 1;
d460 1
a460 1
    	    return 1;
d467 1
a467 1
    	    return 1;
d493 1
a493 1
    	    return 1;
d500 1
a500 1
    	    return 1;
d502 2
a503 1
    return 0;
@


1.4
log
@* Merged changes from 8.0.5:
    - Updated for Mac release
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacColor.c,v 1.3 1998/11/11 17:29:57 jingham Exp $
d91 2
a92 1
	    return GetMenuPartColor((pixel >> 24), macColor);
d434 1
a434 1
    MCEntryPtr mcEntryPtr;
d436 35
a470 46
    /* Under Appearance, we don't want to set any menu colors when we
       are asked for the standard menu colors.  So we return false (which
       means don't use this color... */
       
    if (TkMacHaveAppearance()) {
        macColor->red = 0xFFFF;
        macColor->green = 0;
        macColor->blue = 0;
        return false;
    } else {
        mcEntryPtr = GetMCEntry(0, 0);
        switch (pixel) {
    	    case MENU_ACTIVE_PIXEL:
    	        if (mcEntryPtr == NULL) {
    		    macColor->red = macColor->blue = macColor->green = 0;
    	        } else {
    	    	    *macColor = mcEntryPtr->mctRGB3;
    	        }
    	        return true;
    	    case MENU_ACTIVE_TEXT_PIXEL:
    	        if (mcEntryPtr == NULL) {
    		    macColor->red = macColor->blue = macColor->green = 0xFFFF;
    	        } else {
    	            *macColor = mcEntryPtr->mctRGB2;
    	        }
    	        return true;
    	    case MENU_BACKGROUND_PIXEL:
    	        if (mcEntryPtr == NULL) {
    		    macColor->red = macColor->blue = macColor->green = 0xFFFF;
    	        } else {
    	            *macColor = mcEntryPtr->mctRGB2;
    	        }
    	        return true;
    	    case MENU_DISABLED_PIXEL:
    	        if (mcEntryPtr == NULL) {
    		    backColor.red = backColor.blue = backColor.green = 0xFFFF;
    		    foreColor.red = foreColor.blue = foreColor.green = 0x0000;
    	        } else {
    	    	    backColor = mcEntryPtr->mctRGB2;
                    foreColor = mcEntryPtr->mctRGB3;
                }
                SetRect(&globalRect, SHRT_MIN, SHRT_MIN, SHRT_MAX, SHRT_MAX);
                maxDevice = GetMaxDevice(&globalRect);
                if (GetGray(maxDevice, &backColor, &foreColor)) {
             	    *macColor = foreColor;
    	        } else {
d472 3
a474 3
    	    	    /*
    	    	     * Pointer may have been moved by GetMaxDevice or GetGray.
    	    	     */
d476 15
a490 17
    	    	    mcEntryPtr = GetMCEntry(0,0);
    	    	    if (mcEntryPtr == NULL) {
    	   	        macColor->red = macColor->green = macColor->blue = 0x7777;
    	   	    } else {
    	    	        *macColor = mcEntryPtr->mctRGB2;
    	    	    }
    	        }
    	        return true;
    	    case MENU_TEXT_PIXEL:
    	        if (mcEntryPtr == NULL) {
    	    	    macColor->red = macColor->green = macColor->blue = 0;
    	        } else {
    	    	    *macColor = mcEntryPtr->mctRGB3;
    	        }
    	        return true;
        }
        return false;
d492 1
@


1.3
log
@Make the Macintosh Menu's adopt the current Theme Appearance if the Appearance extension (version 1.0.1 or later) is installed
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacColor.c,v 1.2 1998/09/14 18:23:34 stanton Exp $
d91 1
a91 2
	    GetMenuPartColor((pixel >> 24), macColor);
	    return true;
d433 1
a433 1
    MCEntryPtr mcEntryPtr = GetMCEntry(0, 0);
d435 46
a480 35
    switch (pixel) {
    	case MENU_ACTIVE_PIXEL:
    	    if (mcEntryPtr == NULL) {
    		macColor->red = macColor->blue = macColor->green = 0;
    	    } else {
    	    	*macColor = mcEntryPtr->mctRGB3;
    	    }
    	    return 1;
    	case MENU_ACTIVE_TEXT_PIXEL:
    	    if (mcEntryPtr == NULL) {
    		macColor->red = macColor->blue = macColor->green = 0xFFFF;
    	    } else {
    	        *macColor = mcEntryPtr->mctRGB2;
    	    }
    	    return 1;
    	case MENU_BACKGROUND_PIXEL:
    	    if (mcEntryPtr == NULL) {
    		macColor->red = macColor->blue = macColor->green = 0xFFFF;
    	    } else {
    	        *macColor = mcEntryPtr->mctRGB2;
    	    }
    	    return 1;
    	case MENU_DISABLED_PIXEL:
    	    if (mcEntryPtr == NULL) {
    		backColor.red = backColor.blue = backColor.green = 0xFFFF;
    		foreColor.red = foreColor.blue = foreColor.green = 0x0000;
    	    } else {
    	    	backColor = mcEntryPtr->mctRGB2;
    	    	foreColor = mcEntryPtr->mctRGB3;
    	    }
    	    SetRect(&globalRect, SHRT_MIN, SHRT_MIN, SHRT_MAX, SHRT_MAX);
    	    maxDevice = GetMaxDevice(&globalRect);
    	    if (GetGray(maxDevice, &backColor, &foreColor)) {
    	    	*macColor = foreColor;
    	    } else {
d482 3
a484 3
    	    	/*
    	    	 * Pointer may have been moved by GetMaxDevice or GetGray.
    	    	 */
d486 17
a502 15
    	    	mcEntryPtr = GetMCEntry(0,0);
    	    	if (mcEntryPtr == NULL) {
    	   	    macColor->red = macColor->green = macColor->blue = 0x7777;
    	   	} else {
    	    	    *macColor = mcEntryPtr->mctRGB2;
    	    	}
    	    }
    	    return 1;
    	case MENU_TEXT_PIXEL:
    	    if (mcEntryPtr == NULL) {
    	    	macColor->red = macColor->green = macColor->blue = 0;
    	    } else {
    	    	*macColor = mcEntryPtr->mctRGB3;
    	    }
    	    return 1;
a503 1
    return 0;
@


1.3.2.1
log
@If we are using appearance, don't set ANY of the menu colors.  This gets the menu foregrounds right with Kaliedoscope and the Architect theme.
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacColor.c,v 1.3 1998/11/11 17:29:57 jingham Exp $
d91 2
a92 1
	    return GetMenuPartColor((pixel >> 24), macColor);
d434 1
a434 1
    MCEntryPtr mcEntryPtr;
a435 11
    /* Under Appearance, we don't want to set any menu colors when we
       are asked for the standard menu colors.  So we return false (which
       means don't use this color... */
       
    if (TkMacHaveAppearance() > 1) {
        macColor->red = 0xFFFF;
        macColor->green = 0;
        macColor->blue = 0;
        return 0;
    } else {
        mcEntryPtr = GetMCEntry(0, 0);
a492 1
}
@


1.3.2.2
log
@Formatting fixes: some tabbing got lost.
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacColor.c,v 1.3.2.1 1999/03/22 06:43:25 jingham Exp $
d439 1
a439 1
    if (TkMacHaveAppearance()) {
d443 1
a443 1
        return false;
d446 35
a480 35
        switch (pixel) {
    	    case MENU_ACTIVE_PIXEL:
    	        if (mcEntryPtr == NULL) {
    		    macColor->red = macColor->blue = macColor->green = 0;
    	        } else {
    	    	    *macColor = mcEntryPtr->mctRGB3;
    	        }
    	        return true;
    	    case MENU_ACTIVE_TEXT_PIXEL:
    	        if (mcEntryPtr == NULL) {
    		    macColor->red = macColor->blue = macColor->green = 0xFFFF;
    	        } else {
    	            *macColor = mcEntryPtr->mctRGB2;
    	        }
    	        return true;
    	    case MENU_BACKGROUND_PIXEL:
    	        if (mcEntryPtr == NULL) {
    		    macColor->red = macColor->blue = macColor->green = 0xFFFF;
    	        } else {
    	            *macColor = mcEntryPtr->mctRGB2;
    	        }
    	        return true;
    	    case MENU_DISABLED_PIXEL:
    	        if (mcEntryPtr == NULL) {
    		    backColor.red = backColor.blue = backColor.green = 0xFFFF;
    		    foreColor.red = foreColor.blue = foreColor.green = 0x0000;
    	        } else {
    	    	    backColor = mcEntryPtr->mctRGB2;
                    foreColor = mcEntryPtr->mctRGB3;
                }
                SetRect(&globalRect, SHRT_MIN, SHRT_MIN, SHRT_MAX, SHRT_MAX);
                maxDevice = GetMaxDevice(&globalRect);
                if (GetGray(maxDevice, &backColor, &foreColor)) {
             	    *macColor = foreColor;
    	        } else {
d482 3
a484 3
    	    	    /*
    	    	     * Pointer may have been moved by GetMaxDevice or GetGray.
    	    	     */
d486 15
a500 17
    	    	    mcEntryPtr = GetMCEntry(0,0);
    	    	    if (mcEntryPtr == NULL) {
    	   	        macColor->red = macColor->green = macColor->blue = 0x7777;
    	   	    } else {
    	    	        *macColor = mcEntryPtr->mctRGB2;
    	    	    }
    	        }
    	        return true;
    	    case MENU_TEXT_PIXEL:
    	        if (mcEntryPtr == NULL) {
    	    	    macColor->red = macColor->green = macColor->blue = 0;
    	        } else {
    	    	    *macColor = mcEntryPtr->mctRGB3;
    	        }
    	        return true;
        }
        return false;
d502 2
@


1.2
log
@Replaced SCCS strings, fixed binary files
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id$
d93 2
d256 6
@


1.1
log
@Initial revision
@
text
@d14 1
a14 1
 * SCCS: @@(#) tkMacColor.c 1.36 96/11/25 11:02:12
@


1.1.4.1
log
@Merged 8.0.3 changes into 8.1
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacColor.c,v 1.2 1998/09/14 18:23:34 stanton Exp $
@


1.1.4.2
log
@* integrated tk8.0.4 changes.

* generic/tkBind.c: fixed deletion order bug where a crash would
result if a binding deleted "."
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkMacColor.c,v 1.1.4.1 1998/09/30 02:18:03 stanton Exp $
a92 2
	case APPEARANCE_PIXEL:
	    return false;
a253 6
	    foundSystemColor = true;
	} else if (!strcasecmp(name+6, "AppearanceColor")) {
	    color.red = 0;
	    color.green = 0;
	    color.blue = 0;
	    pixelCode = APPEARANCE_PIXEL;
@


