Bläddra i källkod

* Redesigned syntax tab on compiler options screen

git-svn-id: trunk@3467 -
daniel 19 år sedan
förälder
incheckning
d76aa893e7
3 ändrade filer med 72 tillägg och 24 borttagningar
  1. 26 5
      ide/fpmopts.inc
  2. 21 15
      ide/fpstre.inc
  3. 25 4
      ide/fpswitch.pas

+ 26 - 5
ide/fpmopts.inc

@@ -63,14 +63,14 @@ procedure TIDEApp.DoCompilerSwitch;
 var R,R2,R3,TabR,TabIR: TRect;
     D: PCenterDialog;
     CB1,CB2,CB3,CB4,CB5: PCheckBoxes;
-    RB1,{RB2,}RB3,RB4,RB5,RB6: PRadioButtons;
+    RB1,RB2,RB3,RB4,RB5,RB6: PRadioButtons;
     Items: PSItem;
     IL: PEditorInputLine;
     IL2: PEditorInputLine;
     Count : integer;
     I,L: longint;
     Tab: PTab;
-    Label11,{Label12,}
+    Label11,Label12,
     Label21,Label22,Label23,
     Label31,Label41,
     Label51,Label52,Label53: PLabel;
@@ -93,8 +93,9 @@ begin
     Count:=SyntaxSwitches^.ItemCount;
     R.Copy(TabIR);
     R2.Copy(R);
-{    R2.B.X:=(R2.A.X+(R2.B.X-R2.A.X) div 2)-2;} R2.B.X:=R2.B.X-4;
-    R2.B.Y:=R2.A.Y+((Count+1) div 2);
+    R2.B.X:=(R2.A.X+(R2.B.X-R2.A.X) div 2)-3;{ R2.B.X:=R2.B.X-4;}
+{    R2.B.Y:=R2.A.Y+((Count+1) div 2);}
+    R2.B.Y:=R2.A.Y+Count;
     Items:=nil;
     for I:=Count-1 downto 0 do
       Items:=NewSItem(SyntaxSwitches^.ItemName(I), Items);
@@ -106,6 +107,23 @@ begin
     R2.B.Y:=R2.A.Y+1;
     New(Label11, Init(R2, label_compiler_syntaxswitches, CB1));
 
+    Count:=CompilerModeSwitches^.ItemCount;
+    R.Copy(TabIR);
+    R2.Copy(R);
+    R2.A.X:=(R2.A.X+(R2.B.X-R2.A.X) div 2)-2;
+    R2.B.X:=R2.B.X-3;
+{    R2.B.Y:=R2.A.Y+((Count+1) div 2);}
+    R2.B.Y:=R2.A.Y+Count;
+    Items:=nil;
+    for I:=Count-1 downto 0 do
+      Items:=NewSItem(CompilerModeSwitches^.ItemName(I), Items);
+    New(RB2, Init(R2, Items));
+    L:=CompilerModeSwitches^.GetCurrSel;
+    RB2^.SetData(L);
+    Dec(R2.A.Y);
+    R2.B.Y:=R2.A.Y+1;
+    New(Label12, Init(R2, label_compiler_mode, RB2));
+
     { --- Sheet 2 --- }
     Count:=CodegenSwitches^.ItemCount;
     R2.Copy(TabIR);
@@ -254,7 +272,9 @@ begin
       NewTabDef(page_compiler_syntax,CB1,
         NewTabItem(Label11,
         NewTabItem(CB1,
-        nil)),
+        NewTabItem(Label12,
+        NewTabItem(RB2,
+        nil)))),
       NewTabDef(page_compiler_codegeneration,CB3,
         NewTabItem(Label21,
         NewTabItem(CB3,
@@ -309,6 +329,7 @@ begin
   begin
     for I:=0 to SyntaxSwitches^.ItemCount-1 do
       SyntaxSwitches^.SetBooleanItem(I,CB1^.Mark(I));
+    CompilerModeSwitches^.SetCurrSel(RB2^.Value);
     for I:=0 to CodeGenSwitches^.ItemCount-1 do
       CodegenSwitches^.SetBooleanItem(I,CB3^.Mark(I));
     for I:=0 to OptimizationSwitches^.ItemCount-1 do

+ 21 - 15
ide/fpstre.inc

@@ -548,7 +548,8 @@ const
       static_switchesmode_switchesmode = 'Switches Mode';
 
       dialog_compilerswitches = 'Compiler Switches';
-      label_compiler_syntaxswitches = 'Syntax Switches';
+      label_compiler_syntaxswitches = 'S~y~ntax Switches';
+      label_compiler_mode = 'Compiler ~m~ode';
       label_compiler_runtimechecks = 'Run-time checks';
       label_compiler_optimizations = 'Optimizations';
       label_compiler_targetprocessor = 'Target processor';
@@ -774,20 +775,25 @@ const
       msg_automaticallycreateddontedit = 'Automaticly created file, don''t edit.';
 
       { Compiler options }
-      opt_objectpascal = '~O~bject pascal support';
-      opt_clikeoperators = '~C~-like operators';
-      opt_stopafterfirsterror = 'S~t~op after first error';
-      opt_allowlabelandgoto = 'Allo~w~ LABEL and GOTO';
-      opt_cplusplusstyledinline = 'C++ styled ~i~nline';
-      opt_globalcmacros = 'Global C ~m~acros';
-      opt_tp7compatibility = 'TP/BP ~7~.0 compatibility';
-      opt_delphicompatibility = 'Del~p~hi compatibility';
-      opt_allowstaticinobjects = 'A~l~low STATIC in objects';
-      opt_assertions = 'Include ~a~ssertion code';
-      opt_kylix = 'Load ~K~ylix compat. unit fpcylix';
-      opt_strictvarstrings = 'Strict ~v~ar-strings';
-      opt_extendedsyntax = 'E~x~tended syntax';
-      opt_allowmmxoperations = 'Allow MMX op~e~rations';
+      opt_objectpascal = 'Object pascal support';
+      opt_clikeoperators = 'C-like operators';
+      opt_stopafterfirsterror = 'Stop after first error';
+      opt_allowlabelandgoto = 'Allow LABEL and GOTO';
+      opt_cplusplusstyledinline = 'C++ styled inline';
+      opt_globalcmacros = 'Global C macros';
+      opt_allowstaticinobjects = 'Allow STATIC in objects';
+      opt_assertions = 'Include assertion code';
+      opt_kylix = 'Load Kylix compat. unit';
+      opt_strictvarstrings = 'Strict var-strings';
+      opt_extendedsyntax = 'Extended syntax';
+      opt_allowmmxoperations = 'Allow MMX operations';
+
+      opt_mode_freepascal = 'Free Pascal dialect';
+      opt_mode_objectpascal = 'Object Pascal extension on';
+      opt_mode_turbopascal = 'Turbo Pascal compatible';
+      opt_mode_delphi = 'Delphi compatible';
+      opt_mode_macpascal = 'Macintosh Pascal dialect';
+      opt_mode_gnupascal = 'GNU Pascal';
       { Verbose options }
       opt_warnings = '~W~arnings';
       opt_notes = 'N~o~tes';

+ 25 - 4
ide/fpswitch.pas

@@ -165,6 +165,7 @@ var
     ProfileInfoSwitches,
     {MemorySizeSwitches, doubled !! }
     SyntaxSwitches,
+    CompilerModeSwitches,
     VerboseSwitches,
     CodegenSwitches,
     OptimizationSwitches,
@@ -819,6 +820,7 @@ begin
      TargetSwitches^.WriteItemsCfg;
      VerboseSwitches^.WriteItemsCfg;
      SyntaxSwitches^.WriteItemsCfg;
+     CompilerModeSwitches^.WriteItemsCfg;
      CodegenSwitches^.WriteItemsCfg;
      OptimizationSwitches^.WriteItemsCfg;
      OptimizingGoalSwitches^.WriteItemsCfg;
@@ -890,6 +892,7 @@ begin
                  if not ProcessorSwitches^.ReadItemsCfg(s) then
                    res:=OptimizingGoalSwitches^.ReadItemsCfg(s);
              end;
+       'M' : res:=CompilerModeSwitches^.ReadItemsCfg(s);
        'p' : res:=ProfileInfoSwitches^.ReadItemsCfg(s);
        's' : res:=LinkAfterSwitches^.ReadItemsCfg(s);
        'R' : res:=AsmReaderSwitches^.ReadItemsCfg(s);
@@ -961,14 +964,14 @@ begin
   New(SyntaxSwitches,Init('S'));
   with SyntaxSwitches^ do
    begin
-     AddBooleanItem(opt_objectpascal,'2',idNone);
+//     AddBooleanItem(opt_objectpascal,'2',idNone);
      AddBooleanItem(opt_clikeoperators,'c',idNone);
      AddBooleanItem(opt_stopafterfirsterror,'e',idNone);
      AddBooleanItem(opt_allowlabelandgoto,'g',idNone);
      AddBooleanItem(opt_cplusplusstyledinline,'i',idNone);
      AddBooleanItem(opt_globalcmacros,'m',idNone);
-     AddBooleanItem(opt_tp7compatibility,'o',idNone);
-     AddBooleanItem(opt_delphicompatibility,'d',idNone);
+//     AddBooleanItem(opt_tp7compatibility,'o',idNone);
+//     AddBooleanItem(opt_delphicompatibility,'d',idNone);
      AddBooleanItem(opt_allowstaticinobjects,'s',idNone);
      AddBooleanItem(opt_assertions,'a',idNone);
      AddBooleanItem(opt_kylix,'k',idNone);
@@ -977,6 +980,17 @@ begin
      AddBooleanItem(opt_extendedsyntax,'/',idExtendedSyntax);
      AddBooleanItem(opt_allowmmxoperations,'/',idMMXOps);  }
    end;
+  New(CompilerModeSwitches,InitSelect('M'));
+  with CompilerModeSwitches^ do
+    begin
+       AddSelectItem(opt_mode_freepascal,'fpc',idNone);
+       AddSelectItem(opt_mode_objectpascal,'objfpc',idNone);
+       AddSelectItem(opt_mode_turbopascal,'tp',idNone);
+       AddSelectItem(opt_mode_delphi,'delphi',idNone);
+       AddSelectItem(opt_mode_macpascal,'macpascal',idNone);
+{      GNU Pascal mode doesn't do much, better disable it
+       AddSelectItem(opt_mode_gnupascal,'gpc',idNone);}
+    end;
   New(VerboseSwitches,Init('v'));
   with VerboseSwitches^ do
    begin
@@ -996,7 +1010,7 @@ begin
      AddBooleanItem(opt_iochecking,'i',idIOChecks);
      AddBooleanItem(opt_overflowchecking,'o',idOverflowChecks);
      AddBooleanItem(opt_objmethcallvalid,'R',idObjMethCallChecks);
-{     AddBooleanItem(opt_pic,'g',idNone);}
+     AddBooleanItem(opt_pic,'g',idNone);
    end;
   New(OptimizingGoalSwitches,InitSelect('O'));
   with OptimizingGoalSwitches^ do
@@ -1167,6 +1181,8 @@ begin
        { AT&T reader }
        AsmReaderSwitches^.SetCurrSel(1);
 {$endif i386}
+       { FPC mode}
+       CompilerModeSwitches^.SetCurrSel(0);
        { 128k stack }
        MemorySwitches^.SetLongintItem(0,65536*2);
        { 2 MB heap }
@@ -1202,8 +1218,10 @@ begin
 end;
 
 procedure DoneSwitches;
+
 begin
   dispose(SyntaxSwitches,Done);
+  dispose(CompilerModeSwitches,Done);
   dispose(VerboseSwitches,Done);
   dispose(CodegenSwitches,Done);
   dispose(OptimizationSwitches,Done);
@@ -1241,7 +1259,9 @@ procedure AddParam(const S: string);
 begin
   MiscParams^.Insert(NewStr(S));
 end;
+
 procedure EnumSwitches(P: PSwitches);
+
 procedure HandleSwitch(P: PSwitchItem); {$ifndef FPC}far;{$endif}
 begin
   case P^.ParamID of
@@ -1288,6 +1308,7 @@ begin
   EnumSwitches(DebugInfoSwitches);
   EnumSwitches(ProfileInfoSwitches);
   EnumSwitches(SyntaxSwitches);
+  EnumSwitches(CompilerModeSwitches);
   EnumSwitches(VerboseSwitches);
   EnumSwitches(CodegenSwitches);
   EnumSwitches(OptimizationSwitches);