4 ** contains everything concerning the setupwindow
5 ** also includes reading and writing from the configuration-file
8 ** Copyright (C) 1998 Kurt Van den Branden
10 ** This program is free software; you can redistribute it and/or modify
11 ** it under the terms of the GNU General Public License as published by
12 ** the Free Software Foundation; either version 2 of the License, or
13 ** (at your option) any later version.
15 ** This program is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ** GNU General Public License for more details.
20 ** You should have received a copy of the GNU General Public License
21 ** along with this program; if not, write to the Free Software
22 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include "setup_win.h"
27 #include "configfile.h"
31 ** 1: user pressed OK, values may be changed
32 ** 0: user pressed CANCEL, no values changed
34 int show_setup (configvalues
* config
)
38 setupw
= make_setupwindow ();
39 slider_computer
->value ((double) config
->waitcomputer
);
40 slider_remove
->value ((double) config
->waitremove
);
41 check_posname
->value (config
->showposname
);
43 switch (config
->searchdepth
)
71 switch (config
->animate
)
80 ani_medium
->setonly();
94 while ((x
= Fl::readqueue()))
99 config
->waitcomputer
= (int) slider_computer
->value ();
100 config
->waitremove
= (int) slider_remove
->value ();
101 config
->showposname
= check_posname
->value ();
103 if (level1
->value()) config
->searchdepth
= 1;
104 else if (level2
->value()) config
->searchdepth
= 2;
105 else if (level3
->value()) config
->searchdepth
= 3;
106 else if (level4
->value()) config
->searchdepth
= 4;
107 else if (level5
->value()) config
->searchdepth
= 5;
108 else if (level6
->value()) config
->searchdepth
= 6;
109 else if (level7
->value()) config
->searchdepth
= 7;
110 else if (level8
->value()) config
->searchdepth
= 8;
112 if (ani_none
->value()) config
->animate
= 0;
113 else if (ani_slow
->value()) config
->animate
= 1;
114 else if (ani_medium
->value()) config
->animate
= 2;
115 else if (ani_fast
->value()) config
->animate
= 3;
120 else if (x
== setup_cancel
)
132 void retrieveconfig (configvalues
* config
)
134 config
->configlist
= readconfigfile ("gf1.cfg");
136 config
->searchdepth
= findconfigvalue (config
->configlist
, "searchdepth",
138 config
->animate
= findconfigvalue (config
->configlist
, "animate", ' ', 0);
139 config
->waitcomputer
= findconfigvalue (config
->configlist
,
140 "waitcomputer", ' ', 2);
141 config
->waitremove
= findconfigvalue (config
->configlist
, "waitremove",
143 config
->showposname
= findconfigvalue (config
->configlist
, "showposname",
148 void writeconfig (configvalues
* config
)
150 changeconfigvalue (config
->configlist
, "searchdepth", config
->searchdepth
);
151 changeconfigvalue (config
->configlist
, "animate", config
->animate
);
152 changeconfigvalue (config
->configlist
, "waitcomputer",
153 config
->waitcomputer
);
154 changeconfigvalue (config
->configlist
, "waitremove", config
->waitremove
);
155 changeconfigvalue (config
->configlist
, "showposname", config
->showposname
);
157 writeconfigfile ("gf1.cfg", config
->configlist
);