Browse Source

Gave all pages of both the Project Options and the Program Options the ability to read in settings, but not the ability to write them back.

NOTE: I've had KTIGCC crash after I close the Project Options dialog with this code, but I don't know what caused it, since it happens randomly.  (it says double free or memory corruption is the cause)


git-svn-id: file:///var/svn/tigccpp/trunk@506 9552661e-59e3-4036-b4f2-dbe53926924f
joeyadams 18 years ago
parent
commit
28660223d9
5 changed files with 268 additions and 35 deletions
  1. 1 1
      ktigcc/mainform.ui.h
  2. 109 2
      ktigcc/programoptions.ui
  3. 80 0
      ktigcc/programoptions.ui.h
  4. 2 0
      ktigcc/projectoptions.ui
  5. 76 32
      ktigcc/projectoptions.ui.h

+ 1 - 1
ktigcc/mainform.ui.h

@@ -219,7 +219,7 @@ static QPopupMenu *te_popup;
 static QAssistantClient *assistant;
 static int fileCount=0, hFileCount=0, cFileCount=0, sFileCount=0, asmFileCount=0, qllFileCount=0, oFileCount=0, aFileCount=0, txtFileCount=0, othFileCount=0;
 tprSettings settings; //static is turned off here so ProjectOptions can access it.
-static tprLibOpts libopts;
+tprLibOpts libopts; //static is turned off here so ProgramOptions can access it.
 static QString projectFileName;
 static QString lastDirectory;
 static QClipboard *clipboard;

+ 109 - 2
ktigcc/programoptions.ui

@@ -632,6 +632,14 @@
                                         <property name="name">
                                             <cstring>RelocAMS</cstring>
                                         </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>1</hsizetype>
+                                                <vsizetype>1</vsizetype>
+                                                <horstretch>0</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
                                         <property name="text">
                                             <string>AMS (large calls, &amp;no stub)</string>
                                         </property>
@@ -643,6 +651,14 @@
                                         <property name="name">
                                             <cstring>RelocKernel</cstring>
                                         </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>1</hsizetype>
+                                                <vsizetype>1</vsizetype>
+                                                <horstretch>0</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
                                         <property name="text">
                                             <string>&amp;Kernel (medium calls, medium stub)</string>
                                         </property>
@@ -654,6 +670,14 @@
                                         <property name="name">
                                             <cstring>RelocCompressed</cstring>
                                         </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>1</hsizetype>
+                                                <vsizetype>1</vsizetype>
+                                                <horstretch>0</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
                                         <property name="text">
                                             <string>C&amp;ompressed (smallest calls, large stub)</string>
                                         </property>
@@ -665,6 +689,14 @@
                                         <property name="name">
                                             <cstring>RelocMlink</cstring>
                                         </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>1</hsizetype>
+                                                <vsizetype>1</vsizetype>
+                                                <horstretch>0</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
                                         <property name="text">
                                             <string>&amp;Mlink (small calls, medium stub)</string>
                                         </property>
@@ -676,6 +708,14 @@
                                         <property name="name">
                                             <cstring>UseFLineJumps</cstring>
                                         </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>1</hsizetype>
+                                                <vsizetype>1</vsizetype>
+                                                <horstretch>0</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
                                         <property name="text">
                                             <string>&amp;F-Line (very small calls, no stub, but slow)</string>
                                         </property>
@@ -712,6 +752,14 @@
                                                 <property name="name">
                                                     <cstring>Use4ByteFLineJumps</cstring>
                                                 </property>
+                                                <property name="sizePolicy">
+                                                    <sizepolicy>
+                                                        <hsizetype>1</hsizetype>
+                                                        <vsizetype>1</vsizetype>
+                                                        <horstretch>0</horstretch>
+                                                        <verstretch>0</verstretch>
+                                                    </sizepolicy>
+                                                </property>
                                                 <property name="text">
                                                     <string>&amp;4-Byte F-Line (even smaller) (!)</string>
                                                 </property>
@@ -779,6 +827,14 @@
                                         <property name="name">
                                             <cstring>ROMCallDirect</cstring>
                                         </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>1</hsizetype>
+                                                <vsizetype>1</vsizetype>
+                                                <horstretch>0</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
                                         <property name="text">
                                             <string>&amp;Direct (large calls, no stub)</string>
                                         </property>
@@ -790,6 +846,14 @@
                                         <property name="name">
                                             <cstring>ROMCallKernel</cstring>
                                         </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>1</hsizetype>
+                                                <vsizetype>1</vsizetype>
+                                                <horstretch>0</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
                                         <property name="text">
                                             <string>K&amp;ernel (medium calls, medium stub)</string>
                                         </property>
@@ -801,6 +865,14 @@
                                         <property name="name">
                                             <cstring>ROMCallCompressed</cstring>
                                         </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>1</hsizetype>
+                                                <vsizetype>1</vsizetype>
+                                                <horstretch>0</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
                                         <property name="text">
                                             <string>Com&amp;pressed (smallest calls, large stub)</string>
                                         </property>
@@ -812,6 +884,14 @@
                                         <property name="name">
                                             <cstring>ROMCallMlink</cstring>
                                         </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>1</hsizetype>
+                                                <vsizetype>1</vsizetype>
+                                                <horstretch>0</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
                                         <property name="text">
                                             <string>Ml&amp;ink (small calls, medium stub)</string>
                                         </property>
@@ -823,6 +903,14 @@
                                         <property name="name">
                                             <cstring>ROMCallFLine</cstring>
                                         </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>1</hsizetype>
+                                                <vsizetype>1</vsizetype>
+                                                <horstretch>0</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
                                         <property name="text">
                                             <string>F-&amp;Line (very small calls, no stub, but slow)</string>
                                         </property>
@@ -834,6 +922,14 @@
                                         <property name="name">
                                             <cstring>OptimizeROMCalls</cstring>
                                         </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>1</hsizetype>
+                                                <vsizetype>1</vsizetype>
+                                                <horstretch>0</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
                                         <property name="text">
                                             <string>Op&amp;timized (medium calls, very small stub) (!)</string>
                                         </property>
@@ -847,7 +943,15 @@
                     </widget>
                     <widget class="QCheckBox">
                         <property name="name">
-                            <cstring>checkBox10</cstring>
+                            <cstring>UseInternalFLineEmulator</cstring>
+                        </property>
+                        <property name="sizePolicy">
+                            <sizepolicy>
+                                <hsizetype>1</hsizetype>
+                                <vsizetype>1</vsizetype>
+                                <horstretch>0</horstretch>
+                                <verstretch>0</verstretch>
+                            </sizepolicy>
                         </property>
                         <property name="text">
                             <string>&amp;Use internal F-Line emulator</string>
@@ -1337,7 +1441,7 @@
                         <string></string>
                     </property>
                     <property name="iconSet">
-                        <iconset></iconset>
+                        <iconset>whatsthis.png</iconset>
                     </property>
                 </widget>
                 <spacer>
@@ -1392,6 +1496,9 @@
 <includes>
     <include location="local" impldecl="in implementation">programoptions.ui.h</include>
 </includes>
+<slots>
+    <slot>ImportSettings( void )</slot>
+</slots>
 <pixmapinproject/>
 <layoutdefaults spacing="6" margin="11"/>
 </UI>

+ 80 - 0
ktigcc/programoptions.ui.h

@@ -10,3 +10,83 @@
 ** destructor.
 *****************************************************************************/
 
+#include <kurl.h>
+#include "tpr.h" //tpr.h relies on kurl.h
+
+extern tprLibOpts libopts;
+
+void ProgramOptions::ImportSettings(void)
+{
+  //Tab: Calculator
+  if (libopts.use_ti89)
+    TI89->toggle();
+  if (libopts.use_ti92p)
+    TI92Plus->toggle();
+  if (libopts.use_v200)
+    V200->toggle();
+  if (libopts.opt_calc_consts)
+    OptimizeCalcConsts->toggle();
+  //Tab: Operating System
+  if (libopts.use_preos)
+    PreOS->toggle();
+  else if (libopts.use_kernel)
+    RecentDoorsCompatibleKernels->toggle();
+  else
+    AnyNoKernel->toggle();
+  if (libopts.use_minams)
+    CMinimumAMSVersion->toggle();
+  MinimumAMSVersion->setText(QString("%1.%2").arg(libopts.minams/100).arg(libopts.minams%100));
+  if (libopts.unofficial_os)
+    UnofficialOSSupport->toggle();
+  //Tab: Reloc Format
+  if (libopts.reloc_format==RT_KERNEL)
+    RelocKernel->toggle();
+  else if (libopts.reloc_format==RT_COMPRESSED)
+    RelocCompressed->toggle();
+  else if (libopts.reloc_format==RT_MLINK)
+    RelocMlink->toggle();
+  else
+    RelocAMS->toggle();
+  if (libopts.use_fline_jumps)
+    UseFLineJumps->toggle();
+  if (libopts.use_4b_fline_jumps)
+    Use4ByteFLineJumps->toggle();
+  if (libopts.rom_call_format==RT_KERNEL)
+    ROMCallKernel->toggle();
+  else if (libopts.rom_call_format==RT_COMPRESSED)
+    ROMCallCompressed->toggle();
+  else if (libopts.rom_call_format==RT_MLINK)
+    ROMCallMlink->toggle();
+  else if (libopts.rom_call_format==RT_FLINE)
+    ROMCallFLine->toggle();
+  else
+    ROMCallDirect->toggle();
+  if (libopts.opt_rom_calls)
+    OptimizeROMCalls->toggle();
+  if (libopts.use_internal_fline_emu)
+    UseInternalFLineEmulator->toggle();
+  //Tab: BSS/Data Format
+  if (libopts.bss_ref_format==RT_KERNEL)
+    BSSKernel->toggle();
+  else if (libopts.bss_ref_format==RT_COMPRESSED)
+    BSSCompressed->toggle();
+  else if (libopts.bss_ref_format==RT_MLINK)
+    BSSMlink->toggle();
+  else
+    BSSMerge->toggle();
+  if (libopts.data_ref_format==RT_COMPRESSED)
+    BSSDataCompressed->toggle();
+  else if (libopts.data_ref_format==RT_MLINK)
+    BSSDataMlink->toggle();
+  else
+    BSSDataKernel->toggle();
+  //Tab: Home Screen
+  if (libopts.use_return_value)
+    HomeCustomValue->toggle();
+  else
+    HomeDone->toggle();
+  if (libopts.enable_error_return)
+    EnableReturningErrors->toggle();
+  if (libopts.save_screen)
+    SaveScreen->toggle();
+}

+ 2 - 0
ktigcc/projectoptions.ui

@@ -1631,6 +1631,8 @@
 <functions>
     <function access="private" specifier="non virtual">init()</function>
     <function access="private" specifier="non virtual">destroy()</function>
+    <function access="private" specifier="non virtual">ImportSettings( void )</function>
+    <function access="private" specifier="non virtual">ExportSettings( void )</function>
 </functions>
 <pixmapinproject/>
 <layoutdefaults spacing="6" margin="11"/>

+ 76 - 32
ktigcc/projectoptions.ui.h

@@ -35,7 +35,6 @@ QAccel *AParameters;
 
 void ProjectOptions::init()
 {
-  Boolean isregular;
   //Qt automatically sets QLabels to wrapped when they are RichText.  This undoes this change.
   UnwrapLabel(LOncalcVariableName_1);
   UnwrapLabel(LOncalcVariableName_2);
@@ -45,6 +44,46 @@ void ProjectOptions::init()
   UnwrapLabel(LCallAfterBuilding);
   UnwrapLabel(LParameters);
   //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();
+  //Create accelerators for text boxes manually
+  QAccel *accel; //for temporarily holding the accelerator pointer
+  #define MakeAccelerator(destaccelptr,thewidget,thepage,thekey) destaccelptr=accel=new QAccel(PO_TabWidget->page(thepage)); \
+    accel->connectItem(accel->insertItem(thekey),thewidget,SLOT(setFocus()));
+  MakeAccelerator(AOncalcVariableName_1,OncalcVariableName_1,0,ALT+Key_V);
+  MakeAccelerator(AOncalcVariableName_2,OncalcVariableName_2,0,ALT+Key_I);
+  MakeAccelerator(AGCCSwitches,GCCSwitches,1,ALT+Key_G);
+  MakeAccelerator(AAsSwitches,AsSwitches,1,ALT+Key_S);
+  MakeAccelerator(AA68kSwitches,A68kSwitches,1,ALT+Key_A);
+  MakeAccelerator(ACallAfterBuilding,CallAfterBuilding,3,ALT+Key_A);
+  MakeAccelerator(AParameters,Parameters,3,ALT+Key_R);
+  #undef MakeAccelerator
+}
+
+void ProjectOptions::destroy()
+{
+  delete(AOncalcVariableName_1);
+  delete(AOncalcVariableName_2);
+  delete(AGCCSwitches);
+  delete(AAsSwitches);
+  delete(AA68kSwitches);
+  delete(ACallAfterBuilding);
+  delete(AParameters);
+  delete(programoptions);
+  if (result()!=QDialog::Accepted)
+    return;
+  //Save settings
+  ExportSettings();
+}
+
+void ProjectOptions::ImportSettings(void)
+{
+  Boolean isregular;
   //Tab: General
   OncalcVariableName_1->setText(settings.data_var);
   if (settings.copy_data_var)
@@ -87,40 +126,45 @@ void ProjectOptions::init()
     CompressProgram->setEnabled(FALSE);
   }
   //Tab: Compilation
-  
-  //Create the Program Options dialog
-  programoptions=new ProgramOptions(this);
-  programoptions->TabWidget->setCurrentPage(4); //the original TIGCC IDE went to the BSS/Relocs section the first time you opened Program Options, so this will too.
-  //Update stuff
-  CheckOncalcNames();
-  UpdateVisibilities();
-  //Create accelerators for text boxes manually
-  QAccel *accel; //for temporarily holding the accelerator pointer
-  #define MakeAccelerator(destaccelptr,thewidget,thepage,thekey) destaccelptr=accel=new QAccel(PO_TabWidget->page(thepage)); \
-    accel->connectItem(accel->insertItem(thekey),thewidget,SLOT(setFocus()));
-  MakeAccelerator(AOncalcVariableName_1,OncalcVariableName_1,0,ALT+Key_V);
-  MakeAccelerator(AOncalcVariableName_2,OncalcVariableName_2,0,ALT+Key_I);
-  MakeAccelerator(AGCCSwitches,GCCSwitches,1,ALT+Key_G);
-  MakeAccelerator(AAsSwitches,AsSwitches,1,ALT+Key_S);
-  MakeAccelerator(AA68kSwitches,A68kSwitches,1,ALT+Key_A);
-  MakeAccelerator(ACallAfterBuilding,CallAfterBuilding,3,ALT+Key_A);
-  MakeAccelerator(AParameters,Parameters,3,ALT+Key_R);
-  #undef MakeAccelerator
+  GCCSwitches->setText(settings.cc_switches);
+  AsSwitches->setText(settings.as_switches);
+  A68kSwitches->setText(settings.a68k_switches);
+  if (settings.debug_info)
+    GenerateDebugInformation->toggle();
+  //Tab: Linking
+  if (settings.optimize_nops)
+    NOPs->toggle();
+  if (settings.optimize_returns)
+    ReturnSequences->toggle();
+  if (settings.optimize_branches)
+    Branches->toggle();
+  if (settings.optimize_moves)
+    MoveLoadPushInstructions->toggle();
+  if (settings.optimize_tests)
+    TestCompareInstructions->toggle();
+  if (settings.optimize_calcs)
+    CalculationInstructions->toggle();
+  if (settings.remove_unused)
+    RemoveUnusedSections->toggle();
+  if (settings.reorder_sections)
+    ReorderSections->toggle();
+  if (settings.cut_ranges)
+    CutUnusedRanges->toggle();
+  if (settings.merge_constants)
+    MergeConstants->toggle();
+  if (settings.std_lib)
+    LinkAgainstStandardLibrary->toggle();
+  if (settings.initialize_bss)
+    InitializeBSSSection->toggle();
+  if (settings.outputbin)
+    OutputVariableImageWithoutWrapper->toggle();
+  //Tab: Post-Build
+  CallAfterBuilding->setText(settings.post_build);
+  Parameters->setText(settings.cmd_line);
 }
 
-void ProjectOptions::destroy()
+void ProjectOptions::ExportSettings(void)
 {
-  delete(AOncalcVariableName_1);
-  delete(AOncalcVariableName_2);
-  delete(AGCCSwitches);
-  delete(AAsSwitches);
-  delete(AA68kSwitches);
-  delete(ACallAfterBuilding);
-  delete(AParameters);
-  delete(programoptions);
-  if (result()!=QDialog::Accepted)
-    return;
-  //Save settings
   //Tab: General
   settings.fargo=FALSE;
   settings.flash_os=FALSE;