Преглед на файлове

Fix 2 instances of setChecked(TRUE) in previous commit which should have been setChecked(FALSE).
Clean up import/export code (remove redundant ifs for boolean variables and stop using the now useless ExportCheckbox macro).
Implement export in ProgramOptions.
Make Im/ExportSettings automatically call the Import/Export method in ProgramOptions and move ProgramOptions allocation/deletion accordingly.
Use isChecked rather than isOn.
Set proper maximum length for variable names and input mask for MIN_AMS.
Use the argument of the toggled slot.
Handle enabling/disabling the MIN_AMS textbox according to the checkbox.


git-svn-id: file:///var/svn/tigccpp/trunk@514 9552661e-59e3-4036-b4f2-dbe53926924f

kevinkofler преди 18 години
родител
ревизия
493da2c33a
променени са 4 файла, в които са добавени 349 реда и са изтрити 286 реда
  1. 208 173
      ktigcc/programoptions.ui
  2. 77 25
      ktigcc/programoptions.ui.h
  3. 12 6
      ktigcc/projectoptions.ui
  4. 52 82
      ktigcc/projectoptions.ui.h

+ 208 - 173
ktigcc/programoptions.ui

@@ -368,192 +368,217 @@
                 <attribute name="title">
                     <string>Operating &amp;System</string>
                 </attribute>
-                <vbox>
+                <widget class="QLabel">
                     <property name="name">
-                        <cstring>unnamed</cstring>
+                        <cstring>textLabel4</cstring>
                     </property>
-                    <widget class="QLabel">
-                        <property name="name">
-                            <cstring>textLabel4</cstring>
-                        </property>
-                        <property name="text">
-                            <string>You also have to select the operating system it will run under.</string>
-                        </property>
-                        <property name="textFormat">
-                            <enum>PlainText</enum>
-                        </property>
-                        <property name="alignment">
-                            <set>WordBreak|AlignVCenter</set>
-                        </property>
-                    </widget>
-                    <widget class="QLayoutWidget">
+                    <property name="geometry">
+                        <rect>
+                            <x>11</x>
+                            <y>11</y>
+                            <width>425</width>
+                            <height>16</height>
+                        </rect>
+                    </property>
+                    <property name="text">
+                        <string>You also have to select the operating system it will run under.</string>
+                    </property>
+                    <property name="textFormat">
+                        <enum>PlainText</enum>
+                    </property>
+                    <property name="alignment">
+                        <set>WordBreak|AlignVCenter</set>
+                    </property>
+                </widget>
+                <widget class="QLayoutWidget">
+                    <property name="name">
+                        <cstring>layout18</cstring>
+                    </property>
+                    <property name="geometry">
+                        <rect>
+                            <x>11</x>
+                            <y>33</y>
+                            <width>425</width>
+                            <height>203</height>
+                        </rect>
+                    </property>
+                    <hbox>
                         <property name="name">
-                            <cstring>layout18</cstring>
+                            <cstring>unnamed</cstring>
                         </property>
-                        <hbox>
+                        <spacer>
                             <property name="name">
-                                <cstring>unnamed</cstring>
+                                <cstring>spacer60</cstring>
                             </property>
-                            <spacer>
-                                <property name="name">
-                                    <cstring>spacer60</cstring>
-                                </property>
-                                <property name="orientation">
-                                    <enum>Horizontal</enum>
-                                </property>
-                                <property name="sizeType">
-                                    <enum>Fixed</enum>
-                                </property>
-                                <property name="sizeHint">
-                                    <size>
-                                        <width>20</width>
-                                        <height>20</height>
-                                    </size>
-                                </property>
-                            </spacer>
-                            <widget class="QButtonGroup">
+                            <property name="orientation">
+                                <enum>Horizontal</enum>
+                            </property>
+                            <property name="sizeType">
+                                <enum>Fixed</enum>
+                            </property>
+                            <property name="sizeHint">
+                                <size>
+                                    <width>20</width>
+                                    <height>20</height>
+                                </size>
+                            </property>
+                        </spacer>
+                        <widget class="QButtonGroup">
+                            <property name="name">
+                                <cstring>buttonGroup5</cstring>
+                            </property>
+                            <property name="frameShape">
+                                <enum>NoFrame</enum>
+                            </property>
+                            <property name="frameShadow">
+                                <enum>Plain</enum>
+                            </property>
+                            <property name="title">
+                                <string></string>
+                            </property>
+                            <vbox>
                                 <property name="name">
-                                    <cstring>buttonGroup5</cstring>
-                                </property>
-                                <property name="frameShape">
-                                    <enum>NoFrame</enum>
+                                    <cstring>unnamed</cstring>
                                 </property>
-                                <property name="frameShadow">
-                                    <enum>Plain</enum>
-                                </property>
-                                <property name="title">
-                                    <string></string>
-                                </property>
-                                <vbox>
+                                <widget class="QRadioButton">
                                     <property name="name">
-                                        <cstring>unnamed</cstring>
+                                        <cstring>AnyNoKernel</cstring>
                                     </property>
-                                    <widget class="QRadioButton">
-                                        <property name="name">
-                                            <cstring>AnyNoKernel</cstring>
-                                        </property>
-                                        <property name="text">
-                                            <string>Any/no &amp;kernel</string>
-                                        </property>
-                                        <property name="accel">
-                                            <string>Alt+K</string>
-                                        </property>
-                                    </widget>
-                                    <widget class="QRadioButton">
-                                        <property name="name">
-                                            <cstring>RecentDoorsCompatibleKernels</cstring>
-                                        </property>
-                                        <property name="text">
-                                            <string>Recent &amp;Doors-compatible kernels</string>
-                                        </property>
-                                        <property name="accel">
-                                            <string>Alt+D</string>
-                                        </property>
-                                    </widget>
-                                    <widget class="QRadioButton">
-                                        <property name="name">
-                                            <cstring>PreOS</cstring>
-                                        </property>
-                                        <property name="text">
-                                            <string>&amp;PreOS with compressed reloc table support</string>
-                                        </property>
-                                        <property name="accel">
-                                            <string>Alt+P</string>
-                                        </property>
-                                    </widget>
-                                    <spacer>
-                                        <property name="name">
-                                            <cstring>spacer58</cstring>
-                                        </property>
-                                        <property name="orientation">
-                                            <enum>Vertical</enum>
-                                        </property>
-                                        <property name="sizeType">
-                                            <enum>Fixed</enum>
-                                        </property>
-                                        <property name="sizeHint">
-                                            <size>
-                                                <width>20</width>
-                                                <height>20</height>
-                                            </size>
-                                        </property>
-                                    </spacer>
-                                    <widget class="QLayoutWidget">
+                                    <property name="text">
+                                        <string>Any/no &amp;kernel</string>
+                                    </property>
+                                    <property name="accel">
+                                        <string>Alt+K</string>
+                                    </property>
+                                </widget>
+                                <widget class="QRadioButton">
+                                    <property name="name">
+                                        <cstring>RecentDoorsCompatibleKernels</cstring>
+                                    </property>
+                                    <property name="text">
+                                        <string>Recent &amp;Doors-compatible kernels</string>
+                                    </property>
+                                    <property name="accel">
+                                        <string>Alt+D</string>
+                                    </property>
+                                </widget>
+                                <widget class="QRadioButton">
+                                    <property name="name">
+                                        <cstring>PreOS</cstring>
+                                    </property>
+                                    <property name="text">
+                                        <string>&amp;PreOS with compressed reloc table support</string>
+                                    </property>
+                                    <property name="accel">
+                                        <string>Alt+P</string>
+                                    </property>
+                                </widget>
+                                <spacer>
+                                    <property name="name">
+                                        <cstring>spacer58</cstring>
+                                    </property>
+                                    <property name="orientation">
+                                        <enum>Vertical</enum>
+                                    </property>
+                                    <property name="sizeType">
+                                        <enum>Fixed</enum>
+                                    </property>
+                                    <property name="sizeHint">
+                                        <size>
+                                            <width>20</width>
+                                            <height>20</height>
+                                        </size>
+                                    </property>
+                                </spacer>
+                                <widget class="QLayoutWidget">
+                                    <property name="name">
+                                        <cstring>layout60</cstring>
+                                    </property>
+                                    <hbox>
                                         <property name="name">
-                                            <cstring>layout60</cstring>
+                                            <cstring>unnamed</cstring>
                                         </property>
-                                        <hbox>
+                                        <widget class="QCheckBox">
                                             <property name="name">
-                                                <cstring>unnamed</cstring>
+                                                <cstring>CMinimumAMSVersion</cstring>
                                             </property>
-                                            <widget class="QCheckBox">
-                                                <property name="name">
-                                                    <cstring>CMinimumAMSVersion</cstring>
-                                                </property>
-                                                <property name="text">
-                                                    <string>&amp;Minimum AMS version:</string>
-                                                </property>
-                                                <property name="accel">
-                                                    <string>Alt+M</string>
-                                                </property>
-                                            </widget>
-                                            <widget class="KLineEdit">
-                                                <property name="name">
-                                                    <cstring>MinimumAMSVersion</cstring>
-                                                </property>
-                                            </widget>
-                                        </hbox>
-                                    </widget>
-                                    <spacer>
-                                        <property name="name">
-                                            <cstring>spacer59</cstring>
-                                        </property>
-                                        <property name="orientation">
-                                            <enum>Vertical</enum>
-                                        </property>
-                                        <property name="sizeType">
-                                            <enum>Fixed</enum>
-                                        </property>
-                                        <property name="sizeHint">
-                                            <size>
-                                                <width>20</width>
-                                                <height>20</height>
-                                            </size>
-                                        </property>
-                                    </spacer>
-                                    <widget class="QCheckBox">
-                                        <property name="name">
-                                            <cstring>UnofficialOSSupport</cstring>
-                                        </property>
-                                        <property name="text">
-                                            <string>&amp;Force unofficial operating system support</string>
-                                        </property>
-                                        <property name="accel">
-                                            <string>Alt+F</string>
-                                        </property>
-                                    </widget>
-                                </vbox>
-                            </widget>
-                        </hbox>
-                    </widget>
-                    <spacer>
-                        <property name="name">
-                            <cstring>spacer61</cstring>
-                        </property>
-                        <property name="orientation">
-                            <enum>Vertical</enum>
-                        </property>
-                        <property name="sizeType">
-                            <enum>Expanding</enum>
-                        </property>
-                        <property name="sizeHint">
-                            <size>
-                                <width>20</width>
-                                <height>267</height>
-                            </size>
-                        </property>
-                    </spacer>
-                </vbox>
+                                            <property name="text">
+                                                <string>&amp;Minimum AMS version:</string>
+                                            </property>
+                                            <property name="accel">
+                                                <string>Alt+M</string>
+                                            </property>
+                                        </widget>
+                                        <widget class="KLineEdit">
+                                            <property name="name">
+                                                <cstring>MinimumAMSVersion</cstring>
+                                            </property>
+                                            <property name="text">
+                                                <string>.</string>
+                                            </property>
+                                            <property name="inputMask">
+                                                <string>9.99; </string>
+                                            </property>
+                                        </widget>
+                                    </hbox>
+                                </widget>
+                                <spacer>
+                                    <property name="name">
+                                        <cstring>spacer59</cstring>
+                                    </property>
+                                    <property name="orientation">
+                                        <enum>Vertical</enum>
+                                    </property>
+                                    <property name="sizeType">
+                                        <enum>Fixed</enum>
+                                    </property>
+                                    <property name="sizeHint">
+                                        <size>
+                                            <width>20</width>
+                                            <height>20</height>
+                                        </size>
+                                    </property>
+                                </spacer>
+                                <widget class="QCheckBox">
+                                    <property name="name">
+                                        <cstring>UnofficialOSSupport</cstring>
+                                    </property>
+                                    <property name="text">
+                                        <string>&amp;Force unofficial operating system support</string>
+                                    </property>
+                                    <property name="accel">
+                                        <string>Alt+F</string>
+                                    </property>
+                                </widget>
+                            </vbox>
+                        </widget>
+                    </hbox>
+                </widget>
+                <spacer>
+                    <property name="name">
+                        <cstring>spacer61</cstring>
+                    </property>
+                    <property name="orientation">
+                        <enum>Vertical</enum>
+                    </property>
+                    <property name="sizeType">
+                        <enum>Expanding</enum>
+                    </property>
+                    <property name="sizeHint">
+                        <size>
+                            <width>20</width>
+                            <height>280</height>
+                        </size>
+                    </property>
+                    <property name="geometry">
+                        <rect>
+                            <x>213</x>
+                            <y>242</y>
+                            <width>20</width>
+                            <height>280</height>
+                        </rect>
+                    </property>
+                </spacer>
             </widget>
             <widget class="QWidget">
                 <property name="name">
@@ -1489,13 +1514,23 @@
         <receiver>ProgramOptions</receiver>
         <slot>accept()</slot>
     </connection>
+    <connection>
+        <sender>CMinimumAMSVersion</sender>
+        <signal>toggled(bool)</signal>
+        <receiver>ProgramOptions</receiver>
+        <slot>CMinimumAMSVersion_toggled(bool)</slot>
+    </connection>
 </connections>
 <includes>
     <include location="local" impldecl="in implementation">programoptions.ui.h</include>
 </includes>
 <slots>
-    <slot>ImportSettings( void )</slot>
+    <slot>CMinimumAMSVersion_toggled(bool)</slot>
 </slots>
+<functions>
+    <function specifier="non virtual">ImportSettings()</function>
+    <function specifier="non virtual">ExportSettings()</function>
+</functions>
 <pixmapinproject/>
 <layoutdefaults spacing="6" margin="11"/>
 <includehints>

+ 77 - 25
ktigcc/programoptions.ui.h

@@ -36,17 +36,13 @@
 
 extern tprLibOpts libopts;
 
-void ProgramOptions::ImportSettings(void)
+void ProgramOptions::ImportSettings()
 {
   //Tab: Calculator
-  if (libopts.use_ti89)
-    TI89->setChecked(TRUE);
-  if (libopts.use_ti92p)
-    TI92Plus->setChecked(TRUE);
-  if (libopts.use_v200)
-    V200->setChecked(TRUE);
-  if (libopts.opt_calc_consts)
-    OptimizeCalcConsts->setChecked(TRUE);
+  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);
@@ -54,11 +50,10 @@ void ProgramOptions::ImportSettings(void)
     RecentDoorsCompatibleKernels->setChecked(TRUE);
   else
     AnyNoKernel->setChecked(TRUE);
-  if (libopts.use_minams)
-    CMinimumAMSVersion->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));
-  if (libopts.unofficial_os)
-    UnofficialOSSupport->setChecked(TRUE);
+  MinimumAMSVersion->setEnabled(libopts.use_minams);
+  UnofficialOSSupport->setChecked(libopts.unofficial_os);
   //Tab: Reloc Format
   if (libopts.reloc_format==RT_KERNEL)
     RelocKernel->setChecked(TRUE);
@@ -68,10 +63,8 @@ void ProgramOptions::ImportSettings(void)
     RelocMlink->setChecked(TRUE);
   else
     RelocAMS->setChecked(TRUE);
-  if (libopts.use_fline_jumps)
-    UseFLineJumps->setChecked(TRUE);
-  if (libopts.use_4b_fline_jumps)
-    Use4ByteFLineJumps->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)
@@ -82,10 +75,8 @@ void ProgramOptions::ImportSettings(void)
     ROMCallFLine->setChecked(TRUE);
   else
     ROMCallDirect->setChecked(TRUE);
-  if (libopts.opt_rom_calls)
-    OptimizeROMCalls->setChecked(TRUE);
-  if (libopts.use_internal_fline_emu)
-    UseInternalFLineEmulator->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);
@@ -106,8 +97,69 @@ void ProgramOptions::ImportSettings(void)
     HomeCustomValue->setChecked(TRUE);
   else
     HomeDone->setChecked(TRUE);
-  if (libopts.enable_error_return)
-    EnableReturningErrors->setChecked(TRUE);
-  if (libopts.save_screen)
-    SaveScreen->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=RecentDoorsCompatibleKernels->isChecked();
+  libopts.use_minams=CMinimumAMSVersion->isChecked();
+  QString minams=MinimumAMSVersion->text();
+  libopts.minams=minams.section('.',1,1).toUInt()*100+minams.section('.',2,2).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 (BSSDataCompressed->isChecked())
+    libopts.data_ref_format=RT_COMPRESSED;
+  else if (BSSDataMlink->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);
 }

+ 12 - 6
ktigcc/projectoptions.ui

@@ -248,6 +248,9 @@
                                                 <height>32767</height>
                                             </size>
                                         </property>
+                                        <property name="maxLength">
+                                            <number>8</number>
+                                        </property>
                                     </widget>
                                 </hbox>
                             </widget>
@@ -603,6 +606,9 @@
                                                 <height>32767</height>
                                             </size>
                                         </property>
+                                        <property name="maxLength">
+                                            <number>8</number>
+                                        </property>
                                     </widget>
                                 </hbox>
                             </widget>
@@ -1584,19 +1590,19 @@
         <sender>RegularProgram</sender>
         <signal>toggled(bool)</signal>
         <receiver>ProjectOptions</receiver>
-        <slot>RegularProgramToggle()</slot>
+        <slot>CompressProgram_toggled(bool)</slot>
     </connection>
     <connection>
         <sender>ExternalDataVariable</sender>
         <signal>toggled(bool)</signal>
         <receiver>ProjectOptions</receiver>
-        <slot>ExternalDataVariableToggle()</slot>
+        <slot>ExternalDataVariable_toggled(bool)</slot>
     </connection>
     <connection>
         <sender>CompressProgram</sender>
         <signal>toggled(bool)</signal>
         <receiver>ProjectOptions</receiver>
-        <slot>CompressProgramToggle()</slot>
+        <slot>CompressProgram_toggled(bool)</slot>
     </connection>
     <connection>
         <sender>OncalcVariableName_1</sender>
@@ -1633,9 +1639,9 @@
     <include location="local" impldecl="in implementation">projectoptions.ui.h</include>
 </includes>
 <slots>
-    <slot>RegularProgramToggle()</slot>
-    <slot>ExternalDataVariableToggle()</slot>
-    <slot>CompressProgramToggle()</slot>
+    <slot>RegularProgram_toggled( bool state )</slot>
+    <slot>ExternalDataVariable_toggled( bool state )</slot>
+    <slot>CompressProgram_toggled( bool state )</slot>
     <slot>CheckOncalcNames()</slot>
     <slot>UpdateVisibilities()</slot>
     <slot>ProgramOptionsFunc()</slot>

+ 52 - 82
ktigcc/projectoptions.ui.h

@@ -44,11 +44,10 @@ ProgramOptions *programoptions;
 
 void ProjectOptions::init()
 {
+  //Create the Program Options dialog
+  programoptions=new ProgramOptions(this);
   //Toggle controls to match settings.
   ImportSettings();
-  //Create the Program Options dialog and toggle its controls
-  programoptions=new ProgramOptions(this);
-  programoptions->ImportSettings();
   //Update stuff
   CheckOncalcNames();
   UpdateVisibilities();
@@ -56,11 +55,10 @@ void ProjectOptions::init()
 
 void ProjectOptions::destroy()
 {
-  delete(programoptions);
-  if (result()!=QDialog::Accepted)
-    return;
   //Save settings
-  ExportSettings();
+  if (result()==QDialog::Accepted)
+    ExportSettings();
+  delete(programoptions);
 }
 
 void ProjectOptions::ImportSettings(void)
@@ -111,45 +109,27 @@ void ProjectOptions::ImportSettings(void)
   GCCSwitches->setText(settings.cc_switches);
   AsSwitches->setText(settings.as_switches);
   A68kSwitches->setText(settings.a68k_switches);
-  if (settings.debug_info)
-    GenerateDebugInformation->setChecked(TRUE);
+  GenerateDebugInformation->setChecked(settings.debug_info);
   //Tab: Linking
-  if (settings.optimize_nops)
-    NOPs->setChecked(TRUE);
-  if (settings.optimize_returns)
-    ReturnSequences->setChecked(TRUE);
-  if (settings.optimize_branches)
-    Branches->setChecked(TRUE);
-  if (settings.optimize_moves)
-    MoveLoadPushInstructions->setChecked(TRUE);
-  if (settings.optimize_tests)
-    TestCompareInstructions->setChecked(TRUE);
-  if (settings.optimize_calcs)
-    CalculationInstructions->setChecked(TRUE);
-  if (settings.remove_unused)
-    RemoveUnusedSections->setChecked(TRUE);
-  if (settings.reorder_sections)
-    ReorderSections->setChecked(TRUE);
-  if (settings.cut_ranges)
-    CutUnusedRanges->setChecked(TRUE);
-  if (settings.merge_constants)
-    MergeConstants->setChecked(TRUE);
-  if (settings.std_lib)
-    LinkAgainstStandardLibrary->setChecked(TRUE);
-  if (settings.initialize_bss)
-    InitializeBSSSection->setChecked(TRUE);
-  if (settings.outputbin)
-    OutputVariableImageWithoutWrapper->setChecked(TRUE);
+  NOPs->setChecked(settings.optimize_nops);
+  ReturnSequences->setChecked(settings.optimize_returns);
+  Branches->setChecked(settings.optimize_branches);
+  MoveLoadPushInstructions->setChecked(settings.optimize_moves);
+  TestCompareInstructions->setChecked(settings.optimize_tests);
+  CalculationInstructions->setChecked(settings.optimize_calcs);
+  RemoveUnusedSections->setChecked(settings.remove_unused);
+  ReorderSections->setChecked(settings.reorder_sections);
+  CutUnusedRanges->setChecked(settings.cut_ranges);
+  MergeConstants->setChecked(settings.merge_constants);
+  LinkAgainstStandardLibrary->setChecked(settings.std_lib);
+  InitializeBSSSection->setChecked(settings.initialize_bss);
+  OutputVariableImageWithoutWrapper->setChecked(settings.outputbin);
   //Tab: Post-Build
   CallAfterBuilding->setText(settings.post_build);
   Parameters->setText(settings.cmd_line);
+  programoptions->ImportSettings();
 }
 
-#define ExportCheckbox(checkwidget,settingvariable) if (checkwidget->isOn()) \
-settings.settingvariable=TRUE; \
-else \
-settings.settingvariable=FALSE;
-
 void ProjectOptions::ExportSettings(void)
 {
   //Tab: General
@@ -158,28 +138,28 @@ void ProjectOptions::ExportSettings(void)
   settings.archive=FALSE;
   settings.use_data_var=FALSE;
   settings.pack=FALSE;
-  if (FargoProgram->isOn())
+  if (FargoProgram->isChecked())
     settings.fargo=TRUE;
-  else if (FlashOperatingSystem->isOn())
+  else if (FlashOperatingSystem->isChecked())
     settings.flash_os=TRUE;
-  else if (FunctionArchive->isOn())
+  else if (FunctionArchive->isChecked())
     settings.archive=TRUE;
-  else if (RegularProgram->isOn()) //the original TIGCC IDE automatically unchecked External data variable and Compress program when you toggled away from Regular Program, so we will only consider these two if Regular Program is toggled
+  else if (RegularProgram->isChecked()) //the original TIGCC IDE automatically unchecked External data variable and Compress program when you toggled away from Regular Program, so we will only consider these two if Regular Program is toggled
   {
-    if (ExternalDataVariable->isOn())
+    if (ExternalDataVariable->isChecked())
       settings.use_data_var=TRUE;
-    if (CompressProgram->isOn())
+    if (CompressProgram->isChecked())
       settings.pack=TRUE;
   }
   //Subselections for External data variable and Compress program are always preserved.
   settings.data_var=OncalcVariableName_1->text();
   settings.copy_data_var_arc=FALSE;
-  if (CreateCopyNever->isOn())
+  if (CreateCopyNever->isChecked())
     settings.copy_data_var=FALSE;
   else
   {
     settings.copy_data_var=TRUE;
-    if (CreateCopyIfArchived->isOn())
+    if (CreateCopyIfArchived->isChecked())
       settings.copy_data_var_arc=TRUE;
   }
   settings.pack_name=OncalcVariableName_2->text();
@@ -187,51 +167,43 @@ void ProjectOptions::ExportSettings(void)
   settings.cc_switches=GCCSwitches->text();
   settings.as_switches=AsSwitches->text();
   settings.a68k_switches=A68kSwitches->text();
-  ExportCheckbox(GenerateDebugInformation,debug_info);
+  settings.debug_info=GenerateDebugInformation->isChecked();
   //Tab: Linking
-  ExportCheckbox(NOPs,optimize_nops);
-  ExportCheckbox(ReturnSequences,optimize_returns);
-  ExportCheckbox(Branches,optimize_branches);
-  ExportCheckbox(MoveLoadPushInstructions,optimize_moves);
-  ExportCheckbox(TestCompareInstructions,optimize_tests);
-  ExportCheckbox(CalculationInstructions,optimize_calcs);
-  ExportCheckbox(RemoveUnusedSections,remove_unused);
-  ExportCheckbox(ReorderSections,reorder_sections);
-  ExportCheckbox(CutUnusedRanges,cut_ranges);
-  ExportCheckbox(MergeConstants,merge_constants);
-  ExportCheckbox(LinkAgainstStandardLibrary,std_lib);
-  ExportCheckbox(InitializeBSSSection,initialize_bss);
-  ExportCheckbox(OutputVariableImageWithoutWrapper,outputbin);
+  settings.optimize_nops=NOPs->isChecked();
+  settings.optimize_returns=ReturnSequences->isChecked();
+  settings.optimize_branches=Branches->isChecked();
+  settings.optimize_moves=MoveLoadPushInstructions->isChecked();
+  settings.optimize_tests=TestCompareInstructions->isChecked();
+  settings.optimize_calcs=CalculationInstructions->isChecked();
+  settings.remove_unused=RemoveUnusedSections->isChecked();
+  settings.reorder_sections=ReorderSections->isChecked();
+  settings.cut_ranges=CutUnusedRanges->isChecked();
+  settings.merge_constants=MergeConstants->isChecked();
+  settings.std_lib=LinkAgainstStandardLibrary->isChecked();
+  settings.initialize_bss=InitializeBSSSection->isChecked();
+  settings.outputbin=OutputVariableImageWithoutWrapper->isChecked();
   //Tab: Post-Build
   settings.post_build=CallAfterBuilding->text();
   settings.cmd_line=Parameters->text();
+  programoptions->ExportSettings();
 }
-#undef ExportCheckbox
 
-void ProjectOptions::RegularProgramToggle()
+void ProjectOptions::RegularProgram_toggled(bool state)
 {
-  int state;
-  buttonOk->setAccel(0);
-  buttonOk->setText("OK");
-  state=RegularProgram->isOn()?TRUE:FALSE;
   if (!state)
   {
-    if (ExternalDataVariable->isOn())
-      ExternalDataVariable->setChecked(TRUE);
-    if (CompressProgram->isOn())
-      CompressProgram->setChecked(TRUE);
+    ExternalDataVariable->setChecked(FALSE);
+    CompressProgram->setChecked(FALSE);
+    ExternalDataVariable_toggled(FALSE);
+    CompressProgram_toggled(FALSE);
   }
   ExternalDataVariable->setEnabled(state);
   CompressProgram->setEnabled(state);
-  ExternalDataVariableToggle();
-  CompressProgramToggle();
 }
 
 
-void ProjectOptions::ExternalDataVariableToggle()
+void ProjectOptions::ExternalDataVariable_toggled(bool state)
 {
-  int state;
-  state=ExternalDataVariable->isOn()?TRUE:FALSE;
   LOncalcVariableName_1->setEnabled(state);
   OncalcVariableName_1->setEnabled(state);
   LCreateCopyNever->setEnabled(state);
@@ -242,10 +214,8 @@ void ProjectOptions::ExternalDataVariableToggle()
 }
 
 
-void ProjectOptions::CompressProgramToggle()
+void ProjectOptions::CompressProgram_toggled(bool state)
 {
-  int state;
-  state=CompressProgram->isOn()?TRUE:FALSE;
   LOncalcVariableName_2->setEnabled(state);
   OncalcVariableName_2->setEnabled(state);
   CheckOncalcNames();
@@ -267,8 +237,8 @@ void ProjectOptions::CheckOncalcNames()
 
 void ProjectOptions::UpdateVisibilities()
 {
-  Boolean regularprogram=RegularProgram->isOn();
-  Boolean functionarchive=FunctionArchive->isOn();
+  Boolean regularprogram=RegularProgram->isChecked();
+  Boolean functionarchive=FunctionArchive->isChecked();
   if (regularprogram)
     ProgramOptionsButton->show();
   else