mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 13:00:25 +02:00
IDE: build modes: started delete
git-svn-id: trunk@23141 -
This commit is contained in:
parent
c32d4b7d81
commit
e1c8d7a751
@ -670,7 +670,7 @@ begin
|
||||
// build modes
|
||||
HasBuildModes:=(Options is TProjectCompilerOptions);
|
||||
{$IFNDEF EnableBuildModes}
|
||||
HasBuildModes:=false;
|
||||
HasBuildModes:= false;
|
||||
{$ENDIF}
|
||||
if HasBuildModes then begin
|
||||
// show build modes
|
||||
|
@ -31,6 +31,14 @@ object BuildModesEditorFrame: TBuildModesEditorFrame
|
||||
ShowHint = True
|
||||
OnClick = NewBuildFlagToolButtonClick
|
||||
end
|
||||
object DeleteBMRowToolButton: TToolButton
|
||||
Left = 47
|
||||
Top = 2
|
||||
Caption = 'DeleteBMRowToolButton'
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnClick = DeleteBMRowToolButtonClick
|
||||
end
|
||||
end
|
||||
object BuildModesPopupMenu: TPopupMenu
|
||||
left = 83
|
||||
|
@ -10,6 +10,9 @@ LazarusResources.Add('TBuildModesEditorFrame','FORMDATA',[
|
||||
+#14'ParentShowHint'#8#8'ShowHint'#9#7'OnClick'#7#27'NewBuildModeToolButtonCl'
|
||||
+'ick'#0#0#11'TToolButton'#22'NewBuildFlagToolButton'#4'Left'#2#24#3'Top'#2#2
|
||||
+#7'Caption'#6#22'NewBuildFlagToolButton'#14'ParentShowHint'#8#8'ShowHint'#9#7
|
||||
+'OnClick'#7#27'NewBuildFlagToolButtonClick'#0#0#0#10'TPopupMenu'#19'BuildMod'
|
||||
+'esPopupMenu'#4'left'#2'S'#3'top'#2's'#0#0#0
|
||||
+'OnClick'#7#27'NewBuildFlagToolButtonClick'#0#0#11'TToolButton'#21'DeleteBMR'
|
||||
+'owToolButton'#4'Left'#2'/'#3'Top'#2#2#7'Caption'#6#21'DeleteBMRowToolButton'
|
||||
+#14'ParentShowHint'#8#8'ShowHint'#9#7'OnClick'#7#26'DeleteBMRowToolButtonCli'
|
||||
+'ck'#0#0#0#10'TPopupMenu'#19'BuildModesPopupMenu'#4'left'#2'S'#3'top'#2's'#0
|
||||
+#0#0
|
||||
]);
|
||||
|
@ -54,6 +54,7 @@ type
|
||||
FGraph: TBuildModeGraph;
|
||||
FGroupModeCount: integer;
|
||||
FModeRows: TFPList; // list of TBuildModeGridRow
|
||||
function GetSelectedModeRow: TBuildModeGridRow;
|
||||
function GetModeRowCount: integer;
|
||||
function GetModeRows(Index: integer): TBuildModeGridRow;
|
||||
procedure ClearModeRows;
|
||||
@ -69,11 +70,13 @@ type
|
||||
destructor Destroy; override;
|
||||
function AddNewBuildMode: TBuildMode;
|
||||
function InsertNewBuildFlagBehind: TBuildModeFlag;
|
||||
procedure DeleteSelectedModeRow;
|
||||
property Graph: TBuildModeGraph read FGraph;
|
||||
procedure RebuildGrid; // call this after Graph changed
|
||||
property ModeRowCount: integer read GetModeRowCount;
|
||||
property ModeRows[Index: integer]: TBuildModeGridRow read GetModeRows;
|
||||
property GroupModeCount: integer read FGroupModeCount; // number of modes that are group of modes
|
||||
property SelectedModeRow: TBuildModeGridRow read GetSelectedModeRow;
|
||||
end;
|
||||
|
||||
{ TBuildModesEditorFrame }
|
||||
@ -83,10 +86,15 @@ type
|
||||
BuildModesToolBar: TToolBar;
|
||||
NewBuildModeToolButton: TToolButton;
|
||||
NewBuildFlagToolButton: TToolButton;
|
||||
DeleteBMRowToolButton: TToolButton;
|
||||
procedure DeleteBMRowToolButtonClick(Sender: TObject);
|
||||
procedure GridSelectCell(Sender: TObject; aCol, aRow: Integer;
|
||||
var CanSelect: Boolean);
|
||||
procedure NewBuildFlagToolButtonClick(Sender: TObject);
|
||||
procedure NewBuildModeToolButtonClick(Sender: TObject);
|
||||
private
|
||||
FGrid: TBuildModesGrid;
|
||||
procedure UpdateButtons;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -278,6 +286,14 @@ begin
|
||||
Result:=FModeRows.Count;
|
||||
end;
|
||||
|
||||
function TBuildModesGrid.GetSelectedModeRow: TBuildModeGridRow;
|
||||
begin
|
||||
if (Row<1) or (Row>ModeRowCount) then
|
||||
Result:=nil
|
||||
else
|
||||
Result:=ModeRows[Row-1];
|
||||
end;
|
||||
|
||||
constructor TBuildModesGrid.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
@ -319,7 +335,7 @@ begin
|
||||
lisPleaseSelectABuildModeFirst, mtError, [mbCancel], 0);
|
||||
exit;
|
||||
end;
|
||||
DebugLn(['TBuildModesGrid.InsertNewBuildFlagBehind ',Row]);
|
||||
//DebugLn(['TBuildModesGrid.InsertNewBuildFlagBehind ',Row]);
|
||||
CurModeRow:=ModeRows[Row-1];
|
||||
if CurModeRow.Mode.ShowIncludes then
|
||||
begin
|
||||
@ -329,7 +345,6 @@ begin
|
||||
mtError, [mbCancel], 0);
|
||||
exit;
|
||||
end;
|
||||
DebugLn(['TBuildModesGrid.InsertNewBuildFlagBehind AAA1']);
|
||||
Result:=CurModeRow.Mode.InsertFlag(CurModeRow.IndexInGroup+1,bmftNone,'','');
|
||||
InsertPos:=Row+1;
|
||||
GridRow:=TBuildModeGridRow.Create(CurModeRow.Mode,Result);
|
||||
@ -340,6 +355,33 @@ begin
|
||||
Row:=InsertPos;
|
||||
end;
|
||||
|
||||
procedure TBuildModesGrid.DeleteSelectedModeRow;
|
||||
var
|
||||
CurModeRow: TBuildModeGridRow;
|
||||
begin
|
||||
if (Row<1) or (Row>ModeRowCount) then
|
||||
begin
|
||||
MessageDlg(lisUnableToDelete,
|
||||
lisPleaseSelectABuildModeFirst, mtError, [mbCancel], 0);
|
||||
exit;
|
||||
end;
|
||||
CurModeRow:=ModeRows[Row-1];
|
||||
if (not CurModeRow.Mode.ShowIncludes) and (CurModeRow.Mode.FlagCount>1) then
|
||||
begin
|
||||
// delete flag
|
||||
if MessageDlg('Delete setting?',
|
||||
'Delete setting "'+BuildModeFlagTypeCaptions(CurModeRow.Flag.FlagType)+'"?',
|
||||
mtConfirmation,[mbYes,mbNo],0)<>mrYes
|
||||
then
|
||||
exit;
|
||||
CurModeRow.Mode.DeleteFlag(CurModeRow.IndexInGroup);
|
||||
DeleteColRow(false,Row);
|
||||
end else begin
|
||||
// delete build mode
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBuildModesGrid.RebuildGrid;
|
||||
var
|
||||
GroupInsertPos: Integer;
|
||||
@ -423,11 +465,36 @@ begin
|
||||
Grid.AddNewBuildMode;
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.UpdateButtons;
|
||||
var
|
||||
Mode: TBuildModeGridRow;
|
||||
begin
|
||||
Mode:=Grid.SelectedModeRow;
|
||||
NewBuildFlagToolButton.Enabled:=(Mode<>nil) and (not Mode.Mode.ShowIncludes);
|
||||
DeleteBMRowToolButton.Enabled:=(Mode<>nil);
|
||||
if (Mode<>nil) and (not Mode.Mode.ShowIncludes) and (Mode.Mode.FlagCount>1)
|
||||
then
|
||||
DeleteBMRowToolButton.Hint:=lisDeleteSetting
|
||||
else
|
||||
DeleteBMRowToolButton.Hint:=lisDeleteBuildMode;
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.NewBuildFlagToolButtonClick(Sender: TObject);
|
||||
begin
|
||||
Grid.InsertNewBuildFlagBehind;
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.GridSelectCell(Sender: TObject; aCol,
|
||||
aRow: Integer; var CanSelect: Boolean);
|
||||
begin
|
||||
UpdateButtons;
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.DeleteBMRowToolButtonClick(Sender: TObject);
|
||||
begin
|
||||
Grid.DeleteSelectedModeRow;
|
||||
end;
|
||||
|
||||
constructor TBuildModesEditorFrame.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
@ -436,6 +503,7 @@ begin
|
||||
Name:='Grid';
|
||||
Parent:=Self;
|
||||
Align:=alClient;
|
||||
OnSelectCell:=@GridSelectCell;
|
||||
end;
|
||||
|
||||
BuildModesToolBar.Images := IDEImages.Images_16;
|
||||
@ -443,8 +511,11 @@ begin
|
||||
NewBuildModeToolButton.ImageIndex := IDEImages.LoadImage(16, 'laz_add');
|
||||
NewBuildFlagToolButton.Hint:=lisNewSetting;
|
||||
NewBuildFlagToolButton.ImageIndex := IDEImages.LoadImage(16, 'laz_edit');
|
||||
DeleteBMRowToolButton.Hint:=lisDeleteRow;
|
||||
DeleteBMRowToolButton.ImageIndex := IDEImages.LoadImage(16, 'laz_delete');
|
||||
|
||||
// laz_delete, laz_edit, arrow_up, arrow_down
|
||||
// laz_edit, arrow_up, arrow_down
|
||||
UpdateButtons;
|
||||
end;
|
||||
|
||||
destructor TBuildModesEditorFrame.Destroy;
|
||||
|
@ -4586,6 +4586,10 @@ resourcestring
|
||||
lisUnableToWriteTheProjectInfoFileError = 'Unable to write the project info '
|
||||
+'file%s%s%s%s.%sError: %s';
|
||||
lisBuildMode = 'Build mode';
|
||||
lisDeleteRow = 'Delete row';
|
||||
lisDeleteSetting = 'Delete setting';
|
||||
lisDeleteBuildMode = 'Delete build mode';
|
||||
lisUnableToDelete = 'Unable to delete';
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -3655,7 +3655,7 @@ begin
|
||||
if IsVirtual or Modified then exit;
|
||||
AnUnitInfo:=UnitInfoWithFilename(ProjectInfoFile,[pfsfOnlyEditorFiles]);
|
||||
if (AnUnitInfo<>nil) then begin
|
||||
// users is editing the lpi file in source editor
|
||||
// user is editing the lpi file in source editor
|
||||
exit;
|
||||
end;
|
||||
AnUnitInfo:=fFirst[uilAutoRevertLocked];
|
||||
@ -3669,6 +3669,7 @@ begin
|
||||
|
||||
if not FileExistsCached(ProjectInfoFile) then exit;
|
||||
if fProjectInfoFileDate=FileAgeUTF8(ProjectInfoFile) then exit;
|
||||
|
||||
//DebugLn(['TProject.HasProjectInfoFileChangedOnDisk ',ProjectInfoFile,' fProjectInfoFileDate=',fProjectInfoFileDate,' ',FileAgeUTF8(ProjectInfoFile)]);
|
||||
Result:=true;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user