rem: WMSetPopUpButtonItemEnabled(panel->customPaletteMenuBtn, CPmenuRename, (item > 0) ); WMSetPopUpButtonItemEnabled(panel->customPaletteMenuBtn, CPmenuRemove, (item > 0) );
context: customSetPalette(W_ColorPanel *panel){    W_Screen    *scr = WMWidgetScreen(panel->win);    RImage	*scaledImg;    Pixmap	image;    int		item;        image = XCreatePixmap(scr->display, W_DRAWABLE(scr), customPaletteWidth, 			  customPaletteHeight, scr->depth);        scaledImg = RScaleImage(panel->customPaletteImg, customPaletteWidth, 			    customPaletteHeight);    RConvertImage(scr->rcontext, scaledImg, &image);    RDestroyImage(scaledImg);        XCopyArea(scr->display, image, panel->customPaletteContentView->window, 	      scr->copyGC, 0, 0, customPaletteWidth, customPaletteHeight, 0, 0);        /* Check backimage exists. If it doesn't, allocate and fill it */    if (!panel->selectionBackImg) {	panel->selectionBackImg = XCreatePixmap(scr->display, 						panel->customPaletteContentView->window, 4, 4, scr->depth);    }        XCopyArea(scr->display, image, panel->selectionBackImg, scr->copyGC, 	      panel->palx-2, panel->paly-2, 4, 4, 0, 0); 	    XCopyArea(scr->display, panel->selectionImg, 	      panel->customPaletteContentView->window, scr->copyGC, 0 , 0, 4, 4, 	      panel->palx-2, panel->paly-2);    XFreePixmap(scr->display, image);        panel->palXRatio = (float)(panel->customPaletteImg->width) / 	(float)(customPaletteWidth);    panel->palYRatio = (float)(panel->customPaletteImg->height) / 	(float)(customPaletteHeight);        item = WMGetPopUpButtonSelectedItem (panel->customPaletteHistoryBtn);        /* if palette != "Spectrum", we are allowed to rename and remove it */	    WMSetPopUpButtonItemEnabled(panel->customPaletteMenuBtn, CPmenuRename, 				(item > 0) );    WMSetPopUpButtonItemEnabled(panel->customPaletteMenuBtn, CPmenuRemove, 				(item > 0) );}