summaryrefslogtreecommitdiff
path: root/examples/apps/ide/src
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2013-03-13 00:53:39 +0000
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2013-03-13 00:53:39 +0000
commit1bc6eb96c5a6e37032b672f091f3a72a37163aaa (patch)
treea0e7206df86c422d37f372aefe6d4313fd9aea2f /examples/apps/ide/src
parentc1b9c8c7a73c7f288eea490da239c6af226c8bb7 (diff)
downloadfpGUI-1bc6eb96c5a6e37032b672f091f3a72a37163aaa.tar.xz
ide: Implements loading and saving of user defined project macros
Diffstat (limited to 'examples/apps/ide/src')
-rw-r--r--examples/apps/ide/src/frm_projectoptions.pas27
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);