diff options
-rw-r--r-- | examples/apps/ide/src/frm_projectoptions.pas | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/examples/apps/ide/src/frm_projectoptions.pas b/examples/apps/ide/src/frm_projectoptions.pas index bb6ee5f3..74178090 100644 --- a/examples/apps/ide/src/frm_projectoptions.pas +++ b/examples/apps/ide/src/frm_projectoptions.pas @@ -85,6 +85,7 @@ type procedure SetupCellEdit(AGrid: TfpgStringGrid); procedure CleanupCompilerMakeOptionsGrid; procedure CleanupCompilerDirs; + procedure CleanupUserMacrosGrid; procedure SaveToMacroList(AList: TIDEMacroList); public constructor Create(AOwner: TComponent); override; @@ -447,6 +448,13 @@ begin grdCompilerDirs.Cells[j, i] := cCheck; end; end; + + grdUserMacros.RowCount := GProject.MacroNames.Count; + for i := 0 to GProject.MacroNames.Count-1 do + begin + grdUserMacros.Cells[6, i] := GProject.MacroNames.Names[i]; + grdUserMacros.Cells[7, i] := GProject.MacroNames.ValueFromIndex[i]; + end; end; procedure TProjectOptionsForm.SaveSettings; @@ -484,6 +492,13 @@ begin GProject.UnitDirsGrid[j, i] := True; end; end; + + CleanupUserMacrosGrid; + GProject.ClearAndInitMacrosGrid(grdUserMacros.RowCount); + for i := 0 to grdUserMacros.RowCount-1 do + begin + GProject.MacroNames.Values[grdUserMacros.Cells[6, i]] := grdUserMacros.Cells[7, i]; + end; end; procedure TProjectOptionsForm.SetupCellEdit(AGrid: TfpgStringGrid); @@ -534,6 +549,18 @@ begin end; end; +// remove all rows that have empty macro names or values +procedure TProjectOptionsForm.CleanupUserMacrosGrid; +var + i: integer; +begin + for i := grdUserMacros.RowCount-1 downto 0 do + begin + if (Trim(grdUserMacros.Cells[6, i]) = '') or (Trim(grdUserMacros.Cells[7, i]) = '') then + grdUserMacros.DeleteRow(i); + end; +end; + procedure TProjectOptionsForm.SaveToMacroList(AList: TIDEMacroList); begin // AList.SetValue(cMacro_FPCSrcDir, edtFPCSrcDir.Directory); |