(Temporarily) set "animate" to "none" by default (broken feature).
[gf1.git] / setup_win.cxx
blob8319187c14d6f56da692a9cae710f70f376a4ba7
1 /*
2 ** $Id$
3 **
4 ** contains everything concerning the setupwindow
5 ** also includes reading and writing from the configuration-file
6 */
7 /*
8 ** Copyright (C) 1998 Kurt Van den Branden
9 **
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.
14 **
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.
19 **
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"
26 #include "gipf_ui.H"
27 #include "configfile.h"
30 ** returns:
31 ** 1: user pressed OK, values may be changed
32 ** 0: user pressed CANCEL, no values changed
34 int show_setup (configvalues * config)
36 Fl_Window * setupw;
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)
45 case 1:
46 level1->setonly();
47 break;
48 case 2:
49 level2->setonly();
50 break;
51 case 3:
52 level3->setonly();
53 break;
54 case 4:
55 level4->setonly();
56 break;
57 case 5:
58 level5->setonly();
59 break;
60 case 6:
61 level6->setonly();
62 break;
63 case 7:
64 level7->setonly();
65 break;
66 case 8:
67 level8->setonly();
68 break;
71 switch (config->animate)
73 case 0:
74 ani_none->setonly();
75 break;
76 case 1:
77 ani_slow->setonly();
78 break;
79 case 2:
80 ani_medium->setonly();
81 break;
82 case 3:
83 ani_fast->setonly();
84 break;
87 setupw->show();
89 while (1)
91 Fl::wait();
93 Fl_Widget *x;
94 while ((x = Fl::readqueue()))
96 if (x == setup_ok)
98 /* get values */
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;
117 delete setupw;
118 return (1);
120 else if (x == setup_cancel)
122 delete setupw;
123 return (0);
128 return(0);
132 void retrieveconfig (configvalues * config)
134 config->configlist = readconfigfile ("gf1.cfg");
136 config->searchdepth = findconfigvalue (config->configlist, "searchdepth",
137 ' ', 3);
138 config->animate = findconfigvalue (config->configlist, "animate", ' ', 0);
139 config->waitcomputer = findconfigvalue (config->configlist,
140 "waitcomputer", ' ', 2);
141 config->waitremove = findconfigvalue (config->configlist, "waitremove",
142 ' ', 3);
143 config->showposname = findconfigvalue (config->configlist, "showposname",
144 ' ', 1);
145 return;
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);
159 return;