1 /* dialog.c - dialog windows for internal use
3 * Window Maker window manager
5 * Copyright (c) 1997, 1998 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,
26 #include <X11/Xutil.h>
27 #include <X11/keysym.h>
33 #include <sys/types.h>
39 #define PATH_MAX DEFAULT_PATH_MAX
42 #include "WindowMaker.h"
54 extern WPreferences wPreferences
;
59 wMessageDialog(WScreen
*scr
, char *title
, char *message
,
60 char *defBtn
, char *altBtn
, char *othBtn
)
67 panel
= WMCreateAlertPanel(scr
->wmscreen
, NULL
, title
, message
,
68 defBtn
, altBtn
, othBtn
);
70 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 400, 180, 0, 0, 0);
72 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
74 wwin
= wManageInternalWindow(scr
, parent
, None
, NULL
,
75 (scr
->scr_width
- 400)/2,
76 (scr
->scr_height
- 180)/2, 400, 180);
77 wwin
->client_leader
= WMWidgetXID(panel
->win
);
79 WMMapWidget(panel
->win
);
83 while (!panel
->done
) {
86 WMNextEvent(dpy
, &event
);
87 WMHandleEvent(&event
);
90 result
= panel
->result
;
92 WMUnmapWidget(panel
->win
);
94 wUnmanageWindow(wwin
, False
);
96 WMDestroyAlertPanel(panel
);
98 XDestroyWindow(dpy
, parent
);
106 wInputDialog(WScreen
*scr
, char *title
, char *message
, char **text
)
114 panel
= WMCreateInputPanel(scr
->wmscreen
, NULL
, title
, message
, *text
,
115 _("OK"), _("Cancel"));
118 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 320, 160, 0, 0, 0);
119 XSelectInput(dpy
, parent
, KeyPressMask
|KeyReleaseMask
);
121 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
123 wwin
= wManageInternalWindow(scr
, parent
, None
, NULL
,
124 (scr
->scr_width
- 320)/2,
125 (scr
->scr_height
- 160)/2, 320, 160);
127 wwin
->client_leader
= WMWidgetXID(panel
->win
);
129 WMMapWidget(panel
->win
);
133 while (!panel
->done
) {
136 WMNextEvent(dpy
, &event
);
137 WMHandleEvent(&event
);
140 if (panel
->result
== WAPRDefault
)
141 result
= WMGetTextFieldText(panel
->text
);
145 wUnmanageWindow(wwin
, False
);
147 WMDestroyInputPanel(panel
);
149 XDestroyWindow(dpy
, parent
);
164 *****************************************************************
165 * Icon Selection Panel
166 *****************************************************************
169 typedef struct IconPanel
{
184 WMTextField
*fileField
;
187 WMButton
*cancelButton
;
189 WMButton
*chooseButton
;
198 listPixmaps(WScreen
*scr
, WMList
*lPtr
, char *path
)
200 struct dirent
*dentry
;
202 char pbuf
[PATH_MAX
+16];
205 apath
= wexpandpath(path
);
206 dir
= opendir(apath
);
211 tmp
= _("Could not open directory ");
212 msg
= wmalloc(strlen(tmp
)+strlen(path
)+6);
216 wMessageDialog(scr
, _("Error"), msg
, _("OK"), NULL
, NULL
);
222 /* list contents in the column */
223 while ((dentry
= readdir(dir
))) {
226 if (strcmp(dentry
->d_name
, ".")==0 ||
227 strcmp(dentry
->d_name
, "..")==0)
232 strcat(pbuf
, dentry
->d_name
);
234 if (stat(pbuf
, &statb
)<0)
237 if (statb
.st_mode
& (S_IRUSR
|S_IRGRP
|S_IROTH
)
238 && statb
.st_mode
& (S_IFREG
|S_IFLNK
)) {
239 WMAddSortedListItem(lPtr
, dentry
->d_name
);
250 setViewedImage(IconPanel
*panel
, char *file
)
259 pixmap
= WMCreateBlendedPixmapFromFile(WMWidgetScreen(panel
->win
),
265 WMSetButtonEnabled(panel
->okButton
, False
);
267 tmp
= _("Could not load image file ");
268 msg
= wmalloc(strlen(tmp
)+strlen(file
)+6);
272 wMessageDialog(panel
->scr
, _("Error"), msg
, _("OK"), NULL
, NULL
);
275 WMSetLabelImage(panel
->iconView
, NULL
);
277 WMSetButtonEnabled(panel
->okButton
, True
);
279 WMSetLabelImage(panel
->iconView
, pixmap
);
280 WMReleasePixmap(pixmap
);
286 listCallback(void *self
, void *data
)
288 WMList
*lPtr
= (WMList
*)self
;
289 IconPanel
*panel
= (IconPanel
*)data
;
292 if (lPtr
==panel
->dirList
) {
293 path
= WMGetListSelectedItem(lPtr
)->text
;
295 WMSetTextFieldText(panel
->fileField
, path
);
297 WMSetLabelImage(panel
->iconView
, NULL
);
299 WMSetButtonEnabled(panel
->okButton
, False
);
301 WMClearList(panel
->iconList
);
302 listPixmaps(panel
->scr
, panel
->iconList
, path
);
304 char *tmp
, *iconFile
;
306 path
= WMGetListSelectedItem(panel
->dirList
)->text
;
307 tmp
= wexpandpath(path
);
309 iconFile
= WMGetListSelectedItem(panel
->iconList
)->text
;
311 path
= wmalloc(strlen(tmp
)+strlen(iconFile
)+4);
314 strcat(path
, iconFile
);
316 WMSetTextFieldText(panel
->fileField
, path
);
317 setViewedImage(panel
, path
);
324 listIconPaths(WMList
*lPtr
)
329 paths
= wstrdup(wPreferences
.icon_path
);
331 path
= strtok(paths
, ":");
336 tmp
= wexpandpath(path
);
337 /* do not sort, because the order implies the order of
338 * directories searched */
339 if (access(tmp
, X_OK
)==0)
340 WMAddListItem(lPtr
, tmp
);
342 } while ((path
=strtok(NULL
, ":"))!=NULL
);
350 buttonCallback(void *self
, void *clientData
)
352 WMButton
*bPtr
= (WMButton
*)self
;
353 IconPanel
*panel
= (IconPanel
*)clientData
;
356 if (bPtr
==panel
->okButton
) {
358 panel
->result
= True
;
359 } else if (bPtr
==panel
->cancelButton
) {
361 panel
->result
= False
;
364 else if (bPtr
==panel
->chooseButton
) {
367 op
= WMCreateOpenPanel(WMWidgetScreen(bPtr
));
369 if (WMRunModalOpenPanelForDirectory(op
, NULL
, "/usr/local", NULL
, NULL
)) {
371 path
= WMGetFilePanelFile(op
);
372 WMSetTextFieldText(panel
->fileField
, path
);
373 setViewedImage(panel
, path
);
376 WMDestroyFilePanel(op
);
383 wIconChooserDialog(WScreen
*scr
, char **file
)
391 panel
= wmalloc(sizeof(IconPanel
));
392 memset(panel
, 0, sizeof(IconPanel
));
396 panel
->win
= WMCreateWindow(scr
->wmscreen
, "iconChooser");
397 WMResizeWidget(panel
->win
, 450, 280);
399 boldFont
= WMBoldSystemFontOfSize(scr
->wmscreen
, 12);
401 panel
->dirLabel
= WMCreateLabel(panel
->win
);
402 WMResizeWidget(panel
->dirLabel
, 200, 20);
403 WMMoveWidget(panel
->dirLabel
, 10, 7);
404 WMSetLabelText(panel
->dirLabel
, _("Directories"));
405 WMSetLabelFont(panel
->dirLabel
, boldFont
);
406 WMSetLabelTextAlignment(panel
->dirLabel
, WACenter
);
408 WMSetLabelRelief(panel
->dirLabel
, WRSunken
);
410 panel
->iconLabel
= WMCreateLabel(panel
->win
);
411 WMResizeWidget(panel
->iconLabel
, 140, 20);
412 WMMoveWidget(panel
->iconLabel
, 215, 7);
413 WMSetLabelText(panel
->iconLabel
, _("Icons"));
414 WMSetLabelFont(panel
->iconLabel
, boldFont
);
415 WMSetLabelTextAlignment(panel
->iconLabel
, WACenter
);
417 WMReleaseFont(boldFont
);
419 color
= WMWhiteColor(scr
->wmscreen
);
420 WMSetLabelTextColor(panel
->dirLabel
, color
);
421 WMSetLabelTextColor(panel
->iconLabel
, color
);
422 WMReleaseColor(color
);
424 color
= WMDarkGrayColor(scr
->wmscreen
);
425 WMSetWidgetBackgroundColor(panel
->iconLabel
, color
);
426 WMSetWidgetBackgroundColor(panel
->dirLabel
, color
);
427 WMReleaseColor(color
);
429 WMSetLabelRelief(panel
->iconLabel
, WRSunken
);
431 panel
->dirList
= WMCreateList(panel
->win
);
432 WMResizeWidget(panel
->dirList
, 200, 170);
433 WMMoveWidget(panel
->dirList
, 10, 30);
434 WMSetListAction(panel
->dirList
, listCallback
, panel
);
436 panel
->iconList
= WMCreateList(panel
->win
);
437 WMResizeWidget(panel
->iconList
, 140, 170);
438 WMMoveWidget(panel
->iconList
, 215, 30);
439 WMSetListAction(panel
->iconList
, listCallback
, panel
);
441 panel
->iconView
= WMCreateLabel(panel
->win
);
442 WMResizeWidget(panel
->iconView
, 75, 75);
443 WMMoveWidget(panel
->iconView
, 365, 60);
444 WMSetLabelImagePosition(panel
->iconView
, WIPImageOnly
);
445 WMSetLabelRelief(panel
->iconView
, WRSunken
);
447 panel
->fileLabel
= WMCreateLabel(panel
->win
);
448 WMResizeWidget(panel
->fileLabel
, 80, 20);
449 WMMoveWidget(panel
->fileLabel
, 10, 210);
450 WMSetLabelText(panel
->fileLabel
, _("File Name:"));
452 panel
->fileField
= WMCreateTextField(panel
->win
);
453 WMResizeWidget(panel
->fileField
, 345, 20);
454 WMMoveWidget(panel
->fileField
, 95, 210);
455 WMSetTextFieldEnabled(panel
->fileField
, False
);
457 panel
->okButton
= WMCreateCommandButton(panel
->win
);
458 WMResizeWidget(panel
->okButton
, 80, 26);
459 WMMoveWidget(panel
->okButton
, 360, 240);
460 WMSetButtonText(panel
->okButton
, _("OK"));
461 WMSetButtonEnabled(panel
->okButton
, False
);
462 WMSetButtonAction(panel
->okButton
, buttonCallback
, panel
);
464 panel
->cancelButton
= WMCreateCommandButton(panel
->win
);
465 WMResizeWidget(panel
->cancelButton
, 80, 26);
466 WMMoveWidget(panel
->cancelButton
, 270, 240);
467 WMSetButtonText(panel
->cancelButton
, _("Cancel"));
468 WMSetButtonAction(panel
->cancelButton
, buttonCallback
, panel
);
470 panel
->chooseButton
= WMCreateCommandButton(panel
->win
);
471 WMResizeWidget(panel
->chooseButton
, 110, 26);
472 WMMoveWidget(panel
->chooseButton
, 150, 240);
473 WMSetButtonText(panel
->chooseButton
, _("Choose File"));
474 WMSetButtonAction(panel
->chooseButton
, buttonCallback
, panel
);
476 WMRealizeWidget(panel
->win
);
477 WMMapSubwidgets(panel
->win
);
479 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 450, 280, 0, 0, 0);
481 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
483 wwin
= wManageInternalWindow(scr
, parent
, None
, _("Icon Chooser"),
484 (scr
->scr_width
- 450)/2,
485 (scr
->scr_height
- 280)/2, 450, 280);
488 /* put icon paths in the list */
489 listIconPaths(panel
->dirList
);
491 WMMapWidget(panel
->win
);
495 while (!panel
->done
) {
498 WMNextEvent(dpy
, &event
);
499 WMHandleEvent(&event
);
503 char *defaultPath
, *wantedPath
;
505 /* check if the file the user selected is not the one that
506 * would be loaded by default with the current search path */
507 *file
= WMGetListSelectedItem(panel
->iconList
)->text
;
512 defaultPath
= FindImage(wPreferences
.icon_path
, *file
);
513 wantedPath
= WMGetTextFieldText(panel
->fileField
);
514 /* if the file is not the default, use full path */
515 if (strcmp(wantedPath
, defaultPath
)!=0) {
518 *file
= wstrdup(*file
);
527 WMUnmapWidget(panel
->win
);
529 WMDestroyWidget(panel
->win
);
531 wUnmanageWindow(wwin
, False
);
535 XDestroyWindow(dpy
, parent
);
537 return panel
->result
;
542 ***********************************************************************
544 ***********************************************************************
576 #define COPYRIGHT_TEXT \
577 "Copyright \xa9 1997, 1998 Alfredo K. Kojima <kojima@windowmaker.org>\n"\
578 "Copyright \xa9 1998 Dan Pascu <dan@windowmaker.org>"
582 static InfoPanel
*thePanel
= NULL
;
585 destroyInfoPanel(WCoreWindow
*foo
, void *data
, XEvent
*event
)
588 if (thePanel
->timer
) {
589 WMDeleteTimerHandler(thePanel
->timer
);
591 if (thePanel
->oldPix
) {
592 WMReleasePixmap(thePanel
->oldPix
);
594 if (thePanel
->icon
) {
595 RDestroyImage(thePanel
->icon
);
598 RDestroyImage(thePanel
->pic
);
600 #endif /* SILLYNESS */
601 WMUnmapWidget(thePanel
);
603 WMDestroyWidget(thePanel
->win
);
605 wUnmanageWindow(thePanel
->wwin
, False
);
614 renderText(WMScreen
*scr
, char *text
, char *font
, RColor
*from
, RColor
*to
)
616 WMPixmap
*wpix
= NULL
;
619 RContext
*rc
= WMScreenRContext(scr
);
620 XFontStruct
*f
= NULL
;
624 f
= XLoadQueryFont(dpy
, font
);
628 w
= XTextWidth(f
, text
, strlen(text
));
629 h
= f
->ascent
+f
->descent
;
631 mask
= XCreatePixmap(dpy
, rc
->drawable
, w
, h
, 1);
632 gc
= XCreateGC(dpy
, mask
, 0, NULL
);
633 XSetForeground(dpy
, gc
, 0);
634 XSetFont(dpy
, gc
, f
->fid
);
635 XFillRectangle(dpy
, mask
, gc
, 0, 0, w
, h
);
637 XSetForeground(dpy
, gc
, 1);
638 XDrawString(dpy
, mask
, gc
, 0, f
->ascent
, text
, strlen(text
));
639 XSetLineAttributes(dpy
, gc
, 3, LineSolid
, CapRound
, JoinMiter
);
640 XDrawLine(dpy
, mask
, gc
, 0, h
-2, w
, h
-2);
642 grad
= XCreatePixmap(dpy
, rc
->drawable
, w
, h
, rc
->depth
);
646 color
= WMBlackColor(scr
);
647 XFillRectangle(dpy
, grad
, WMColorGC(color
), 0, 0, w
, h
);
648 WMReleaseColor(color
);
651 wpix
= WMCreatePixmapFromXPixmaps(scr
, grad
, mask
, w
, h
, rc
->depth
);
662 logoPushCallback(void *data
)
664 InfoPanel
*panel
= (InfoPanel
*)data
;
668 if (panel
->cycle
< 30) {
672 image
= RCloneImage(panel
->icon
);
673 RCombineImagesWithOpaqueness(image
, panel
->pic
, panel
->cycle
*255/30);
674 pix
= WMCreatePixmapFromRImage(panel
->scr
->wmscreen
, image
, 128);
675 RDestroyImage(image
);
676 WMSetLabelImage(panel
->logoL
, pix
);
677 WMReleasePixmap(pix
);
680 i
= panel
->cycle
%150;
682 strncpy(buffer
, "Sloppy focus is a *?#@", i
<22 ? i
: 22);
684 memset(&buffer
[22], ' ', i
-22);
686 WMSetLabelText(panel
->versionL
, buffer
);
688 panel
->timer
= WMAddTimerHandler(50, logoPushCallback
, panel
);
694 handleLogoPush(XEvent
*event
, void *data
)
696 InfoPanel
*panel
= (InfoPanel
*)data
;
697 static int broken
= 0;
698 static int clicks
= 0;
699 static char *pic_data
[] = {
759 " ....XoO+@##+O$%.... ",
760 " ...%X&*========-;;:o... ",
761 " ...>.>,<122222222222134@... ",
762 " ..>5678912222222222222220q%.. ",
763 " ..$.&-w2222222222222222222er>.. ",
764 " ..O.t31222222222222222222222y4>.. ",
765 " ...O5u3222222222222222222222222yri... ",
766 " ..>p&a22222222222222222222222222wso.. ",
767 " ..ids91222222222222222222222222222wfi.. ",
768 " ..X.7w222222wgs-w2222222213=g0222222<hi.. ",
769 " ..Xuj2222222<@X5=222222229k@l:022222y4i.. ",
770 " .Xdz22222222*X%.s22222222axo%$-222222<c>.. ",
771 " ..o7y22222222v...r222222223hX.i82222221si.. ",
772 "..io*222222222&...u22222222yt..%*22222220:%. ",
773 "..>k02222222227...f222222222v..X=222222229t. ",
774 "..dz12222222220ui:y2222222223d%qw222222221g. ",
775 ".%vw222222222221y2222222222219*y2222222222wd.",
776 ".X;2222222222222222222222222222222222222222b.",
777 ".i*2222222222222222222222222222222222222222v.",
778 ".i*2222222222222222222222222222222222222222;.",
779 ".i*22222222222222222222222222222222222222228.",
780 ".>*2222222222222222222222222222222222222222=.",
781 ".i*22222222222222222222222222222222222222228.",
782 ".i*2222222222222222222222222222222222222222;.",
783 ".X*222222222222222222222222222222we12222222r.",
784 ".Xs12222222w3aw22222222222222222y8s0222222wk.",
785 ".Xq02222222a,na22222222222222222zm6zwy2222gi.",
786 "..>*22222y<:Xcj22222222222222222-o$k;;02228..",
787 "..i7y2220rhX.:y22222222222222222jtiXd,a220,..",
788 " .X@z222a,do%kj2222222222222222wMX5q;gw228%..",
789 " ..58222wagsh6ry222222222222221;>Of0w222y:...",
790 " ...:e2222218mdz22222222222222a&$vw222220@...",
791 " ...O-122222y:.u02222222222229q$uj222221r... ",
792 " ..%&a1222223&573w2222222219NOxz122221z>... ",
793 " ...t3222221-l$nr8ay1222yzbo,=12222w-5... ",
794 " ..X:022222w-k+>o,7s**s7xOn=12221<f5... ",
795 " ..o:9222221j8:&Bl>>>>ihv<12221=dX... ",
796 " ..Xb9122222109g-****;<y22221zn%... ",
797 " ..X&801222222222222222222w-h.... ",
798 " ...o:=022222222222222221=lX... ",
799 " ..X@:;3w2222222222210fO... ",
800 " ...XX&v8<30000003-N@... ",
801 " .....XmnbN:q&Bo.... ",
805 if (!panel
->timer
&& !broken
&& clicks
> 2) {
811 file
= wDefaultGetIconFile(panel
->scr
, "Logo", "WMPanel", False
);
817 path
= FindImage(wPreferences
.icon_path
, file
);
823 panel
->icon
= RLoadImage(panel
->scr
->rcontext
, path
, 0);
831 panel
->pic
= RGetImageFromXPMData(panel
->scr
->rcontext
, pic_data
);
832 if (!panel
->pic
|| panel
->icon
->width
!=panel
->pic
->width
833 || panel
->icon
->height
!=panel
->pic
->height
) {
835 RDestroyImage(panel
->icon
);
838 RDestroyImage(panel
->pic
);
850 RCombineImageWithColor(panel
->icon
, &color
);
851 RCombineImageWithColor(panel
->pic
, &color
);
854 panel
->timer
= WMAddTimerHandler(50, logoPushCallback
, panel
);
856 panel
->oldPix
= WMRetainPixmap(WMGetLabelImage(panel
->logoL
));
857 } else if (panel
->timer
) {
861 WMSetLabelImage(panel
->logoL
, panel
->oldPix
);
862 WMReleasePixmap(panel
->oldPix
);
863 panel
->oldPix
= NULL
;
865 WMDeleteTimerHandler(panel
->timer
);
868 sprintf(version
, "Version %s", VERSION
);
869 WMSetLabelText(panel
->versionL
, version
);
874 while (XCheckTypedWindowEvent(dpy
, WMWidgetXID(panel
->versionL
),
878 #endif /* SILLYNESS */
881 wShowInfoPanel(WScreen
*scr
)
891 RColor color1
, color2
;
904 wRaiseFrame(thePanel
->wwin
->frame
->core
);
905 wSetFocusTo(scr
, thePanel
->wwin
);
909 panel
= wmalloc(sizeof(InfoPanel
));
910 memset(panel
, 0, sizeof(InfoPanel
));
914 panel
->win
= WMCreateWindow(scr
->wmscreen
, "info");
915 WMResizeWidget(panel
->win
, 382, 230);
917 logo
= WMGetApplicationIconImage(scr
->wmscreen
);
919 size
= WMGetPixmapSize(logo
);
920 panel
->logoL
= WMCreateLabel(panel
->win
);
921 WMResizeWidget(panel
->logoL
, 64, 64);
922 WMMoveWidget(panel
->logoL
, 30, 20);
923 WMSetLabelImagePosition(panel
->logoL
, WIPImageOnly
);
924 WMSetLabelImage(panel
->logoL
, logo
);
926 WMCreateEventHandler(WMWidgetView(panel
->logoL
), ButtonPressMask
,
927 handleLogoPush
, panel
);
931 panel
->name1L
= WMCreateLabel(panel
->win
);
932 WMResizeWidget(panel
->name1L
, 200, 30);
933 WMMoveWidget(panel
->name1L
, 120, 30);
940 logo
= renderText(scr
->wmscreen
, " Window Maker ",
941 "-*-times-bold-r-*-*-24-*", &color1
, &color2
);
943 WMSetLabelImagePosition(panel
->name1L
, WIPImageOnly
);
944 WMSetLabelImage(panel
->name1L
, logo
);
945 WMReleasePixmap(logo
);
947 font
= WMBoldSystemFontOfSize(scr
->wmscreen
, 24);
949 WMSetLabelFont(panel
->name1L
, font
);
952 WMSetLabelText(panel
->name1L
, "Window Maker");
955 panel
->name2L
= WMCreateLabel(panel
->win
);
956 WMResizeWidget(panel
->name2L
, 200, 24);
957 WMMoveWidget(panel
->name2L
, 120, 60);
958 font
= WMBoldSystemFontOfSize(scr
->wmscreen
, 18);
960 WMSetLabelFont(panel
->name2L
, font
);
964 WMSetLabelText(panel
->name2L
, "X11 Window Manager");
967 sprintf(version
, "Version %s", VERSION
);
968 panel
->versionL
= WMCreateLabel(panel
->win
);
969 WMResizeWidget(panel
->versionL
, 310, 16);
970 WMMoveWidget(panel
->versionL
, 30, 95);
971 WMSetLabelTextAlignment(panel
->versionL
, WARight
);
972 WMSetLabelText(panel
->versionL
, version
);
973 WMSetLabelWraps(panel
->versionL
, False
);
975 panel
->copyrL
= WMCreateLabel(panel
->win
);
976 WMResizeWidget(panel
->copyrL
, 340, 40);
977 WMMoveWidget(panel
->copyrL
, 15, 185);
978 WMSetLabelTextAlignment(panel
->copyrL
, WALeft
);
979 WMSetLabelText(panel
->copyrL
, COPYRIGHT_TEXT
);
980 /* we want the (c) character in the helvetica font */
981 font
= WMCreateFontInDefaultEncoding(scr
->wmscreen
, HELVETICA10_FONT
);
983 WMSetLabelFont(panel
->copyrL
, font
);
986 switch (scr
->w_depth
) {
988 strcpy(version
, "32 thousand");
991 strcpy(version
, "64 thousand");
995 strcpy(version
, "16 million");
998 sprintf(version
, "%d", 1<<scr
->w_depth
);
1002 sprintf(buffer
, "Using visual 0x%x: %s %ibpp (%s colors)\n",
1003 (unsigned)scr
->w_visual
->visualid
,
1004 visuals
[scr
->w_visual
->class], scr
->w_depth
, version
);
1006 strcat(buffer
, "Supported image formats: ");
1007 strl
= RSupportedFileFormats();
1008 for (i
=0; strl
[i
]!=NULL
; i
++) {
1009 strcat(buffer
, strl
[i
]);
1010 strcat(buffer
, " ");
1013 strcat(buffer
, "\nAdditional Support For: ");
1026 list
[j
++] = "GNOME";
1032 list
[j
++] = "Sound";
1036 for (i
= 0; i
< j
; i
++) {
1039 strcat(buf
, " and ");
1043 strcat(buf
, list
[i
]);
1045 strcat(buffer
, buf
);
1049 panel
->infoL
= WMCreateLabel(panel
->win
);
1050 WMResizeWidget(panel
->infoL
, 350, 75);
1051 WMMoveWidget(panel
->infoL
, 15, 115);
1052 WMSetLabelText(panel
->infoL
, buffer
);
1054 WMSetLabelFont(panel
->infoL
, font
);
1055 WMReleaseFont(font
);
1059 WMRealizeWidget(panel
->win
);
1060 WMMapSubwidgets(panel
->win
);
1062 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 382, 230, 0, 0, 0);
1064 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1066 WMMapWidget(panel
->win
);
1068 wwin
= wManageInternalWindow(scr
, parent
, None
, "Info",
1069 (scr
->scr_width
- 382)/2,
1070 (scr
->scr_height
- 230)/2, 382, 230);
1072 WSETUFLAG(wwin
, no_closable
, 0);
1073 WSETUFLAG(wwin
, no_close_button
, 0);
1074 wWindowUpdateButtonImages(wwin
);
1075 wFrameWindowShowButton(wwin
->frame
, WFF_RIGHT_BUTTON
);
1076 wwin
->frame
->on_click_right
= destroyInfoPanel
;
1087 ***********************************************************************
1089 ***********************************************************************
1104 #define LICENSE_TEXT \
1105 " Window Maker is free software; you can redistribute it and/or modify "\
1106 "it under the terms of the GNU General Public License as published "\
1107 "by the Free Software Foundation; either version 2 of the License, "\
1108 "or (at your option) any later version.\n\n\n"\
1109 " Window Maker is distributed in the hope that it will be useful, but "\
1110 "WITHOUT ANY WARRANTY; without even the implied warranty of "\
1111 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU "\
1112 "General Public License for more details.\n\n\n"\
1113 " You should have received a copy of the GNU General Public License "\
1114 "along with this program; if not, write to the Free Software "\
1115 "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA "\
1119 static LegalPanel
*legalPanel
= NULL
;
1122 destroyLegalPanel(WCoreWindow
*foo
, void *data
, XEvent
*event
)
1124 WMUnmapWidget(legalPanel
->win
);
1126 WMDestroyWidget(legalPanel
->win
);
1128 wUnmanageWindow(legalPanel
->wwin
, False
);
1137 wShowLegalPanel(WScreen
*scr
)
1144 wRaiseFrame(legalPanel
->wwin
->frame
->core
);
1145 wSetFocusTo(scr
, legalPanel
->wwin
);
1149 panel
= wmalloc(sizeof(LegalPanel
));
1153 panel
->win
= WMCreateWindow(scr
->wmscreen
, "legal");
1154 WMResizeWidget(panel
->win
, 420, 250);
1157 panel
->licenseL
= WMCreateLabel(panel
->win
);
1158 WMResizeWidget(panel
->licenseL
, 400, 230);
1159 WMMoveWidget(panel
->licenseL
, 10, 10);
1160 WMSetLabelTextAlignment(panel
->licenseL
, WALeft
);
1161 WMSetLabelText(panel
->licenseL
, LICENSE_TEXT
);
1162 WMSetLabelRelief(panel
->licenseL
, WRGroove
);
1164 WMRealizeWidget(panel
->win
);
1165 WMMapSubwidgets(panel
->win
);
1167 parent
= XCreateSimpleWindow(dpy
, scr
->root_win
, 0, 0, 420, 250, 0, 0, 0);
1169 XReparentWindow(dpy
, WMWidgetXID(panel
->win
), parent
, 0, 0);
1171 wwin
= wManageInternalWindow(scr
, parent
, None
, "Legal",
1172 (scr
->scr_width
- 420)/2,
1173 (scr
->scr_height
- 250)/2, 420, 250);
1175 WSETUFLAG(wwin
, no_closable
, 0);
1176 WSETUFLAG(wwin
, no_close_button
, 0);
1177 wWindowUpdateButtonImages(wwin
);
1178 wFrameWindowShowButton(wwin
->frame
, WFF_RIGHT_BUTTON
);
1179 wwin
->frame
->on_click_right
= destroyLegalPanel
;
1183 WMMapWidget(panel
->win
);