Copy purify.fvwm2rc to /tmp - add instructions in README.
[fvwm.git] / modules / FvwmButtons / output.c
blob2ea5a762f79baadc6d4394c2eb4a9dad32ad21c2
1 /* -*-c-*- */
2 /*
3 * FvwmButtons, copyright 1996, Jarl Totland
5 * This module, and the entire GoodStuff program, and the concept for
6 * interfacing this module to the Window Manager, are all original work
7 * by Robert Nation
9 * Copyright 1993, Robert Nation. No guarantees or warantees or anything
10 * are provided or implied in any way whatsoever. Use this program at your
11 * own risk. Permission to use this program for any purpose is given,
12 * as long as the copyright is kept intact.
16 /* This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 #include "config.h"
33 #include <unistd.h>
34 #include <ctype.h>
35 #include <stdio.h>
36 #include <X11/Intrinsic.h>
37 #include "FvwmButtons.h"
39 /**
40 *** DumpButtons()
41 *** Debug function. May only be called after ShuffleButtons has been called.
42 **/
43 void DumpButtons(button_info *b)
45 if (!b)
47 fprintf(stderr, "NULL\n");
48 return;
50 if (b != UberButton)
52 int button = buttonNum(b);
53 fprintf(stderr,
54 "0x%lx(%ix%i@(%i,%i)): ",
55 (unsigned long)b, b->BWidth, b->BHeight,
56 buttonXPos(b, button), buttonYPos(b, button));
58 else
60 fprintf(stderr,
61 "0x%lx(%ix%i@): ",
62 (unsigned long)b, b->BWidth, b->BHeight);
65 if (b->flags.b_Font)
66 fprintf(stderr,
67 "Font(%s,0x%lx) ",
68 b->font_string, (unsigned long)b->Ffont);
69 if (b->flags.b_Padding)
70 fprintf(stderr, "Padding(%i,%i) ", b->xpad, b->ypad);
71 if (b->flags.b_Frame)
72 fprintf(stderr, "Framew(%i) ", b->framew);
73 if (b->flags.b_Title)
74 fprintf(stderr, "Title(%s) ", b->title);
75 if (b->flags.b_Icon)
76 fprintf(stderr, "Icon(%s,%i) ", b->icon_file, (int)b->IconWin);
77 if (b->flags.b_Icon)
78 fprintf(stderr, "Panelw(%i) ", (int)b->PanelWin);
79 if (b->flags.b_Action)
80 fprintf(stderr,
81 "\n Action(%s,%s,%s,%s) ",
82 b->action[0] ? b->action[0] : "",
83 b->action[1] ? b->action[1] : "",
84 b->action[2] ? b->action[2] : "",
85 b->action[3] ? b->action[3] : "");
86 if (b->flags.b_Swallow)
88 fprintf(stderr, "Swallow(0x%02x) ", b->swallow);
89 if (b->swallow & b_Respawn)
90 fprintf(stderr, "\n Respawn(%s) ", b->spawn);
91 if (b->newflags.do_swallow_new)
92 fprintf(stderr, "\n SwallowNew(%s) ", b->spawn);
94 if (b->flags.b_Panel)
96 fprintf(stderr, "Panel(0x%02x) ", b->swallow);
97 if (b->swallow & b_Respawn)
98 fprintf(stderr, "\n Respawn(%s) ", b->spawn);
99 if (b->newflags.do_swallow_new)
100 fprintf(stderr, "\n SwallowNew(%s) ", b->spawn);
102 if (b->flags.b_Hangon)
103 fprintf(stderr, "Hangon(%s) ", b->hangon);
104 fprintf(stderr, "\n");
105 if (b->flags.b_Container)
107 int i = 0;
108 fprintf(stderr,
109 " Container(%ix%i=%i buttons (alloc %i),"
110 " size %ix%i, pos %i,%i)\n{ ",
111 b->c->num_columns, b->c->num_rows, b->c->num_buttons,
112 b->c->allocated_buttons,
113 b->c->width, b->c->height, b->c->xpos, b->c->ypos);
115 fprintf(stderr," font(%s,%i) framew(%i) pad(%i,%i) { ",
116 b->c->font_string,(int)b->c->Ffont,b->c->framew,b->c->xpad,
117 b->c->ypad);
119 while (i<b->c->num_buttons)
121 fprintf(stderr,
122 "0x%lx ", (unsigned long)b->c->buttons[i++]);
124 fprintf(stderr, "}\n");
125 i = 0;
126 while (i < b->c->num_buttons)
128 DumpButtons(b->c->buttons[i++]);
130 return;
134 void SaveButtons(button_info *b)
136 int i;
137 if (!b)
138 return;
139 if (b->BWidth>1 || b->BHeight > 1)
140 fprintf(stderr, "%ix%i ", b->BWidth, b->BHeight);
141 if (b->flags.b_Font)
142 fprintf(stderr, "Font %s ", b->font_string);
143 if (b->flags.b_Fore)
144 fprintf(stderr, "Fore %s ", b->fore);
145 if (b->flags.b_Back)
146 fprintf(stderr, "Back %s ", b->back);
147 if (b->flags.b_Frame)
148 fprintf(stderr, "Frame %i ", b->framew);
149 if (b->flags.b_Padding)
150 fprintf(stderr, "Padding %i %i ", b->xpad, b->ypad);
151 if (b->flags.b_Title)
153 fprintf(stderr, "Title ");
154 if (b->flags.b_Justify)
156 fprintf(stderr, "(");
157 switch (b->justify & b_TitleHoriz)
159 case 0:
160 fprintf(stderr, "Left");
161 break;
162 case 1:
163 fprintf(stderr, "Center");
164 break;
165 case 2:
166 fprintf(stderr, "Right");
167 break;
169 if (b->justify & b_Horizontal)
171 fprintf(stderr, ", Side");
173 fprintf(stderr, ") ");
175 fprintf(stderr, "\"%s\" ", b->title);
177 if (b->flags.b_Icon)
179 fprintf(stderr, "Icon \"%s\" ", b->icon_file);
181 if (b->flags.b_Swallow || b->flags.b_Panel)
183 if (b->flags.b_Swallow)
184 fprintf(stderr, "Swallow ");
185 else
186 fprintf(stderr, "Panel ");
187 if (b->swallow_mask)
189 fprintf(stderr, "(");
190 if (b->swallow_mask & b_NoHints)
192 if (b->swallow & b_NoHints)
193 fprintf(stderr, "NoHints ");
194 else
195 fprintf(stderr, "Hints ");
198 if (b->swallow_mask & b_Kill)
200 if (b->swallow & b_Kill)
201 fprintf(stderr, "Kill ");
202 else
203 fprintf(stderr, "NoKill ");
206 if (b->swallow_mask & b_NoClose)
208 if (b->swallow & b_NoClose)
209 fprintf(stderr, "NoClose ");
210 else
211 fprintf(stderr, "Close ");
214 if (b->swallow_mask & b_Respawn)
216 if (b->swallow & b_Respawn)
217 fprintf(stderr, "Respawn ");
218 else
219 fprintf(stderr, "NoRespawn ");
222 if (b->swallow_mask & b_UseOld)
224 if (b->swallow & b_UseOld)
225 fprintf(stderr, "UseOld ");
226 else
227 fprintf(stderr, "NoOld ");
230 if (b->swallow_mask & b_UseTitle)
232 if (b->swallow & b_UseTitle)
233 fprintf(stderr, "UseTitle ");
234 else
235 fprintf(stderr, "NoTitle ");
238 fprintf(stderr, ") ");
240 fprintf(stderr, "\"%s\" \"%s\" ", b->hangon, b->spawn);
242 if (b->flags.b_Action)
244 if (b->action[0])
245 fprintf(stderr, "Action `%s` ", b->action[0]);
246 for (i = 1; i < 4; i++)
248 if (b->action[i])
249 fprintf(stderr,
250 "Action (Mouse %i) `%s` ",
251 i, b->action[i]);
256 if (b->flags.b_Container)
258 fprintf(stderr,
259 "Container (Columns %i Rows %i ",
260 b->c->num_columns, b->c->num_rows);
262 if (b->c->flags.b_Font)
263 fprintf(stderr, "Font %s ", b->c->font_string);
264 if (b->c->flags.b_Fore)
265 fprintf(stderr, "Fore %s ", b->c->fore);
266 if (b->c->flags.b_Back)
267 fprintf(stderr, "Back %s ", b->c->back);
268 if (b->c->flags.b_Frame)
269 fprintf(stderr, "Frame %i ", b->c->framew);
270 if (b->c->flags.b_Padding)
271 fprintf(stderr,
272 "Padding %i %i ",
273 b->c->xpad, b->c->ypad);
274 if (b->c->flags.b_Justify)
276 fprintf(stderr, "Title (");
277 switch (b->c->justify & b_TitleHoriz)
279 case 0:
280 fprintf(stderr, "Left");
281 break;
282 case 1:
283 fprintf(stderr, "Center");
284 break;
285 case 2:
286 fprintf(stderr, "Right");
287 break;
289 if (b->c->justify & b_Horizontal)
291 fprintf(stderr, ", Side");
293 fprintf(stderr, ") ");
295 if (b->c->swallow_mask)
297 fprintf(stderr, "Swallow (");
298 if (b->c->swallow_mask & b_NoHints)
300 if (b->c->swallow & b_NoHints)
301 fprintf(stderr, "NoHints ");
302 else
303 fprintf(stderr, "Hints ");
306 if (b->c->swallow_mask & b_Kill)
308 if (b->c->swallow & b_Kill)
309 fprintf(stderr, "Kill ");
310 else
311 fprintf(stderr, "NoKill ");
314 if (b->c->swallow_mask & b_NoClose)
316 if (b->c->swallow & b_NoClose)
317 fprintf(stderr, "NoClose ");
318 else
319 fprintf(stderr, "Close ");
322 if (b->c->swallow_mask & b_Respawn)
324 if (b->c->swallow & b_Respawn)
325 fprintf(stderr, "Respawn ");
326 else
327 fprintf(stderr, "NoRespawn ");
330 if (b->c->swallow_mask & b_UseOld)
332 if (b->c->swallow & b_UseOld)
333 fprintf(stderr, "UseOld ");
334 else
335 fprintf(stderr, "NoOld ");
338 if (b->c->swallow_mask & b_UseTitle)
340 if (b->c->swallow & b_UseTitle)
341 fprintf(stderr, "UseTitle ");
342 else
343 fprintf(stderr, "NoTitle ");
346 fprintf(stderr, ") ");
349 fprintf(stderr, ")");
351 fprintf(stderr, "\n");
353 if (b->flags.b_Container)
355 i = 0;
356 while (i<b->c->num_buttons)
358 SaveButtons(b->c->buttons[i++]);
360 fprintf(stderr, "End\n");