added some updated po files (korean, chinese)
[wmaker-crm.git] / WPrefs.app / Appearance.c
blob7b56bfba40ef0231217939003d5d0a4bdde678bd
1 /* Apperance.c- color/texture for titlebar etc.
2 *
3 * WPrefs - Window Maker Preferences Program
4 *
5 * Copyright (c) 1999 Alfredo K. Kojima
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 * USA.
24 #include "WPrefs.h"
26 #include <unistd.h>
27 #include <errno.h>
28 #include <ctype.h>
29 #include <time.h>
30 #include <sys/stat.h>
31 #include <sys/types.h>
32 #include <fcntl.h>
33 #include <unistd.h>
38 #include "TexturePanel.h"
40 typedef struct _Panel {
41 WMFrame *frame;
42 char *sectionName;
44 CallbackRec callbacks;
46 WMWindow *win;
48 WMLabel *prevL;
50 WMPopUpButton *secP;
52 /* texture list */
53 WMLabel *texL;
54 WMList *texLs;
55 WMLabel *texsL;
57 WMButton *newB;
58 WMButton *editB;
59 WMButton *ripB;
60 WMButton *delB;
62 int textureIndex[8];
64 WMFont *smallFont;
65 WMFont *normalFont;
66 WMFont *boldFont;
68 TexturePanel *texturePanel;
70 WMPixmap *onLed;
71 WMPixmap *offLed;
72 WMPixmap *hand;
74 int oldsection;
76 Pixmap preview;
78 char *fprefix;
79 } _Panel;
82 typedef struct {
83 char *title;
84 char *texture;
85 proplist_t prop;
86 Pixmap preview;
88 char *path;
90 char selectedFor;
91 unsigned current:1;
92 unsigned ispixmap:1;
93 } TextureListItem;
96 static void showData(_Panel *panel);
98 static void changePage(WMWidget *w, void *data);
100 static void OpenExtractPanelFor(_Panel *panel, char *path);
102 #define ICON_FILE "appearance"
104 #define TNEW_FILE "tnew"
105 #define TDEL_FILE "tdel"
106 #define TEDIT_FILE "tedit"
107 #define TEXTR_FILE "textr"
111 /* XPM */
112 static char * blueled_xpm[] = {
113 "8 8 17 1",
114 " c None",
115 ". c #020204",
116 "+ c #16B6FC",
117 "@ c #176AFC",
118 "# c #163AFC",
119 "$ c #72D2FC",
120 "% c #224CF4",
121 "& c #76D6FC",
122 "* c #16AAFC",
123 "= c #CEE9FC",
124 "- c #229EFC",
125 "; c #164CFC",
126 "> c #FAFEFC",
127 ", c #2482FC",
128 "' c #1652FC",
129 ") c #1E76FC",
130 "! c #1A60FC",
131 " .... ",
132 " .=>-@. ",
133 ".=>$@@'.",
134 ".=$@!;;.",
135 ".!@*+!#.",
136 ".#'*+*,.",
137 " .@)@,. ",
138 " .... "};
141 /* XPM */
142 static char *blueled2_xpm[] = {
143 /* width height num_colors chars_per_pixel */
144 " 8 8 17 1",
145 /* colors */
146 ". c None",
147 "# c #090909",
148 "a c #4b63a4",
149 "b c #011578",
150 "c c #264194",
151 "d c #04338c",
152 "e c #989dac",
153 "f c #011a7c",
154 "g c #465c9c",
155 "h c #03278a",
156 "i c #6175ac",
157 "j c #011e74",
158 "k c #043a90",
159 "l c #042f94",
160 "m c #0933a4",
161 "n c #022184",
162 "o c #012998",
163 /* pixels */
164 "..####..",
165 ".#aimn#.",
166 "#aechnf#",
167 "#gchnjf#",
168 "#jndknb#",
169 "#bjdddl#",
170 ".#nono#.",
171 "..####.."
174 /* XPM */
175 static char * hand_xpm[] = {
176 "22 21 17 1",
177 " c None",
178 ". c #030305",
179 "+ c #101010",
180 "@ c #535355",
181 "# c #7F7F7E",
182 "$ c #969697",
183 "% c #B5B5B6",
184 "& c #C5C5C6",
185 "* c #D2D2D0",
186 "= c #DCDCDC",
187 "- c #E5E5E4",
188 "; c #ECECEC",
189 "> c #767674",
190 ", c #F2F2F4",
191 "' c #676767",
192 ") c #FDFDFB",
193 "! c #323234",
194 " ",
195 " ..... ",
196 " ..#%&&$. ",
197 " .))),%.......... ",
198 " .)-)),&)))))))))$. ",
199 " .-&))))))))),,,,;;. ",
200 " .=)))))))));-=***&$. ",
201 " .=)))))))),..+..... ",
202 " +=)))))))))-&#. ",
203 " +=)))))))))-%>. ",
204 " +&)))))))))-%'. ",
205 " +$,,))))));... ",
206 " .#%%*;,)),*$>+ ",
207 " .'>$%&&&&$#@. ",
208 " .!'>#$##>'. ",
209 " ..+++++. ",
210 " ",
211 " ##@@@## ",
212 " @@@@@@@@@@@ ",
213 " >>@@@## ",
214 " "};
219 #define FTITLE (1<<0)
220 #define UTITLE (1<<1)
221 #define OTITLE (1<<2)
222 #define RESIZEBAR (1<<3)
223 #define MTITLE (1<<4)
224 #define MITEM (1<<5)
225 #define ICON (1<<6)
226 #define BACK (1<<7)
227 #define EVERYTHING 0xff
230 #define RESIZEBAR_BEVEL -1
231 #define MENU_BEVEL -2
233 #define TEXPREV_WIDTH 40
234 #define TEXPREV_HEIGHT 24
240 static void
241 str2rcolor(RContext *rc, char *name, RColor *color)
243 XColor xcolor;
245 XParseColor(rc->dpy, rc->cmap, name, &xcolor);
247 color->alpha = 255;
248 color->red = xcolor.red >> 8;
249 color->green = xcolor.green >> 8;
250 color->blue = xcolor.blue >> 8;
255 static void
256 dumpRImage(char *path, RImage *image)
258 FILE *f;
260 f = fopen(path, "w");
261 if (!f) {
262 wsyserror(path);
263 return;
265 fprintf(f, "%02x%02x%1x", image->width, image->height,
266 image->data[3]!=NULL ? 4 : 3);
268 fwrite(image->data[0], 1, image->width * image->height, f);
269 fwrite(image->data[1], 1, image->width * image->height, f);
270 fwrite(image->data[2], 1, image->width * image->height, f);
271 if (image->data[3])
272 fwrite(image->data[3], 1, image->width * image->height, f);
274 if (fclose(f) < 0) {
275 wsyserror(path);
281 static int
282 isPixmap(proplist_t prop)
284 proplist_t p;
285 char *s;
287 p = PLGetArrayElement(prop, 0);
288 s = PLGetString(p);
289 if (strcasecmp(&s[1], "pixmap")==0)
290 return 1;
291 else
292 return 0;
296 static void
297 drawResizebarBevel(RImage *img)
299 RColor light;
300 RColor dark;
301 RColor black;
302 int width = img->width;
303 int height = img->height;
304 int cwidth = 28;
306 black.alpha = 255;
307 black.red = black.green = black.blue = 0;
309 light.alpha = 0;
310 light.red = light.green = light.blue = 80;
312 dark.alpha = 0;
313 dark.red = dark.green = dark.blue = 40;
315 ROperateLine(img, RSubtractOperation, 0, 0, width-1, 0, &dark);
316 ROperateLine(img, RAddOperation, 0, 1, width-1, 1, &light);
318 ROperateLine(img, RSubtractOperation, cwidth, 2, cwidth, height-1, &dark);
319 ROperateLine(img, RAddOperation, cwidth+1, 2, cwidth+1, height-1, &light);
321 ROperateLine(img, RSubtractOperation, width-cwidth-2, 2, width-cwidth-2,
322 height-1, &dark);
323 ROperateLine(img, RAddOperation, width-cwidth-1, 2, width-cwidth-1,
324 height-1, &light);
326 RDrawLine(img, 0, height-1, width-1, height-1, &black);
327 RDrawLine(img, 0, 0, 0, height-1, &black);
328 RDrawLine(img, width-1, 0, width-1, height-1, &black);
332 static void
333 drawMenuBevel(RImage *img)
335 RColor light, dark, mid;
336 int i;
337 int iheight = img->height / 3;
339 light.alpha = 0;
340 light.red = light.green = light.blue = 80;
342 dark.alpha = 255;
343 dark.red = dark.green = dark.blue = 0;
345 mid.alpha = 0;
346 mid.red = mid.green = mid.blue = 40;
348 for (i = 1; i < 3; i++) {
349 ROperateLine(img, RSubtractOperation, 0, i*iheight-2,
350 img->width-1, i*iheight-2, &mid);
352 RDrawLine(img, 0, i*iheight-1,
353 img->width-1, i*iheight-1, &dark);
355 ROperateLine(img, RAddOperation, 0, i*iheight,
356 img->width-1, i*iheight, &light);
361 static Pixmap
362 renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
363 char *path, int border)
365 char *type;
366 RImage *image;
367 Pixmap pixmap;
368 RContext *rc = WMScreenRContext(scr);
369 char *str;
370 RColor rcolor;
373 type = PLGetString(PLGetArrayElement(texture, 0));
375 image = RCreateImage(width, height, False);
377 if (strcasecmp(type, "solid")==0) {
379 str = PLGetString(PLGetArrayElement(texture, 1));
381 str2rcolor(rc, str, &rcolor);
383 RClearImage(image, &rcolor);
384 } else if (strcasecmp(&type[1], "gradient")==0) {
385 int style;
386 RColor rcolor2;
388 switch (toupper(type[0])) {
389 case 'V':
390 style = RVerticalGradient;
391 break;
392 case 'H':
393 style = RHorizontalGradient;
394 break;
395 default:
396 case 'D':
397 style = RDiagonalGradient;
398 break;
401 str = PLGetString(PLGetArrayElement(texture, 1));
402 str2rcolor(rc, str, &rcolor);
403 str = PLGetString(PLGetArrayElement(texture, 2));
404 str2rcolor(rc, str, &rcolor2);
406 image = RRenderGradient(width, height, &rcolor, &rcolor2, style);
407 } else if (strcasecmp(&type[2], "gradient")==0 && toupper(type[0])=='T') {
408 int style;
409 RColor rcolor2;
410 int i;
411 RImage *grad, *timage;
412 char *path;
414 switch (toupper(type[1])) {
415 case 'V':
416 style = RVerticalGradient;
417 break;
418 case 'H':
419 style = RHorizontalGradient;
420 break;
421 default:
422 case 'D':
423 style = RDiagonalGradient;
424 break;
427 str = PLGetString(PLGetArrayElement(texture, 3));
428 str2rcolor(rc, str, &rcolor);
429 str = PLGetString(PLGetArrayElement(texture, 4));
430 str2rcolor(rc, str, &rcolor2);
432 str = PLGetString(PLGetArrayElement(texture, 1));
434 path = wfindfileinarray(GetObjectForKey("PixmapPath"), str);
435 timage = RLoadImage(rc, path, 0);
437 if (!timage) {
438 wwarning("could not load file '%s': %s", path,
439 RMessageForError(RErrorCode));
440 } else {
441 grad = RRenderGradient(width, height, &rcolor, &rcolor2, style);
443 image = RMakeTiledImage(timage, width, height);
444 RDestroyImage(timage);
446 i = atoi(PLGetString(PLGetArrayElement(texture, 2)));
448 RCombineImagesWithOpaqueness(image, grad, i);
449 RDestroyImage(grad);
451 } else if (strcasecmp(&type[2], "gradient")==0 && toupper(type[0])=='M') {
452 int style;
453 RColor **colors;
454 int i, j;
456 switch (toupper(type[1])) {
457 case 'V':
458 style = RVerticalGradient;
459 break;
460 case 'H':
461 style = RHorizontalGradient;
462 break;
463 default:
464 case 'D':
465 style = RDiagonalGradient;
466 break;
469 j = PLGetNumberOfElements(texture);
471 if (j > 0) {
472 colors = wmalloc(j * sizeof(RColor*));
474 for (i = 2; i < j; i++) {
475 str = PLGetString(PLGetArrayElement(texture, i));
476 colors[i-2] = wmalloc(sizeof(RColor));
477 str2rcolor(rc, str, colors[i-2]);
479 colors[i-2] = NULL;
481 image = RRenderMultiGradient(width, height, colors, style);
483 for (i = 0; colors[i]!=NULL; i++)
484 free(colors[i]);
485 free(colors);
487 } else if (strcasecmp(&type[1], "pixmap")==0) {
488 RImage *timage;
489 char *path;
490 RColor color;
492 str = PLGetString(PLGetArrayElement(texture, 1));
494 path = wfindfileinarray(GetObjectForKey("PixmapPath"), str);
495 timage = RLoadImage(rc, path, 0);
497 if (!timage) {
498 wwarning("could not load file '%s': %s", path,
499 RMessageForError(RErrorCode));
500 } else {
501 str = PLGetString(PLGetArrayElement(texture, 2));
502 str2rcolor(rc, str, &color);
504 switch (toupper(type[0])) {
505 case 'T':
506 image = RMakeTiledImage(timage, width, height);
507 RDestroyImage(timage);
508 timage = image;
509 break;
510 case 'C':
511 image = RMakeCenteredImage(timage, width, height, &color);
512 RDestroyImage(timage);
513 timage = image;
514 break;
515 case 'S':
516 case 'M':
517 image = RScaleImage(timage, width, height);
518 RDestroyImage(timage);
519 timage = image;
520 break;
524 free(path);
527 if (!image)
528 return None;
530 if (path) {
531 dumpRImage(path, image);
534 if (border < 0) {
535 if (border == RESIZEBAR_BEVEL) {
536 drawResizebarBevel(image);
537 } else if (border == MENU_BEVEL) {
538 drawMenuBevel(image);
540 } else if (border) {
541 RBevelImage(image, border);
544 RConvertImage(rc, image, &pixmap);
545 RDestroyImage(image);
547 return pixmap;
551 static Pixmap
552 renderMenu(_Panel *panel, proplist_t texture, int width, int iheight)
554 WMScreen *scr = WMWidgetScreen(panel->win);
555 Display *dpy = WMScreenDisplay(scr);
556 Pixmap pix, tmp;
557 char *str;
558 GC gc = XCreateGC(dpy, WMWidgetXID(panel->win), 0, NULL);
561 str = GetStringForKey("MenuStyle");
562 if (!str || strcasecmp(str, "normal")==0) {
563 int i;
565 tmp = renderTexture(scr, texture, width, iheight, NULL, RBEV_RAISED2);
567 pix = XCreatePixmap(dpy, tmp, width, iheight*3,
568 WMScreenDepth(scr));
569 for (i = 0; i < 3; i++) {
570 XCopyArea(dpy, tmp, pix, gc, 0, 0, width, iheight,
571 0, iheight*i);
573 XFreePixmap(dpy, tmp);
574 } else if (strcasecmp(str, "flat")==0) {
575 pix = renderTexture(scr, texture, width, iheight*3, NULL, RBEV_RAISED2);
576 } else {
577 pix = renderTexture(scr, texture, width, iheight*3, NULL, MENU_BEVEL);
580 XFreeGC(dpy, gc);
582 return pix;
586 static void
587 updatePreviewBox(_Panel *panel, int elements)
589 WMScreen *scr = WMWidgetScreen(panel->win);
590 Display *dpy = WMScreenDisplay(scr);
591 /* RContext *rc = WMScreenRContext(scr);*/
592 int refresh = 0;
593 Pixmap pix;
594 GC gc;
595 WMListItem *item;
596 TextureListItem *titem;
598 gc = XCreateGC(dpy, WMWidgetXID(panel->win), 0, NULL);
601 if (!panel->preview) {
602 WMColor *color;
604 panel->preview = XCreatePixmap(dpy, WMWidgetXID(panel->win),
605 260-4, 165-4, WMScreenDepth(scr));
607 color = WMGrayColor(scr);
608 XFillRectangle(dpy, panel->preview, WMColorGC(color),
609 0, 0, 260-4, 165-4);
610 WMReleaseColor(color);
612 refresh = -1;
615 if (elements & FTITLE) {
616 item = WMGetListItem(panel->texLs, panel->textureIndex[0]);
617 titem = (TextureListItem*)item->clientData;
619 pix = renderTexture(scr, titem->prop, 210, 20, NULL, RBEV_RAISED2);
621 XCopyArea(dpy, pix, panel->preview, gc, 0, 0, 210, 20, 30, 5);
623 XFreePixmap(dpy, pix);
625 if (elements & UTITLE) {
626 item = WMGetListItem(panel->texLs, panel->textureIndex[1]);
627 titem = (TextureListItem*)item->clientData;
629 pix = renderTexture(scr, titem->prop, 210, 20, NULL, RBEV_RAISED2);
631 XCopyArea(dpy, pix, panel->preview, gc, 0, 0, 210, 20, 30, 30);
633 XFreePixmap(dpy, pix);
635 if (elements & OTITLE) {
636 item = WMGetListItem(panel->texLs, panel->textureIndex[2]);
637 titem = (TextureListItem*)item->clientData;
639 pix = renderTexture(scr, titem->prop, 210, 20, NULL, RBEV_RAISED2);
641 XCopyArea(dpy, pix, panel->preview, gc, 0, 0, 210, 20, 30, 55);
643 XFreePixmap(dpy, pix);
645 if (elements & RESIZEBAR) {
646 item = WMGetListItem(panel->texLs, panel->textureIndex[3]);
647 titem = (TextureListItem*)item->clientData;
649 pix = renderTexture(scr, titem->prop, 210, 9, NULL, RESIZEBAR_BEVEL);
651 XCopyArea(dpy, pix, panel->preview, gc, 0, 0, 210, 20, 30, 80);
653 XFreePixmap(dpy, pix);
655 if (elements & MTITLE) {
656 item = WMGetListItem(panel->texLs, panel->textureIndex[4]);
657 titem = (TextureListItem*)item->clientData;
659 pix = renderTexture(scr, titem->prop, 100, 20, NULL, RBEV_RAISED2);
661 XCopyArea(dpy, pix, panel->preview, gc, 0, 0, 100, 20, 30, 95);
663 XFreePixmap(dpy, pix);
665 if (elements & MITEM) {
666 item = WMGetListItem(panel->texLs, panel->textureIndex[5]);
667 titem = (TextureListItem*)item->clientData;
669 pix = renderMenu(panel, titem->prop, 100, 18);
671 XCopyArea(dpy, pix, panel->preview, gc, 0, 0, 100, 18*3, 30, 115);
673 XFreePixmap(dpy, pix);
675 if (elements & (MITEM|MTITLE)) {
676 XDrawLine(dpy, panel->preview, gc, 29, 95, 29, 115+36+20);
677 XDrawLine(dpy, panel->preview, gc, 29, 94, 129, 94);
680 if (elements & ICON) {
681 item = WMGetListItem(panel->texLs, panel->textureIndex[6]);
682 titem = (TextureListItem*)item->clientData;
684 pix = renderTexture(scr, titem->prop, 64, 64, NULL,
685 titem->ispixmap ? 0 : RBEV_RAISED3);
687 XCopyArea(dpy, pix, panel->preview, gc, 0, 0, 64, 64, 170, 95);
689 XFreePixmap(dpy, pix);
693 if (refresh < 0) {
694 WMPixmap *p;
695 p = WMCreatePixmapFromXPixmaps(scr, panel->preview, None,
696 260-4, 165-4, WMScreenDepth(scr));
698 WMSetLabelImage(panel->prevL, p);
699 WMReleasePixmap(p);
700 } else {
701 WMRedisplayWidget(panel->prevL);
704 XFreeGC(dpy, gc);
710 static void
711 cancelNewTexture(void *data)
713 _Panel *panel = (_Panel*)data;
715 HideTexturePanel(panel->texturePanel);
721 static char*
722 makeFileName(char *prefix)
724 char *fname;
726 fname = wstrdup(prefix);
728 while (access(fname, F_OK)==0) {
729 char buf[30];
731 free(fname);
732 sprintf(buf, "%08lx.cache", time(NULL));
733 fname = wstrappend(prefix, buf);
736 return fname;
742 static void
743 okNewTexture(void *data)
745 _Panel *panel = (_Panel*)data;
746 WMListItem *item;
747 char *name;
748 char *str;
749 proplist_t prop;
750 TextureListItem *titem;
751 WMScreen *scr = WMWidgetScreen(panel->win);
753 titem = wmalloc(sizeof(TextureListItem));
754 memset(titem, 0, sizeof(TextureListItem));
756 HideTexturePanel(panel->texturePanel);
758 name = GetTexturePanelTextureName(panel->texturePanel);
760 prop = GetTexturePanelTexture(panel->texturePanel);
762 str = PLGetDescription(prop);
764 titem->title = name;
765 titem->prop = prop;
766 titem->texture = str;
767 titem->selectedFor = 0;
769 titem->ispixmap = isPixmap(prop);
771 titem->path = makeFileName(panel->fprefix);
772 titem->preview = renderTexture(scr, prop, TEXPREV_WIDTH, TEXPREV_HEIGHT,
773 titem->path, 0);
775 item = WMAddListItem(panel->texLs, "");
776 item->clientData = titem;
778 WMSetListPosition(panel->texLs, WMGetListNumberOfRows(panel->texLs));
782 static void
783 okEditTexture(void *data)
785 _Panel *panel = (_Panel*)data;
786 WMListItem *item;
787 char *name;
788 char *str;
789 proplist_t prop;
790 TextureListItem *titem;
792 item = WMGetListItem(panel->texLs, WMGetListSelectedItemRow(panel->texLs));
793 titem = (TextureListItem*)item->clientData;
795 HideTexturePanel(panel->texturePanel);
797 if (titem->current) {
798 name = GetTexturePanelTextureName(panel->texturePanel);
800 free(titem->title);
801 titem->title = name;
804 prop = GetTexturePanelTexture(panel->texturePanel);
806 str = PLGetDescription(prop);
808 PLRelease(titem->prop);
809 titem->prop = prop;
811 titem->ispixmap = isPixmap(prop);
813 free(titem->texture);
814 titem->texture = str;
816 XFreePixmap(WMScreenDisplay(WMWidgetScreen(panel->texLs)), titem->preview);
817 titem->preview = renderTexture(WMWidgetScreen(panel->texLs), titem->prop,
818 TEXPREV_WIDTH, TEXPREV_HEIGHT,
819 titem->path, 0);
821 WMRedisplayWidget(panel->texLs);
823 if (titem->selectedFor)
824 updatePreviewBox(panel, titem->selectedFor);
826 changePage(panel->secP, panel);
831 static void
832 editTexture(WMWidget *w, void *data)
834 _Panel *panel = (_Panel*)data;
835 WMListItem *item;
836 TextureListItem *titem;
838 item = WMGetListItem(panel->texLs, WMGetListSelectedItemRow(panel->texLs));
839 titem = (TextureListItem*)item->clientData;
841 SetTexturePanelPixmapPath(panel->texturePanel,
842 GetObjectForKey("PixmapPath"));
844 SetTexturePanelTexture(panel->texturePanel, titem->title, titem->prop);
846 SetTexturePanelCancelAction(panel->texturePanel, cancelNewTexture, panel);
847 SetTexturePanelOkAction(panel->texturePanel, okEditTexture, panel);
849 ShowTexturePanel(panel->texturePanel);
854 static void
855 newTexture(WMWidget *w, void *data)
857 _Panel *panel = (_Panel*)data;
859 SetTexturePanelPixmapPath(panel->texturePanel,
860 GetObjectForKey("PixmapPath"));
862 SetTexturePanelTexture(panel->texturePanel, "New Texture", NULL);
864 SetTexturePanelCancelAction(panel->texturePanel, cancelNewTexture, panel);
866 SetTexturePanelOkAction(panel->texturePanel, okNewTexture, panel);
868 ShowTexturePanel(panel->texturePanel);
873 static void
874 deleteTexture(WMWidget *w, void *data)
876 _Panel *panel = (_Panel*)data;
877 WMListItem *item;
878 TextureListItem *titem;
879 int row;
880 int section;
882 section = WMGetPopUpButtonSelectedItem(panel->secP);
883 row = WMGetListSelectedItemRow(panel->texLs);
884 item = WMGetListItem(panel->texLs, row);
885 titem = (TextureListItem*)item->clientData;
887 if (titem->selectedFor & (1 << section)) {
888 TextureListItem *titem2;
890 panel->textureIndex[section] = section;
891 item = WMGetListItem(panel->texLs, section);
892 titem2 = (TextureListItem*)item->clientData;
893 titem2->selectedFor |= 1 << section;
896 free(titem->title);
897 free(titem->texture);
898 PLRelease(titem->prop);
899 if (titem->path) {
900 if (remove(titem->path) < 0 && errno != ENOENT) {
901 wsyserror("could not remove file %s", titem->path);
903 free(titem->path);
906 free(titem);
908 WMRemoveListItem(panel->texLs, row);
909 WMSetButtonEnabled(panel->delB, False);
915 static void
916 extractTexture(WMWidget *w, void *data)
918 _Panel *panel = (_Panel*)data;
919 char *path;
920 WMOpenPanel *opanel;
921 WMScreen *scr = WMWidgetScreen(w);
923 opanel = WMGetOpenPanel(scr);
924 WMSetFilePanelCanChooseDirectories(opanel, False);
925 WMSetFilePanelCanChooseFiles(opanel, True);
927 if (WMRunModalFilePanelForDirectory(opanel, panel->win, wgethomedir(),
928 _("Select File"), NULL)) {
929 path = WMGetFilePanelFileName(opanel);
931 OpenExtractPanelFor(panel, path);
933 free(path);
938 static void
939 changePage(WMWidget *w, void *data)
941 _Panel *panel = (_Panel*)data;
942 int section;
943 WMListItem *item;
944 TextureListItem *titem;
945 char *str;
946 WMScreen *scr = WMWidgetScreen(w);
947 RContext *rc = WMScreenRContext(scr);
948 static WMPoint positions[] = {
949 {5, 5},
950 {5, 30},
951 {5, 55},
952 {5, 80},
953 {5, 95},
954 {5, 130},
955 {145, 110}
958 section = WMGetPopUpButtonSelectedItem(panel->secP);
960 WMSelectListItem(panel->texLs, panel->textureIndex[section]);
962 WMSetListPosition(panel->texLs, panel->textureIndex[section] - 2);
964 item = WMGetListItem(panel->texLs, panel->textureIndex[section]);
966 titem = (TextureListItem*)item->clientData;
968 str = wmalloc(strlen(titem->title) + strlen(titem->texture) + 4);
969 sprintf(str, "%s: %s", titem->title, titem->texture);
970 WMSetLabelText(panel->texsL, str);
971 free(str);
974 WMColor *color;
976 color = WMGrayColor(scr);
977 XFillRectangle(rc->dpy, panel->preview, WMColorGC(color),
978 positions[panel->oldsection].x,
979 positions[panel->oldsection].y, 22, 22);
980 WMReleaseColor(color);
982 panel->oldsection = section;
983 WMDrawPixmap(panel->hand, panel->preview, positions[section].x,
984 positions[section].y);
986 WMRedisplayWidget(panel->prevL);
991 static void
992 previewClick(XEvent *event, void *clientData)
994 _Panel *panel = (_Panel*)clientData;
995 int i;
996 static WMRect parts[] = {
997 {{30, 5},{210, 20}},
998 {{30,30},{210,20}},
999 {{30,55},{210,20}},
1000 {{30,80},{210,9}},
1001 {{30,95},{100,20}},
1002 {{30,115},{100,60}},
1003 {{170,90},{64,64}}
1006 for (i = 0; i < 7; i++) {
1007 if (event->xbutton.x >= parts[i].pos.x
1008 && event->xbutton.y >= parts[i].pos.y
1009 && event->xbutton.x < parts[i].pos.x + parts[i].size.width
1010 && event->xbutton.y < parts[i].pos.y + parts[i].size.height) {
1012 WMSetPopUpButtonSelectedItem(panel->secP, i);
1013 changePage(panel->secP, panel);
1014 return;
1020 static void
1021 textureClick(WMWidget *w, void *data)
1023 _Panel *panel = (_Panel*)data;
1024 int i;
1025 WMListItem *item;
1026 TextureListItem *titem;
1028 i = WMGetListSelectedItemRow(panel->texLs);
1030 item = WMGetListItem(panel->texLs, i);
1032 titem = (TextureListItem*)item->clientData;
1034 if (titem->current) {
1035 WMSetButtonEnabled(panel->delB, False);
1036 } else {
1037 WMSetButtonEnabled(panel->delB, True);
1043 static void
1044 textureDoubleClick(WMWidget *w, void *data)
1046 _Panel *panel = (_Panel*)data;
1047 int i, section;
1048 WMListItem *item;
1049 TextureListItem *titem;
1050 char *str;
1052 /* unselect old texture */
1053 section = WMGetPopUpButtonSelectedItem(panel->secP);
1055 item = WMGetListItem(panel->texLs, panel->textureIndex[section]);
1056 titem = (TextureListItem*)item->clientData;
1057 titem->selectedFor &= ~(1 << section);
1059 /* select new texture */
1060 i = WMGetListSelectedItemRow(panel->texLs);
1062 item = WMGetListItem(panel->texLs, i);
1064 titem = (TextureListItem*)item->clientData;
1066 titem->selectedFor |= 1<<section;
1068 panel->textureIndex[section] = i;
1070 WMRedisplayWidget(panel->texLs);
1072 str = wmalloc(strlen(titem->title) + strlen(titem->texture) + 4);
1073 sprintf(str, "%s: %s", titem->title, titem->texture);
1074 WMSetLabelText(panel->texsL, str);
1075 free(str);
1077 updatePreviewBox(panel, 1<<section);
1083 static void
1084 paintListItem(WMList *lPtr, int index, Drawable d, char *text, int state,
1085 WMRect *rect)
1087 _Panel *panel = (_Panel*)WMGetHangedData(lPtr);
1088 WMScreen *scr = WMWidgetScreen(lPtr);
1089 int width, height, x, y;
1090 Display *dpy = WMScreenDisplay(scr);
1091 WMColor *white = WMWhiteColor(scr);
1092 WMListItem *item;
1093 WMColor *black = WMBlackColor(scr);
1094 TextureListItem *titem;
1096 width = rect->size.width;
1097 height = rect->size.height;
1098 x = rect->pos.x;
1099 y = rect->pos.y;
1101 if (state & WLDSSelected)
1102 XFillRectangle(dpy, d, WMColorGC(white), x, y, width, height);
1103 else
1104 XClearArea(dpy, d, x, y, width, height, False);
1106 item = WMGetListItem(lPtr, index);
1107 titem = (TextureListItem*)item->clientData;
1109 if (titem->preview)
1110 XCopyArea(dpy, titem->preview, d, WMColorGC(black), 0, 0, TEXPREV_WIDTH,
1111 TEXPREV_HEIGHT, x + 5, y + 5);
1113 if ((1 << WMGetPopUpButtonSelectedItem(panel->secP)) & titem->selectedFor)
1114 WMDrawPixmap(panel->onLed, d, x + TEXPREV_WIDTH + 10, y + 6);
1115 else if (titem->selectedFor)
1116 WMDrawPixmap(panel->offLed, d, x + TEXPREV_WIDTH + 10, y + 6);
1118 WMDrawString(scr, d, WMColorGC(black), panel->boldFont,
1119 x + TEXPREV_WIDTH + 22, y + 2, titem->title,
1120 strlen(titem->title));
1122 WMDrawString(scr, d, WMColorGC(black), panel->smallFont,
1123 x + TEXPREV_WIDTH + 14, y + 18, titem->texture,
1124 strlen(titem->texture));
1127 WMReleaseColor(white);
1128 WMReleaseColor(black);
1133 static Pixmap
1134 loadRImage(WMScreen *scr, char *path)
1136 FILE *f;
1137 RImage *image;
1138 int w, h, d;
1139 int i;
1140 Pixmap pixmap;
1142 f = fopen(path, "r");
1143 if (!f)
1144 return None;
1146 fscanf(f, "%02x%02x%1x", &w, &h, &d);
1148 image = RCreateImage(w, h, d == 4);
1149 for (i = 0; i < d; i++) {
1150 fread(image->data[i], 1, w*h, f);
1152 fclose(f);
1154 RConvertImage(WMScreenRContext(scr), image, &pixmap);
1155 RDestroyImage(image);
1157 return pixmap;
1162 static void
1163 fillTextureList(WMList *lPtr)
1165 proplist_t textureList;
1166 proplist_t texture;
1167 WMUserDefaults *udb = WMGetStandardUserDefaults();
1168 int i;
1169 TextureListItem *titem;
1170 WMScreen *scr = WMWidgetScreen(lPtr);
1172 textureList = WMGetUDObjectForKey(udb, "TextureList");
1173 if (!textureList)
1174 return;
1176 for (i = 0; i < PLGetNumberOfElements(textureList); i++) {
1177 WMListItem *item;
1179 texture = PLGetArrayElement(textureList, i);
1181 titem = wmalloc(sizeof(TextureListItem));
1182 memset(titem, 0, sizeof(TextureListItem));
1184 titem->title = wstrdup(PLGetString(PLGetArrayElement(texture, 0)));
1185 titem->prop = PLRetain(PLGetArrayElement(texture, 1));
1186 titem->texture = PLGetDescription(titem->prop);
1187 titem->selectedFor = 0;
1188 titem->path = wstrdup(PLGetString(PLGetArrayElement(texture, 2)));
1190 titem->preview = loadRImage(scr, titem->path);
1191 if (!titem->preview) {
1192 titem->preview = renderTexture(scr, titem->prop, TEXPREV_WIDTH,
1193 TEXPREV_HEIGHT, NULL, 0);
1195 item = WMAddListItem(lPtr, "");
1196 item->clientData = titem;
1201 static void
1202 createPanel(Panel *p)
1204 _Panel *panel = (_Panel*)p;
1205 WMColor *color;
1206 WMFont *font;
1207 WMScreen *scr = WMWidgetScreen(panel->win);
1209 char *tmp;
1210 Bool ok = True;
1212 panel->fprefix = wstrappend(wusergnusteppath(), "/.AppInfo");
1214 if (access(panel->fprefix, F_OK)!=0) {
1215 if (mkdir(panel->fprefix, 0755) < 0) {
1216 wsyserror(panel->fprefix);
1217 ok = False;
1220 if (ok) {
1221 tmp = wstrappend(panel->fprefix, "/WPrefs/");
1222 free(panel->fprefix);
1223 panel->fprefix = tmp;
1224 if (access(panel->fprefix, F_OK)!=0) {
1225 if (mkdir(panel->fprefix, 0755) < 0) {
1226 wsyserror(panel->fprefix);
1231 panel->smallFont = WMSystemFontOfSize(scr, 10);
1232 panel->normalFont = WMSystemFontOfSize(scr, 12);
1233 panel->boldFont = WMBoldSystemFontOfSize(scr, 12);
1235 panel->onLed = WMCreatePixmapFromXPMData(scr, blueled_xpm);
1236 panel->offLed = WMCreatePixmapFromXPMData(scr, blueled2_xpm);
1237 panel->hand = WMCreatePixmapFromXPMData(scr, hand_xpm);
1239 panel->frame = WMCreateFrame(panel->win);
1240 WMResizeWidget(panel->frame, FRAME_WIDTH, FRAME_HEIGHT);
1241 WMMoveWidget(panel->frame, FRAME_LEFT, FRAME_TOP);
1243 /* preview box */
1244 panel->prevL = WMCreateLabel(panel->frame);
1245 WMResizeWidget(panel->prevL, 260, 165);
1246 WMMoveWidget(panel->prevL, 15, 10);
1247 WMSetLabelRelief(panel->prevL, WRSunken);
1248 WMSetLabelImagePosition(panel->prevL, WIPImageOnly);
1250 WMCreateEventHandler(WMWidgetView(panel->prevL), ButtonPressMask,
1251 previewClick, panel);
1254 panel->secP = WMCreatePopUpButton(panel->frame);
1255 WMResizeWidget(panel->secP, 260, 20);
1256 WMMoveWidget(panel->secP, 15, 180);
1257 WMSetPopUpButtonSelectedItem(panel->secP, 0);
1258 WMAddPopUpButtonItem(panel->secP, _("Titlebar of Focused Window"));
1259 WMAddPopUpButtonItem(panel->secP, _("Titlebar of Unfocused Windows"));
1260 WMAddPopUpButtonItem(panel->secP, _("Titlebar of Focused Window's Owner"));
1261 WMAddPopUpButtonItem(panel->secP, _("Window Resizebar"));
1262 WMAddPopUpButtonItem(panel->secP, _("Titlebar of Menus"));
1263 WMAddPopUpButtonItem(panel->secP, _("Menu Items"));
1264 WMAddPopUpButtonItem(panel->secP, _("Icon Background"));
1265 /* WMAddPopUpButtonItem(panel->secP, _("Workspace Backgrounds"));
1267 WMSetPopUpButtonAction(panel->secP, changePage, panel);
1270 panel->texsL = WMCreateLabel(panel->frame);
1271 WMResizeWidget(panel->texsL, 260, 20);
1272 WMMoveWidget(panel->texsL, 15, 205);
1273 WMSetLabelWraps(panel->texsL, False);
1275 /* texture list */
1276 font = WMBoldSystemFontOfSize(scr, 12);
1278 panel->texL = WMCreateLabel(panel->frame);
1279 WMResizeWidget(panel->texL, 225, 18);
1280 WMMoveWidget(panel->texL, 285, 10);
1281 WMSetLabelFont(panel->texL, font);
1282 WMSetLabelText(panel->texL, _("Textures"));
1283 WMSetLabelRelief(panel->texL, WRSunken);
1284 WMSetLabelTextAlignment(panel->texL, WACenter);
1285 color = WMDarkGrayColor(scr);
1286 WMSetWidgetBackgroundColor(panel->texL, color);
1287 WMReleaseColor(color);
1288 color = WMWhiteColor(scr);
1289 WMSetLabelTextColor(panel->texL, color);
1290 WMReleaseColor(color);
1292 WMReleaseFont(font);
1294 panel->texLs = WMCreateList(panel->frame);
1295 WMResizeWidget(panel->texLs, 225, 144);
1296 WMMoveWidget(panel->texLs, 285, 30);
1297 WMSetListUserDrawItemHeight(panel->texLs, 35);
1298 WMSetListUserDrawProc(panel->texLs, paintListItem);
1299 WMHangData(panel->texLs, panel);
1300 WMSetListAction(panel->texLs, textureClick, panel);
1301 WMSetListDoubleAction(panel->texLs, textureDoubleClick, panel);
1303 /* command buttons */
1305 font = WMSystemFontOfSize(scr, 10);
1308 panel->newB = WMCreateCommandButton(panel->frame);
1309 WMResizeWidget(panel->newB, 56, 48);
1310 WMMoveWidget(panel->newB, 285, 180);
1311 WMSetButtonFont(panel->newB, font);
1312 WMSetButtonImagePosition(panel->newB, WIPAbove);
1313 WMSetButtonText(panel->newB, _("New"));
1314 WMSetButtonAction(panel->newB, newTexture, panel);
1315 SetButtonAlphaImage(scr, panel->newB, TNEW_FILE);
1317 panel->ripB = WMCreateCommandButton(panel->frame);
1318 WMResizeWidget(panel->ripB, 56, 48);
1319 WMMoveWidget(panel->ripB, 341, 180);
1320 WMSetButtonFont(panel->ripB, font);
1321 WMSetButtonImagePosition(panel->ripB, WIPAbove);
1322 WMSetButtonText(panel->ripB, _("Extract..."));
1323 WMSetButtonAction(panel->ripB, extractTexture, panel);
1324 SetButtonAlphaImage(scr, panel->ripB, TEXTR_FILE);
1326 WMSetButtonEnabled(panel->ripB, False);
1328 panel->editB = WMCreateCommandButton(panel->frame);
1329 WMResizeWidget(panel->editB, 56, 48);
1330 WMMoveWidget(panel->editB, 397, 180);
1331 WMSetButtonFont(panel->editB, font);
1332 WMSetButtonImagePosition(panel->editB, WIPAbove);
1333 WMSetButtonText(panel->editB, _("Edit"));
1334 SetButtonAlphaImage(scr, panel->editB, TEDIT_FILE);
1335 WMSetButtonAction(panel->editB, editTexture, panel);
1337 panel->delB = WMCreateCommandButton(panel->frame);
1338 WMResizeWidget(panel->delB, 56, 48);
1339 WMMoveWidget(panel->delB, 453, 180);
1340 WMSetButtonFont(panel->delB, font);
1341 WMSetButtonImagePosition(panel->delB, WIPAbove);
1342 WMSetButtonText(panel->delB, _("Delete"));
1343 SetButtonAlphaImage(scr, panel->delB, TDEL_FILE);
1344 WMSetButtonEnabled(panel->delB, False);
1345 WMSetButtonAction(panel->delB, deleteTexture, panel);
1347 WMReleaseFont(font);
1349 /**/
1351 WMRealizeWidget(panel->frame);
1352 WMMapSubwidgets(panel->frame);
1354 WMSetPopUpButtonSelectedItem(panel->secP, 0);
1356 showData(panel);
1358 changePage(panel->secP, panel);
1360 fillTextureList(panel->texLs);
1362 panel->texturePanel = CreateTexturePanel(panel->win);
1367 static void
1368 setupTextureFor(WMList *list, char *key, char *defValue, char *title,
1369 int index)
1371 WMListItem *item;
1372 TextureListItem *titem;
1374 titem = wmalloc(sizeof(TextureListItem));
1375 memset(titem, 0, sizeof(TextureListItem));
1377 titem->title = wstrdup(title);
1378 titem->prop = GetObjectForKey(key);
1379 if (!titem->prop) {
1380 titem->prop = PLGetProplistWithDescription(defValue);
1381 } else {
1382 PLRetain(titem->prop);
1384 titem->texture = PLGetDescription((proplist_t)titem->prop);
1385 titem->current = 1;
1386 titem->selectedFor = 1<<index;
1388 titem->ispixmap = isPixmap(titem->prop);
1390 titem->preview = renderTexture(WMWidgetScreen(list), titem->prop,
1391 TEXPREV_WIDTH, TEXPREV_HEIGHT, NULL, 0);
1393 item = WMAddListItem(list, "");
1394 item->clientData = titem;
1399 static void
1400 showData(_Panel *panel)
1402 int i = 0;
1404 setupTextureFor(panel->texLs, "FTitleBack", "(solid, black)",
1405 "[Focused]", i);
1406 panel->textureIndex[i] = i++;
1408 setupTextureFor(panel->texLs, "UTitleBack", "(solid, gray)",
1409 "[Unfocused]", i);
1410 panel->textureIndex[i] = i++;
1412 setupTextureFor(panel->texLs, "PTitleBack", "(solid, \"#616161\")",
1413 "[Owner of Focused]", i);
1414 panel->textureIndex[i] = i++;
1416 setupTextureFor(panel->texLs, "ResizebarBack", "(solid, gray)",
1417 "[Resizebar]", i);
1418 panel->textureIndex[i] = i++;
1420 setupTextureFor(panel->texLs, "MenuTitleBack", "(solid, black)",
1421 "[Menu Title]", i);
1422 panel->textureIndex[i] = i++;
1424 setupTextureFor(panel->texLs, "MenuTextBack", "(solid, gray)",
1425 "[Menu Item]", i);
1426 panel->textureIndex[i] = i++;
1428 setupTextureFor(panel->texLs, "IconBack", "(solid, gray)", "[Icon]", i);
1429 panel->textureIndex[i] = i++;
1431 setupTextureFor(panel->texLs, "WorkspaceBack", "(solid, black)",
1432 "[Workspace]", i);
1433 panel->textureIndex[i] = i++;
1436 updatePreviewBox(panel, EVERYTHING);
1441 static void
1442 storeData(_Panel *panel)
1444 TextureListItem *titem;
1445 WMListItem *item;
1447 item = WMGetListItem(panel->texLs, panel->textureIndex[0]);
1448 titem = (TextureListItem*)item->clientData;
1449 SetObjectForKey(titem->prop, "FTitleBack");
1451 item = WMGetListItem(panel->texLs, panel->textureIndex[1]);
1452 titem = (TextureListItem*)item->clientData;
1453 SetObjectForKey(titem->prop, "UTitleBack");
1455 item = WMGetListItem(panel->texLs, panel->textureIndex[2]);
1456 titem = (TextureListItem*)item->clientData;
1457 SetObjectForKey(titem->prop, "PTitleBack");
1459 item = WMGetListItem(panel->texLs, panel->textureIndex[3]);
1460 titem = (TextureListItem*)item->clientData;
1461 SetObjectForKey(titem->prop, "ResizebarBack");
1463 item = WMGetListItem(panel->texLs, panel->textureIndex[4]);
1464 titem = (TextureListItem*)item->clientData;
1465 SetObjectForKey(titem->prop, "MenuTitleBack");
1467 item = WMGetListItem(panel->texLs, panel->textureIndex[5]);
1468 titem = (TextureListItem*)item->clientData;
1469 SetObjectForKey(titem->prop, "MenuTextBack");
1471 item = WMGetListItem(panel->texLs, panel->textureIndex[6]);
1472 titem = (TextureListItem*)item->clientData;
1473 SetObjectForKey(titem->prop, "IconBack");
1477 static void
1478 prepareForClose(_Panel *panel)
1480 proplist_t textureList;
1481 proplist_t texture;
1482 int i;
1483 TextureListItem *titem;
1484 WMListItem *item;
1485 WMUserDefaults *udb = WMGetStandardUserDefaults();
1487 textureList = PLMakeArrayFromElements(NULL, NULL);
1489 /* store list of textures */
1490 for (i = 7; i < WMGetListNumberOfRows(panel->texLs); i++) {
1491 item = WMGetListItem(panel->texLs, i);
1492 titem = (TextureListItem*)item->clientData;
1494 texture = PLMakeArrayFromElements(PLMakeString(titem->title),
1495 PLRetain(titem->prop),
1496 PLMakeString(titem->path),
1497 NULL);
1499 PLAppendArrayElement(textureList, texture);
1502 WMSetUDObjectForKey(udb, textureList, "TextureList");
1503 PLRelease(textureList);
1505 WMSynchronizeUserDefaults(udb);
1510 Panel*
1511 InitAppearance(WMScreen *scr, WMWindow *win)
1513 _Panel *panel;
1515 panel = wmalloc(sizeof(_Panel));
1516 memset(panel, 0, sizeof(_Panel));
1518 panel->sectionName = _("Appearance Preferences");
1520 panel->win = win;
1522 panel->callbacks.createWidgets = createPanel;
1523 panel->callbacks.updateDomain = storeData;
1524 panel->callbacks.prepareForClose = prepareForClose;
1526 AddSection(panel, ICON_FILE);
1528 return panel;
1533 /****************************************************************************/
1537 typedef struct ExtractPanel {
1538 WMWindow *win;
1540 WMLabel *label;
1541 WMList *list;
1543 WMButton *closeB;
1544 WMButton *extrB;
1545 } ExtractPanel;
1549 static void
1550 OpenExtractPanelFor(_Panel *panel, char *path)
1552 ExtractPanel *epanel;
1553 WMColor *color;
1554 WMFont *font;
1555 WMScreen *scr = WMWidgetScreen(panel->win);
1557 epanel = wmalloc(sizeof(ExtractPanel));
1558 epanel->win = WMCreatePanelWithStyleForWindow(panel->win, "extract",
1559 WMTitledWindowMask
1560 |WMClosableWindowMask);
1561 WMResizeWidget(epanel->win, 245, 250);
1562 WMSetWindowTitle(epanel->win, _("Extract Texture"));
1564 epanel->label = WMCreateLabel(epanel->win);
1565 WMResizeWidget(epanel->label, 225, 18);
1566 WMMoveWidget(epanel->label, 10, 10);
1567 WMSetLabelTextAlignment(epanel->label, WACenter);
1568 WMSetLabelRelief(epanel->label, WRSunken);
1570 color = WMDarkGrayColor(scr);
1571 WMSetWidgetBackgroundColor(epanel->label, color);
1572 WMReleaseColor(color);
1574 color = WMWhiteColor(scr);
1575 WMSetLabelTextColor(epanel->label, color);
1576 WMReleaseColor(color);
1578 font = WMBoldSystemFontOfSize(scr, 12);
1579 WMSetLabelFont(epanel->label, font);
1580 WMReleaseFont(font);
1582 WMSetLabelText(epanel->label, _("Textures"));
1584 epanel->list = WMCreateList(epanel->win);
1585 WMResizeWidget(epanel->list, 225, 165);
1586 WMMoveWidget(epanel->list, 10, 30);
1590 epanel->closeB = WMCreateCommandButton(epanel->win);
1591 WMResizeWidget(epanel->closeB, 74, 24);
1592 WMMoveWidget(epanel->closeB, 165, 215);
1593 WMSetButtonText(epanel->closeB, _("Close"));
1595 epanel->extrB = WMCreateCommandButton(epanel->win);
1596 WMResizeWidget(epanel->extrB, 74, 24);
1597 WMMoveWidget(epanel->extrB, 80, 215);
1598 WMSetButtonText(epanel->extrB, _("Extract"));
1600 WMMapSubwidgets(epanel->win);
1603 /* take textures from file */
1607 WMRealizeWidget(epanel->win);
1609 WMMapWidget(epanel->win);