~ubuntu-branches/ubuntu/precise/glbsp/precise

« back to all changes in this revision

Viewing changes to fltk/prefs.cpp

  • 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
 
// PREFS : Unix/FLTK Preference Window
3
 
//------------------------------------------------------------------------
4
 
//
5
 
//  GL-Friendly Node Builder (C) 2000-2005 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
 
Guix_PrefWin *guix_pref_win;
26
 
 
27
 
 
28
 
static void prefs_quit_CB(Fl_Widget *w, void *data)
29
 
{
30
 
  if (guix_pref_win)
31
 
    guix_pref_win->want_quit = TRUE;
32
 
}
33
 
 
34
 
static void prefs_reset_all_CB(Fl_Widget *w, void *data)
35
 
{
36
 
  MainSetDefaults();
37
 
 
38
 
  if (guix_pref_win)
39
 
    guix_pref_win->PrefsChanged();
40
 
 
41
 
  guix_win->ReadAllInfo();
42
 
}
43
 
 
44
 
 
45
 
//------------------------------------------------------------------------
46
 
 
47
 
//
48
 
// PrefWin Constructor
49
 
//
50
 
Guix_PrefWin::Guix_PrefWin() : Fl_Window(480, 290, "glBSP Preferences")
51
 
{
52
 
  // cancel the automatic 'begin' in Fl_Group constructor
53
 
  end();
54
 
 
55
 
  // non-resizable window
56
 
  size_range(w(), h(), w(), h());
57
 
 
58
 
  position(guix_prefs.other_x, guix_prefs.other_y);
59
 
 
60
 
  want_quit = FALSE;
61
 
 
62
 
  // allow manual closing of window
63
 
  callback((Fl_Callback *) prefs_quit_CB);
64
 
  
65
 
  // create buttons in top row
66
 
 
67
 
  groups[0] = new Fl_Group(0, 0, w(), 110, "Pop-up dialog options:");
68
 
  groups[0]->box(FL_THIN_UP_BOX);
69
 
  groups[0]->resizable(0);
70
 
  groups[0]->labelfont(FL_HELVETICA | FL_BOLD);
71
 
  groups[0]->labeltype(FL_NORMAL_LABEL);
72
 
  groups[0]->align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT | FL_ALIGN_TOP);
73
 
  add(groups[0]);
74
 
 
75
 
  int CX = 20;
76
 
  int CY = 24;
77
 
   
78
 
  overwrite = new Fl_Check_Button(CX, CY, 22, 22,
79
 
      "Warn before overwriting files");
80
 
  overwrite->down_box(FL_DOWN_BOX);
81
 
  overwrite->align(FL_ALIGN_RIGHT);
82
 
  overwrite->value(guix_prefs.overwrite_warn ? 1 : 0);
83
 
  groups[0]->add(overwrite);
84
 
 
85
 
  CY += 22;
86
 
 
87
 
  same_file = new Fl_Check_Button(CX, CY, 22, 22,
88
 
      "Warn if Input and Output files are the same");
89
 
  same_file->down_box(FL_DOWN_BOX);
90
 
  same_file->align(FL_ALIGN_RIGHT);
91
 
  same_file->value(guix_prefs.same_file_warn ? 1 : 0);
92
 
  groups[0]->add(same_file);
93
 
 
94
 
  CY += 22;
95
 
 
96
 
  lack_ext = new Fl_Check_Button(CX, CY, 22, 22,
97
 
      "Warn about missing extensions (otherwise add the default)");
98
 
  lack_ext->down_box(FL_DOWN_BOX);
99
 
  lack_ext->align(FL_ALIGN_RIGHT);
100
 
  lack_ext->value(guix_prefs.lack_ext_warn ? 1 : 0);
101
 
  groups[0]->add(lack_ext);
102
 
 
103
 
  CY += 22;
104
 
 
105
 
  // create reset button
106
 
  
107
 
  groups[1] = new Fl_Group(0, 110, w(), 120);
108
 
  groups[1]->box(FL_THIN_UP_BOX);
109
 
  groups[1]->resizable(0);
110
 
  add(groups[1]);
111
 
 
112
 
  reset_all = new Fl_Button((w() - 240) / 2, 180, 240, 26,
113
 
      "Reset All To Defaults");
114
 
  reset_all->labelfont(FL_HELVETICA | FL_BOLD);
115
 
  reset_all->callback((Fl_Callback *) prefs_reset_all_CB);
116
 
  groups[1]->add(reset_all);
117
 
 
118
 
  Fl_Box *reset_txt = new Fl_Box(FL_FLAT_BOX, 20, 130, w() - 40, 46,
119
 
      "This button resets all user-changeable options to default "
120
 
      "values, including everything in the main window.");
121
 
 
122
 
  reset_txt->align(FL_ALIGN_LEFT | FL_ALIGN_TOP | 
123
 
      FL_ALIGN_INSIDE | FL_ALIGN_WRAP);
124
 
  groups[1]->add(reset_txt);
125
 
  
126
 
  // create quit button
127
 
  
128
 
  groups[2] = new Fl_Group(0, 230, w(), 60);
129
 
  groups[2]->box(FL_THIN_UP_BOX);
130
 
  groups[2]->resizable(0);
131
 
  add(groups[2]);
132
 
  
133
 
  quit = new Fl_Button(w() - 100, h() - 40, 80, 26, "Close");
134
 
  quit->callback((Fl_Callback *) prefs_quit_CB);
135
 
  groups[2]->add(quit);
136
 
 
137
 
  // show the window
138
 
  set_modal();
139
 
  show();
140
 
 
141
 
  // read initial pos (same logic as in Guix_MainWin)
142
 
  WindowSmallDelay();
143
 
  
144
 
  init_x = x(); init_y = y();
145
 
}
146
 
 
147
 
 
148
 
//
149
 
// PrefWin Destructor
150
 
//
151
 
Guix_PrefWin::~Guix_PrefWin()
152
 
{
153
 
  // write new preferences
154
 
  guix_prefs.overwrite_warn = overwrite->value() ? TRUE : FALSE;
155
 
  guix_prefs.same_file_warn = same_file->value() ? TRUE : FALSE;
156
 
  guix_prefs.lack_ext_warn  = lack_ext->value()  ? TRUE : FALSE;
157
 
 
158
 
  // update window_pos if user moved the window
159
 
  if (x() != init_x || y() != init_y)
160
 
  {
161
 
    guix_prefs.other_x = x();
162
 
    guix_prefs.other_y = y();
163
 
  }
164
 
}
165
 
 
166
 
 
167
 
void Guix_PrefWin::PrefsChanged()
168
 
{
169
 
  overwrite->value(guix_prefs.overwrite_warn ? 1 : 0);
170
 
  overwrite->redraw();
171
 
 
172
 
  same_file->value(guix_prefs.same_file_warn ? 1 : 0);
173
 
  same_file->redraw();
174
 
 
175
 
  lack_ext->value(guix_prefs.lack_ext_warn ? 1 : 0);
176
 
  lack_ext->redraw();
177
 
}
178