📄 taddfrmunit.pas
字号:
(* $Id: TAddFrmunit.pas,v 1.8 2003/01/08 19:23:55 turbo Exp $
*
* Form for adding files to CVS (cvs add)
*
* Copyright 2001 by Thomas Bleier
* For license details see LICENSE.txt
*)
unit TAddFrmunit;
{$I BORCVS.inc}
interface
//---------------------------------------------------------------------------
uses
Classes,
Controls,
StdCtrls,
Forms,
TCvsBaseFrmunit,
TRunCvsFrmunit,
TFilesFrameunit,
ExtCtrls;
//---------------------------------------------------------------------------
type
TAddFrm = class(TCvsBaseFrm)
Label1: TLabel;
PDescription: TEdit;
PMode: TRadioGroup;
Label2: TLabel;
PFilesFrame: TFilesFrame;
procedure FormShow(Sender: TObject);
procedure POkBtnClick(Sender: TObject);
private
FWhichFiles: TWhichFilesMode; // Anwender-Deklarationen
protected
procedure ApplyParameters(runcvs: TRunCvsFrm; InDirectory: string = ''); override;
procedure GetDirectories(Dirs: TStrings); override;
public // Anwender-Deklarationen
constructor create(Owner: TComponent); override;
property WhichFiles: TWhichFilesMode read FWhichFiles write FWhichFiles;
end;
//---------------------------------------------------------------------------
var
AddFrm: TAddFrm;
//---------------------------------------------------------------------------
implementation
uses
TToolsApiHelperunit,
sysutils,
dialogs,
Utilityunit;
//---------------------------------------------------------------------------
{$R *.dfm}
//---------------------------------------------------------------------------
constructor TAddFrm.create(Owner: TComponent);
begin
inherited create(owner);
FWhichFiles := wfmCustom;
PFilesFrame.OnlyFileNameasParameter := true;
end;
//---------------------------------------------------------------------------
procedure TAddFrm.FormShow(Sender: TObject);
begin
DebugInfo('FormShow');
ActiveControl := PDescription;
PMode.ItemIndex := 0;
PFilesFrame.LoadSettings;
case (FWhichFiles) of
wfmCustom:
begin
end;
wfmModule:
begin
end;
wfmProject:
begin
PFilesFrame.SetFilesInProjectButNotCvs(true);
end;
wfmProjectGroup:
begin
PFilesFrame.SetFilesInProjectGroupButNotCvs(true);
end;
else
assert(false);
end;
end;
//---------------------------------------------------------------------------
procedure TAddFrm.POkBtnClick(Sender: TObject);
begin
if (not PFilesFrame.IsValid(1)) then
begin
ShowMessage('You have to select at least one file!');
ActiveControl := PFilesFrame;
exit;
end;
if (Trim(PDescription.Text) = '') and
(MessageDlg('Are you sure that you don''t want to enter a description?',
mtConfirmation, [mbYes, mbNo], 0) = mrNo) then
begin
ActiveControl := PDescription;
exit;
end;
PFilesFrame.SaveSettings;
ModalResult := mrOk;
end;
//---------------------------------------------------------------------------
procedure TAddFrm.ApplyParameters(runcvs: TRunCvsFrm; InDirectory: string = '');
begin
runcvs.Command := CVSCMD_ADD;
PFilesFrame.ApplyParameters(runcvs, InDirectory);
runcvs.CommandOptions.Add('-m ' + GetQuotedString(PDescription.Text));
case (PMode.ItemIndex) of
1:
runcvs.CommandOptions.Add('-kkv');
2:
runcvs.CommandOptions.Add('-kk');
3:
runcvs.CommandOptions.Add('-kb');
end;
end;
//---------------------------------------------------------------------------
procedure TAddFrm.GetDirectories(Dirs: TStrings);
begin
PFilesFrame.GetDirectories(dirs);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -