-
Notifications
You must be signed in to change notification settings - Fork 1
/
coresprjedformu.pas
148 lines (126 loc) · 3.23 KB
/
coresprjedformu.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
unit CoresPrjEdFormU;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons, SBAProjectU;
type
{ TCoresPrjEdForm }
TCoresPrjEdForm = class(TForm)
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
B_CoreAdd: TBitBtn;
B_CoreDel: TBitBtn;
Label1: TLabel;
Label8: TLabel;
LibIpCoreList: TListBox;
PrjIpCoreList: TListBox;
procedure B_CoreAddClick(Sender: TObject);
procedure B_CoreDelClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure LibIpCoreListDblClick(Sender: TObject);
procedure PrjIpCoreListDblClick(Sender: TObject);
procedure ListMouseMove(Sender: TObject;Shift: TShiftState; X, Y: Integer);
procedure ListMouseLeave(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
function CoresEdit(Prj:TSBAPrj):Boolean;
end;
var
CoresPrjEdForm: TCoresPrjEdForm;
implementation
{$R *.lfm}
uses ConfigFormU, FloatFormU, DebugU;
{ TCoresPrjEdForm }
function TCoresPrjEdForm.CoresEdit(Prj: TSBAPrj): Boolean;
var
S:String;
h:integer;
begin
FloatForm.Start(Self);
LibIpCoreList.Items.Assign(IpCoreList);
PrjIpCoreList.Clear;
PrjIpCoreList.Items.Assign(Prj.libcores);
for S in PrjIpCoreList.Items do
begin
h:=LibIpCoreList.Items.IndexOf(S);
if h<>-1 then LibIpCoreList.Items.Delete(h);
end;
Result:=ShowModal=mrOK;
end;
procedure TCoresPrjEdForm.LibIpCoreListDblClick(Sender: TObject);
begin
B_CoreAddClick(nil);
end;
procedure TCoresPrjEdForm.ListMouseLeave(Sender: TObject);
begin
FloatForm.L_CoreName.caption:='';
FloatForm.hide;
end;
procedure TCoresPrjEdForm.ListMouseMove(Sender: TObject;Shift: TShiftState; X, Y: Integer);
var
P: TPoint;
i: Integer;
L:TListBox;
begin
If not Sender.ClassNameIs('TListBox') then exit;
L:=TListBox(Sender);
P:=Mouse.CursorPos;
FloatForm.Top:=P.Y+20;
FloatForm.Left:=P.X+10;
i:=L.GetIndexAtXY(X,Y);
if i>=0 then
begin
FloatForm.ShowCoreInfo(L.Items[i]);
end else begin
FloatForm.L_CoreName.caption:='';
FloatForm.hide;
end;
end;
procedure TCoresPrjEdForm.B_CoreAddClick(Sender: TObject);
var
i: integer;
begin
if LibIpCoreList.SelCount > 0 then
begin
LibIpCoreList.Items.BeginUpdate;
For i:=LibIpCoreList.Items.Count-1 downto 0 do if LibIpCoreList.Selected[i] then
begin
PrjIpCoreList.Items.Add(LibIpCoreList.Items[i]);
LibIpCoreList.Items.Delete(i);
end;
LibIpCoreList.Items.EndUpdate;
end else
begin
ShowMessage('Please select an item first!');
end;
end;
procedure TCoresPrjEdForm.B_CoreDelClick(Sender: TObject);
var
i: integer;
begin
if PrjIpCoreList.SelCount > 0 then
begin
PrjIpCoreList.Items.BeginUpdate;
For i:=PrjIpCoreList.Items.Count-1 downto 0 do if PrjIpCoreList.Selected[i] then
begin
LibIpCoreList.Items.Add(PrjIpCoreList.Items[i]);
PrjIpCoreList.Items.Delete(i);
end;
PrjIpCoreList.Items.EndUpdate;
end else
begin
ShowMessage('Please select an item first!');
end;
end;
procedure TCoresPrjEdForm.FormDestroy(Sender: TObject);
begin
Info('TCoresPrjEdForm','FormDestroy');
end;
procedure TCoresPrjEdForm.PrjIpCoreListDblClick(Sender: TObject);
begin
B_CoreDelClick(nil);
end;
end.