diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/apps/ide/src/frm_main.pas | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas index 65985631..6391ceba 100644 --- a/examples/apps/ide/src/frm_main.pas +++ b/examples/apps/ide/src/frm_main.pas @@ -118,6 +118,7 @@ type procedure AddUnitToProject(const AUnitName: TfpgString); procedure miProjectAddUnitToProject(Sender: TObject); procedure tvProjectDoubleClick(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); + procedure tvProjectKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean); procedure grdMessageKeyPressed(Sender: TObject; var KeyCode: Word; var ShiftState: TShiftState; var Consumed: Boolean); procedure TabSheetClosing(Sender: TObject; ATabSheet: TfpgTabSheet); procedure BuildTerminated(Sender: TObject); @@ -587,6 +588,38 @@ begin end; end; +procedure TMainForm.tvProjectKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean); +var + r: TfpgTreeNode; + n: TfpgTreeNode; + i: integer; +begin + if keyCode = keyDelete then + begin + r := GetUnitsNode; + if r.FindSubNode(tvProject.Selection.Text, False) = tvProject.Selection then + begin + // remove from project, then from tree view + n := tvProject.Selection; + tvProject.GotoNextNodeUp; + r.Remove(n); + tvProject.Invalidate; + GProject.UnitList.Remove(TUnit(n.Data)); + + for i := 0 to pcEditor.PageCount-1 do + begin + if pcEditor.Pages[i].TagPointer = n.Data then + begin + pcEditor.Pages[i].TagPointer := nil; + break + end; + end; + TUnit(n.Data).Free; + n.Free; + end; + end; +end; + procedure TMainForm.grdMessageKeyPressed(Sender: TObject; var KeyCode: Word; var ShiftState: TShiftState; var Consumed: Boolean); var cr: TClipboardKeyType; @@ -1478,6 +1511,7 @@ begin Hint := ''; TabOrder := 20; OnDoubleClick := @tvProjectDoubleClick; + OnKeyPress := @tvProjectKeyPressed; end; tsFiles := TfpgTabSheet.Create(pnlTool); |