File: info.c

package info (click to toggle)
wmss 0.7-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 204 kB
  • ctags: 498
  • sloc: ansic: 936; makefile: 513
file content (164 lines) | stat: -rw-r--r-- 5,055 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/******************************************************************************
*   WMSound Setup       for WindowMaker Sound Server            [Version 0.7] *
*   Copyright (C) 1998  Pascal Hofstee <daeron@shadowmere.student.utwente.nl> *
*                                                                             *
*   WindowMaker Sound Server                                                  *
*   Copyright (C) 1998  Anthony Quinn <southgat@frontiernet.net>              *
*                       William Moore <billy@mud.mind.net>                    *
*                                                                             *
*   This program is free software; you can redistribute it and/or modify      *
*   it under the terms of the GNU General Public License as published by      *
*   the Free Software Foundation; either version 2 of the License, or         *
*   (at your option) any later version.                                       *
*                                                                             *
*   This program is distributed in the hope that it will be useful,           *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of            *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
*   GNU General Public License for more details.                              *
*                                                                             *
*   You should have received a copy of the GNU General Public License         *
*   along with this program; if not, write to the Free Software               *
*   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
*******************************************************************************/

#include <WINGs.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <proplist.h>

#include "wsconfig.h"
#include "wmss.h"


extern Display	*dpy;


static void
wmssExitInfo(WMButton *bPtr, WMSSInfoPanel *panel)
{
    panel->flags.done = 1;
}

WMSSInfoPanel*
wmssCreateInfoPanel(WMScreen *scrPtr, char **soundpath)
{
    WMSSInfoPanel	*panel;
    WMFont		*font;

    panel = malloc(sizeof(WMSSInfoPanel));
    memset(panel, 0, sizeof(WMSSInfoPanel));

    /*
    ---------------------
    The Actual Info Panel
    ---------------------
    */
    panel->win = WMCreateWindow(scrPtr, "infoPanel");
    WMSetWindowTitle(panel->win, "WMSound Setup Info");
    WMResizeWidget(panel->win, 340,176);


    /*
    ----------
    Name Label
    ----------
    */
    panel->nameLabel = WMCreateLabel(panel->win);
    WMResizeWidget(panel->nameLabel, 170, 20);
    WMMoveWidget(panel->nameLabel, 14, 22);

    font = WMBoldSystemFontOfSize(scrPtr, 20);
    WMSetLabelFont(panel->nameLabel, font);
    WMSetLabelText(panel->nameLabel, "WMSound Setup");
    WMReleaseFont(font);
    /*
    -------------
    Version Label
    -------------
    */
    panel->versionLabel = WMCreateLabel(panel->win);
    WMResizeWidget(panel->versionLabel, 100, 14);
    WMMoveWidget(panel->versionLabel, 184, 26);

    font = WMBoldSystemFontOfSize(scrPtr, 14);
    WMSetLabelFont(panel->versionLabel, font);
    WMSetLabelText(panel->versionLabel, "Version 0.7");
    WMReleaseFont(font);
    /*
    -------------
    Credits Label
    -------------
    */
    panel->creditsLabel = WMCreateLabel(panel->win);
    WMResizeWidget(panel->creditsLabel, 312, 40);
    WMMoveWidget(panel->creditsLabel, 14, 70);

    font = WMSystemFontOfSize(scrPtr, 10);
    WMSetLabelFont(panel->creditsLabel, font);
    WMSetLabelText(panel->creditsLabel, "Thanks go to:\n     ]d for helping me out with some nasty bugs\n     Antony Quinn for his great WMSound Server");
    WMReleaseFont(font);
    /*
    ----------
    Info Label
    ----------
    */
    panel->infoLabel = WMCreateLabel(panel->win);
    WMResizeWidget(panel->infoLabel, 312, 30);
    WMMoveWidget(panel->infoLabel, 14, 138);

    font = WMSystemFontOfSize(scrPtr, 9);
    WMSetLabelFont(panel->infoLabel, font);
    WMSetLabelText(panel->infoLabel, "(C) Copyright 1998, by Pascal G.Hofstee\n<daeron@shadowmere.student.utwente.nl>\nhttp://shadowmere.student.utwente.nl/wmss");
    WMReleaseFont(font);




    /*
    ---------
    Exit Button
    ---------
    */
    panel->exitButton = WMCreateCommandButton(panel->win);
    WMResizeWidget(panel->exitButton, 75,24);
    WMMoveWidget(panel->exitButton, 257, 144);
    WMSetButtonText(panel->exitButton, "Exit");
    WMSetButtonAction(panel->exitButton, (WMAction *)wmssExitInfo, panel);



    WMRealizeWidget(panel->win);
    WMMapSubwidgets(panel->win);

    return panel;
}


void
wmssRunInfoPanel(WMSSInfoPanel *panel)
{
    XEvent event;

    WMMapWidget(panel->win);

    panel->flags.done = 0;

    while (!panel->flags.done) {
        WMNextEvent(dpy, &event);
        WMHandleEvent(&event);
    }

    WMUnmapWidget(panel->win);
}


void
wmssDestroyInfoPanel(WMSSInfoPanel *panel)
{
    WMUnmapWidget(panel->win);
    WMDestroyWidget(panel->win);
    free(panel);
}