예제 #1
0
파일: tkColor.c 프로젝트: arazaq/ns2
XColor *
Tk_GetColorByValue(
    Tk_Window tkwin,		/* Window where color will be used. */
    XColor *colorPtr)		/* Red, green, and blue fields indicate
				 * desired color. */
{
    ValueKey valueKey;
    Tcl_HashEntry *valueHashPtr;
    int isNew;
    TkColor *tkColPtr;
    Display *display = Tk_Display(tkwin);
    TkDisplay *dispPtr = TkGetDisplay(display);

    if (!dispPtr->colorInit) {
        ColorInit(dispPtr);
    }

    /*
     * First, check to see if there's already a mapping for this color name.
     * Must clear the structure first; it's not tightly packed on 64-bit
     * systems. [Bug 2911570]
     */

    memset(&valueKey, 0, sizeof(ValueKey));
    valueKey.red = colorPtr->red;
    valueKey.green = colorPtr->green;
    valueKey.blue = colorPtr->blue;
    valueKey.colormap = Tk_Colormap(tkwin);
    valueKey.display = display;
    valueHashPtr = Tcl_CreateHashEntry(&dispPtr->colorValueTable,
                                       (char *) &valueKey, &isNew);
    if (!isNew) {
        tkColPtr = Tcl_GetHashValue(valueHashPtr);
        tkColPtr->resourceRefCount++;
        return &tkColPtr->color;
    }

    /*
     * The name isn't currently known. Find a pixel value for this color and
     * add a new structure to colorValueTable (in TkDisplay).
     */

    tkColPtr = TkpGetColorByValue(tkwin, colorPtr);
    tkColPtr->magic = COLOR_MAGIC;
    tkColPtr->gc = None;
    tkColPtr->screen = Tk_Screen(tkwin);
    tkColPtr->colormap = valueKey.colormap;
    tkColPtr->visual = Tk_Visual(tkwin);
    tkColPtr->resourceRefCount = 1;
    tkColPtr->objRefCount = 0;
    tkColPtr->type = TK_COLOR_BY_VALUE;
    tkColPtr->hashPtr = valueHashPtr;
    tkColPtr->nextPtr = NULL;
    Tcl_SetHashValue(valueHashPtr, tkColPtr);
    return &tkColPtr->color;
}
예제 #2
0
파일: tkColor.c 프로젝트: arazaq/ns2
XColor *
Tk_GetColor(
    Tcl_Interp *interp,		/* Place to leave error message if color can't
				 * be found. */
    Tk_Window tkwin,		/* Window in which color will be used. */
    Tk_Uid name)		/* Name of color to be allocated (in form
				 * suitable for passing to XParseColor). */
{
    Tcl_HashEntry *nameHashPtr;
    int isNew;
    TkColor *tkColPtr;
    TkColor *existingColPtr;
    TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;

    if (!dispPtr->colorInit) {
        ColorInit(dispPtr);
    }

    /*
     * First, check to see if there's already a mapping for this color name.
     */

    nameHashPtr = Tcl_CreateHashEntry(&dispPtr->colorNameTable, name, &isNew);
    if (!isNew) {
        existingColPtr = Tcl_GetHashValue(nameHashPtr);
        for (tkColPtr = existingColPtr; tkColPtr != NULL;
                tkColPtr = tkColPtr->nextPtr) {
            if ((tkColPtr->screen == Tk_Screen(tkwin))
                    && (Tk_Colormap(tkwin) == tkColPtr->colormap)) {
                tkColPtr->resourceRefCount++;
                return &tkColPtr->color;
            }
        }
    } else {
        existingColPtr = NULL;
    }

    /*
     * The name isn't currently known. Map from the name to a pixel value.
     */

    tkColPtr = TkpGetColor(tkwin, name);
    if (tkColPtr == NULL) {
        if (interp != NULL) {
            if (*name == '#') {
                Tcl_AppendResult(interp, "invalid color name \"", name,
                                 "\"", NULL);
            } else {
                Tcl_AppendResult(interp, "unknown color name \"", name,
                                 "\"", NULL);
            }
        }
        if (isNew) {
            Tcl_DeleteHashEntry(nameHashPtr);
        }
        return NULL;
    }

    /*
     * Now create a new TkColor structure and add it to colorNameTable (in
     * TkDisplay).
     */

    tkColPtr->magic = COLOR_MAGIC;
    tkColPtr->gc = None;
    tkColPtr->screen = Tk_Screen(tkwin);
    tkColPtr->colormap = Tk_Colormap(tkwin);
    tkColPtr->visual = Tk_Visual(tkwin);
    tkColPtr->resourceRefCount = 1;
    tkColPtr->objRefCount = 0;
    tkColPtr->type = TK_COLOR_BY_NAME;
    tkColPtr->hashPtr = nameHashPtr;
    tkColPtr->nextPtr = existingColPtr;
    Tcl_SetHashValue(nameHashPtr, tkColPtr);

    return &tkColPtr->color;
}
예제 #3
0
파일: init.c 프로젝트: AEUG/400plus
void my_task_Startup() {
	DebugManager(1, 0x1F, 0x180000, 0x40000, 0x1C0000);

	dmstart();
	dmProcInit();

#ifdef ENABLE_MASSIVE_DEBUG
	// the 2nd level is 32 flags for debug classes
	// the 3rd arg is log level, 0 == full debug, >0 == less debug
	dmSetStoreLevel(hDbgMgr, 0xFF, 0);
	dmSetPrintLevel(hDbgMgr, 0xFF, 0);
#endif

	initialize();
	
	sub_FFAFE5BC();
	SetAssert();
	EventProcedureServiceInit();
	ShutDownProcInit();
	Install3VMemory(0xF8000000);
	RomManagerInit();
	CreateParamPubInstance();
	PropertyServiceInit();
	ErrorNumberListInit();
	FatalErrorsProcInit();
	RegisterISRs_OCH();
	BlockUntilAfterTimeoutProcInit(50);

	sub_FFB07740(0x10, 8, 0x1BBC);
	ResourceNameServiceInit();

	MemorySuite(0);

	sysClockRateSet_100(3);

	sub_FFB2BD6C();

	InitializeSerialIO();

	RtcInit(0x386D4380);

	AdjDefectsInit();

	CameraAdjsInit();

	SetAssertProc(AssertPrepare, 0);

	my_InitializeIntercom(); // InitializeIntercom();

	AfeGainCmosParamInit();

	EngineInit();

	EDmacPriorityManager();

	EngineResourceInit();

	PowerMgrInit(0);

	ClockInit(1);

	RegisterISR_CAPREADY();

	FaceSensorInit();

	RemDrvInit();
	ActSweepInit();

	LcdInit();

	DisplayInit1();

	DisplayInit2();

	PowerSaveProcInit();

	sub_FFA03B0C();

	sub_FFA05114();

	InitializeImagePlayDriver();

	LensNameTblInit();

	LensPOTblInit();

	FlyingInit();

	CaptureInit();

	BathtubSaturateInit();

	Module_CaptureImagePass();

	ClearSomeCapMem();

	ColorAdjustmentsInit();

	Module_PreDarkPassInit();

	LoadSystemInfo();

	SharedBufferInit(0x10800000, 0x18000000, 0xEE0000, 0xEE0000);

	FileCacheInit();
	PackMemInit();

	ImagePropInit();
	DigPropInit();

	ShootMainInit();

	OlcInfoInit();

	RegisterISR_EMERGENCY_CARDDOOR();

	my_MainCtrlInit();

	CaptureSemaphoreInit();

	VShadingInit();

	Module_CaptureDarkPassInit();

	Module_DarkSubtractionPassInit();
	BathtubInit();

	Module_BathtubCorrectPassInit();

	Module_VObIntegPassInit();

	SetProjectionInit();
	Module_DefectsDetectPassInit();

	DefsInit();
	WbDetectionInit();
	ObInit();

	Module_WbDetectionPassInit();
	DefsProcInit();

	Module_ObAreaCopyPassInit();
	Module_AdditionVTwoLinePassInit();

	VShadingProcInit();
	Module_VShadingCorrectPassInit();

	sub_FFA24838();
	HuffmanInit();

	RawToJpegPass_L_Init();
	RawToJpegPass_M2_Init();

	RawToJpegPass_S_Init();
	YcToJpegLargeFastInit();

	YcToJpegM2FastInit();
	YcToJpegSFastInit();

	RawToLosslessInit();
	Module_YcToTwainInit();

	RawToYcPass_S_Init();
	RawToYPackPass_S_Init();

	DvlpInit();
	DecodeJpegPassInit();
	HistPassInit();
	RectangleColorPassInit();
	RectangleCopyPassInit();

	ResizeYuvPassInit();
	sub_FFA35354();
	LpfPassInit();

	EncodeJpegPassInit();
	AdjRgbGainInit();
	LuckyInit();

	SysInfoProcInit();

	TablesInit();

	ColorInit();

	CtrlManRecursiveLock();

	CtrlSrvInit(0x19);

	LangConInit();
	sub_FF926E40();

	CreateDispSwControlPubInstance();

	CreateMemoryManagerPubInstance();

	my_GUIInit(); //GUIInit();
	GUIApiCalls();

	InitializeImagePlayer();

	ColorBarProcsInit();
	LcdAdjustProcsInit();

	sub_FFB29348();
	CMOSParamInit();

	CameraSettingsInit();
	BootDiskProcsInit();

	DDDInit();
	TFTInit();

	RegisterResourceName(hResourceName, "USR ROOT DEVICE HANDLE", 0x7B);

	RegisterResource_env(0xC02200B8, "U2VBUS");
	RegisterResource_env(1, "USBC20 VBUS SUPPORT");

	RegisterResource_env(0x14, "DEVICESPEED");
	USBC20_Init();
	USBC20_USBIF_Init();

	USBC20_BUFCON_Init();
	USBC20_CLK_Init();
	USBC20_HDMAC_Init();

	DCPClassFunctionsInit();
	USBDriverInit();
	RapiSwitcherInit();

	DCPClassInit();
	RAPITransportUSBInit();
	PTPRespondInit();

	PTPFrameworkInit();
	StartupPtpResponder();

	RapiTransportManagerInit();
	DCPClassInit();

	EventProcServerInit();
	sub_FFA5D8A0();
	DCPInit();

	SesnMngrInit();
	MemMngrInit();
	InitializeRapiTransportManager();

	PrintInit();
	sub_FF95EC54();
	SomePrintInit();
	sub_FF9EB94C();

	InitializeUSBDriver();
	TransMemoryInit();
	InitializeComCtrl();

	FactoryModeInit();
	DP_Init(0, 0x1B, 0, 0);
	return_0();

	sub_FF98CF4C();
	EdLedProcsInit();
	CallBacksInit();

	RegistNotifyConnectDT();
	DPOF_Initialize();

	MpuMonInit();

	StartConsole();
}
예제 #4
0
파일: colorwp.c 프로젝트: mingpen/OpenNT
DIALOGPROC ColorDlgProc(
    HWND hwnd,
    UINT msg,
    WPARAM wParam,
    LONG lParam)
{
    switch (msg) {
        case WM_INITDIALOG:
            ColorInit(hwnd);

            /*
             * Return TRUE so that the dialog manager does NOT set the focus
             * for me.  This prevents the status window from initially having
             * the focus when the editor is started.
             */
            return TRUE;

        case WM_ACTIVATE:
            if (GET_WM_ACTIVATE_STATE(wParam, lParam))
                gidCurrentDlg = DID_COLOR;

            break;

        case WM_CTLCOLOR:
        case WM_CTLCOLORBTN:
        case WM_CTLCOLORDLG:
        case WM_CTLCOLORSTATIC:
            switch (GET_WM_CTLCOLOR_TYPE(wParam, lParam, msg)) {
                case CTLCOLOR_BTN:
                case CTLCOLOR_DLG:
                    return (BOOL)GetStockObject(LTGRAY_BRUSH);

                case CTLCOLOR_STATIC:
                    SetBkColor(GET_WM_CTLCOLOR_HDC(wParam, lParam, msg),
                            RGB_LIGHTGRAY);
                    return (BOOL)GetStockObject(LTGRAY_BRUSH);
            }

            return (BOOL)NULL;

        case  WM_PAINT:
            {
                HDC hdc;
                PAINTSTRUCT ps;

                hdc = BeginPaint(hwnd, &ps);
                DrawMarginBorder(hwnd, hdc);
                EndPaint(hwnd, &ps);
            }

            break;

        case WM_COMMAND:
            ColorProcessCommand(hwnd,
                    GET_WM_COMMAND_ID(wParam, lParam),
                    GET_WM_COMMAND_CMD(wParam, lParam));
            break;

        case WM_CLOSE:
            /*
             * The user closed the color palette from the system menu.
             * Hide the window (we don't actually destroy it so
             * that it will appear in the same spot when they show
             * it again).
             */
            ColorShow(FALSE);
            gfShowColor = FALSE;
            break;

        case WM_DESTROY:
            {
                RECT rc;

                /*
                 * Save the position of the color palette.
                 */
                GetWindowRect(hwnd, &rc);
                WriteWindowPos(&rc, FALSE, szColorPos);

                /*
                 * Null out the global window handle for the color palette
                 * for safety's sake.
                 */
                ghwndColor = NULL;
            }

            break;

        default:
            return FALSE;
    }

    return FALSE;
}
예제 #5
0
BOOL WINPROC EXPORT DlgTextProc(
/***********************************************************************/
HWND 	hDlg,
UINT 	msg,
WPARAM 	wParam,
LPARAM 	lParam)
{
int i;
WORD wKey;
HFONT hFont;
STRING szString;

switch (msg)
    {
    case WM_INITDIALOG:
	RibbonInit( hDlg );
	ColorInit( hDlg );
	GetFonts( hDlg );
	CheckRadioButton( hDlg, IDC_TEXT_T1, IDC_TEXT_T10, Text.nFont+IDC_TEXT_T1 );
	Text.Size = 48;
	InitSlide( hDlg, IDC_TEXT_SIZE, Text.Size, 24, 200 );
	Text.Angle = 0;
	InitSlide( hDlg, IDC_TEXT_ANGLE, 0, -2, 2 );
	ControlEnable(hDlg, IDC_TEXT_ANGLE, TextCanRotate(hDlg, Text.nFont));
	for ( i=0; i<max(10,Text.nFont); i++ )
		{
		hFont = CreateFont(
				/* Height */ 45,
				/* Width */ 0,
				/* Escapement */ 0,
				/* Orientation */ 0,
				/* Weight */ FW_NORMAL,
				/* Italic */ FALSE,
				/* UnderLine */ FALSE,
				/* StrikeOut */ FALSE,
				/* CharSet */ Text.lpFontList[i].fdCharSet,
				/* Output Precis */ OUT_CHARACTER_PRECIS,
				/* Clip Precis */ CLIP_DEFAULT_PRECIS,
				/* Quality */ PROOF_QUALITY,
				/* PitchAndFamily */ Text.lpFontList[i].fdPitchAndFamily,
				/* Face */ Text.lpFontList[i].fdFaceName );
		if ( hFont )
			SendDlgItemMessage( hDlg, IDC_TEXT_T1+i, WM_SETFONT, (WPARAM)hFont, 0L );
		}
	if ( lpImage )
		{
		bTextBegun = TextBegin( lpImage->hWnd, 10/*x*/, 40/*y*/ );
		Tool.bActive = YES;
		SetFocus( lpImage->hWnd );
		}
	else
		bTextBegun = NO;
	// fall thru

    case WM_CONTROLENABLE:
    case WM_DOCACTIVATED:
	break;

	case WM_DESTROY:
	if ( bTextBegun )
		{
		if ( lpImage )
			{
			TextEnd( lpImage->hWnd, NO/*fCancel*/ );
			Tool.bActive = NO;
			AstralUpdateWindow( lpImage->hWnd );
			}
		bTextBegun = NO;
		}
	for ( i=0; i<max(10,Text.nFont); i++ )
		{
		if ( hFont = (HFONT)SendDlgItemMessage( hDlg, IDC_TEXT_T1+i, WM_GETFONT, (WPARAM)0, 0L ) )
			DeleteObject( hFont );
		}
	if ( Text.lpFontList )
		{
		FreeUp((LPTR)Text.lpFontList);
		Text.lpFontList = NULL;
		}
	break;

    case WM_CHAR:
	if ( !lpImage || !bTextBegun )
		return( FALSE );
	TextSetFocus();
	wKey = (WORD)lParam;
	TextKeystroke( lpImage->hWnd, wKey );
	if ( wKey == VK_RETURN )
		{
		TextAnchor( lpImage->hWnd );
		RandomizeActiveColor();
		break;
		}
	szString[0] = '_';
	szString[1] = wKey;
	szString[2] = '\0';
	Lowercase( szString );
	SoundStartResource( szString, NO/*bLoop*/, NULL/*hInstance*/ );
	break;

    case WM_KEYDOWN:
	if ( !lpImage || !bTextBegun )
		return( FALSE );
	wKey = lParam;
	switch (wKey)
		{
		case VK_UP:
			TextRMove( lpImage->hWnd, 0, -1 );
			break;
		case VK_DOWN:
			TextRMove( lpImage->hWnd, 0, 1);
			break;
		case VK_LEFT:
			TextRMove( lpImage->hWnd, -1, 0);
			break;
		case VK_RIGHT:
			TextRMove( lpImage->hWnd, 1, 0);
			break;
		default:
			break;
		}
	break;

    case WM_SETCURSOR:
	return( SetupCursor( wParam, lParam, IDD_TEXT ) );

    case WM_ERASEBKGND:
	break; // handle ERASEBKGND and do nothing; PAINT covers everything

    case WM_PAINT:
	LayoutPaint( hDlg );
	break;

    case WM_CLOSE:
	AstralDlgEnd( hDlg, FALSE );
	break;

    case WM_MEASUREITEM:
    case WM_DRAWITEM:
	return( OwnerDraw( hDlg, msg, lParam, NO ) );

    case WM_CTLCOLOR:
// We don't get this message
//	Print( "%u", HIWORD(lParam) );
//	if ( HIWORD(lParam) == CTLCOLOR_BTN )
//		{
//		SetTextColor( (HDC)wParam, RGB(0,0,255) ); // Blue text...
//		SetBkColor( (HDC)wParam, RGB(255,255,255) ); // on a white background
//		return( GetStockObject(WHITE_BRUSH) );
//		}
	return( (BOOL)SetControlColors( (HDC)wParam, hDlg, (HWND)LOWORD(lParam),
		HIWORD(lParam) ) );

    case WM_COMMAND:
	switch (wParam)
	    {
		case IDC_ACTIVECOLOR:
		case IDC_COLORS_TEXT:
		ColorCommand( hDlg, wParam, lParam );
		TextSetFocus();
		if (bTextBegun)
			TextFontChanged(lpImage->hWnd);
		break;

		case IDC_TEXT_T1:
		case IDC_TEXT_T2:
		case IDC_TEXT_T3:
		case IDC_TEXT_T4:
		case IDC_TEXT_T5:
		case IDC_TEXT_T6:
		case IDC_TEXT_T7:
		case IDC_TEXT_T8:
		case IDC_TEXT_T9:
		case IDC_TEXT_T10:
		CheckRadioButton( hDlg, IDC_TEXT_T1, IDC_TEXT_T10, wParam );
		Text.nFont = wParam - IDC_TEXT_T1;
		ControlEnable(hDlg, IDC_TEXT_ANGLE, TextCanRotate(hDlg, Text.nFont));
		TextSetFocus();
		if (bTextBegun)
			TextFontChanged(lpImage->hWnd);
		break;

	    case IDC_TEXT_SIZE:
		Text.Size = HandleSlide( hDlg, (ITEMID)wParam, (UINT)lParam, NULL );
		Text.Size = bound( Text.Size, 16, 216 );
		if ( !LBUTTON )
			TextSetFocus();
		if (bTextBegun)
			TextFontChanged(lpImage->hWnd);
		break;

	    case IDC_TEXT_ANGLE:
		i = HandleSlide( hDlg, (ITEMID)wParam, (UINT)lParam, NULL ); // -2 to 2
		Text.Angle = (i * 45);
		if ( Text.Angle < 0 )
			Text.Angle += 360;
		i = (Text.Angle + 22) / 45; // down to 0-8
		if ( i > 4 )
				i = bound( i - 8, -2, 0 );
		else	i = bound( i, 0, 2 );
		SetSlide( hDlg, wParam, i );
		if ( !LBUTTON )
			TextSetFocus();
		if (bTextBegun)
			TextFontChanged(lpImage->hWnd);
		break;

	    default:
		return( FALSE );
	    }

    default:
	return( FALSE );
    }

return( TRUE );
}
예제 #6
0
void SkJS::InitializeDisplayables(const SkBitmap& bitmap, JSContext *cx, JSObject *obj, JSObject *proto) {
    SkJSDisplayable::gCanvas = new SkCanvas(bitmap);
    SkJSDisplayable::gPaint = new SkPaint();
#if SK_USE_CONDENSED_INFO == 0
    GenerateTables();
#else
    SkASSERT(0); // !!! compressed version hasn't been implemented
#endif
    AddInit(cx, obj, proto);
    AddCircleInit(cx, obj, proto);
    AddOvalInit(cx, obj, proto);
    AddPathInit(cx, obj, proto);
    AddRectangleInit(cx, obj, proto);
    AddRoundRectInit(cx, obj, proto);
//  AfterInit(cx, obj, proto);
    ApplyInit(cx, obj, proto);
    // AnimateInit(cx, obj, proto);
//  AnimateColorInit(cx, obj, proto);
    AnimateFieldInit(cx, obj, proto);
//  AnimateRotateInit(cx, obj, proto);
//  AnimateScaleInit(cx, obj, proto);
//  AnimateTranslateInit(cx, obj, proto);
    BitmapInit(cx, obj, proto);
//  BaseBitmapInit(cx, obj, proto);
//  BeforeInit(cx, obj, proto);
    BitmapShaderInit(cx, obj, proto);
    BlurInit(cx, obj, proto);
    ClipInit(cx, obj, proto);
    ColorInit(cx, obj, proto);
    CubicToInit(cx, obj, proto);
    DashInit(cx, obj, proto);
    DataInit(cx, obj, proto);
//  DimensionsInit(cx, obj, proto);
    DiscreteInit(cx, obj, proto);
    DrawToInit(cx, obj, proto);
    EmbossInit(cx, obj, proto);
    EventInit(cx, obj, proto);
//  FontInit(cx, obj, proto);
//  FocusInit(cx, obj, proto);
    ImageInit(cx, obj, proto);
    IncludeInit(cx, obj, proto);
//  InputInit(cx, obj, proto);
    LineInit(cx, obj, proto);
    LinearGradientInit(cx, obj, proto);
    LineToInit(cx, obj, proto);
    MatrixInit(cx, obj, proto);
    MoveInit(cx, obj, proto);
    MoveToInit(cx, obj, proto);
    OvalInit(cx, obj, proto);
    PathInit(cx, obj, proto);
    PaintInit(cx, obj, proto);
    DrawPointInit(cx, obj, proto);
    PolyToPolyInit(cx, obj, proto);
    PolygonInit(cx, obj, proto);
    PolylineInit(cx, obj, proto);
    PostInit(cx, obj, proto);
    QuadToInit(cx, obj, proto);
    RadialGradientInit(cx, obj, proto);
    RandomInit(cx, obj, proto);
    RectToRectInit(cx, obj, proto);
    RectangleInit(cx, obj, proto);
    RemoveInit(cx, obj, proto);
    ReplaceInit(cx, obj, proto);
    RotateInit(cx, obj, proto);
    RoundRectInit(cx, obj, proto);
    ScaleInit(cx, obj, proto);
    SetInit(cx, obj, proto);
    SkewInit(cx, obj, proto);
    // 3D_CameraInit(cx, obj, proto);
    // 3D_PatchInit(cx, obj, proto);
    SnapshotInit(cx, obj, proto);
//  StrokeInit(cx, obj, proto);
    TextInit(cx, obj, proto);
    TextOnPathInit(cx, obj, proto);
    TextToPathInit(cx, obj, proto);
    TranslateInit(cx, obj, proto);
//  UseInit(cx, obj, proto);
}
예제 #7
0
BOOL WINPROC EXPORT DlgLinesProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
/***********************************************************************/
{
STRING szOptions;
LPFRAME lpFrame;

switch (msg)
    {
    case WM_INITDIALOG:
	SetControlFont (hDlg, IDC_LINES_CATEGORY);
	RibbonInit( hDlg );
	ColorInit( hDlg );
	iTotalCategories = GetExtNameCount( IDN_CUSTOM );
	hOptions = OptionLoadLibrary( hDlg, IDC_LINES_CATEGORY, 11/*iCount*/,
		IDN_CUSTOM, iCategory, iTotalCategories );
	OptionGetString( hOptions, 0, szOptions );
	SetWindowText( GetDlgItem( hDlg, IDC_LINES_CATEGORY ), szOptions );
	CheckRadioButton( hDlg, IDC_LINES_T1, IDC_LINES_T10,
		iTool+IDC_LINES_T1 );
	// Fall thru...

    case WM_CONTROLENABLE:
    case WM_DOCACTIVATED:
	Retouch.hBrush = CreateSimpleBrush( Retouch.hBrush );
	SetSimpleBrushStrokeMethod( Retouch.hBrush, SM_SIMPLE_DDA );
	SetSimpleBrushSpacing( Retouch.hBrush, 100 );
	OptionGetString( hOptions, iTool+1, szOptions );
	lpFrame = TiffResource2Frame( hOptions, (LPSTR)MAKEINTRESOURCE(iTool+1) );
	SetSimpleBrushSource( Retouch.hBrush, lpFrame, szOptions );
	break;

    case WM_SETCURSOR:
	return( SetupCursor( wParam, lParam, Tool.idRibbon ) );

    case WM_ERASEBKGND:
	break; // handle ERASEBKGND and do nothing; PAINT covers everything

    case WM_PAINT:
	LayoutPaint( hDlg );
	break;

    case WM_DESTROY:
	if ( hOptions != hInstAstral )
		FreeLibrary( hOptions );
	return( FALSE );

    case WM_CLOSE:
	AstralDlgEnd( hDlg, FALSE );
	break;

    case WM_CTLCOLOR:
	return( (BOOL)SetControlColors( (HDC)wParam, hDlg, (HWND)LOWORD(lParam),
		HIWORD(lParam) ) );

    case WM_COMMAND:
	switch (wParam)
	    {
		case IDC_ACTIVECOLOR:
		case IDC_COLORS_LINES:
			ColorCommand( hDlg, wParam, lParam );
			break;

		case IDC_LINES_CATEGORY:
		if ( hOptions != hInstAstral )
			FreeLibrary( hOptions );
		iCategory++;
		hOptions = OptionLoadLibrary( hDlg, IDC_LINES_CATEGORY, 11/*iCount*/,
			IDN_CUSTOM, iCategory, iTotalCategories );
		OptionGetString( hOptions, 0, szOptions );
		SetWindowText( GetDlgItem( hDlg, IDC_LINES_CATEGORY ), szOptions );
		OptionGetString( hOptions, iTool+1, szOptions );
		lpFrame = TiffResource2Frame( hOptions, (LPSTR)MAKEINTRESOURCE(iTool+1) );
		SetSimpleBrushSource( Retouch.hBrush, lpFrame, szOptions );
		break;

		case IDC_LINES_T1:
		case IDC_LINES_T2:
		case IDC_LINES_T3:
		case IDC_LINES_T4:
		case IDC_LINES_T5:
		case IDC_LINES_T6:
		case IDC_LINES_T7:
		case IDC_LINES_T8:
		case IDC_LINES_T9:
		case IDC_LINES_T10:
		CheckRadioButton( hDlg, IDC_LINES_T1, IDC_LINES_T10, wParam );
		iTool = wParam - IDC_LINES_T1;
		OptionGetString( hOptions, iTool+1, szOptions );
		lpFrame = TiffResource2Frame( hOptions, (LPSTR)MAKEINTRESOURCE(iTool+1) );
		SetSimpleBrushSource( Retouch.hBrush, lpFrame, szOptions );
		break;

	    default:
		return( FALSE );
		}
	break;

    default:
	return( FALSE );
    }

return( TRUE );
}