-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprogramoptions.ui.h
316 lines (299 loc) · 11.5 KB
/
programoptions.ui.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** Qt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and
** destructor.
*****************************************************************************/
/*
ktigcc - TIGCC IDE for KDE
Copyright (C) 2004-2006 Kevin Kofler
Copyright (C) 2006 Joey Adams
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <qapplication.h>
#include <qevent.h>
#include <qeventloop.h>
#include <qtooltip.h>
#include "ktigcc.h"
#include "tpr.h"
#include "assistant.h"
void ProgramOptions::ImportSettings()
{
//Tab: Calculator
TI89->setChecked(libopts.use_ti89);
TI92Plus->setChecked(libopts.use_ti92p);
V200->setChecked(libopts.use_v200);
OptimizeCalcConsts->setChecked(libopts.opt_calc_consts);
//Tab: Operating System
if (libopts.use_preos)
PreOS->setChecked(TRUE);
else if (libopts.use_kernel)
UseKernel->setChecked(TRUE);
else
Nostub->setChecked(TRUE);
CMinimumAMSVersion->setChecked(libopts.use_minams);
MinimumAMSVersion->setText(QString("%1.%2%3").arg(libopts.minams/100).arg((libopts.minams/10)%10).arg(libopts.minams%10));
MinimumAMSVersion->setEnabled(libopts.use_minams);
UnofficialOSSupport->setChecked(libopts.unofficial_os);
//Tab: Reloc Format
if (libopts.reloc_format==RT_KERNEL)
RelocKernel->setChecked(TRUE);
else if (libopts.reloc_format==RT_COMPRESSED)
RelocCompressed->setChecked(TRUE);
else if (libopts.reloc_format==RT_MLINK)
RelocMlink->setChecked(TRUE);
else
RelocAMS->setChecked(TRUE);
UseFLineJumps->setChecked(libopts.use_fline_jumps);
Use4ByteFLineJumps->setChecked(libopts.use_4b_fline_jumps);
if (libopts.rom_call_format==RT_KERNEL)
ROMCallKernel->setChecked(TRUE);
else if (libopts.rom_call_format==RT_COMPRESSED)
ROMCallCompressed->setChecked(TRUE);
else if (libopts.rom_call_format==RT_MLINK)
ROMCallMlink->setChecked(TRUE);
else if (libopts.rom_call_format==RT_FLINE)
ROMCallFLine->setChecked(TRUE);
else
ROMCallDirect->setChecked(TRUE);
OptimizeROMCalls->setChecked(libopts.opt_rom_calls);
UseInternalFLineEmulator->setChecked(libopts.use_internal_fline_emu);
//Tab: BSS/Data Format
if (libopts.bss_ref_format==RT_KERNEL)
BSSKernel->setChecked(TRUE);
else if (libopts.bss_ref_format==RT_COMPRESSED)
BSSCompressed->setChecked(TRUE);
else if (libopts.bss_ref_format==RT_MLINK)
BSSMlink->setChecked(TRUE);
else
BSSMerge->setChecked(TRUE);
if (libopts.data_ref_format==RT_COMPRESSED)
DataVarCompressed->setChecked(TRUE);
else if (libopts.data_ref_format==RT_MLINK)
DataVarMlink->setChecked(TRUE);
else
DataVarKernel->setChecked(TRUE);
//Tab: Home Screen
if (libopts.use_return_value)
HomeCustomValue->setChecked(TRUE);
else
HomeDone->setChecked(TRUE);
EnableReturningErrors->setChecked(libopts.enable_error_return);
SaveScreen->setChecked(libopts.save_screen);
}
void ProgramOptions::ExportSettings()
{
//Tab: Calculator
libopts.use_ti89=TI89->isChecked();
libopts.use_ti92p=TI92Plus->isChecked();
libopts.use_v200=V200->isChecked();
libopts.opt_calc_consts=OptimizeCalcConsts->isChecked();
//Tab: Operating System
libopts.use_preos=PreOS->isChecked();
libopts.use_kernel=UseKernel->isChecked();
libopts.use_minams=CMinimumAMSVersion->isChecked();
QString minams=MinimumAMSVersion->text();
libopts.minams=minams.section('.',0,0).toUInt()*100+minams.section('.',1,1).toUInt();
libopts.unofficial_os=UnofficialOSSupport->isChecked();
//Tab: Reloc Format
if (RelocKernel->isChecked())
libopts.reloc_format=RT_KERNEL;
else if (RelocCompressed->isChecked())
libopts.reloc_format=RT_COMPRESSED;
else if (RelocMlink->isChecked())
libopts.reloc_format=RT_MLINK;
else
libopts.reloc_format=RT_AMS;
libopts.use_fline_jumps=UseFLineJumps->isChecked();
libopts.use_4b_fline_jumps=Use4ByteFLineJumps->isChecked();
if (ROMCallKernel->isChecked())
libopts.rom_call_format=RT_KERNEL;
else if (ROMCallCompressed->isChecked())
libopts.rom_call_format=RT_COMPRESSED;
else if (ROMCallMlink->isChecked())
libopts.rom_call_format=RT_MLINK;
else if (ROMCallFLine->isChecked())
libopts.rom_call_format=RT_FLINE;
else
libopts.rom_call_format=RT_DIRECT;
libopts.opt_rom_calls=OptimizeROMCalls->isChecked();
libopts.use_internal_fline_emu=UseInternalFLineEmulator->isChecked();
//Tab: BSS/Data Format
if (BSSKernel->isChecked())
libopts.bss_ref_format=RT_KERNEL;
else if (BSSCompressed->isChecked())
libopts.bss_ref_format=RT_COMPRESSED;
else if (BSSMlink->isChecked())
libopts.bss_ref_format=RT_MLINK;
else
libopts.bss_ref_format=RT_NONE;
if (DataVarCompressed->isChecked())
libopts.data_ref_format=RT_COMPRESSED;
else if (DataVarMlink->isChecked())
libopts.data_ref_format=RT_MLINK;
else
libopts.data_ref_format=RT_KERNEL;
//Tab: Home Screen
libopts.use_return_value=HomeCustomValue->isChecked();
libopts.enable_error_return=EnableReturningErrors->isChecked();
libopts.save_screen=SaveScreen->isChecked();
}
void ProgramOptions::CMinimumAMSVersion_toggled(bool on)
{
MinimumAMSVersion->setEnabled(on);
}
#define on_unused on __attribute__((unused))
void ProgramOptions::CalcCheckbox_toggled(bool on_unused)
{
static bool inEvent=FALSE;
if (!inEvent) {
inEvent=TRUE;
unsigned numCalcs=TI89->isChecked()+TI92Plus->isChecked()+V200->isChecked();
// OPTIMIZE_CALC_CONSTS makes no sense for only 1 calculator (calculator
// constants are already optimized for that calculator at compile-time in
// that case, no need to do it at link time).
// Moreover, we can't enable it for old projects (no calculator checked,
// calculators selected through int _ti89 and such in the code).
OptimizeCalcConsts->setEnabled(numCalcs>=2);
if (numCalcs<2) OptimizeCalcConsts->setChecked(numCalcs);
inEvent=FALSE;
}
}
void ProgramOptions::KernelRadiobutton_toggled(bool on_unused)
{
static bool inEvent=FALSE;
if (!inEvent) {
inEvent=TRUE;
bool nostub=Nostub->isChecked();
bool kernel=UseKernel->isChecked();
bool preos=PreOS->isChecked();
// SAVE_SCREEN is currently always on in kernel mode.
SaveScreen->setEnabled(nostub);
if (!nostub) SaveScreen->setChecked(TRUE);
if (kernel) {
// Kernel mode, enable kernel reloc types.
RelocKernel->setEnabled(TRUE);
ROMCallKernel->setEnabled(TRUE);
BSSKernel->setEnabled(TRUE);
// Default to them if an unsupported reloc type was selected.
if (RelocAMS->isChecked() || RelocCompressed->isChecked()
|| RelocMlink->isChecked())
RelocKernel->setChecked(TRUE);
if (ROMCallDirect->isChecked() || ROMCallCompressed->isChecked()
|| ROMCallMlink->isChecked())
ROMCallKernel->setChecked(TRUE);
if (BSSCompressed->isChecked() || BSSMlink->isChecked())
BSSKernel->setChecked(TRUE);
// Now disable the unsupported types.
RelocAMS->setEnabled(FALSE);
RelocCompressed->setEnabled(FALSE);
RelocMlink->setEnabled(FALSE);
ROMCallDirect->setEnabled(FALSE);
ROMCallCompressed->setEnabled(FALSE);
ROMCallMlink->setEnabled(FALSE);
BSSCompressed->setEnabled(FALSE);
BSSMlink->setEnabled(FALSE);
} else if (preos) {
// Kernel with compressed reloc tables mode, enable compressed reloc types.
RelocCompressed->setEnabled(TRUE);
ROMCallCompressed->setEnabled(TRUE);
BSSCompressed->setEnabled(TRUE);
// Default to them if an unsupported reloc type was selected.
if (RelocAMS->isChecked() || RelocKernel->isChecked()
|| RelocMlink->isChecked())
RelocCompressed->setChecked(TRUE);
if (ROMCallDirect->isChecked() || ROMCallKernel->isChecked()
|| ROMCallMlink->isChecked())
ROMCallCompressed->setChecked(TRUE);
if (BSSKernel->isChecked() || BSSMlink->isChecked())
BSSCompressed->setChecked(TRUE);
// Now disable the unsupported types.
RelocAMS->setEnabled(FALSE);
RelocKernel->setEnabled(FALSE);
RelocMlink->setEnabled(FALSE);
ROMCallDirect->setEnabled(FALSE);
ROMCallKernel->setEnabled(FALSE);
ROMCallMlink->setEnabled(FALSE);
BSSKernel->setEnabled(FALSE);
BSSMlink->setEnabled(FALSE);
} else {
// In _nostub mode, all reloc types are allowed.
RelocAMS->setEnabled(TRUE);
RelocKernel->setEnabled(TRUE);
RelocCompressed->setEnabled(TRUE);
RelocMlink->setEnabled(TRUE);
ROMCallDirect->setEnabled(TRUE);
ROMCallKernel->setEnabled(TRUE);
ROMCallCompressed->setEnabled(TRUE);
ROMCallMlink->setEnabled(TRUE);
BSSKernel->setEnabled(TRUE);
BSSCompressed->setEnabled(TRUE);
BSSMlink->setEnabled(TRUE);
}
RelocSettings_toggled(0);
inEvent=FALSE;
}
}
void ProgramOptions::RelocSettings_toggled(bool on_unused)
{
static bool inEvent=FALSE;
if (!inEvent) {
inEvent=TRUE;
// 4-byte F-Line jumps only make sense if F-Line jumps are enabled
if (UseFLineJumps->isChecked())
Use4ByteFLineJumps->setEnabled(TRUE);
else {
Use4ByteFLineJumps->setEnabled(FALSE);
Use4ByteFLineJumps->setChecked(FALSE);
}
if (Use4ByteFLineJumps->isChecked()) {
// 4-byte F-Line jumps require the internal emulator
UseInternalFLineEmulator->setEnabled(FALSE);
UseInternalFLineEmulator->setChecked(TRUE);
} else if (UseFLineJumps->isChecked() || ROMCallFLine->isChecked()) {
// using F-Line instructions where the internal emulator can be used
UseInternalFLineEmulator->setEnabled(TRUE);
} else {
// no F-Line instructions to emulate, internally or otherwise
UseInternalFLineEmulator->setEnabled(FALSE);
UseInternalFLineEmulator->setChecked(FALSE);
}
// OPTIMIZE_ROM_CALLS only allowed with direct or F-Line ROM_CALLs in _nostub mode
if (Nostub->isChecked() && (ROMCallDirect->isChecked() || ROMCallFLine->isChecked()))
OptimizeROMCalls->setEnabled(TRUE);
else {
OptimizeROMCalls->setEnabled(FALSE);
OptimizeROMCalls->setChecked(FALSE);
}
inEvent=FALSE;
}
}
void ProgramOptions::mousePressEvent( QMouseEvent * e )
{
if (e->button()==Qt::RightButton) {
QWidget *widgetUnderCursor=childAt(e->pos());
if (!widgetUnderCursor) return;
QString toolTip=QToolTip::textFor(widgetUnderCursor, widgetUnderCursor->mapFromParent(e->pos()));
if (toolTip.isEmpty()) return;
QString docFile=lookup_doc_keyword(toolTip);
if (docFile.isEmpty()) return;
force_qt_assistant_page(1);
assistant->openAssistant(
QString(tigcc_base)+QString("/doc/html/")+docFile);
}
}