-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathProjectVersionCommit.pas
158 lines (137 loc) · 4.41 KB
/
ProjectVersionCommit.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
148
149
150
151
152
153
154
155
156
157
158
/// File Versioning Commit form
// - this unit is part of SynProject, under GPL 3.0 license; version 1.7
unit ProjectVersionCommit;
(*
This file is part of SynProject.
Synopse SynProject. Copyright (C) 2008-2023 Arnaud Bouchez
Synopse Informatique - https://synopse.info
SynProject is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at
your option) any later version.
SynProject is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License
along with SynProject. If not, see <http://www.gnu.org/licenses/>.
*)
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, CheckLst, ProjectCommons, ExtCtrls, ProjectVersioning;
type
TProjectVersionCommitForm = class(TForm)
CheckListBox: TCheckListBox;
Label1: TLabel;
BtnSelected: TBitBtn;
BtnAll: TBitBtn;
BtnCancel: TBitBtn;
Description: TLabeledEdit;
Label2: TLabel;
Comments: TMemo;
Label3: TLabel;
SCR: TComboBox;
PVCS: TCheckBox;
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure BtnAllClick(Sender: TObject);
procedure BtnSelectedClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
private
{ Private declarations }
public
Selected: TIntegerDynArray;
procedure Init(const Title: string; Versions: TVersions);
end;
var
ProjectVersionCommitForm: TProjectVersionCommitForm;
implementation
uses
ProjectVersionSCR, // for notVoid()
ProjectSections;
{$R *.dfm}
procedure TProjectVersionCommitForm.FormKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
if byte(Shift)=0 then
case Key of
vk_F3: BtnSelected.Click;
vk_F4: BtnAll.Click;
end;
end;
procedure TProjectVersionCommitForm.BtnAllClick(Sender: TObject);
var i: integer;
begin
SetLength(Selected,CheckListBox.Count);
with CheckListBox.Items do
for i := 0 to Count-1 do
Selected[i] := integer(Objects[i]);
end;
procedure TProjectVersionCommitForm.BtnSelectedClick(Sender: TObject);
var n,i: integer;
begin
SetLength(Selected,CheckListBox.Count);
n := 0;
with CheckListBox.Items do
for i := 0 to Count-1 do
if CheckListBox.Checked[i] then begin
Selected[n] := integer(Objects[i]);
inc(n);
end;
Setlength(Selected,n);
end;
procedure TProjectVersionCommitForm.FormShow(Sender: TObject);
begin
Description.SetFocus;
end;
procedure TProjectVersionCommitForm.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
if not (ModalResult in [mrOK,mrAll]) then exit;
if NotVoid(Description) then exit;
CanClose := false;
end;
procedure TProjectVersionCommitForm.Init(const Title: string; Versions: TVersions);
var i, s, Value,Code: integer;
sel, u, last: string;
aSCR: TSectionsStorage;
Sec: TSection;
begin
Caption := ' '+Title;
Description.Text := '';
Comments.Clear;
PVCS.Checked := isTrue(Versions.Params['CommitToPVCS']);
sel := Versions.Params['LastUpdate']; // LastUpdate=012
with CheckListBox.Items do begin
Clear; // Update4=IFA Software;Synopse\IFA2;FilterDefault,*.sld,*.ias
for i := 0 to 9 do begin
u := Versions.Params['Update'+IntToStr(i)];
if u='' then continue;
AddObject(format('%s - %s',[ValAt(u,0,';'),ValAt(u,1,';')]),pointer(i));
if pos(chr(i+48),sel)>0 then
CheckListBox.Checked[Count-1] := true;
end;
end;
with SCR.Items do begin
Clear;
aSCR := Versions.SCR;
if aSCR<>nil then begin
s := 0;
last := Versions.Commits[Versions.Params['LastCommit']]['SCR'];
AddObject('-=- None -=-',pointer(-1));
for i := 0 to aSCR.Sections.Count-1 do begin
Sec := aSCR.Sections[i];
Val(Sec.SectionName,Value,Code);
if Code<>0 then continue; // [section] must be numeric
AddObject(format('%s - %s',[Sec.SectionName,Sec.ShortDescription('')]),
pointer(Value));
if Sec.SectionName=last then
s := Count-1;
end;
SCR.ItemIndex := s;
end;
end;
end;
end.