add: */
context: CreateTexturePanel(WMWindow *keyWindow)/*CreateTexturePanel(WMScreen *scr)*/{    TexturePanel *panel;    WMScreen *scr = WMWidgetScreen(keyWindow);    panel = wmalloc(sizeof(TexturePanel));    memset(panel, 0, sizeof(TexturePanel));    panel->listFont = WMSystemFontOfSize(scr, 12);    panel->win = WMCreatePanelWithStyleForWindow(keyWindow, "texturePanel",						 WMTitledWindowMask						 |WMClosableWindowMask); /*    panel->win = WMCreateWindowWithStyle(scr, "texturePanel",					 WMTitledWindowMask					 |WMClosableWindowMask);  */    WMResizeWidget(panel->win, 325, 423);    WMSetWindowTitle(panel->win, _("Texture Panel"));    /* texture name */    panel->nameF = WMCreateFrame(panel->win);    WMResizeWidget(panel->nameF, 185, 50);    WMMoveWidget(panel->nameF, 15, 10);    WMSetFrameTitle(panel->nameF, _("Texture Name"));    panel->nameT = WMCreateTextField(panel->nameF);    WMResizeWidget(panel->nameT, 160, 20);    WMMoveWidget(panel->nameT, 12, 18);    WMMapSubwidgets(panel->nameF);    /* texture types */    panel->typeP = WMCreatePopUpButton(panel->win);    WMResizeWidget(panel->typeP, 185, 20);    WMMoveWidget(panel->typeP, 15, 65);    WMAddPopUpButtonItem(panel->typeP, _("Solid Color"));    WMAddPopUpButtonItem(panel->typeP, _("Gradient Texture"));    WMAddPopUpButtonItem(panel->typeP, _("Simple Gradient Texture"));    WMAddPopUpButtonItem(panel->typeP, _("Textured Gradient"));    WMAddPopUpButtonItem(panel->typeP, _("Image Texture"));    WMSetPopUpButtonSelectedItem(panel->typeP, 0);    WMSetPopUpButtonAction(panel->typeP, changeTypeCallback, panel);    /* color */    panel->defcF = WMCreateFrame(panel->win);    WMResizeWidget(panel->defcF, 100, 75);    WMMoveWidget(panel->defcF, 210, 10);    WMSetFrameTitle(panel->defcF, _("Default Color"));    panel->defcW = WMCreateColorWell(panel->defcF);    WMResizeWidget(panel->defcW, 60, 45);    WMMoveWidget(panel->defcW, 20, 20);    WMMapSubwidgets(panel->defcF);    /****** Gradient ******/    panel->gcolF = WMCreateFrame(panel->win);    WMResizeWidget(panel->gcolF, 295, 205);    WMMoveWidget(panel->gcolF, 15, 95);    WMSetFrameTitle(panel->gcolF, _("Gradient Colors"));    panel->gcolL = WMCreateList(panel->gcolF);    WMResizeWidget(panel->gcolL, 130, 140);    WMMoveWidget(panel->gcolL, 10, 25);    WMHangData(panel->gcolL, panel);    WMSetListUserDrawProc(panel->gcolL, paintGradListItem);    WMSetListAction(panel->gcolL, gradClickCallback, panel);    panel->gcolaB = WMCreateCommandButton(panel->gcolF);    WMResizeWidget(panel->gcolaB, 64, 24);    WMMoveWidget(panel->gcolaB, 10, 170);    WMSetButtonText(panel->gcolaB, _("Add"));    WMSetButtonAction(panel->gcolaB, gradAddCallback, panel);        panel->gcoldB = WMCreateCommandButton(panel->gcolF);    WMResizeWidget(panel->gcoldB, 64, 24);    WMMoveWidget(panel->gcoldB, 75, 170);    WMSetButtonText(panel->gcoldB, _("Delete"));    WMSetButtonAction(panel->gcoldB, gradDeleteCallback, panel);#if 0    panel->gbriS = WMCreateSlider(panel->gcolF);    WMResizeWidget(panel->gbriS, 130, 16);    WMMoveWidget(panel->gbriS, 150, 25);    WMSetSliderKnobThickness(panel->gbriS, 8);    WMSetSliderMaxValue(panel->gbriS, 100);    WMSetSliderAction(panel->gbriS, sliderChangeCallback, panel);    {	WMPixmap *pixmap;	WMColor *color;	pixmap = WMCreatePixmap(scr, 130, 16, WMScreenDepth(scr), False);	color = WMDarkGrayColor(scr);	XFillRectangle(WMScreenDisplay(scr), WMGetPixmapXID(pixmap),		       WMColorGC(color), 0, 0, 130, 16);	WMReleaseColor(color);	color = WMWhiteColor(color);	WMDrawString(scr, WMGetPixmapXID(pixmap), WMColorGC(color),		     panel->listFont, 2, 		     (16 - WMFontHeight(panel->listFont))/2 - 1,		     "Brightness", 10);	WMSetSliderImage(panel->gbriS, pixmap);	WMReleasePixmap(pixmap);    }    panel->gconS = WMCreateSlider(panel->gcolF);    WMResizeWidget(panel->gconS, 130, 16);    WMMoveWidget(panel->gconS, 150, 50);    WMSetSliderKnobThickness(panel->gconS, 8);    WMSetSliderMaxValue(panel->gconS, 100);    WMSetSliderAction(panel->gconS, sliderChangeCallback, panel);    {	WMPixmap *pixmap;	WMColor *color;	pixmap = WMCreatePixmap(scr, 130, 16, WMScreenDepth(scr), False);	color = WMDarkGrayColor(scr);	XFillRectangle(WMScreenDisplay(scr), WMGetPixmapXID(pixmap),		       WMColorGC(color), 0, 0, 130, 16);	WMReleaseColor(color);	color = WMWhiteColor(scr);	WMDrawString(scr, WMGetPixmapXID(pixmap), WMColorGC(color), 		     panel->listFont, 2,		     (16 - WMFontHeight(panel->listFont))/2 - 1,		     "Contrast", 8);	WMSetSliderImage(panel->gconS, pixmap);	WMReleasePixmap(pixmap);    }#endif    panel->ghueS = WMCreateSlider(panel->gcolF);    WMResizeWidget(panel->ghueS, 130, 16);    WMMoveWidget(panel->ghueS, 150, 100);    WMSetSliderKnobThickness(panel->ghueS, 8);    WMSetSliderMaxValue(panel->ghueS, 359);    WMSetSliderAction(panel->ghueS, sliderChangeCallback, panel);    panel->gsatS = WMCreateSlider(panel->gcolF);    WMResizeWidget(panel->gsatS, 130, 16);    WMMoveWidget(panel->gsatS, 150, 125);    WMSetSliderKnobThickness(panel->gsatS, 8);    WMSetSliderMaxValue(panel->gsatS, 255);    WMSetSliderAction(panel->gsatS, sliderChangeCallback, panel);    panel->gvalS = WMCreateSlider(panel->gcolF);    WMResizeWidget(panel->gvalS, 130, 16);    WMMoveWidget(panel->gvalS, 150, 150);    WMSetSliderKnobThickness(panel->gvalS, 8);    WMSetSliderMaxValue(panel->gvalS, 255);    WMSetSliderAction(panel->gvalS, sliderChangeCallback, panel);    WMMapSubwidgets(panel->gcolF);    /** Direction **/    panel->dirF = WMCreateFrame(panel->win);    WMSetFrameTitle(panel->dirF, _("Direction"));    WMResizeWidget(panel->dirF, 295, 75);    WMMoveWidget(panel->dirF, 15, 305);    panel->dirvB = WMCreateButton(panel->dirF, WBTOnOff);    WMSetButtonImagePosition(panel->dirvB, WIPImageOnly);    WMResizeWidget(panel->dirvB, 90, 40);    WMMoveWidget(panel->dirvB, 10, 20);    panel->dirhB = WMCreateButton(panel->dirF, WBTOnOff);    WMSetButtonImagePosition(panel->dirhB, WIPImageOnly);    WMResizeWidget(panel->dirhB, 90, 40);    WMMoveWidget(panel->dirhB, 102, 20);    panel->dirdB = WMCreateButton(panel->dirF, WBTOnOff);    WMSetButtonImagePosition(panel->dirdB, WIPImageOnly);    WMResizeWidget(panel->dirdB, 90, 40);    WMMoveWidget(panel->dirdB, 194, 20);    WMGroupButtons(panel->dirvB, panel->dirhB);    WMGroupButtons(panel->dirvB, panel->dirdB);    WMMapSubwidgets(panel->dirF);    /****************** Textured Gradient ******************/    panel->tcolF = WMCreateFrame(panel->win);    WMResizeWidget(panel->tcolF, 100, 135);    WMMoveWidget(panel->tcolF, 210, 10);    WMSetFrameTitle(panel->tcolF, _("Gradient"));    panel->tcol1W = WMCreateColorWell(panel->tcolF);    WMResizeWidget(panel->tcol1W, 60, 45);    WMMoveWidget(panel->tcol1W, 20, 25);    WMAddNotificationObserver(colorWellObserver, panel,			      WMColorWellDidChangeNotification, panel->tcol1W);    panel->tcol2W = WMCreateColorWell(panel->tcolF);    WMResizeWidget(panel->tcol2W, 60, 45);    WMMoveWidget(panel->tcol2W, 20, 75);    WMAddNotificationObserver(colorWellObserver, panel,			      WMColorWellDidChangeNotification, panel->tcol2W);    /** Opacity */    panel->topaF = WMCreateFrame(panel->win);    WMResizeWidget(panel->topaF, 185, 50);    WMMoveWidget(panel->topaF, 15, 95);    WMSetFrameTitle(panel->topaF, _("Gradient Opacity"));    panel->topaS = WMCreateSlider(panel->topaF);    WMResizeWidget(panel->topaS, 155, 18);    WMMoveWidget(panel->topaS, 15, 20);    WMSetSliderMaxValue(panel->topaS, 255);    WMSetSliderValue(panel->topaS, 200);    WMMapSubwidgets(panel->topaF);    {	WMPixmap *pixmap;	Pixmap p;	WMColor *color;	pixmap = WMCreatePixmap(scr, 155, 18, WMScreenDepth(scr), False);	p = WMGetPixmapXID(pixmap);	color = WMDarkGrayColor(scr);	XFillRectangle(WMScreenDisplay(scr), p, WMColorGC(color),		       0, 0, 155, 18);	WMReleaseColor(color);	color = WMWhiteColor(scr);	WMDrawString(scr, p, WMColorGC(color), panel->listFont,		     2, 1, "0%", 2);	WMDrawString(scr, p, WMColorGC(color), panel->listFont,		     153 - WMWidthOfString(panel->listFont, "100%", 4), 1,		     "100%", 4);	WMReleaseColor(color);	WMSetSliderImage(panel->topaS, pixmap);	WMReleasePixmap(pixmap);    }    WMMapSubwidgets(panel->tcolF);    /****************** Image ******************/    panel->imageF = WMCreateFrame(panel->win);    WMResizeWidget(panel->imageF, 295, 150);    WMMoveWidget(panel->imageF, 15, 150);    WMSetFrameTitle(panel->imageF, _("Image"));    panel->imageL = WMCreateLabel(panel->imageF);    WMSetLabelImagePosition(panel->imageL, WIPImageOnly);    panel->imageT = WMCreateTextField(panel->imageF);    WMResizeWidget(panel->imageT, 90, 20);    WMMoveWidget(panel->imageT, 190, 25);    panel->imageV = WMCreateScrollView(panel->imageF);    WMResizeWidget(panel->imageV, 165, 115);    WMMoveWidget(panel->imageV, 15, 20);    WMSetScrollViewRelief(panel->imageV, WRSunken);    WMSetScrollViewHasHorizontalScroller(panel->imageV, True);    WMSetScrollViewHasVerticalScroller(panel->imageV, True);    WMSetScrollViewContentView(panel->imageV, WMWidgetView(panel->imageL));    panel->browB = WMCreateCommandButton(panel->imageF);    WMResizeWidget(panel->browB, 90, 24);    WMMoveWidget(panel->browB, 190, 50);    WMSetButtonText(panel->browB, _("Browse..."));    WMSetButtonAction(panel->browB, browseImageCallback, panel);    panel->dispB = WMCreateCommandButton(panel->imageF);    WMResizeWidget(panel->dispB, 90, 24);    WMMoveWidget(panel->dispB, 190, 80);    WMSetButtonText(panel->dispB, _("Show"));    panel->arrP = WMCreatePopUpButton(panel->imageF);    WMResizeWidget(panel->arrP, 90, 20);    WMMoveWidget(panel->arrP, 190, 120);    WMAddPopUpButtonItem(panel->arrP, _("Tile"));    WMAddPopUpButtonItem(panel->arrP, _("Scale"));    WMAddPopUpButtonItem(panel->arrP, _("Center"));    WMAddPopUpButtonItem(panel->arrP, _("Maximize"));    WMSetPopUpButtonSelectedItem(panel->arrP, 0);    WMMapSubwidgets(panel->imageF);    /****/    panel->okB = WMCreateCommandButton(panel->win);    WMResizeWidget(panel->okB, 84, 24);    WMMoveWidget(panel->okB, 225, 390);    WMSetButtonText(panel->okB, _("OK"));    WMSetButtonAction(panel->okB, buttonCallback, panel);        panel->cancelB = WMCreateCommandButton(panel->win);    WMResizeWidget(panel->cancelB, 84, 24);    WMMoveWidget(panel->cancelB, 130, 390);    WMSetButtonText(panel->cancelB, _("Cancel"));    WMSetButtonAction(panel->cancelB, buttonCallback, panel);    WMMapWidget(panel->nameF);    WMMapWidget(panel->typeP);    WMMapWidget(panel->okB);    WMMapWidget(panel->cancelB);    WMUnmapWidget(panel->arrP);    WMRealizeWidget(panel->win);    panel->currentType = -1;    panel->sectionParts[TYPE_SOLID][0] = panel->defcF;    panel->sectionParts[TYPE_GRADIENT][0] = panel->defcF;    panel->sectionParts[TYPE_GRADIENT][1] = panel->gcolF;    panel->sectionParts[TYPE_GRADIENT][2] = panel->dirF;    panel->sectionParts[TYPE_SGRADIENT][0] = panel->tcolF;    panel->sectionParts[TYPE_SGRADIENT][1] = panel->dirF;    panel->sectionParts[TYPE_TGRADIENT][0] = panel->tcolF;    panel->sectionParts[TYPE_TGRADIENT][1] = panel->dirF;    panel->sectionParts[TYPE_TGRADIENT][2] = panel->imageF;    panel->sectionParts[TYPE_TGRADIENT][3] = panel->topaF;    panel->sectionParts[TYPE_TGRADIENT][4] = panel->arrP;    panel->sectionParts[TYPE_PIXMAP][0] = panel->defcF;    panel->sectionParts[TYPE_PIXMAP][1] = panel->imageF;    panel->sectionParts[TYPE_PIXMAP][2] = panel->arrP;    /* setup for first time */    changeTypeCallback(panel->typeP, panel);    sliderChangeCallback(panel->ghueS, panel);    sliderChangeCallback(panel->gsatS, panel);    return panel;}