~ubuntu-branches/ubuntu/trusty/glbsp/trusty

« back to all changes in this revision

Viewing changes to gui/options.cc

  • Committer: Bazaar Package Importer
  • Author(s): Darren Salt
  • Date: 2008-01-30 13:33:49 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080130133349-kgojg33vyiu8xbvp
Tags: 2.24-1
* New upstream release.
* Bumped the lib soname and the library package name due to one silly
  little binary incompatibility caused by changes in an exported struct.
  (Safe; nothing else currently in the archive has ever used libglbsp2.)
* Removed my patches since they're all applied upstream.
* Updated the list of documentation files.
* Build-time changes:
  - Switched from dh_movefiles to dh_install.
  - Updated my makefile to cope with upstream changes.
  - Corrected for debian-rules-ignores-make-clean-error.
  - Corrected for substvar-source-version-is-deprecated.
  - Link libglbsp, rather than glbsp, with libm and libz.
* Fixed shlibdeps. (Closes: #460387)
* Bumped standards version to 3.7.3 (no other changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//------------------------------------------------------------------------
 
2
// Options : Unix/FLTK Option boxes
 
3
//------------------------------------------------------------------------
 
4
//
 
5
//  GL-Friendly Node Builder (C) 2000-2007 Andrew Apted
 
6
//
 
7
//  Based on 'BSP 2.3' by Colin Reed, Lee Killough and others.
 
8
//
 
9
//  This program is free software; you can redistribute it and/or
 
10
//  modify it under the terms of the GNU General Public License
 
11
//  as published by the Free Software Foundation; either version 2
 
12
//  of the License, or (at your option) any later version.
 
13
//
 
14
//  This program is distributed in the hope that it will be useful,
 
15
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
//  GNU General Public License for more details.
 
18
//
 
19
//------------------------------------------------------------------------
 
20
 
 
21
// this includes everything we need
 
22
#include "local.h"
 
23
 
 
24
 
 
25
#define BM_BUTTONTYPE  FL_ROUND_DOWN_BOX
 
26
#define BM_BUTTONSIZE  30
 
27
 
 
28
 
 
29
static void build_mode_radio_CB(Fl_Widget *w, void *data)
 
30
{
 
31
  boolean_g old_gwa = guix_info.gwa_mode;
 
32
 
 
33
  guix_win->build_mode->WriteInfo();
 
34
 
 
35
  // communicate with output file widget, for GWA mode
 
36
  if (old_gwa != guix_info.gwa_mode)
 
37
  {
 
38
    guix_win->files->GWA_Changed();
 
39
  }
 
40
 
 
41
  guix_win->misc_opts->GWA_Changed();
 
42
}
 
43
 
 
44
 
 
45
//
 
46
// BuildMode Constructor
 
47
//
 
48
Guix_BuildMode::Guix_BuildMode(int x, int y, int w, int h) :
 
49
    Fl_Group(x, y, w, h, "Build Mode")
 
50
{
 
51
  // cancel the automatic 'begin' in Fl_Group constructor
 
52
  end();
 
53
  
 
54
  box(FL_THIN_UP_BOX);
 
55
  resizable(0);  // no resizing the kiddies, please
 
56
 
 
57
  labelfont(FL_HELVETICA | FL_BOLD);
 
58
  labeltype(FL_NORMAL_LABEL);
 
59
  align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT | FL_ALIGN_TOP);
 
60
 
 
61
  // create the children
 
62
 
 
63
  int CX = x+12;
 
64
  int CY = y+16;
 
65
 
 
66
  gwa = new Fl_Check_Button(CX, CY, 
 
67
      BM_BUTTONSIZE, BM_BUTTONSIZE, "GWA Mode");
 
68
  gwa->down_box(BM_BUTTONTYPE);
 
69
  gwa->type(FL_RADIO_BUTTON);
 
70
  gwa->align(FL_ALIGN_RIGHT);
 
71
  gwa->callback((Fl_Callback *) build_mode_radio_CB);
 
72
  add(gwa);
 
73
 
 
74
  CY += 24;
 
75
 
 
76
  maybe_normal = new Fl_Check_Button(CX, CY,
 
77
      BM_BUTTONSIZE, BM_BUTTONSIZE, "GL, Normal if missing");
 
78
  maybe_normal->down_box(BM_BUTTONTYPE);
 
79
  maybe_normal->type(FL_RADIO_BUTTON);
 
80
  maybe_normal->align(FL_ALIGN_RIGHT);
 
81
  maybe_normal->callback((Fl_Callback *) build_mode_radio_CB);
 
82
  add(maybe_normal);
 
83
 
 
84
  CY += 24;
 
85
 
 
86
  both = new Fl_Check_Button(CX, CY,
 
87
      BM_BUTTONSIZE, BM_BUTTONSIZE, "GL and Normal nodes");
 
88
  both->down_box(BM_BUTTONTYPE);
 
89
  both->type(FL_RADIO_BUTTON);
 
90
  both->align(FL_ALIGN_RIGHT);
 
91
  both->callback((Fl_Callback *) build_mode_radio_CB);
 
92
  add(both);
 
93
 
 
94
  CY += 24;
 
95
 
 
96
  gl_only = new Fl_Check_Button(CX, CY,
 
97
      BM_BUTTONSIZE, BM_BUTTONSIZE, "GL nodes only");
 
98
  gl_only->down_box(BM_BUTTONTYPE);
 
99
  gl_only->type(FL_RADIO_BUTTON);
 
100
  gl_only->align(FL_ALIGN_RIGHT);
 
101
  gl_only->callback((Fl_Callback *) build_mode_radio_CB);
 
102
  add(gl_only);
 
103
 
 
104
  CY += 24;
 
105
 
 
106
  ReadInfo();
 
107
}
 
108
 
 
109
 
 
110
//
 
111
// BuildMode Destructor
 
112
//
 
113
Guix_BuildMode::~Guix_BuildMode()
 
114
{
 
115
  WriteInfo();
 
116
}
 
117
 
 
118
 
 
119
void Guix_BuildMode::ReadInfo()
 
120
{
 
121
  if (guix_info.gwa_mode)
 
122
    gwa->setonly();
 
123
  
 
124
  else if (guix_info.no_normal)
 
125
    gl_only->setonly();
 
126
  
 
127
  else if (guix_info.force_normal)
 
128
    both->setonly();
 
129
 
 
130
  else
 
131
    maybe_normal->setonly();
 
132
 
 
133
  // redraw them all (just to be safe)
 
134
  gwa->redraw();
 
135
  gl_only->redraw();
 
136
  both->redraw();
 
137
  maybe_normal->redraw();
 
138
}
 
139
 
 
140
 
 
141
void Guix_BuildMode::WriteInfo()
 
142
{
 
143
  // default: everything false
 
144
  guix_info.gwa_mode = FALSE;
 
145
  guix_info.no_normal = FALSE;
 
146
  guix_info.force_normal = FALSE;
 
147
 
 
148
  if (gwa->value())
 
149
  {
 
150
    guix_info.gwa_mode = TRUE;
 
151
  }
 
152
  else if (gl_only->value())
 
153
  {
 
154
    guix_info.no_normal = TRUE;
 
155
  }
 
156
  else if (both->value())
 
157
  {
 
158
    guix_info.force_normal = TRUE;
 
159
  }
 
160
}
 
161
 
 
162
 
 
163
void Guix_BuildMode::LockOut(boolean_g lock_it)
 
164
{
 
165
  if (lock_it)
 
166
  {
 
167
    gwa->set_output();
 
168
    maybe_normal->set_output();
 
169
    both->set_output();
 
170
    gl_only->set_output();
 
171
  }
 
172
  else
 
173
  {
 
174
    gwa->clear_output();
 
175
    maybe_normal->clear_output();
 
176
    both->clear_output();
 
177
    gl_only->clear_output();
 
178
  }
 
179
}
 
180
 
 
181
 
 
182
//------------------------------------------------------------------------
 
183
 
 
184
 
 
185
static void misc_opts_check_CB(Fl_Widget *w, void *data)
 
186
{
 
187
  guix_win->misc_opts->WriteInfo();
 
188
}
 
189
 
 
190
 
 
191
//
 
192
// MiscOptions Constructor
 
193
//
 
194
Guix_MiscOptions::Guix_MiscOptions(int x, int y, int w, int h) :
 
195
    Fl_Group(x, y, w, h, "Misc Options")
 
196
{
 
197
  // cancel the automatic 'begin' in Fl_Group constructor
 
198
  end();
 
199
  
 
200
  box(FL_THIN_UP_BOX);
 
201
  resizable(0);  // no resizing the kiddies, please
 
202
 
 
203
  labelfont(FL_HELVETICA | FL_BOLD);
 
204
  labeltype(FL_NORMAL_LABEL);
 
205
  align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT | FL_ALIGN_TOP);
 
206
 
 
207
  // create children
 
208
 
 
209
  int CX = x+12;
 
210
  int CY = y+20;
 
211
 
 
212
  warnings = new Fl_Check_Button(CX, CY, 22, 22, "Extra Warnings");
 
213
  warnings->down_box(FL_DOWN_BOX);
 
214
  warnings->align(FL_ALIGN_RIGHT);
 
215
  warnings->callback((Fl_Callback *) misc_opts_check_CB);
 
216
  add(warnings);
 
217
 
 
218
  CY += 24;
 
219
 
 
220
  no_reject = new Fl_Check_Button(CX, CY, 22, 22, "Don't clobber REJECT");
 
221
  no_reject->down_box(FL_DOWN_BOX);
 
222
  no_reject->align(FL_ALIGN_RIGHT);
 
223
  no_reject->callback((Fl_Callback *) misc_opts_check_CB);
 
224
  add(no_reject);
 
225
 
 
226
  CY += 24;
 
227
 
 
228
  pack_sides = new Fl_Check_Button(CX, CY, 22, 22, "Pack Sidedefs");
 
229
  pack_sides->down_box(FL_DOWN_BOX);
 
230
  pack_sides->align(FL_ALIGN_RIGHT);
 
231
  pack_sides->callback((Fl_Callback *) misc_opts_check_CB);
 
232
  add(pack_sides);
 
233
 
 
234
  CY += 24;
 
235
 
 
236
  choose_fresh = new Fl_Check_Button(CX, CY, 22, 22, "Fresh Partition Lines");
 
237
  choose_fresh->down_box(FL_DOWN_BOX);
 
238
  choose_fresh->align(FL_ALIGN_RIGHT);
 
239
  choose_fresh->callback((Fl_Callback *) misc_opts_check_CB);
 
240
  add(choose_fresh);
 
241
 
 
242
  CY += 24;
 
243
 
 
244
  ReadInfo();
 
245
}
 
246
 
 
247
 
 
248
//
 
249
// MiscOptions Destructor
 
250
//
 
251
Guix_MiscOptions::~Guix_MiscOptions()
 
252
{
 
253
  WriteInfo();
 
254
}
 
255
 
 
256
 
 
257
void Guix_MiscOptions::ReadInfo()
 
258
{
 
259
  choose_fresh->value(guix_info.fast ? 0 : 1);  // API change
 
260
  choose_fresh->redraw();
 
261
 
 
262
  warnings->value(guix_info.mini_warnings ? 1 : 0);
 
263
  warnings->redraw();
 
264
 
 
265
  no_reject->value(guix_info.no_reject ? 1 : 0);
 
266
  no_reject->redraw();
 
267
 
 
268
  pack_sides->value(guix_info.pack_sides ? 1 : 0);
 
269
  pack_sides->redraw();
 
270
 
 
271
  GWA_Changed();
 
272
}
 
273
 
 
274
 
 
275
void Guix_MiscOptions::WriteInfo()
 
276
{
 
277
  guix_info.fast = choose_fresh->value() ? FALSE : TRUE;  // API change
 
278
  guix_info.no_reject = no_reject->value() ? TRUE : FALSE;
 
279
  guix_info.mini_warnings = warnings->value() ? TRUE : FALSE;
 
280
  guix_info.pack_sides = pack_sides->value() ? TRUE : FALSE;
 
281
}
 
282
 
 
283
 
 
284
void Guix_MiscOptions::GWA_Changed()
 
285
{
 
286
  if (guix_info.gwa_mode)
 
287
  {
 
288
    no_reject->deactivate();
 
289
    pack_sides->deactivate();
 
290
  }
 
291
  else
 
292
  {
 
293
    no_reject->activate();
 
294
    pack_sides->activate();
 
295
  }
 
296
 
 
297
  if (guix_info.force_normal)
 
298
    choose_fresh->deactivate();
 
299
  else
 
300
    choose_fresh->activate();
 
301
}
 
302
 
 
303
 
 
304
void Guix_MiscOptions::LockOut(boolean_g lock_it)
 
305
{
 
306
  if (lock_it)
 
307
  {
 
308
    choose_fresh->set_output();
 
309
    warnings->set_output();
 
310
    no_reject->set_output();
 
311
    pack_sides->set_output();
 
312
  }
 
313
  else
 
314
  {
 
315
    choose_fresh->clear_output();
 
316
    warnings->clear_output();
 
317
    no_reject->clear_output();
 
318
    pack_sides->clear_output();
 
319
  }
 
320