added a btn to remove a folder of source from the proj

This commit is contained in:
Basile Burg 2014-08-30 11:15:00 +02:00
parent 45c9e3f219
commit 0ee612ebdb
2 changed files with 91 additions and 18 deletions

View File

@ -1,29 +1,29 @@
inherited CEProjectInspectWidget: TCEProjectInspectWidget
Left = 1242
Height = 257
Height = 247
Top = 360
Width = 264
Width = 345
AllowDropFiles = True
Caption = 'Project inspector'
ClientHeight = 257
ClientWidth = 264
ClientHeight = 247
ClientWidth = 345
OnDropFiles = FormDropFiles
inherited Back: TPanel
Height = 257
Width = 264
ClientHeight = 257
ClientWidth = 264
Height = 247
Width = 345
ClientHeight = 247
ClientWidth = 345
inherited Content: TPanel
Height = 257
Width = 264
ClientHeight = 257
ClientWidth = 264
Height = 247
Width = 345
ClientHeight = 247
ClientWidth = 345
PopupMenu = nil
object Tree: TTreeView[0]
Left = 2
Height = 227
Height = 217
Top = 28
Width = 260
Width = 341
Align = alClient
AutoExpand = True
BorderSpacing.Around = 2
@ -47,12 +47,12 @@ inherited CEProjectInspectWidget: TCEProjectInspectWidget
Left = 2
Height = 24
Top = 2
Width = 260
Width = 341
Align = alTop
BorderSpacing.Around = 2
BevelOuter = bvNone
ClientHeight = 24
ClientWidth = 260
ClientWidth = 341
TabOrder = 1
object btnAddFile: TSpeedButton
Left = 0
@ -101,7 +101,7 @@ inherited CEProjectInspectWidget: TCEProjectInspectWidget
ShowCaption = False
end
object btnProjOpts: TSpeedButton
Left = 84
Left = 112
Height = 24
Top = 0
Width = 28
@ -195,7 +195,7 @@ inherited CEProjectInspectWidget: TCEProjectInspectWidget
Left = 114
Height = 23
Top = 0
Width = 114
Width = 195
ButtonWidth = 28
NumGlyphs = 1
Align = alCustom
@ -251,6 +251,52 @@ inherited CEProjectInspectWidget: TCEProjectInspectWidget
}
OnClick = btnRemFileClick
end
object btnRemFold: TSpeedButton
Left = 84
Height = 24
Hint = 'remove a folder of source from the project'
Top = 0
Width = 28
Align = alLeft
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000001E0000003300000033000000330000001E00000000469AD300469A
D300469AD300469AD300469AD300469AD300469AD300469BD30048A2D3000000
001E3044B4AC384DCCFF384DCBFF384DCCFF3145B4AC0000001E469AD3000000
000B0000000A0000000A0000000A0000000A0000000A0000000A000000082F3D
B4AA3851D7FF385DF9FF375DFAFF385DF9FF3852D7FF3044B4AC0000002F2959
7A5F2655755C2655745C2655745C2655745C2655745C2654725A214B63513342
CBFF4164FBFF3C60FAFF3A5DF8FF3C60FAFF4165FBFF344BCCFF4598D0F14398
D2FF4094D0FF3E92CFFF3E92CEFF3F92CEFF3F92CEFF4094CFFF419BCFFF2E3E
C9FFA9B8FFFFFFFFFFFFFFFFFFFFFFFFFFFFA9BAFFFF3148CAFF4499D2FF3F94
D0FFABFBFFFF9BF3FFFF92F1FFFF93F1FFFF93F1FFFF94F3FFFF98FCFFFF2A38
C6FF5B75FDFF5775FEFF5473FDFF5775FEFF5D79FFFF3349CBFF4397D1FF56AC
DDFF8EDAF5FFA2EDFFFF82E5FEFF84E5FEFF84E5FEFF86E7FEFF89EEFFFF5589
E0FF4052D9FF6E85FFFF7289FFFF6E86FFFF4559DCFF3446CC924296D1FF71C4
EAFF6CBCE6FFBBF2FFFF75DEFDFF77DEFCFF78DEFCFF7BDFFCFF7FE3FDFF83EC
FFFF5186DEFF2B38C6FF2B3AC6FF2B3AC7FF3E6FCFFF000000124095D0FF90DD
F8FF44A0D8FFDDFCFFFFDAFAFFFFDBF9FFFFDEFAFFFF74DCFCFF76DCFBFF77DD
FBFF79E2FCFF7AE6FDFF79E7FEFFA7F4FFFF7FC6E7FF3377A4703E93CFFFB2F6
FFFF51ACDEFF358ACAFF358ACAFF358ACAFF368ACAFF5BBDE9FF6ED9FBFF6AD6
FAFF69D6FAFF68D6FAFF67D6FAFF83DFFCFFAAE1F6FF3A8AC1C83D92CFFFB8F3
FFFF77DFFEFF7BE0FEFF7CE1FEFF7CE1FFFF7DE2FFFF52ABDDFF56B9E8FFDAF8
FFFFD6F6FFFFD6F6FFFFD5F6FFFFD5F7FFFFDBFCFFFF3E94D0FF3C92CFFFC0F3
FFFF70D9FBFF73DAFBFF74DAFBFF74DAFBFF74DBFBFF76DEFDFF4FA9DCFF368B
CAFF358BCBFF338BCBFF338CCCFF3790CEFF3D94D0FF4398D2AE3B92CFFFCAF6
FFFF69D5F9FF6CD5F9FF6AD4F9FF69D4F9FF69D5F9FF6AD6FAFF6BD8FBFF6BD9
FCFF6BDAFDFF69DAFDFFDAFDFFFF3C93D0FF367BAA2F469AD3003B92CFFFD5F7
FFFF60D1F9FF61D0F8FFB4EBFDFFD9F6FFFFDAF8FFFFDAF8FFFFDAF9FFFFDBF9
FFFFDAF9FFFFDAFAFFFFDFFEFFFF3D94D0FF4599D335469AD3003D94D0FFDCFC
FFFFD8F7FFFFD8F7FFFFDBFAFFFF358ECDFF3991CEFF3A92CFFF3A92CFFF3A92
CFFF3A92CFFF3A92CFFF3D94D0FF4298D2EA469AD300469AD3004398D2EF3D94
D0FF3A92CFFF3A92CFFF3D94D0FF4197D1E44398D22B4498D2324498D2334498
D2334498D2334499D2334499D337459AD300469AD300469AD300
}
OnClick = btnRemFoldClick
ShowCaption = False
end
end
end
end

View File

@ -10,7 +10,11 @@ uses
ce_widget, ce_observer;
type
{ TCEProjectInspectWidget }
TCEProjectInspectWidget = class(TCEWidget, ICEProjectObserver)
btnRemFold: TSpeedButton;
imgList: TImageList;
Panel1: TPanel;
btnAddFile: TSpeedButton;
@ -22,6 +26,7 @@ type
procedure btnAddFileClick(Sender: TObject);
procedure btnAddFoldClick(Sender: TObject);
procedure btnRemFileClick(Sender: TObject);
procedure btnRemFoldClick(Sender: TObject);
procedure FormDropFiles(Sender: TObject; const FileNames: array of String);
procedure TreeKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure TreeSelectionChanged(Sender: TObject);
@ -225,6 +230,28 @@ begin
end;
end;
procedure TCEProjectInspectWidget.btnRemFoldClick(Sender: TObject);
var
dir, fname: string;
i: Integer;
begin
if fProject = nil then exit;
if Tree.Selected = nil then exit;
if Tree.Selected.Parent <> fFileNode then exit;
//
fname := Tree.Selected.Text;
i := fProject.Sources.IndexOf(fname);
if i = -1 then exit;
fname := fProject.getAbsoluteSourceName(i);
dir := extractFilePath(fname);
if not DirectoryExists(dir) then exit;
//
for i:= fProject.Sources.Count-1 downto 0 do
if extractFilePath(fProject.getAbsoluteSourceName(i)) = dir then
fProject.Sources.Delete(i);
UpdateByEvent;
end;
procedure TCEProjectInspectWidget.btnRemFileClick(Sender: TObject);
var
fname: string;