rem: WMAddPopUpButtonItem(panel->colorListColorMenuBtn, "Add..."); WMAddPopUpButtonItem(panel->colorListColorMenuBtn, "Rename..."); WMAddPopUpButtonItem(panel->colorListColorMenuBtn, "Remove");
add: WMAddPopUpButtonItem(panel->colorListColorMenuBtn, _("Add...")); WMAddPopUpButtonItem(panel->colorListColorMenuBtn, _("Rename...")); WMAddPopUpButtonItem(panel->colorListColorMenuBtn, _("Remove"));
context: makeColorPanel(WMScreen *scrPtr, char *name){    WMColorPanel	*panel;    RImage		*image;    WMPixmap		*pixmap;    RColor		from;    RColor		to;    WMColor		*textcolor, *graybuttoncolor;    int			i;    GC			bgc = WMColorGC(scrPtr->black);    GC			wgc = WMColorGC(scrPtr->white);         panel = wmalloc(sizeof(WMColorPanel));    memset(panel, 0, sizeof(WMColorPanel));     panel->color.rgb.red = 0;    panel->color.rgb.green = 0;    panel->color.rgb.blue = 0;    panel->color.hsv.hue = 0;    panel->color.hsv.saturation = 0;    panel->color.hsv.value = 0;    panel->color.set = cpNone;	/* Color has not been set yet */       panel->font8 = WMSystemFontOfSize(scrPtr, 8);    panel->font12 = WMSystemFontOfSize(scrPtr, 12);        panel->win = WMCreateWindowWithStyle(scrPtr, name,	    WMTitledWindowMask | WMClosableWindowMask | WMResizableWindowMask);    WMResizeWidget(panel->win, PWIDTH, PHEIGHT);    WMSetWindowTitle(panel->win, "Colors");    WMSetWindowCloseAction(panel->win, closeWindowCallback, panel);            /* Set Default ColorPanel Mode(s) */    panel->mode = WMWheelModeColorPanel;    panel->lastChanged = 0;    panel->slidersmode = WMRGBModeColorPanel;    panel->configurationPath = wstrconcat(wusergnusteppath(), 					  "/Library/Colors/");        /* Some General Purpose Widgets */    panel->colorWell = WMCreateColorWell(panel->win);    WMResizeWidget(panel->colorWell, 134, 36);    WSetColorWellBordered(panel->colorWell, False);    WMMoveWidget(panel->colorWell, 56, 4);        panel->magnifyBtn = WMCreateCustomButton(panel->win,	    WBBStateLightMask|WBBStateChangeMask);    WMResizeWidget(panel->magnifyBtn, 46, 36);    WMMoveWidget(panel->magnifyBtn, 6,4);    WMSetButtonAction(panel->magnifyBtn, magnifyPutCursor, panel);    WMSetButtonImagePosition(panel->magnifyBtn, WIPImageOnly);    WMSetButtonImage(panel->magnifyBtn, scrPtr->magnifyIcon);        panel->wheelBtn = WMCreateCustomButton(panel->win,	    WBBStateLightMask|WBBStateChangeMask);    WMResizeWidget(panel->wheelBtn, 46, 32);    WMMoveWidget(panel->wheelBtn, 6, 44);    WMSetButtonAction(panel->wheelBtn, modeButtonCallback, panel);    WMSetButtonImagePosition(panel->wheelBtn, WIPImageOnly);    WMSetButtonImage(panel->wheelBtn, scrPtr->wheelIcon);        panel->slidersBtn = WMCreateCustomButton(panel->win,	    WBBStateLightMask|WBBStateChangeMask);    WMResizeWidget(panel->slidersBtn, 46, 32);    WMMoveWidget(panel->slidersBtn, 52, 44);    WMSetButtonAction(panel->slidersBtn, modeButtonCallback, panel);    WMSetButtonImagePosition(panel->slidersBtn, WIPImageOnly);    WMSetButtonImage(panel->slidersBtn, scrPtr->rgbIcon);        panel->customPaletteBtn = WMCreateCustomButton(panel->win,	    WBBStateLightMask|WBBStateChangeMask);    WMResizeWidget(panel->customPaletteBtn, 46, 32);    WMMoveWidget(panel->customPaletteBtn, 98, 44);    WMSetButtonAction(panel->customPaletteBtn, modeButtonCallback, panel);    WMSetButtonImagePosition(panel->customPaletteBtn, WIPImageOnly);    WMSetButtonImage(panel->customPaletteBtn, scrPtr->customPaletteIcon);    panel->colorListBtn = WMCreateCustomButton(panel->win,	    WBBStateLightMask|WBBStateChangeMask);    WMResizeWidget(panel->colorListBtn, 46, 32);    WMMoveWidget(panel->colorListBtn, 144, 44);    WMSetButtonAction(panel->colorListBtn, modeButtonCallback, panel);    WMSetButtonImagePosition(panel->colorListBtn, WIPImageOnly);    WMSetButtonImage(panel->colorListBtn, scrPtr->colorListIcon);    /* Let's Group some of them together */    WMGroupButtons(panel->wheelBtn, panel->slidersBtn);    WMGroupButtons(panel->wheelBtn, panel->customPaletteBtn);    WMGroupButtons(panel->wheelBtn, panel->colorListBtn);      /* Widgets for the ColorWheel Panel */    panel->wheelFrm = WMCreateFrame(panel->win);    WMSetFrameRelief(panel->wheelFrm, WRFlat);    WMResizeWidget(panel->wheelFrm, PWIDTH - 8, PHEIGHT - 80 - 26);    WMMoveWidget(panel->wheelFrm, 5, 80);        panel->wheelView = W_CreateView(W_VIEW(panel->wheelFrm));    /* XXX Can we create a view ? */    W_ResizeView(panel->wheelView, colorWheelSize+4, colorWheelSize+4);    W_MoveView(panel->wheelView, 0, 0);        /* Create an event handler to handle expose/click events in ColorWheel */    WMCreateEventHandler(panel->wheelView, 			 ButtonPressMask|ButtonReleaseMask|EnterWindowMask|			 LeaveWindowMask|ButtonMotionMask, wheelHandleActionEvents, panel);        WMCreateEventHandler(panel->wheelView, ExposureMask, wheelHandleEvents, 			 panel);        panel->wheelBrightnessS = WMCreateSlider(panel->wheelFrm);    WMResizeWidget(panel->wheelBrightnessS, 16, 153);    WMMoveWidget(panel->wheelBrightnessS, 5+colorWheelSize+14, 1);    WMSetSliderMinValue(panel->wheelBrightnessS, 0);    WMSetSliderMaxValue(panel->wheelBrightnessS, 255);    WMSetSliderAction(panel->wheelBrightnessS, wheelBrightnessSliderCallback, 		      panel);    WMSetSliderKnobThickness(panel->wheelBrightnessS, knobThickness);        panel->wheelMtrx = wheelCreateMatrix(colorWheelSize+4, colorWheelSize+4);    wheelInitMatrix(panel);            /* Widgets for the Slider Panels */    panel->slidersFrm = WMCreateFrame(panel->win);    WMSetFrameRelief(panel->slidersFrm, WRFlat);    WMResizeWidget(panel->slidersFrm, PWIDTH - 8, PHEIGHT - 80 - 26);    WMMoveWidget(panel->slidersFrm, 4, 80);        panel->seperatorFrm = WMCreateFrame(panel->slidersFrm);    WMSetFrameRelief(panel->seperatorFrm, WRPushed);    WMResizeWidget(panel->seperatorFrm, PWIDTH - 8, 2);    WMMoveWidget(panel->seperatorFrm, 0, 1);        panel->grayBtn = WMCreateCustomButton(panel->slidersFrm,	    WBBStateLightMask|WBBStateChangeMask);    WMResizeWidget(panel->grayBtn, 46, 24);    WMMoveWidget(panel->grayBtn, 1, 8);    WMSetButtonAction(panel->grayBtn, modeButtonCallback, panel);    WMSetButtonImagePosition(panel->grayBtn, WIPImageOnly);    WMSetButtonImage(panel->grayBtn, scrPtr->grayIcon);        panel->rgbBtn = WMCreateCustomButton(panel->slidersFrm,	    WBBStateLightMask|WBBStateChangeMask);    WMResizeWidget(panel->rgbBtn, 46, 24);    WMMoveWidget(panel->rgbBtn, 47, 8);    WMSetButtonAction(panel->rgbBtn, modeButtonCallback, panel);    WMSetButtonImagePosition(panel->rgbBtn, WIPImageOnly);    WMSetButtonImage(panel->rgbBtn, scrPtr->rgbIcon);        panel->cmykBtn = WMCreateCustomButton(panel->slidersFrm,	    WBBStateLightMask|WBBStateChangeMask);    WMResizeWidget(panel->cmykBtn, 46, 24);    WMMoveWidget(panel->cmykBtn, 93, 8);    WMSetButtonAction(panel->cmykBtn, modeButtonCallback, panel);    WMSetButtonImagePosition(panel->cmykBtn, WIPImageOnly);    WMSetButtonImage(panel->cmykBtn, scrPtr->cmykIcon);        panel->hsbBtn = WMCreateCustomButton(panel->slidersFrm,	    WBBStateLightMask|WBBStateChangeMask);    WMResizeWidget(panel->hsbBtn, 46, 24);    WMMoveWidget(panel->hsbBtn, 139, 8);    WMSetButtonAction(panel->hsbBtn, modeButtonCallback, panel);    WMSetButtonImagePosition(panel->hsbBtn, WIPImageOnly);    WMSetButtonImage(panel->hsbBtn, scrPtr->hsbIcon);        /* Let's Group the Slider Panel Buttons Together */    WMGroupButtons(panel->grayBtn, panel->rgbBtn);    WMGroupButtons(panel->grayBtn, panel->cmykBtn);    WMGroupButtons(panel->grayBtn, panel->hsbBtn);        textcolor = WMDarkGrayColor(scrPtr);        /* Widgets for GrayScale Panel */    panel->grayFrm = WMCreateFrame(panel->slidersFrm);    WMSetFrameRelief(panel->grayFrm, WRFlat);    WMResizeWidget(panel->grayFrm, PWIDTH - 8, PHEIGHT - 80 - 26 - 32);    WMMoveWidget(panel->grayFrm, 0, 34);        panel->grayMinL = WMCreateLabel(panel->grayFrm);    WMResizeWidget(panel->grayMinL, 20, 10);    WMMoveWidget(panel->grayMinL, 2, 2);    WMSetLabelText(panel->grayMinL, "0");    WMSetLabelTextAlignment(panel->grayMinL, WALeft);    WMSetLabelTextColor(panel->grayMinL, textcolor);    WMSetLabelFont(panel->grayMinL, panel->font8);        panel->grayMaxL = WMCreateLabel(panel->grayFrm);    WMResizeWidget(panel->grayMaxL, 40, 10);    WMMoveWidget(panel->grayMaxL, 104, 2);    WMSetLabelText(panel->grayMaxL, "100");    WMSetLabelTextAlignment(panel->grayMaxL, WARight);    WMSetLabelTextColor(panel->grayMaxL, textcolor);    WMSetLabelFont(panel->grayMaxL, panel->font8);        panel->grayBrightnessS = WMCreateSlider(panel->grayFrm);    WMResizeWidget(panel->grayBrightnessS, 141, 16);    WMMoveWidget(panel->grayBrightnessS, 2, 14);    WMSetSliderMinValue(panel->grayBrightnessS, 0);    WMSetSliderMaxValue(panel->grayBrightnessS, 100);    WMSetSliderKnobThickness(panel->grayBrightnessS, knobThickness);    WMSetSliderAction(panel->grayBrightnessS, grayBrightnessSliderCallback, 		      panel);        from.red = 0;    from.green = 0;    from.blue = 0;        to.red = 255;    to.green = 255;    to.blue = 255;        image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);    pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);    RReleaseImage(image);       if (pixmap)    W_PaintText(W_VIEW(panel->grayBrightnessS), pixmap->pixmap, 		panel->font12, 2, 0, 100, WALeft, WMColorGC(scrPtr->white), 		False, "Brightness", strlen("Brightness"));    else	wwarning(NO_MEMORY_ERR);    WMSetSliderImage(panel->grayBrightnessS, pixmap);    WMReleasePixmap(pixmap);        panel->grayBrightnessT = WMCreateTextField(panel->grayFrm);    WMResizeWidget(panel->grayBrightnessT, 40, 18);    WMMoveWidget(panel->grayBrightnessT, 146, 13);    WMSetTextFieldAlignment(panel->grayBrightnessT, WALeft);    WMAddNotificationObserver(grayBrightnessTextFieldCallback, panel,	    WMTextDidEndEditingNotification, panel->grayBrightnessT);        for (i=0; i < 7; i++) {	pixmap = WMCreatePixmap(scrPtr, 13, 13, scrPtr->depth, False);	graybuttoncolor = WMCreateRGBColor(scrPtr, (255/6)*i << 8,		(255/6)*i << 8, (255/6)*i << 8, True);	WMPaintColorSwatch(graybuttoncolor, pixmap->pixmap, 0, 0, 15, 15);	WMReleaseColor(graybuttoncolor);	panel->grayPresetBtn[i] = WMCreateCommandButton(panel->grayFrm);	WMResizeWidget(panel->grayPresetBtn[i], 20, 24);	WMMoveWidget(panel->grayPresetBtn[i], 2+(i*20), 34);	WMSetButtonAction(panel->grayPresetBtn[i], 			  grayPresetButtonCallback, panel);	WMSetButtonImage(panel->grayPresetBtn[i], pixmap);	WMSetButtonImagePosition(panel->grayPresetBtn[i], WIPImageOnly);	WMReleasePixmap(pixmap);	    }        /* End of GrayScale Panel */        /* Widgets for RGB Panel */    panel->rgbFrm = WMCreateFrame(panel->slidersFrm);    WMSetFrameRelief(panel->rgbFrm, WRFlat);    WMResizeWidget(panel->rgbFrm, PWIDTH - 8, PHEIGHT - 80 - 26 - 32);    WMMoveWidget(panel->rgbFrm, 0, 34);        panel->rgbMinL = WMCreateLabel(panel->rgbFrm);    WMResizeWidget(panel->rgbMinL, 20, 10);    WMMoveWidget(panel->rgbMinL, 2, 2);    WMSetLabelText(panel->rgbMinL, "0");    WMSetLabelTextAlignment(panel->rgbMinL, WALeft);    WMSetLabelTextColor(panel->rgbMinL, textcolor);    WMSetLabelFont(panel->rgbMinL, panel->font8);        panel->rgbMaxL = WMCreateLabel(panel->rgbFrm);    WMResizeWidget(panel->rgbMaxL, 40, 10);    WMMoveWidget(panel->rgbMaxL, 104, 2);    WMSetLabelText(panel->rgbMaxL, "255");    WMSetLabelTextAlignment(panel->rgbMaxL, WARight);    WMSetLabelTextColor(panel->rgbMaxL, textcolor);    WMSetLabelFont(panel->rgbMaxL, panel->font8);        panel->rgbRedS = WMCreateSlider(panel->rgbFrm);    WMResizeWidget(panel->rgbRedS, 141, 16);    WMMoveWidget(panel->rgbRedS, 2, 14);    WMSetSliderMinValue(panel->rgbRedS, 0);    WMSetSliderMaxValue(panel->rgbRedS, 255);    WMSetSliderKnobThickness(panel->rgbRedS, knobThickness);    WMSetSliderAction(panel->rgbRedS, rgbSliderCallback, panel);        to.red = 255;    to.green = 0;    to.blue = 0;        image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);    pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);    RReleaseImage(image);    if (pixmap)	W_PaintText(W_VIEW(panel->rgbRedS), pixmap->pixmap, panel->font12,		2, 0, 100, WALeft, WMColorGC(scrPtr->white), False, "Red",		strlen("Red"));    else	wwarning(NO_MEMORY_ERR);    WMSetSliderImage(panel->rgbRedS, pixmap);    WMReleasePixmap(pixmap);        panel->rgbRedT = WMCreateTextField(panel->rgbFrm);    WMResizeWidget(panel->rgbRedT, 40, 18);    WMMoveWidget(panel->rgbRedT, 146, 13);    WMSetTextFieldAlignment(panel->rgbRedT, WALeft);    WMAddNotificationObserver(rgbTextFieldCallback, panel,			      WMTextDidEndEditingNotification, panel->rgbRedT);        panel->rgbGreenS = WMCreateSlider(panel->rgbFrm);    WMResizeWidget(panel->rgbGreenS, 141, 16);    WMMoveWidget(panel->rgbGreenS, 2, 36);    WMSetSliderMinValue(panel->rgbGreenS, 0);    WMSetSliderMaxValue(panel->rgbGreenS, 255);    WMSetSliderKnobThickness(panel->rgbGreenS, knobThickness);    WMSetSliderAction(panel->rgbGreenS, rgbSliderCallback, panel);        to.red = 0;    to.green = 255;    to.blue = 0;        image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);    pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);    RReleaseImage(image);    if (pixmap)	W_PaintText(W_VIEW(panel->rgbGreenS), pixmap->pixmap, panel->font12,		2, 0, 100, WALeft, WMColorGC(scrPtr->white), False, "Green",		strlen("Green"));    else	wwarning(NO_MEMORY_ERR);        WMSetSliderImage(panel->rgbGreenS, pixmap);    WMReleasePixmap(pixmap);        panel->rgbGreenT = WMCreateTextField(panel->rgbFrm);    WMResizeWidget(panel->rgbGreenT, 40, 18);    WMMoveWidget(panel->rgbGreenT, 146, 35);    WMSetTextFieldAlignment(panel->rgbGreenT, WALeft);    WMAddNotificationObserver(rgbTextFieldCallback, panel,			      WMTextDidEndEditingNotification, panel->rgbGreenT);            panel->rgbBlueS = WMCreateSlider(panel->rgbFrm);    WMResizeWidget(panel->rgbBlueS, 141, 16);    WMMoveWidget(panel->rgbBlueS, 2, 58);    WMSetSliderMinValue(panel->rgbBlueS, 0);    WMSetSliderMaxValue(panel->rgbBlueS, 255);    WMSetSliderKnobThickness(panel->rgbBlueS, knobThickness);    WMSetSliderAction(panel->rgbBlueS, rgbSliderCallback, panel);        to.red = 0;    to.green = 0;    to.blue = 255;        image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);    pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);    RReleaseImage(image);    if (pixmap)	W_PaintText(W_VIEW(panel->rgbBlueS), pixmap->pixmap, panel->font12,		2, 0, 100, WALeft, WMColorGC(scrPtr->white), False, "Blue", 		strlen("Blue"));    else	wwarning(NO_MEMORY_ERR);        WMSetSliderImage(panel->rgbBlueS, pixmap);    WMReleasePixmap(pixmap);        panel->rgbBlueT = WMCreateTextField(panel->rgbFrm);    WMResizeWidget(panel->rgbBlueT, 40, 18);    WMMoveWidget(panel->rgbBlueT, 146, 57);    WMSetTextFieldAlignment(panel->rgbBlueT, WALeft);    WMAddNotificationObserver(rgbTextFieldCallback, panel,			      WMTextDidEndEditingNotification, panel->rgbBlueT);    /* End of RGB Panel */        /* Widgets for CMYK Panel */    panel->cmykFrm = WMCreateFrame(panel->slidersFrm);    WMSetFrameRelief(panel->cmykFrm, WRFlat);    WMResizeWidget(panel->cmykFrm, PWIDTH - 8, PHEIGHT - 80 - 26 - 32);    WMMoveWidget(panel->cmykFrm, 0, 34);        panel->cmykMinL = WMCreateLabel(panel->cmykFrm);    WMResizeWidget(panel->cmykMinL, 20, 10);    WMMoveWidget(panel->cmykMinL, 2, 2);    WMSetLabelText(panel->cmykMinL, "0");    WMSetLabelTextAlignment(panel->cmykMinL, WALeft);    WMSetLabelTextColor(panel->cmykMinL, textcolor);    WMSetLabelFont(panel->cmykMinL, panel->font8);        panel->cmykMaxL = WMCreateLabel(panel->cmykFrm);    WMResizeWidget(panel->cmykMaxL, 40, 10);    WMMoveWidget(panel->cmykMaxL, 104, 2);    WMSetLabelText(panel->cmykMaxL, "100");    WMSetLabelTextAlignment(panel->cmykMaxL, WARight);    WMSetLabelTextColor(panel->cmykMaxL, textcolor);    WMSetLabelFont(panel->cmykMaxL, panel->font8);        panel->cmykCyanS = WMCreateSlider(panel->cmykFrm);    WMResizeWidget(panel->cmykCyanS, 141, 16);    WMMoveWidget(panel->cmykCyanS, 2, 14);    WMSetSliderMinValue(panel->cmykCyanS, 0);    WMSetSliderMaxValue(panel->cmykCyanS, 100);    WMSetSliderKnobThickness(panel->cmykCyanS, knobThickness);    WMSetSliderAction(panel->cmykCyanS, cmykSliderCallback, panel);        from.red = 255;    from.green = 255;    from.blue = 255;        to.red = 0;    to.green = 255;    to.blue = 255;        image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);    pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);    RReleaseImage(image);    if (pixmap)	W_PaintText(W_VIEW(panel->cmykCyanS), pixmap->pixmap, panel->font12,		2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, "Cyan", 		strlen("Cyan"));    else	wwarning(NO_MEMORY_ERR);        WMSetSliderImage(panel->cmykCyanS, pixmap);    WMReleasePixmap(pixmap);        panel->cmykCyanT = WMCreateTextField(panel->cmykFrm);    WMResizeWidget(panel->cmykCyanT, 40, 18);    WMMoveWidget(panel->cmykCyanT, 146, 13);    WMSetTextFieldAlignment(panel->cmykCyanT, WALeft);    WMAddNotificationObserver(cmykTextFieldCallback, panel,			      WMTextDidEndEditingNotification, panel->cmykCyanT);            panel->cmykMagentaS = WMCreateSlider(panel->cmykFrm);    WMResizeWidget(panel->cmykMagentaS, 141, 16);    WMMoveWidget(panel->cmykMagentaS, 2, 36);    WMSetSliderMinValue(panel->cmykMagentaS, 0);    WMSetSliderMaxValue(panel->cmykMagentaS, 100);    WMSetSliderKnobThickness(panel->cmykMagentaS, knobThickness);    WMSetSliderAction(panel->cmykMagentaS, cmykSliderCallback, panel);        to.red = 255;    to.green = 0;    to.blue = 255;        image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);    pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);    RReleaseImage(image);    if (pixmap)	W_PaintText(W_VIEW(panel->cmykMagentaS), pixmap->pixmap, panel->font12,		2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, "Magenta", 		strlen("Magenta"));    else	wwarning(NO_MEMORY_ERR);    WMSetSliderImage(panel->cmykMagentaS, pixmap);    WMReleasePixmap(pixmap);        panel->cmykMagentaT = WMCreateTextField(panel->cmykFrm);    WMResizeWidget(panel->cmykMagentaT, 40, 18);    WMMoveWidget(panel->cmykMagentaT, 146, 35);    WMSetTextFieldAlignment(panel->cmykMagentaT, WALeft);    WMAddNotificationObserver(cmykTextFieldCallback, panel,			      WMTextDidEndEditingNotification, panel->cmykMagentaT);            panel->cmykYellowS = WMCreateSlider(panel->cmykFrm);    WMResizeWidget(panel->cmykYellowS, 141, 16);    WMMoveWidget(panel->cmykYellowS, 2, 58);    WMSetSliderMinValue(panel->cmykYellowS, 0);    WMSetSliderMaxValue(panel->cmykYellowS, 100);    WMSetSliderKnobThickness(panel->cmykYellowS, knobThickness);    WMSetSliderAction(panel->cmykYellowS, cmykSliderCallback, panel);        to.red = 255;    to.green = 255;    to.blue = 0;        image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);    pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);    RReleaseImage(image);    if (pixmap)	W_PaintText(W_VIEW(panel->cmykYellowS), pixmap->pixmap, panel->font12,		2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, "Yellow", 		strlen("Yellow"));    else	wwarning(NO_MEMORY_ERR);        WMSetSliderImage(panel->cmykYellowS, pixmap);    WMReleasePixmap(pixmap);        panel->cmykYellowT = WMCreateTextField(panel->cmykFrm);    WMResizeWidget(panel->cmykYellowT, 40, 18);    WMMoveWidget(panel->cmykYellowT, 146, 57);    WMSetTextFieldAlignment(panel->cmykYellowT, WALeft);    WMAddNotificationObserver(cmykTextFieldCallback, panel,			      WMTextDidEndEditingNotification, panel->cmykYellowT);            panel->cmykBlackS = WMCreateSlider(panel->cmykFrm);    WMResizeWidget(panel->cmykBlackS, 141, 16);    WMMoveWidget(panel->cmykBlackS, 2, 80);    WMSetSliderMinValue(panel->cmykBlackS, 0);    WMSetSliderMaxValue(panel->cmykBlackS, 100);    WMSetSliderValue(panel->cmykBlackS, 0);    WMSetSliderKnobThickness(panel->cmykBlackS, knobThickness);    WMSetSliderAction(panel->cmykBlackS, cmykSliderCallback, panel);        to.red = 0;    to.green = 0;    to.blue = 0;        image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);    pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);    RReleaseImage(image);    if (pixmap)	W_PaintText(W_VIEW(panel->cmykBlackS), pixmap->pixmap, panel->font12,		2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, "Black", 		strlen("Black"));    else	wwarning(NO_MEMORY_ERR);    WMSetSliderImage(panel->cmykBlackS, pixmap);    WMReleasePixmap(pixmap);        panel->cmykBlackT = WMCreateTextField(panel->cmykFrm);    WMResizeWidget(panel->cmykBlackT, 40, 18);    WMMoveWidget(panel->cmykBlackT, 146, 79);    WMSetTextFieldAlignment(panel->cmykBlackT, WALeft);    WMAddNotificationObserver(cmykTextFieldCallback, panel,			      WMTextDidEndEditingNotification, panel->cmykBlackT);    /* End of CMYK Panel */        /* Widgets for HSB Panel */    panel->hsbFrm = WMCreateFrame(panel->slidersFrm);    WMSetFrameRelief(panel->hsbFrm, WRFlat);    WMResizeWidget(panel->hsbFrm, PWIDTH - 8, PHEIGHT - 80 - 26 - 32);    WMMoveWidget(panel->hsbFrm, 0, 34);        panel->hsbHueS = WMCreateSlider(panel->hsbFrm);    WMResizeWidget(panel->hsbHueS, 141, 16);    WMMoveWidget(panel->hsbHueS, 2, 14);    WMSetSliderMinValue(panel->hsbHueS, 0);    WMSetSliderMaxValue(panel->hsbHueS, 359);    WMSetSliderKnobThickness(panel->hsbHueS, knobThickness);    WMSetSliderAction(panel->hsbHueS, hsbSliderCallback, panel);        panel->hsbHueT = WMCreateTextField(panel->hsbFrm);    WMResizeWidget(panel->hsbHueT, 40, 18);    WMMoveWidget(panel->hsbHueT, 146, 13);    WMSetTextFieldAlignment(panel->hsbHueT, WALeft);    WMAddNotificationObserver(hsbTextFieldCallback, panel,			      WMTextDidEndEditingNotification, panel->hsbHueT);            panel->hsbSaturationS = WMCreateSlider(panel->hsbFrm);    WMResizeWidget(panel->hsbSaturationS, 141, 16);    WMMoveWidget(panel->hsbSaturationS, 2, 36);    WMSetSliderMinValue(panel->hsbSaturationS, 0);    WMSetSliderMaxValue(panel->hsbSaturationS, 100);    WMSetSliderKnobThickness(panel->hsbSaturationS, knobThickness);    WMSetSliderAction(panel->hsbSaturationS, hsbSliderCallback, panel);        panel->hsbSaturationT = WMCreateTextField(panel->hsbFrm);    WMResizeWidget(panel->hsbSaturationT, 40, 18);    WMMoveWidget(panel->hsbSaturationT, 146, 35);    WMSetTextFieldAlignment(panel->hsbSaturationT, WALeft);    WMAddNotificationObserver(hsbTextFieldCallback, panel,			      WMTextDidEndEditingNotification, panel->hsbSaturationT);            panel->hsbBrightnessS = WMCreateSlider(panel->hsbFrm);    WMResizeWidget(panel->hsbBrightnessS, 141, 16);    WMMoveWidget(panel->hsbBrightnessS, 2, 58);    WMSetSliderMinValue(panel->hsbBrightnessS, 0);    WMSetSliderMaxValue(panel->hsbBrightnessS, 100);    WMSetSliderKnobThickness(panel->hsbBrightnessS, knobThickness);    WMSetSliderAction(panel->hsbBrightnessS, hsbSliderCallback, panel);        panel->hsbBrightnessT = WMCreateTextField(panel->hsbFrm);    WMResizeWidget(panel->hsbBrightnessT, 40, 18);    WMMoveWidget(panel->hsbBrightnessT, 146, 57);    WMSetTextFieldAlignment(panel->hsbBrightnessT, WALeft);    WMAddNotificationObserver(hsbTextFieldCallback, panel,			      WMTextDidEndEditingNotification, panel->hsbBrightnessT);    /* End of HSB Panel */            WMReleaseColor(textcolor);        /* Widgets for the CustomPalette Panel */    panel->customPaletteFrm = WMCreateFrame(panel->win);    WMSetFrameRelief(panel->customPaletteFrm, WRFlat);    WMResizeWidget(panel->customPaletteFrm, PWIDTH - 8, PHEIGHT - 80 - 26);    WMMoveWidget(panel->customPaletteFrm, 5, 80);        panel->customPaletteHistoryBtn = WMCreatePopUpButton(							 panel->customPaletteFrm);    WMAddPopUpButtonItem(panel->customPaletteHistoryBtn, "Spectrum");    WMSetPopUpButtonSelectedItem(panel->customPaletteHistoryBtn, 				 WMGetPopUpButtonNumberOfItems(panel->customPaletteHistoryBtn)-1);    WMSetPopUpButtonAction(panel->customPaletteHistoryBtn, 			   customPaletteHistoryCallback, panel);    WMResizeWidget(panel->customPaletteHistoryBtn, PWIDTH - 8, 20);    WMMoveWidget(panel->customPaletteHistoryBtn, 0, 0);        panel->customPaletteContentFrm = WMCreateFrame(panel->customPaletteFrm);    WMSetFrameRelief(panel->customPaletteContentFrm, WRSunken);    WMResizeWidget(panel->customPaletteContentFrm, PWIDTH - 8, PHEIGHT - 156);    WMMoveWidget(panel->customPaletteContentFrm, 0, 23);        panel->customPaletteContentView = W_CreateView(						   W_VIEW(panel->customPaletteContentFrm));    /* XXX Test if we can create a view */    W_ResizeView(panel->customPaletteContentView, customPaletteWidth, 		 customPaletteHeight);    W_MoveView(panel->customPaletteContentView, 2, 2);        /* Create event handler to handle expose/click events in CustomPalette */    WMCreateEventHandler(panel->customPaletteContentView, 	    ButtonPressMask|ButtonReleaseMask|EnterWindowMask| LeaveWindowMask |	    ButtonMotionMask, customPaletteHandleActionEvents, panel);        WMCreateEventHandler(panel->customPaletteContentView, ExposureMask, 			 customPaletteHandleEvents, panel);        panel->customPaletteMenuBtn = WMCreatePopUpButton(panel->customPaletteFrm);    WMSetPopUpButtonPullsDown(panel->customPaletteMenuBtn, 1);    WMSetPopUpButtonText(panel->customPaletteMenuBtn, "Palette");    WMSetPopUpButtonAction(panel->customPaletteMenuBtn, 			   customPaletteMenuCallback, panel);    WMResizeWidget(panel->customPaletteMenuBtn, PWIDTH - 8, 20);    WMMoveWidget(panel->customPaletteMenuBtn, 0, PHEIGHT - 130);        WMAddPopUpButtonItem(panel->customPaletteMenuBtn, "New from File...");    WMAddPopUpButtonItem(panel->customPaletteMenuBtn, "Rename...");    WMAddPopUpButtonItem(panel->customPaletteMenuBtn, "Remove");    WMAddPopUpButtonItem(panel->customPaletteMenuBtn, "Copy");    WMAddPopUpButtonItem(panel->customPaletteMenuBtn, "New from Clipboard");        WMSetPopUpButtonItemEnabled(panel->customPaletteMenuBtn, CPmenuRename, 0);    WMSetPopUpButtonItemEnabled(panel->customPaletteMenuBtn, CPmenuRemove, 0);    WMSetPopUpButtonItemEnabled(panel->customPaletteMenuBtn, CPmenuCopy, 0);    WMSetPopUpButtonItemEnabled(panel->customPaletteMenuBtn, 				CPmenuNewFromClipboard, 0);        customRenderSpectrum(panel);    panel->currentPalette = 0;    panel->palx = customPaletteWidth/2;    panel->paly = customPaletteHeight/2;        /* Widgets for the ColorList Panel */    panel->colorListFrm = WMCreateFrame(panel->win);    WMSetFrameRelief(panel->colorListFrm, WRFlat);    WMResizeWidget(panel->colorListFrm, PWIDTH - 8, PHEIGHT - 80 - 26);    WMMoveWidget(panel->colorListFrm, 5, 80);        panel->colorListHistoryBtn = WMCreatePopUpButton(panel->colorListFrm);    WMAddPopUpButtonItem(panel->colorListHistoryBtn, "X11-Colors");    WMSetPopUpButtonSelectedItem(panel->colorListHistoryBtn, 				 WMGetPopUpButtonNumberOfItems(panel->colorListHistoryBtn)-1);    /*	WMSetPopUpButtonAction(panel->colorListHistoryBtn, 			       *	colorListHistoryCallback, panel); */    WMResizeWidget(panel->colorListHistoryBtn, PWIDTH - 8, 20);    WMMoveWidget(panel->colorListHistoryBtn, 0, 0);        panel->colorListContentLst = WMCreateList(panel->colorListFrm);    WMSetListAction(panel->colorListContentLst, colorListSelect, panel);    WMSetListUserDrawProc(panel->colorListContentLst, colorListPaintItem);    WMResizeWidget(panel->colorListContentLst, PWIDTH - 8, PHEIGHT - 156);    WMMoveWidget(panel->colorListContentLst, 0, 23);    WMHangData(panel->colorListContentLst, panel);        panel->colorListColorMenuBtn = WMCreatePopUpButton(panel->colorListFrm);    WMSetPopUpButtonPullsDown(panel->colorListColorMenuBtn, 1);    WMSetPopUpButtonText(panel->colorListColorMenuBtn, "Color");    WMSetPopUpButtonAction(panel->colorListColorMenuBtn, 			   colorListColorMenuCallback, panel);    WMResizeWidget(panel->colorListColorMenuBtn, (PWIDTH - 16)/2, 20);    WMMoveWidget(panel->colorListColorMenuBtn, 0, PHEIGHT - 130);        WMAddPopUpButtonItem(panel->colorListColorMenuBtn, "Add...");    WMAddPopUpButtonItem(panel->colorListColorMenuBtn, "Rename...");    WMAddPopUpButtonItem(panel->colorListColorMenuBtn, "Remove");        WMSetPopUpButtonItemEnabled(panel->colorListColorMenuBtn, CLmenuAdd, 0);    WMSetPopUpButtonItemEnabled(panel->colorListColorMenuBtn, CLmenuRename, 0);    WMSetPopUpButtonItemEnabled(panel->colorListColorMenuBtn, CLmenuRemove, 0);        panel->colorListListMenuBtn = WMCreatePopUpButton(panel->colorListFrm);    WMSetPopUpButtonPullsDown(panel->colorListListMenuBtn, 1);    WMSetPopUpButtonText(panel->colorListListMenuBtn, "List");    WMSetPopUpButtonAction(panel->colorListListMenuBtn, 			   colorListListMenuCallback, panel);    WMResizeWidget(panel->colorListListMenuBtn, (PWIDTH - 16)/2, 20);    WMMoveWidget(panel->colorListListMenuBtn, (PWIDTH - 16)/2 + 8, 		 PHEIGHT - 130);        WMAddPopUpButtonItem(panel->colorListListMenuBtn, "New...");    WMAddPopUpButtonItem(panel->colorListListMenuBtn, "Rename...");    WMAddPopUpButtonItem(panel->colorListListMenuBtn, "Remove");        WMSetPopUpButtonItemEnabled(panel->colorListListMenuBtn, CLmenuAdd, 0);    WMSetPopUpButtonItemEnabled(panel->colorListListMenuBtn, CLmenuRename, 0);    WMSetPopUpButtonItemEnabled(panel->colorListListMenuBtn, CLmenuRemove, 0);        WMRealizeWidget(panel->win);    WMMapSubwidgets(panel->win);        WMMapSubwidgets(panel->wheelFrm);    WMMapSubwidgets(panel->slidersFrm);    WMMapSubwidgets(panel->grayFrm);    WMMapSubwidgets(panel->rgbFrm);    WMMapSubwidgets(panel->cmykFrm);    WMMapSubwidgets(panel->hsbFrm);    WMMapSubwidgets(panel->customPaletteFrm);    WMMapSubwidgets(panel->customPaletteContentFrm);    WMMapSubwidgets(panel->colorListFrm);      /* Pixmap to indicate selection positions     * wheelframe MUST be mapped.     */    panel->selectionImg = XCreatePixmap(scrPtr->display,	    WMWidgetXID(panel->win), 4, 4, scrPtr->depth);    XFillRectangle(scrPtr->display, panel->selectionImg, bgc, 0, 0, 4, 4);    XFillRectangle(scrPtr->display, panel->selectionImg, wgc, 1, 1, 2, 2);        readConfiguration(panel);    readXColors(panel);        return panel;}