1 /* Apperance.c- color/texture for titlebar etc.
3 * WPrefs - Window Maker Preferences Program
5 * Copyright (c) 1999 Alfredo K. Kojima
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,
31 #include <sys/types.h>
38 #include "TexturePanel.h"
40 typedef struct _Panel
{
46 CallbackRec callbacks
;
73 WMColorWell
*sampW
[15];
89 TexturePanel
*texturePanel
;
119 static void showData(_Panel
*panel
);
121 static void changePage(WMWidget
*w
, void *data
);
123 static void OpenExtractPanelFor(_Panel
*panel
, char *path
);
125 #define ICON_FILE "appearance"
127 #define TNEW_FILE "tnew"
128 #define TDEL_FILE "tdel"
129 #define TEDIT_FILE "tedit"
130 #define TEXTR_FILE "textr"
132 #define MSTYLE1_FILE "msty1"
133 #define MSTYLE2_FILE "msty2"
134 #define MSTYLE3_FILE "msty3"
138 static char * blueled_xpm
[] = {
168 static char *blueled2_xpm
[] = {
169 /* width height num_colors chars_per_pixel */
201 static char * hand_xpm
[] = {
223 " .))),%.......... ",
224 " .)-)),&)))))))))$. ",
225 " .-&))))))))),,,,;;. ",
226 " .=)))))))));-=***&$. ",
227 " .=)))))))),..+..... ",
245 #define FTITLE (1<<0)
246 #define UTITLE (1<<1)
247 #define OTITLE (1<<2)
248 #define RESIZEBAR (1<<3)
249 #define MTITLE (1<<4)
253 #define EVERYTHING 0xff
256 #define RESIZEBAR_BEVEL -1
257 #define MENU_BEVEL -2
259 #define TEXPREV_WIDTH 40
260 #define TEXPREV_HEIGHT 24
263 #define MSTYLE_NORMAL 0
264 #define MSTYLE_SINGLE 1
265 #define MSTYLE_FLAT 2
271 str2rcolor(RContext
*rc
, char *name
, RColor
*color
)
275 XParseColor(rc
->dpy
, rc
->cmap
, name
, &xcolor
);
278 color
->red
= xcolor
.red
>> 8;
279 color
->green
= xcolor
.green
>> 8;
280 color
->blue
= xcolor
.blue
>> 8;
286 dumpRImage(char *path
, RImage
*image
)
290 f
= fopen(path
, "w");
295 fprintf(f
, "%02x%02x%1x", image
->width
, image
->height
,
296 image
->data
[3]!=NULL
? 4 : 3);
298 fwrite(image
->data
[0], 1, image
->width
* image
->height
, f
);
299 fwrite(image
->data
[1], 1, image
->width
* image
->height
, f
);
300 fwrite(image
->data
[2], 1, image
->width
* image
->height
, f
);
302 fwrite(image
->data
[3], 1, image
->width
* image
->height
, f
);
312 isPixmap(proplist_t prop
)
317 p
= PLGetArrayElement(prop
, 0);
319 if (strcasecmp(&s
[1], "pixmap")==0)
327 drawResizebarBevel(RImage
*img
)
332 int width
= img
->width
;
333 int height
= img
->height
;
337 black
.red
= black
.green
= black
.blue
= 0;
340 light
.red
= light
.green
= light
.blue
= 80;
343 dark
.red
= dark
.green
= dark
.blue
= 40;
345 ROperateLine(img
, RSubtractOperation
, 0, 0, width
-1, 0, &dark
);
346 ROperateLine(img
, RAddOperation
, 0, 1, width
-1, 1, &light
);
348 ROperateLine(img
, RSubtractOperation
, cwidth
, 2, cwidth
, height
-1, &dark
);
349 ROperateLine(img
, RAddOperation
, cwidth
+1, 2, cwidth
+1, height
-1, &light
);
351 ROperateLine(img
, RSubtractOperation
, width
-cwidth
-2, 2, width
-cwidth
-2,
353 ROperateLine(img
, RAddOperation
, width
-cwidth
-1, 2, width
-cwidth
-1,
356 RDrawLine(img
, 0, height
-1, width
-1, height
-1, &black
);
357 RDrawLine(img
, 0, 0, 0, height
-1, &black
);
358 RDrawLine(img
, width
-1, 0, width
-1, height
-1, &black
);
363 drawMenuBevel(RImage
*img
)
365 RColor light
, dark
, mid
;
367 int iheight
= img
->height
/ 4;
370 light
.red
= light
.green
= light
.blue
= 80;
373 dark
.red
= dark
.green
= dark
.blue
= 0;
376 mid
.red
= mid
.green
= mid
.blue
= 40;
378 for (i
= 1; i
< 4; i
++) {
379 ROperateLine(img
, RSubtractOperation
, 0, i
*iheight
-2,
380 img
->width
-1, i
*iheight
-2, &mid
);
382 RDrawLine(img
, 0, i
*iheight
-1,
383 img
->width
-1, i
*iheight
-1, &dark
);
385 ROperateLine(img
, RAddOperation
, 1, i
*iheight
,
386 img
->width
-2, i
*iheight
, &light
);
392 renderTexture(WMScreen
*scr
, proplist_t texture
, int width
, int height
,
393 char *path
, int border
)
396 RImage
*image
= NULL
;
398 RContext
*rc
= WMScreenRContext(scr
);
403 type
= PLGetString(PLGetArrayElement(texture
, 0));
405 if (strcasecmp(type
, "solid")==0) {
407 str
= PLGetString(PLGetArrayElement(texture
, 1));
409 str2rcolor(rc
, str
, &rcolor
);
411 image
= RCreateImage(width
, height
, False
);
412 RClearImage(image
, &rcolor
);
413 } else if (strcasecmp(&type
[1], "gradient")==0) {
417 switch (toupper(type
[0])) {
419 style
= RVerticalGradient
;
422 style
= RHorizontalGradient
;
426 style
= RDiagonalGradient
;
430 str
= PLGetString(PLGetArrayElement(texture
, 1));
431 str2rcolor(rc
, str
, &rcolor
);
432 str
= PLGetString(PLGetArrayElement(texture
, 2));
433 str2rcolor(rc
, str
, &rcolor2
);
435 image
= RRenderGradient(width
, height
, &rcolor
, &rcolor2
, style
);
436 } else if (strcasecmp(&type
[2], "gradient")==0 && toupper(type
[0])=='T') {
440 RImage
*grad
, *timage
;
443 switch (toupper(type
[1])) {
445 style
= RVerticalGradient
;
448 style
= RHorizontalGradient
;
452 style
= RDiagonalGradient
;
456 str
= PLGetString(PLGetArrayElement(texture
, 3));
457 str2rcolor(rc
, str
, &rcolor
);
458 str
= PLGetString(PLGetArrayElement(texture
, 4));
459 str2rcolor(rc
, str
, &rcolor2
);
461 str
= PLGetString(PLGetArrayElement(texture
, 1));
463 path
= wfindfileinarray(GetObjectForKey("PixmapPath"), str
);
464 timage
= RLoadImage(rc
, path
, 0);
467 wwarning("could not load file '%s': %s", path
,
468 RMessageForError(RErrorCode
));
470 grad
= RRenderGradient(width
, height
, &rcolor
, &rcolor2
, style
);
472 image
= RMakeTiledImage(timage
, width
, height
);
473 RDestroyImage(timage
);
475 i
= atoi(PLGetString(PLGetArrayElement(texture
, 2)));
477 RCombineImagesWithOpaqueness(image
, grad
, i
);
480 } else if (strcasecmp(&type
[2], "gradient")==0 && toupper(type
[0])=='M') {
485 switch (toupper(type
[1])) {
487 style
= RVerticalGradient
;
490 style
= RHorizontalGradient
;
494 style
= RDiagonalGradient
;
498 j
= PLGetNumberOfElements(texture
);
501 colors
= wmalloc(j
* sizeof(RColor
*));
503 for (i
= 2; i
< j
; i
++) {
504 str
= PLGetString(PLGetArrayElement(texture
, i
));
505 colors
[i
-2] = wmalloc(sizeof(RColor
));
506 str2rcolor(rc
, str
, colors
[i
-2]);
510 image
= RRenderMultiGradient(width
, height
, colors
, style
);
512 for (i
= 0; colors
[i
]!=NULL
; i
++)
516 } else if (strcasecmp(&type
[1], "pixmap")==0) {
517 RImage
*timage
= NULL
;
521 str
= PLGetString(PLGetArrayElement(texture
, 1));
523 path
= wfindfileinarray(GetObjectForKey("PixmapPath"), str
);
525 timage
= RLoadImage(rc
, path
, 0);
528 wwarning("could not load file '%s': %s", path
? path
: str
,
529 RMessageForError(RErrorCode
));
531 str
= PLGetString(PLGetArrayElement(texture
, 2));
532 str2rcolor(rc
, str
, &color
);
534 switch (toupper(type
[0])) {
536 image
= RMakeTiledImage(timage
, width
, height
);
537 RDestroyImage(timage
);
541 image
= RMakeCenteredImage(timage
, width
, height
, &color
);
542 RDestroyImage(timage
);
547 image
= RScaleImage(timage
, width
, height
);
548 RDestroyImage(timage
);
561 dumpRImage(path
, image
);
565 if (border
== RESIZEBAR_BEVEL
) {
566 drawResizebarBevel(image
);
567 } else if (border
== MENU_BEVEL
) {
568 drawMenuBevel(image
);
569 RBevelImage(image
, RBEV_RAISED2
);
572 RBevelImage(image
, border
);
575 RConvertImage(rc
, image
, &pixmap
);
576 RDestroyImage(image
);
583 renderMenu(_Panel
*panel
, proplist_t texture
, int width
, int iheight
)
585 WMScreen
*scr
= WMWidgetScreen(panel
->win
);
586 Display
*dpy
= WMScreenDisplay(scr
);
588 GC gc
= XCreateGC(dpy
, WMWidgetXID(panel
->win
), 0, NULL
);
591 switch (panel
->menuStyle
) {
593 tmp
= renderTexture(scr
, texture
, width
, iheight
, NULL
, RBEV_RAISED2
);
595 pix
= XCreatePixmap(dpy
, tmp
, width
, iheight
*4, WMScreenDepth(scr
));
596 for (i
= 0; i
< 4; i
++) {
597 XCopyArea(dpy
, tmp
, pix
, gc
, 0, 0, width
, iheight
,
600 XFreePixmap(dpy
, tmp
);
603 pix
= renderTexture(scr
, texture
, width
, iheight
*4, NULL
, MENU_BEVEL
);
606 pix
= renderTexture(scr
, texture
, width
, iheight
*4, NULL
, RBEV_RAISED2
);
616 updatePreviewBox(_Panel
*panel
, int elements
)
618 WMScreen
*scr
= WMWidgetScreen(panel
->win
);
619 Display
*dpy
= WMScreenDisplay(scr
);
620 /* RContext *rc = WMScreenRContext(scr);*/
625 TextureListItem
*titem
;
627 gc
= XCreateGC(dpy
, WMWidgetXID(panel
->win
), 0, NULL
);
630 if (!panel
->preview
) {
633 panel
->preview
= XCreatePixmap(dpy
, WMWidgetXID(panel
->win
),
634 240-4, 215-4, WMScreenDepth(scr
));
636 color
= WMGrayColor(scr
);
637 XFillRectangle(dpy
, panel
->preview
, WMColorGC(color
),
639 WMReleaseColor(color
);
644 if (elements
& FTITLE
) {
645 item
= WMGetListItem(panel
->texLs
, panel
->textureIndex
[0]);
646 titem
= (TextureListItem
*)item
->clientData
;
648 pix
= renderTexture(scr
, titem
->prop
, 190, 20, NULL
, RBEV_RAISED2
);
650 XCopyArea(dpy
, pix
, panel
->preview
, gc
, 0, 0, 210, 20, 30, 10);
652 XFreePixmap(dpy
, pix
);
654 if (elements
& UTITLE
) {
655 item
= WMGetListItem(panel
->texLs
, panel
->textureIndex
[1]);
656 titem
= (TextureListItem
*)item
->clientData
;
658 pix
= renderTexture(scr
, titem
->prop
, 190, 20, NULL
, RBEV_RAISED2
);
660 XCopyArea(dpy
, pix
, panel
->preview
, gc
, 0, 0, 210, 20, 30, 40);
662 XFreePixmap(dpy
, pix
);
664 if (elements
& OTITLE
) {
665 item
= WMGetListItem(panel
->texLs
, panel
->textureIndex
[2]);
666 titem
= (TextureListItem
*)item
->clientData
;
668 pix
= renderTexture(scr
, titem
->prop
, 190, 20, NULL
, RBEV_RAISED2
);
670 XCopyArea(dpy
, pix
, panel
->preview
, gc
, 0, 0, 210, 20, 30, 70);
672 XFreePixmap(dpy
, pix
);
674 if (elements
& RESIZEBAR
) {
675 item
= WMGetListItem(panel
->texLs
, panel
->textureIndex
[3]);
676 titem
= (TextureListItem
*)item
->clientData
;
678 pix
= renderTexture(scr
, titem
->prop
, 190, 9, NULL
, RESIZEBAR_BEVEL
);
680 XCopyArea(dpy
, pix
, panel
->preview
, gc
, 0, 0, 210, 20, 30, 100);
682 XFreePixmap(dpy
, pix
);
684 if (elements
& MTITLE
) {
685 item
= WMGetListItem(panel
->texLs
, panel
->textureIndex
[4]);
686 titem
= (TextureListItem
*)item
->clientData
;
688 pix
= renderTexture(scr
, titem
->prop
, 90, 20, NULL
, RBEV_RAISED2
);
690 XCopyArea(dpy
, pix
, panel
->preview
, gc
, 0, 0, 90, 20, 30, 120);
692 XFreePixmap(dpy
, pix
);
694 if (elements
& MITEM
) {
695 item
= WMGetListItem(panel
->texLs
, panel
->textureIndex
[5]);
696 titem
= (TextureListItem
*)item
->clientData
;
698 pix
= renderMenu(panel
, titem
->prop
, 90, 18);
700 XCopyArea(dpy
, pix
, panel
->preview
, gc
, 0, 0, 90, 18*4, 30, 140);
702 XFreePixmap(dpy
, pix
);
704 if (elements
& (MITEM
|MTITLE
)) {
705 XDrawLine(dpy
, panel
->preview
, gc
, 29, 120, 29, 120+18*4+20);
706 XDrawLine(dpy
, panel
->preview
, gc
, 29, 119, 119, 119);
709 if (elements
& ICON
) {
710 item
= WMGetListItem(panel
->texLs
, panel
->textureIndex
[6]);
711 titem
= (TextureListItem
*)item
->clientData
;
713 pix
= renderTexture(scr
, titem
->prop
, 64, 64, NULL
,
714 titem
->ispixmap
? 0 : RBEV_RAISED3
);
716 XCopyArea(dpy
, pix
, panel
->preview
, gc
, 0, 0, 64, 64, 155, 130);
718 XFreePixmap(dpy
, pix
);
723 p
= WMCreatePixmapFromXPixmaps(scr
, panel
->preview
, None
,
724 240-4, 215-4, WMScreenDepth(scr
));
726 WMSetLabelImage(panel
->prevL
, p
);
729 WMRedisplayWidget(panel
->prevL
);
739 cancelNewTexture(void *data
)
741 _Panel
*panel
= (_Panel
*)data
;
743 HideTexturePanel(panel
->texturePanel
);
750 makeFileName(char *prefix
)
754 fname
= wstrdup(prefix
);
756 while (access(fname
, F_OK
)==0) {
760 sprintf(buf
, "%08lx.cache", time(NULL
));
761 fname
= wstrappend(prefix
, buf
);
771 okNewTexture(void *data
)
773 _Panel
*panel
= (_Panel
*)data
;
778 TextureListItem
*titem
;
779 WMScreen
*scr
= WMWidgetScreen(panel
->win
);
781 titem
= wmalloc(sizeof(TextureListItem
));
782 memset(titem
, 0, sizeof(TextureListItem
));
784 HideTexturePanel(panel
->texturePanel
);
786 name
= GetTexturePanelTextureName(panel
->texturePanel
);
788 prop
= GetTexturePanelTexture(panel
->texturePanel
);
790 str
= PLGetDescription(prop
);
794 titem
->texture
= str
;
795 titem
->selectedFor
= 0;
797 titem
->ispixmap
= isPixmap(prop
);
799 titem
->path
= makeFileName(panel
->fprefix
);
800 titem
->preview
= renderTexture(scr
, prop
, TEXPREV_WIDTH
, TEXPREV_HEIGHT
,
803 item
= WMAddListItem(panel
->texLs
, "");
804 item
->clientData
= titem
;
806 WMSetListPosition(panel
->texLs
, WMGetListNumberOfRows(panel
->texLs
));
811 okEditTexture(void *data
)
813 _Panel
*panel
= (_Panel
*)data
;
818 TextureListItem
*titem
;
820 item
= WMGetListItem(panel
->texLs
, WMGetListSelectedItemRow(panel
->texLs
));
821 titem
= (TextureListItem
*)item
->clientData
;
823 HideTexturePanel(panel
->texturePanel
);
825 if (titem
->current
) {
826 name
= GetTexturePanelTextureName(panel
->texturePanel
);
832 prop
= GetTexturePanelTexture(panel
->texturePanel
);
834 str
= PLGetDescription(prop
);
836 PLRelease(titem
->prop
);
839 titem
->ispixmap
= isPixmap(prop
);
841 free(titem
->texture
);
842 titem
->texture
= str
;
844 XFreePixmap(WMScreenDisplay(WMWidgetScreen(panel
->texLs
)), titem
->preview
);
845 titem
->preview
= renderTexture(WMWidgetScreen(panel
->texLs
), titem
->prop
,
846 TEXPREV_WIDTH
, TEXPREV_HEIGHT
,
849 WMRedisplayWidget(panel
->texLs
);
851 if (titem
->selectedFor
)
852 updatePreviewBox(panel
, titem
->selectedFor
);
854 changePage(panel
->secP
, panel
);
860 editTexture(WMWidget
*w
, void *data
)
862 _Panel
*panel
= (_Panel
*)data
;
864 TextureListItem
*titem
;
866 item
= WMGetListItem(panel
->texLs
, WMGetListSelectedItemRow(panel
->texLs
));
867 titem
= (TextureListItem
*)item
->clientData
;
869 SetTexturePanelPixmapPath(panel
->texturePanel
,
870 GetObjectForKey("PixmapPath"));
872 SetTexturePanelTexture(panel
->texturePanel
, titem
->title
, titem
->prop
);
874 SetTexturePanelCancelAction(panel
->texturePanel
, cancelNewTexture
, panel
);
875 SetTexturePanelOkAction(panel
->texturePanel
, okEditTexture
, panel
);
877 ShowTexturePanel(panel
->texturePanel
);
883 newTexture(WMWidget
*w
, void *data
)
885 _Panel
*panel
= (_Panel
*)data
;
887 SetTexturePanelPixmapPath(panel
->texturePanel
,
888 GetObjectForKey("PixmapPath"));
890 SetTexturePanelTexture(panel
->texturePanel
, "New Texture", NULL
);
892 SetTexturePanelCancelAction(panel
->texturePanel
, cancelNewTexture
, panel
);
894 SetTexturePanelOkAction(panel
->texturePanel
, okNewTexture
, panel
);
896 ShowTexturePanel(panel
->texturePanel
);
902 deleteTexture(WMWidget
*w
, void *data
)
904 _Panel
*panel
= (_Panel
*)data
;
906 TextureListItem
*titem
;
910 section
= WMGetPopUpButtonSelectedItem(panel
->secP
);
911 row
= WMGetListSelectedItemRow(panel
->texLs
);
912 item
= WMGetListItem(panel
->texLs
, row
);
913 titem
= (TextureListItem
*)item
->clientData
;
915 if (titem
->selectedFor
& (1 << section
)) {
916 TextureListItem
*titem2
;
918 panel
->textureIndex
[section
] = section
;
919 item
= WMGetListItem(panel
->texLs
, section
);
920 titem2
= (TextureListItem
*)item
->clientData
;
921 titem2
->selectedFor
|= 1 << section
;
925 free(titem
->texture
);
926 PLRelease(titem
->prop
);
928 if (remove(titem
->path
) < 0 && errno
!= ENOENT
) {
929 wsyserror("could not remove file %s", titem
->path
);
936 WMRemoveListItem(panel
->texLs
, row
);
937 WMSetButtonEnabled(panel
->delB
, False
);
944 extractTexture(WMWidget
*w
, void *data
)
946 _Panel
*panel
= (_Panel
*)data
;
949 WMScreen
*scr
= WMWidgetScreen(w
);
951 opanel
= WMGetOpenPanel(scr
);
952 WMSetFilePanelCanChooseDirectories(opanel
, False
);
953 WMSetFilePanelCanChooseFiles(opanel
, True
);
955 if (WMRunModalFilePanelForDirectory(opanel
, panel
->win
, wgethomedir(),
956 _("Select File"), NULL
)) {
957 path
= WMGetFilePanelFileName(opanel
);
959 OpenExtractPanelFor(panel
, path
);
967 changePage(WMWidget
*w
, void *data
)
969 _Panel
*panel
= (_Panel
*)data
;
972 TextureListItem
*titem
;
973 WMScreen
*scr
= WMWidgetScreen(w
);
974 RContext
*rc
= WMScreenRContext(scr
);
975 static WMPoint positions
[] = {
985 section
= WMGetPopUpButtonSelectedItem(panel
->secP
);
987 WMSelectListItem(panel
->texLs
, panel
->textureIndex
[section
]);
989 WMSetListPosition(panel
->texLs
, panel
->textureIndex
[section
] - 2);
991 item
= WMGetListItem(panel
->texLs
, panel
->textureIndex
[section
]);
993 titem
= (TextureListItem
*)item
->clientData
;
998 color
= WMGrayColor(scr
);
999 XFillRectangle(rc
->dpy
, panel
->preview
, WMColorGC(color
),
1000 positions
[panel
->oldsection
].x
,
1001 positions
[panel
->oldsection
].y
, 22, 22);
1002 WMReleaseColor(color
);
1004 panel
->oldsection
= section
;
1005 WMDrawPixmap(panel
->hand
, panel
->preview
, positions
[section
].x
,
1006 positions
[section
].y
);
1008 WMRedisplayWidget(panel
->prevL
);
1014 previewClick(XEvent
*event
, void *clientData
)
1016 _Panel
*panel
= (_Panel
*)clientData
;
1018 static WMRect parts
[] = {
1019 {{30,10},{190, 20}},
1024 {{30,140},{90,18*4}},
1028 for (i
= 0; i
< 7; i
++) {
1029 if (event
->xbutton
.x
>= parts
[i
].pos
.x
1030 && event
->xbutton
.y
>= parts
[i
].pos
.y
1031 && event
->xbutton
.x
< parts
[i
].pos
.x
+ parts
[i
].size
.width
1032 && event
->xbutton
.y
< parts
[i
].pos
.y
+ parts
[i
].size
.height
) {
1034 WMSetPopUpButtonSelectedItem(panel
->secP
, i
);
1035 changePage(panel
->secP
, panel
);
1043 textureClick(WMWidget
*w
, void *data
)
1045 _Panel
*panel
= (_Panel
*)data
;
1048 TextureListItem
*titem
;
1050 i
= WMGetListSelectedItemRow(panel
->texLs
);
1052 item
= WMGetListItem(panel
->texLs
, i
);
1054 titem
= (TextureListItem
*)item
->clientData
;
1056 if (titem
->current
) {
1057 WMSetButtonEnabled(panel
->delB
, False
);
1059 WMSetButtonEnabled(panel
->delB
, True
);
1066 textureDoubleClick(WMWidget
*w
, void *data
)
1068 _Panel
*panel
= (_Panel
*)data
;
1071 TextureListItem
*titem
;
1073 /* unselect old texture */
1074 section
= WMGetPopUpButtonSelectedItem(panel
->secP
);
1076 item
= WMGetListItem(panel
->texLs
, panel
->textureIndex
[section
]);
1077 titem
= (TextureListItem
*)item
->clientData
;
1078 titem
->selectedFor
&= ~(1 << section
);
1080 /* select new texture */
1081 i
= WMGetListSelectedItemRow(panel
->texLs
);
1083 item
= WMGetListItem(panel
->texLs
, i
);
1085 titem
= (TextureListItem
*)item
->clientData
;
1087 titem
->selectedFor
|= 1<<section
;
1089 panel
->textureIndex
[section
] = i
;
1091 WMRedisplayWidget(panel
->texLs
);
1093 updatePreviewBox(panel
, 1<<section
);
1100 paintListItem(WMList
*lPtr
, int index
, Drawable d
, char *text
, int state
,
1103 _Panel
*panel
= (_Panel
*)WMGetHangedData(lPtr
);
1104 WMScreen
*scr
= WMWidgetScreen(lPtr
);
1105 int width
, height
, x
, y
;
1106 Display
*dpy
= WMScreenDisplay(scr
);
1107 WMColor
*white
= WMWhiteColor(scr
);
1109 WMColor
*black
= WMBlackColor(scr
);
1110 TextureListItem
*titem
;
1112 width
= rect
->size
.width
;
1113 height
= rect
->size
.height
;
1117 if (state
& WLDSSelected
)
1118 XFillRectangle(dpy
, d
, WMColorGC(white
), x
, y
, width
, height
);
1120 XClearArea(dpy
, d
, x
, y
, width
, height
, False
);
1122 item
= WMGetListItem(lPtr
, index
);
1123 titem
= (TextureListItem
*)item
->clientData
;
1126 XCopyArea(dpy
, titem
->preview
, d
, WMColorGC(black
), 0, 0, TEXPREV_WIDTH
,
1127 TEXPREV_HEIGHT
, x
+ 5, y
+ 5);
1129 if ((1 << WMGetPopUpButtonSelectedItem(panel
->secP
)) & titem
->selectedFor
)
1130 WMDrawPixmap(panel
->onLed
, d
, x
+ TEXPREV_WIDTH
+ 10, y
+ 6);
1131 else if (titem
->selectedFor
)
1132 WMDrawPixmap(panel
->offLed
, d
, x
+ TEXPREV_WIDTH
+ 10, y
+ 6);
1134 WMDrawString(scr
, d
, WMColorGC(black
), panel
->boldFont
,
1135 x
+ TEXPREV_WIDTH
+ 22, y
+ 2, titem
->title
,
1136 strlen(titem
->title
));
1138 WMDrawString(scr
, d
, WMColorGC(black
), panel
->smallFont
,
1139 x
+ TEXPREV_WIDTH
+ 14, y
+ 18, titem
->texture
,
1140 strlen(titem
->texture
));
1143 WMReleaseColor(white
);
1144 WMReleaseColor(black
);
1150 loadRImage(WMScreen
*scr
, char *path
)
1158 f
= fopen(path
, "r");
1162 fscanf(f
, "%02x%02x%1x", &w
, &h
, &d
);
1164 image
= RCreateImage(w
, h
, d
== 4);
1165 for (i
= 0; i
< d
; i
++) {
1166 fread(image
->data
[i
], 1, w
*h
, f
);
1170 RConvertImage(WMScreenRContext(scr
), image
, &pixmap
);
1171 RDestroyImage(image
);
1179 fillTextureList(WMList
*lPtr
)
1181 proplist_t textureList
;
1183 WMUserDefaults
*udb
= WMGetStandardUserDefaults();
1185 TextureListItem
*titem
;
1186 WMScreen
*scr
= WMWidgetScreen(lPtr
);
1188 textureList
= WMGetUDObjectForKey(udb
, "TextureList");
1192 for (i
= 0; i
< PLGetNumberOfElements(textureList
); i
++) {
1195 texture
= PLGetArrayElement(textureList
, i
);
1197 titem
= wmalloc(sizeof(TextureListItem
));
1198 memset(titem
, 0, sizeof(TextureListItem
));
1200 titem
->title
= wstrdup(PLGetString(PLGetArrayElement(texture
, 0)));
1201 titem
->prop
= PLRetain(PLGetArrayElement(texture
, 1));
1202 titem
->texture
= PLGetDescription(titem
->prop
);
1203 titem
->selectedFor
= 0;
1204 titem
->path
= wstrdup(PLGetString(PLGetArrayElement(texture
, 2)));
1206 titem
->preview
= loadRImage(scr
, titem
->path
);
1207 if (!titem
->preview
) {
1208 titem
->preview
= renderTexture(scr
, titem
->prop
, TEXPREV_WIDTH
,
1209 TEXPREV_HEIGHT
, NULL
, 0);
1211 item
= WMAddListItem(lPtr
, "");
1212 item
->clientData
= titem
;
1218 menuStyleCallback(WMWidget
*self
, void *data
)
1220 _Panel
*panel
= (_Panel
*)data
;
1222 if (self
== panel
->mstyB
[0]) {
1223 panel
->menuStyle
= MSTYLE_NORMAL
;
1224 updatePreviewBox(panel
, MITEM
);
1226 } else if (self
== panel
->mstyB
[1]) {
1227 panel
->menuStyle
= MSTYLE_SINGLE
;
1228 updatePreviewBox(panel
, MITEM
);
1230 } else if (self
== panel
->mstyB
[2]) {
1231 panel
->menuStyle
= MSTYLE_FLAT
;
1232 updatePreviewBox(panel
, MITEM
);
1238 createPanel(Panel
*p
)
1240 _Panel
*panel
= (_Panel
*)p
;
1242 WMScreen
*scr
= WMWidgetScreen(panel
->win
);
1243 WMTabViewItem
*item
;
1248 panel
->fprefix
= wstrappend(wusergnusteppath(), "/.AppInfo");
1250 if (access(panel
->fprefix
, F_OK
)!=0) {
1251 if (mkdir(panel
->fprefix
, 0755) < 0) {
1252 wsyserror(panel
->fprefix
);
1257 tmp
= wstrappend(panel
->fprefix
, "/WPrefs/");
1258 free(panel
->fprefix
);
1259 panel
->fprefix
= tmp
;
1260 if (access(panel
->fprefix
, F_OK
)!=0) {
1261 if (mkdir(panel
->fprefix
, 0755) < 0) {
1262 wsyserror(panel
->fprefix
);
1267 panel
->smallFont
= WMSystemFontOfSize(scr
, 10);
1268 panel
->normalFont
= WMSystemFontOfSize(scr
, 12);
1269 panel
->boldFont
= WMBoldSystemFontOfSize(scr
, 12);
1271 panel
->onLed
= WMCreatePixmapFromXPMData(scr
, blueled_xpm
);
1272 panel
->offLed
= WMCreatePixmapFromXPMData(scr
, blueled2_xpm
);
1273 panel
->hand
= WMCreatePixmapFromXPMData(scr
, hand_xpm
);
1275 panel
->frame
= WMCreateFrame(panel
->win
);
1276 WMResizeWidget(panel
->frame
, FRAME_WIDTH
, FRAME_HEIGHT
);
1277 WMMoveWidget(panel
->frame
, FRAME_LEFT
, FRAME_TOP
);
1280 panel
->prevL
= WMCreateLabel(panel
->frame
);
1281 WMResizeWidget(panel
->prevL
, 240, FRAME_HEIGHT
- 20);
1282 WMMoveWidget(panel
->prevL
, 15, 10);
1283 WMSetLabelRelief(panel
->prevL
, WRSunken
);
1284 WMSetLabelImagePosition(panel
->prevL
, WIPImageOnly
);
1286 WMCreateEventHandler(WMWidgetView(panel
->prevL
), ButtonPressMask
,
1287 previewClick
, panel
);
1292 panel
->tabv
= WMCreateTabView(panel
->frame
);
1293 WMResizeWidget(panel
->tabv
, 245, FRAME_HEIGHT
- 20);
1294 WMMoveWidget(panel
->tabv
, 265, 10);
1296 /*** texture list ***/
1298 panel
->texF
= WMCreateFrame(panel
->frame
);
1299 WMSetFrameRelief(panel
->texF
, WRFlat
);
1301 item
= WMCreateTabViewItemWithIdentifier(0);
1302 WMSetTabViewItemView(item
, WMWidgetView(panel
->texF
));
1303 WMSetTabViewItemLabel(item
, _("Texture"));
1305 WMAddItemInTabView(panel
->tabv
, item
);
1308 panel
->secP
= WMCreatePopUpButton(panel
->texF
);
1309 WMResizeWidget(panel
->secP
, 228, 20);
1310 WMMoveWidget(panel
->secP
, 7, 7);
1311 WMSetPopUpButtonSelectedItem(panel
->secP
, 0);
1312 WMAddPopUpButtonItem(panel
->secP
, _("Titlebar of Focused Window"));
1313 WMAddPopUpButtonItem(panel
->secP
, _("Titlebar of Unfocused Windows"));
1314 WMAddPopUpButtonItem(panel
->secP
, _("Titlebar of Focused Window's Owner"));
1315 WMAddPopUpButtonItem(panel
->secP
, _("Window Resizebar"));
1316 WMAddPopUpButtonItem(panel
->secP
, _("Titlebar of Menus"));
1317 WMAddPopUpButtonItem(panel
->secP
, _("Menu Items"));
1318 WMAddPopUpButtonItem(panel
->secP
, _("Icon Background"));
1319 /* WMAddPopUpButtonItem(panel->secP, _("Workspace Backgrounds"));
1321 WMSetPopUpButtonAction(panel
->secP
, changePage
, panel
);
1323 panel
->texLs
= WMCreateList(panel
->texF
);
1324 WMResizeWidget(panel
->texLs
, 165, 155);
1325 WMMoveWidget(panel
->texLs
, 70, 33);
1326 WMSetListUserDrawItemHeight(panel
->texLs
, 35);
1327 WMSetListUserDrawProc(panel
->texLs
, paintListItem
);
1328 WMHangData(panel
->texLs
, panel
);
1329 WMSetListAction(panel
->texLs
, textureClick
, panel
);
1330 WMSetListDoubleAction(panel
->texLs
, textureDoubleClick
, panel
);
1332 WMSetBalloonTextForView(_("Double click in the texture you want to use\n"
1333 "for the selected item."),
1334 WMWidgetView(panel
->texLs
));
1336 /* command buttons */
1338 font
= WMSystemFontOfSize(scr
, 10);
1341 panel
->newB
= WMCreateCommandButton(panel
->texF
);
1342 WMResizeWidget(panel
->newB
, 57, 39);
1343 WMMoveWidget(panel
->newB
, 7, 33);
1344 WMSetButtonFont(panel
->newB
, font
);
1345 WMSetButtonImagePosition(panel
->newB
, WIPAbove
);
1346 WMSetButtonText(panel
->newB
, _("New"));
1347 WMSetButtonAction(panel
->newB
, newTexture
, panel
);
1348 SetButtonAlphaImage(scr
, panel
->newB
, TNEW_FILE
);
1350 WMSetBalloonTextForView(_("Create a new texture."),
1351 WMWidgetView(panel
->newB
));
1353 panel
->ripB
= WMCreateCommandButton(panel
->texF
);
1354 WMResizeWidget(panel
->ripB
, 57, 39);
1355 WMMoveWidget(panel
->ripB
, 7, 72);
1356 WMSetButtonFont(panel
->ripB
, font
);
1357 WMSetButtonImagePosition(panel
->ripB
, WIPAbove
);
1358 WMSetButtonText(panel
->ripB
, _("Extract..."));
1359 WMSetButtonAction(panel
->ripB
, extractTexture
, panel
);
1360 SetButtonAlphaImage(scr
, panel
->ripB
, TEXTR_FILE
);
1362 WMSetBalloonTextForView(_("Extract texture(s) from a theme or a style file."),
1363 WMWidgetView(panel
->ripB
));
1365 WMSetButtonEnabled(panel
->ripB
, False
);
1367 panel
->editB
= WMCreateCommandButton(panel
->texF
);
1368 WMResizeWidget(panel
->editB
, 57, 39);
1369 WMMoveWidget(panel
->editB
, 7, 111);
1370 WMSetButtonFont(panel
->editB
, font
);
1371 WMSetButtonImagePosition(panel
->editB
, WIPAbove
);
1372 WMSetButtonText(panel
->editB
, _("Edit"));
1373 SetButtonAlphaImage(scr
, panel
->editB
, TEDIT_FILE
);
1374 WMSetButtonAction(panel
->editB
, editTexture
, panel
);
1375 WMSetBalloonTextForView(_("Edit the highlighted texture."),
1376 WMWidgetView(panel
->editB
));
1378 panel
->delB
= WMCreateCommandButton(panel
->texF
);
1379 WMResizeWidget(panel
->delB
, 57, 38);
1380 WMMoveWidget(panel
->delB
, 7, 150);
1381 WMSetButtonFont(panel
->delB
, font
);
1382 WMSetButtonImagePosition(panel
->delB
, WIPAbove
);
1383 WMSetButtonText(panel
->delB
, _("Delete"));
1384 SetButtonAlphaImage(scr
, panel
->delB
, TDEL_FILE
);
1385 WMSetButtonEnabled(panel
->delB
, False
);
1386 WMSetButtonAction(panel
->delB
, deleteTexture
, panel
);
1387 WMSetBalloonTextForView(_("Delete the highlighted texture."),
1388 WMWidgetView(panel
->delB
));
1390 WMReleaseFont(font
);
1392 WMMapSubwidgets(panel
->texF
);
1395 panel
->colF
= WMCreateFrame(panel
->frame
);
1396 WMSetFrameRelief(panel
->colF
, WRFlat
);
1398 item
= WMCreateTabViewItemWithIdentifier(1);
1399 WMSetTabViewItemView(item
, WMWidgetView(panel
->colF
));
1400 WMSetTabViewItemLabel(item
, _("Color"));
1402 WMAddItemInTabView(panel
->tabv
, item
);
1405 panel
->colP
= WMCreatePopUpButton(panel
->colF
);
1406 WMResizeWidget(panel
->colP
, 228, 20);
1407 WMMoveWidget(panel
->colP
, 7, 7);
1408 WMSetPopUpButtonSelectedItem(panel
->colP
, 0);
1409 WMAddPopUpButtonItem(panel
->colP
, _("Focused Window Title"));
1410 WMAddPopUpButtonItem(panel
->colP
, _("Unfocused Window Title"));
1412 /* WMSetPopUpButtonAction(panel->colP, changePage, panel);
1415 panel
->colW
= WMCreateColorWell(panel
->colF
);
1416 WMResizeWidget(panel
->colW
, 65, 50);
1417 WMMoveWidget(panel
->colW
, 40, 75);
1419 for (i
= 0; i
< 3; i
++) {
1421 for (j
= 0; j
< 5; j
++) {
1422 panel
->sampW
[i
] = WMCreateColorWell(panel
->colF
);
1423 WMResizeWidget(panel
->sampW
[i
], 28, 28);
1424 WMMoveWidget(panel
->sampW
[i
], 140 + i
*28, 40 + j
*28);
1425 WSetColorWellBordered(panel
->sampW
[i
], False
);
1429 WMMapSubwidgets(panel
->colF
);
1432 panel
->optF
= WMCreateFrame(panel
->frame
);
1433 WMSetFrameRelief(panel
->optF
, WRFlat
);
1435 item
= WMCreateTabViewItemWithIdentifier(2);
1436 WMSetTabViewItemView(item
, WMWidgetView(panel
->optF
));
1437 WMSetTabViewItemLabel(item
, _("Options"));
1439 WMAddItemInTabView(panel
->tabv
, item
);
1441 panel
->mstyF
= WMCreateFrame(panel
->optF
);
1442 WMResizeWidget(panel
->mstyF
, 215, 85);
1443 WMMoveWidget(panel
->mstyF
, 15, 10);
1444 WMSetFrameTitle(panel
->mstyF
, _("Menu Style"));
1446 for (i
= 0; i
< 3; i
++) {
1450 panel
->mstyB
[i
] = WMCreateButton(panel
->mstyF
, WBTOnOff
);
1451 WMResizeWidget(panel
->mstyB
[i
], 54, 54);
1452 WMMoveWidget(panel
->mstyB
[i
], 15 + i
*65, 20);
1453 WMSetButtonImagePosition(panel
->mstyB
[i
], WIPImageOnly
);
1454 WMSetButtonAction(panel
->mstyB
[i
], menuStyleCallback
, panel
);
1457 path
= LocateImage(MSTYLE1_FILE
);
1460 path
= LocateImage(MSTYLE2_FILE
);
1463 path
= LocateImage(MSTYLE3_FILE
);
1467 icon
= WMCreatePixmapFromFile(scr
, path
);
1469 WMSetButtonImage(panel
->mstyB
[i
], icon
);
1470 WMReleasePixmap(icon
);
1472 wwarning(_("could not load icon file %s"), path
);
1477 WMGroupButtons(panel
->mstyB
[0], panel
->mstyB
[1]);
1478 WMGroupButtons(panel
->mstyB
[0], panel
->mstyB
[2]);
1480 WMMapSubwidgets(panel
->mstyF
);
1482 WMMapSubwidgets(panel
->optF
);
1486 WMRealizeWidget(panel
->frame
);
1487 WMMapSubwidgets(panel
->frame
);
1489 WMSetPopUpButtonSelectedItem(panel
->secP
, 0);
1493 changePage(panel
->secP
, panel
);
1495 fillTextureList(panel
->texLs
);
1497 panel
->texturePanel
= CreateTexturePanel(panel
->win
);
1503 setupTextureFor(WMList
*list
, char *key
, char *defValue
, char *title
,
1507 TextureListItem
*titem
;
1509 titem
= wmalloc(sizeof(TextureListItem
));
1510 memset(titem
, 0, sizeof(TextureListItem
));
1512 titem
->title
= wstrdup(title
);
1513 titem
->prop
= GetObjectForKey(key
);
1515 titem
->prop
= PLGetProplistWithDescription(defValue
);
1517 PLRetain(titem
->prop
);
1519 titem
->texture
= PLGetDescription((proplist_t
)titem
->prop
);
1521 titem
->selectedFor
= 1<<index
;
1523 titem
->ispixmap
= isPixmap(titem
->prop
);
1525 titem
->preview
= renderTexture(WMWidgetScreen(list
), titem
->prop
,
1526 TEXPREV_WIDTH
, TEXPREV_HEIGHT
, NULL
, 0);
1528 item
= WMAddListItem(list
, "");
1529 item
->clientData
= titem
;
1535 showData(_Panel
*panel
)
1540 str
= GetStringForKey("MenuStyle");
1541 if (str
&& strcasecmp(str
, "flat")==0) {
1542 panel
->menuStyle
= MSTYLE_FLAT
;
1543 } else if (str
&& strcasecmp(str
, "singletexture")==0) {
1544 panel
->menuStyle
= MSTYLE_SINGLE
;
1546 panel
->menuStyle
= MSTYLE_NORMAL
;
1549 setupTextureFor(panel
->texLs
, "FTitleBack", "(solid, black)",
1551 panel
->textureIndex
[i
] = i
++;
1553 setupTextureFor(panel
->texLs
, "UTitleBack", "(solid, gray)",
1555 panel
->textureIndex
[i
] = i
++;
1557 setupTextureFor(panel
->texLs
, "PTitleBack", "(solid, \"#616161\")",
1558 "[Owner of Focused]", i
);
1559 panel
->textureIndex
[i
] = i
++;
1561 setupTextureFor(panel
->texLs
, "ResizebarBack", "(solid, gray)",
1563 panel
->textureIndex
[i
] = i
++;
1565 setupTextureFor(panel
->texLs
, "MenuTitleBack", "(solid, black)",
1567 panel
->textureIndex
[i
] = i
++;
1569 setupTextureFor(panel
->texLs
, "MenuTextBack", "(solid, gray)",
1571 panel
->textureIndex
[i
] = i
++;
1573 setupTextureFor(panel
->texLs
, "IconBack", "(solid, gray)", "[Icon]", i
);
1574 panel
->textureIndex
[i
] = i
++;
1576 setupTextureFor(panel->texLs, "WorkspaceBack", "(solid, black)",
1578 panel->textureIndex[i] = i++;
1581 updatePreviewBox(panel
, EVERYTHING
);
1583 for (i
= 0; i
< 3; i
++) {
1584 WMSetButtonSelected(panel
->mstyB
[i
], i
==panel
->menuStyle
);
1591 storeData(_Panel
*panel
)
1593 TextureListItem
*titem
;
1596 item
= WMGetListItem(panel
->texLs
, panel
->textureIndex
[0]);
1597 titem
= (TextureListItem
*)item
->clientData
;
1598 SetObjectForKey(titem
->prop
, "FTitleBack");
1600 item
= WMGetListItem(panel
->texLs
, panel
->textureIndex
[1]);
1601 titem
= (TextureListItem
*)item
->clientData
;
1602 SetObjectForKey(titem
->prop
, "UTitleBack");
1604 item
= WMGetListItem(panel
->texLs
, panel
->textureIndex
[2]);
1605 titem
= (TextureListItem
*)item
->clientData
;
1606 SetObjectForKey(titem
->prop
, "PTitleBack");
1608 item
= WMGetListItem(panel
->texLs
, panel
->textureIndex
[3]);
1609 titem
= (TextureListItem
*)item
->clientData
;
1610 SetObjectForKey(titem
->prop
, "ResizebarBack");
1612 item
= WMGetListItem(panel
->texLs
, panel
->textureIndex
[4]);
1613 titem
= (TextureListItem
*)item
->clientData
;
1614 SetObjectForKey(titem
->prop
, "MenuTitleBack");
1616 item
= WMGetListItem(panel
->texLs
, panel
->textureIndex
[5]);
1617 titem
= (TextureListItem
*)item
->clientData
;
1618 SetObjectForKey(titem
->prop
, "MenuTextBack");
1620 item
= WMGetListItem(panel
->texLs
, panel
->textureIndex
[6]);
1621 titem
= (TextureListItem
*)item
->clientData
;
1622 SetObjectForKey(titem
->prop
, "IconBack");
1624 switch (panel
->menuStyle
) {
1626 SetStringForKey("singletexture", "MenuStyle");
1629 SetStringForKey("flat", "MenuStyle");
1633 SetStringForKey("normal", "MenuStyle");
1640 prepareForClose(_Panel
*panel
)
1642 proplist_t textureList
;
1645 TextureListItem
*titem
;
1647 WMUserDefaults
*udb
= WMGetStandardUserDefaults();
1649 textureList
= PLMakeArrayFromElements(NULL
, NULL
);
1651 /* store list of textures */
1652 for (i
= 7; i
< WMGetListNumberOfRows(panel
->texLs
); i
++) {
1653 item
= WMGetListItem(panel
->texLs
, i
);
1654 titem
= (TextureListItem
*)item
->clientData
;
1656 texture
= PLMakeArrayFromElements(PLMakeString(titem
->title
),
1657 PLRetain(titem
->prop
),
1658 PLMakeString(titem
->path
),
1661 PLAppendArrayElement(textureList
, texture
);
1664 WMSetUDObjectForKey(udb
, textureList
, "TextureList");
1665 PLRelease(textureList
);
1667 WMSynchronizeUserDefaults(udb
);
1673 InitAppearance(WMScreen
*scr
, WMWindow
*win
)
1677 panel
= wmalloc(sizeof(_Panel
));
1678 memset(panel
, 0, sizeof(_Panel
));
1680 panel
->sectionName
= _("Appearance Preferences");
1682 panel
->description
= _("Background texture configuration for windows,\n"
1683 "menus and icons.");
1687 panel
->callbacks
.createWidgets
= createPanel
;
1688 panel
->callbacks
.updateDomain
= storeData
;
1689 panel
->callbacks
.prepareForClose
= prepareForClose
;
1691 AddSection(panel
, ICON_FILE
);
1698 /****************************************************************************/
1702 typedef struct ExtractPanel
{
1715 OpenExtractPanelFor(_Panel
*panel
, char *path
)
1717 ExtractPanel
*epanel
;
1720 WMScreen
*scr
= WMWidgetScreen(panel
->win
);
1722 epanel
= wmalloc(sizeof(ExtractPanel
));
1723 epanel
->win
= WMCreatePanelWithStyleForWindow(panel
->win
, "extract",
1725 |WMClosableWindowMask
);
1726 WMResizeWidget(epanel
->win
, 245, 250);
1727 WMSetWindowTitle(epanel
->win
, _("Extract Texture"));
1729 epanel
->label
= WMCreateLabel(epanel
->win
);
1730 WMResizeWidget(epanel
->label
, 225, 18);
1731 WMMoveWidget(epanel
->label
, 10, 10);
1732 WMSetLabelTextAlignment(epanel
->label
, WACenter
);
1733 WMSetLabelRelief(epanel
->label
, WRSunken
);
1735 color
= WMDarkGrayColor(scr
);
1736 WMSetWidgetBackgroundColor(epanel
->label
, color
);
1737 WMReleaseColor(color
);
1739 color
= WMWhiteColor(scr
);
1740 WMSetLabelTextColor(epanel
->label
, color
);
1741 WMReleaseColor(color
);
1743 font
= WMBoldSystemFontOfSize(scr
, 12);
1744 WMSetLabelFont(epanel
->label
, font
);
1745 WMReleaseFont(font
);
1747 WMSetLabelText(epanel
->label
, _("Textures"));
1749 epanel
->list
= WMCreateList(epanel
->win
);
1750 WMResizeWidget(epanel
->list
, 225, 165);
1751 WMMoveWidget(epanel
->list
, 10, 30);
1755 epanel
->closeB
= WMCreateCommandButton(epanel
->win
);
1756 WMResizeWidget(epanel
->closeB
, 74, 24);
1757 WMMoveWidget(epanel
->closeB
, 165, 215);
1758 WMSetButtonText(epanel
->closeB
, _("Close"));
1760 epanel
->extrB
= WMCreateCommandButton(epanel
->win
);
1761 WMResizeWidget(epanel
->extrB
, 74, 24);
1762 WMMoveWidget(epanel
->extrB
, 80, 215);
1763 WMSetButtonText(epanel
->extrB
, _("Extract"));
1765 WMMapSubwidgets(epanel
->win
);
1768 /* take textures from file */
1772 WMRealizeWidget(epanel
->win
);
1774 WMMapWidget(epanel
->win
);