456 lines
12 KiB
Plaintext
456 lines
12 KiB
Plaintext
unit DDispLogoMain;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, DDispLogo, Vcl.ComCtrls,
|
|
Vcl.Buttons, Vcl.ExtCtrls;
|
|
|
|
type
|
|
TDlgDispLogoMain = class(TForm)
|
|
OpenDialog: TOpenDialog;
|
|
SaveDialog: TSaveDialog;
|
|
pnClient: TPanel;
|
|
mmText: TMemo;
|
|
FontDialog: TFontDialog;
|
|
pnLeft: TPanel;
|
|
GroupBox1: TGroupBox;
|
|
Label4: TLabel;
|
|
Label1: TLabel;
|
|
Label7: TLabel;
|
|
Label8: TLabel;
|
|
Label9: TLabel;
|
|
Label10: TLabel;
|
|
Label11: TLabel;
|
|
Label2: TLabel;
|
|
btnSelFont: TSpeedButton;
|
|
Label12: TLabel;
|
|
rdTxtLeft: TRadioButton;
|
|
rdTxtCenter: TRadioButton;
|
|
rdTxtRight: TRadioButton;
|
|
pnPos2: TPanel;
|
|
rdTxtUp: TRadioButton;
|
|
rdTxtCenter2: TRadioButton;
|
|
rdTxtDown: TRadioButton;
|
|
crbText: TColorBox;
|
|
crbBg: TColorBox;
|
|
edDtFormat: TEdit;
|
|
chDefDateTime: TCheckBox;
|
|
edOri: TEdit;
|
|
edOriTop: TEdit;
|
|
edTimeIntvSec: TEdit;
|
|
edFont: TEdit;
|
|
GroupBox2: TGroupBox;
|
|
Label5: TLabel;
|
|
Label6: TLabel;
|
|
btnImgOpen: TSpeedButton;
|
|
rdImgLeft: TRadioButton;
|
|
rdImgCenter1: TRadioButton;
|
|
rdImgRight: TRadioButton;
|
|
Panel1: TPanel;
|
|
rdImgUp: TRadioButton;
|
|
rdImgCenter2: TRadioButton;
|
|
rdImgDown: TRadioButton;
|
|
edImgPath: TEdit;
|
|
GroupBox3: TGroupBox;
|
|
lbAlpha: TLabel;
|
|
tbAlpha: TTrackBar;
|
|
chTaskbarDetect: TCheckBox;
|
|
btnShowLogo: TButton;
|
|
btnExportSet: TButton;
|
|
btnImportSet: TButton;
|
|
btnSetText: TSpeedButton;
|
|
procedure btnShowLogoClick(Sender: TObject);
|
|
procedure edTextKeyPress(Sender: TObject; var Key: Char);
|
|
procedure tbAlphaChange(Sender: TObject);
|
|
procedure rdTxtLeftClick(Sender: TObject);
|
|
procedure btnImgOpenClick(Sender: TObject);
|
|
procedure btnSetTextClick(Sender: TObject);
|
|
procedure crbBgChange(Sender: TObject);
|
|
procedure chDefDateTimeClick(Sender: TObject);
|
|
procedure edOriKeyPress(Sender: TObject; var Key: Char);
|
|
procedure btnExportSetClick(Sender: TObject);
|
|
procedure btnImportSetClick(Sender: TObject);
|
|
procedure btnSelFontClick(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
DispLogos_: TDlgDispLogoList;
|
|
procedure UpdateLogo;
|
|
public
|
|
{ Public declarations }
|
|
Constructor Create(aOwner: TComponent); override;
|
|
Destructor Destroy; override;
|
|
end;
|
|
|
|
var
|
|
DlgDispLogoMain: TDlgDispLogoMain;
|
|
|
|
implementation
|
|
|
|
uses
|
|
Tocsg.WinInfo, Tocsg.WTS, superobject, Tocsg.Convert, CrmLogger, Vcl.Clipbrd,
|
|
Tocsg.Safe, DImportData, Soap.EncdDecd, Tocsg.Strings, Tocsg.Path;
|
|
|
|
{$R *.dfm}
|
|
|
|
Constructor TDlgDispLogoMain.Create(aOwner: TComponent);
|
|
begin
|
|
Inherited Create(aOwner);
|
|
DispLogos_ := TDlgDispLogoList.Create;
|
|
mmText.Lines.Add(GetComName + '\' + WTS_GetCurrentUserName);
|
|
mmText.Lines.Add('{DateTime}');
|
|
edFont.Text := mmText.Font.Name;
|
|
end;
|
|
|
|
Destructor TDlgDispLogoMain.Destroy;
|
|
begin
|
|
FreeAndNil(DispLogos_);
|
|
Inherited;
|
|
end;
|
|
|
|
procedure TDlgDispLogoMain.edOriKeyPress(Sender: TObject; var Key: Char);
|
|
begin
|
|
if Key = #13 then
|
|
begin
|
|
Key := #0;
|
|
UpdateLogo;
|
|
exit;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgDispLogoMain.edTextKeyPress(Sender: TObject; var Key: Char);
|
|
begin
|
|
if Key = #13 then
|
|
begin
|
|
Key := #0;
|
|
UpdateLogo;
|
|
exit;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgDispLogoMain.rdTxtLeftClick(Sender: TObject);
|
|
begin
|
|
UpdateLogo;
|
|
end;
|
|
|
|
procedure TDlgDispLogoMain.tbAlphaChange(Sender: TObject);
|
|
begin
|
|
if DispLogos_.Count > 0 then
|
|
DispLogos_.SetAlpha(tbAlpha.Position);
|
|
lbAlpha.Caption := Format('투명도(%d) :', [tbAlpha.Position]);
|
|
end;
|
|
|
|
procedure TDlgDispLogoMain.UpdateLogo;
|
|
var
|
|
nPos1, nPos2: Integer;
|
|
sDtFormat: String;
|
|
begin
|
|
if DispLogos_.Count > 0 then
|
|
begin
|
|
// mmText.Text := Trim(mmText.Text);
|
|
edTimeIntvSec.Text := Trim(edTimeIntvSec.Text);
|
|
|
|
if rdTxtLeft.Checked then
|
|
nPos1 := 1
|
|
else if rdTxtRight.Checked then
|
|
nPos1 := 2
|
|
else
|
|
nPos1 := 3;
|
|
|
|
if rdTxtUp.Checked then
|
|
nPos2 := 1
|
|
else if rdTxtDown.Checked then
|
|
nPos2 := 2
|
|
else
|
|
nPos2 := 3;
|
|
|
|
if chDefDateTime.Checked then
|
|
sDtFormat := ''
|
|
else
|
|
sDtFormat := Trim(edDtFormat.Text);
|
|
DispLogos_.SetText(mmText.Text, mmText.Font, nPos1, nPos2, StrToIntDef(edOri.Text, 0), StrToIntDef(edOriTop.Text, 0),
|
|
crbText.Selected, crbBg.Selected, sDtFormat, StrToIntDef(edTimeIntvSec.Text, 0));
|
|
|
|
if rdImgLeft.Checked then
|
|
nPos1 := 1
|
|
else if rdImgRight.Checked then
|
|
nPos1 := 2
|
|
else
|
|
nPos1 := 3;
|
|
|
|
if rdImgUp.Checked then
|
|
nPos2 := 1
|
|
else if rdImgDown.Checked then
|
|
nPos2 := 2
|
|
else
|
|
nPos2 := 3;
|
|
|
|
DispLogos_.SetImage(edImgPath.Text, nPos1, nPos2);
|
|
DispLogos_.SetAlpha(tbAlpha.Position);
|
|
DispLogos_.SetTaskbarDetect(chTaskbarDetect.Checked);
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgDispLogoMain.btnExportSetClick(Sender: TObject);
|
|
var
|
|
O, OFont: ISuperObject;
|
|
nPos1, nPos2: Integer;
|
|
sTemp,
|
|
sDtFormat: String;
|
|
CB: TClipboard;
|
|
begin
|
|
try
|
|
O := SO;
|
|
|
|
if rdTxtLeft.Checked then
|
|
nPos1 := 1
|
|
else if rdTxtRight.Checked then
|
|
nPos1 := 2
|
|
else
|
|
nPos1 := 3;
|
|
|
|
if rdTxtUp.Checked then
|
|
nPos2 := 1
|
|
else if rdTxtDown.Checked then
|
|
nPos2 := 2
|
|
else
|
|
nPos2 := 3;
|
|
|
|
if chDefDateTime.Checked then
|
|
sDtFormat := ''
|
|
else
|
|
sDtFormat := Trim(edDtFormat.Text);
|
|
|
|
DispLogos_.SetText(mmText.Text, mmText.Font, nPos1, nPos2, StrToIntDef(edOri.Text, 0), StrToIntDef(edOriTop.Text, 0),
|
|
crbText.Selected, crbBg.Selected, sDtFormat, StrToIntDef(edTimeIntvSec.Text, 0));
|
|
|
|
O.I['TxHPos'] := nPos1;
|
|
O.I['TxVPos'] := nPos2;
|
|
if sDtFormat <> '' then
|
|
O.S['TxDtFmt'] := sDtFormat;
|
|
|
|
OFont := SO;
|
|
OFont.S['Name'] := mmText.Font.Name;
|
|
OFont.I['Size'] := mmText.Font.Size;
|
|
OFont.I['Color'] := mmText.Font.Color;
|
|
OFont.I['Style'] := TTgRtti.SetTypeToInt64<TFontStyles>(mmText.Font.Style);
|
|
O.O['TxFont'] := OFont;
|
|
sTemp := StringReplace(mmText.Text, #13#10, '|*|', [rfReplaceAll]);
|
|
sTemp := StringReplace(sTemp, ' ', '§', [rfReplaceAll]);
|
|
O.S['TxStr'] := sTemp;
|
|
O.I['TxOri'] := StrToIntDef(edOri.Text, 0);
|
|
O.I['TxOriT'] := StrToIntDef(edOriTop.Text, 0);
|
|
O.I['TxCol'] := ULONGLONG(crbText.Selected);
|
|
O.I['TxColB'] := ULONGLONG(crbBg.Selected);
|
|
O.I['Alpha'] := tbAlpha.Position;
|
|
if chTaskbarDetect.Checked then
|
|
O.B['TBar'] := true;
|
|
|
|
if FileExists(edImgPath.Text) then
|
|
begin
|
|
if rdImgLeft.Checked then
|
|
nPos1 := 1
|
|
else if rdImgRight.Checked then
|
|
nPos1 := 2
|
|
else
|
|
nPos1 := 3;
|
|
|
|
if rdImgUp.Checked then
|
|
nPos2 := 1
|
|
else if rdImgDown.Checked then
|
|
nPos2 := 2
|
|
else
|
|
nPos2 := 3;
|
|
|
|
O.I['ImHPos'] := nPos1;
|
|
O.I['ImVPos'] := nPos2;
|
|
O.S['ImData'] := FileToBase64(edImgPath.Text);
|
|
end;
|
|
|
|
Guard(CB, TClipboard.Create);
|
|
CB.AsText := EncryptStrToBase64(O.AsString);
|
|
|
|
MessageBox(Handle, PChar('설정값이 클립보드에 복사되었습니다.'), PChar(Caption), MB_ICONINFORMATION or MB_OK);
|
|
except
|
|
MessageBox(Handle, PChar('내보내기를 시도 중 오류가 발생했습니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgDispLogoMain.btnImgOpenClick(Sender: TObject);
|
|
begin
|
|
OpenDialog.FileName := '';
|
|
if OpenDialog.Execute(Handle) then
|
|
begin
|
|
edImgPath.Text := OpenDialog.FileName;
|
|
if DispLogos_.Count > 0 then
|
|
UpdateLogo;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgDispLogoMain.btnImportSetClick(Sender: TObject);
|
|
var
|
|
dlg: TDlgImportData;
|
|
O: ISuperObject;
|
|
sTemp: String;
|
|
begin
|
|
Guard(dlg, TDlgImportData.Create(Self));
|
|
if dlg.ShowModal <> mrOk then
|
|
exit;
|
|
|
|
try
|
|
O := SO(DecryptStr(dlg.mmInfo.Text));
|
|
|
|
case O.I['TxHPos'] of
|
|
1 : rdTxtLeft.Checked := true;
|
|
2 : rdTxtRight.Checked := true;
|
|
else rdTxtCenter.Checked := true;
|
|
end;
|
|
|
|
case O.I['TxVPos'] of
|
|
1 : rdTxtUp.Checked := true;
|
|
2 : rdTxtDown.Checked := true;
|
|
else rdTxtCenter2.Checked := true;
|
|
end;
|
|
|
|
if O.S['TxDtFmt'] <> '' then
|
|
edDtFormat.Text := O.S['TxDtFmt'];
|
|
|
|
if O.O['TxFont'] <> nil then
|
|
begin
|
|
try
|
|
mmText.Font.Name := O.O['TxFont'].S['Name'];
|
|
mmText.Font.Size := O.O['TxFont'].I['Size'];
|
|
mmText.Font.Color := O.O['TxFont'].I['Color'];
|
|
mmText.Font.Style := TTgRtti.Int64ToSetType<TFontStyles>(O.O['TxFont'].I['Style']);
|
|
except
|
|
MessageBox(Handle, PChar('폰트 정보를 블러오는중 오류가 발생했습니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
end;
|
|
end;
|
|
|
|
sTemp := StringReplace(O.S['TxStr'], '§', ' ', [rfReplaceAll]);
|
|
sTemp := StringReplace(sTemp, '|*|', #13#10, [rfReplaceAll]);
|
|
mmText.Text := sTemp;
|
|
edOri.Text := IntToStr(O.I['TxOri']);
|
|
edOriTop.Text := IntToStr(O.I['TxOriT']);
|
|
crbText.Selected := O.I['TxCol'];
|
|
crbBg.Selected := O.I['TxColB'];
|
|
tbAlpha.Position := O.I['Alpha'];
|
|
chTaskbarDetect.Checked := O.B['TBar'];
|
|
|
|
if O.S['ImData'] <> '' then
|
|
begin
|
|
if MessageBox(Handle, PChar('이미지 데이터가 포함되어 있습니다.'+#13+#10+'파일을 생성 후 추가 하시겠습니까?'), PChar(Caption), MB_ICONQUESTION or MB_YESNO) = IDYES then
|
|
begin
|
|
if SaveDialog.Execute(Handle) then
|
|
begin
|
|
var ms: TMemoryStream;
|
|
Guard(ms, TMemoryStream.Create);
|
|
var pBuf: TBytes := DecodeBase64(O.S['ImData']);
|
|
|
|
ms.Write(pBuf[0], Length(pBuf));
|
|
ms.SaveToFile(SaveDialog.FileName);
|
|
|
|
case O.I['ImHPos'] of
|
|
1 : rdImgLeft.Checked := true;
|
|
2 : rdImgRight.Checked := true;
|
|
else rdImgCenter1.Checked := true;
|
|
end;
|
|
|
|
case O.I['ImVPos'] of
|
|
1 : rdImgUp.Checked := true;
|
|
2 : rdImgDown.Checked := true;
|
|
else rdImgCenter2.Checked := true;
|
|
end;
|
|
|
|
edImgPath.Text := SaveDialog.FileName;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
if DispLogos_.Count > 0 then
|
|
UpdateLogo
|
|
else
|
|
btnShowLogo.Click;
|
|
except
|
|
MessageBox(Handle, PChar('설정값을 가져오는 중 오류가 발생했습니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgDispLogoMain.btnSelFontClick(Sender: TObject);
|
|
begin
|
|
FontDialog.Font.Assign(mmText.Font);
|
|
if FontDialog.Execute(Handle) then
|
|
begin
|
|
edFont.Text := FontDialog.Font.Name;
|
|
mmText.Font.Assign(FontDialog.Font);
|
|
crbText.Selected := mmText.Font.Color;
|
|
UpdateLogo;
|
|
end;
|
|
end;
|
|
|
|
procedure TDlgDispLogoMain.btnSetTextClick(Sender: TObject);
|
|
begin
|
|
UpdateLogo;
|
|
end;
|
|
|
|
procedure TDlgDispLogoMain.btnShowLogoClick(Sender: TObject);
|
|
begin
|
|
if DispLogos_.Count = 0 then
|
|
begin
|
|
{$IF true}
|
|
DispLogos_.CreateLogos;
|
|
|
|
var F: TFont;
|
|
Guard(F, TFont.Create);
|
|
F.Name := 'Tahoma';
|
|
F.Size := 26;
|
|
|
|
var sTemp := GetRunExePathDir + 'CI.bmp';
|
|
if FileExists(sTemp) then
|
|
DispLogos_.SetImage(sTemp, 3, 3);
|
|
sTemp := '';
|
|
SumString(sTemp, '{DateTime}' {DateTimeToStr(Now)}, ' ');
|
|
SumString(sTemp, 'kku', ' ');
|
|
SumString(sTemp, '김구진', ' ');
|
|
|
|
DispLogos_.SetTaskbarDetect(true);
|
|
DispLogos_.SetTextWEL(sTemp, 3, F, 3, 3, 250, clBlack, clSilver, 'yyyy-mm-dd hh:nn:ss', 0);
|
|
DispLogos_.SetAlpha(20);
|
|
{$ELSE}
|
|
edImgPath.Text := Trim(edImgPath.Text);
|
|
if (edImgPath.Text <> '') and not FileExists(edImgPath.Text) then
|
|
begin
|
|
MessageBox(Handle, PChar('이미지 파일이 존재하지 않습니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
|
|
exit;
|
|
end;
|
|
|
|
DispLogos_.CreateLogos;
|
|
UpdateLogo;
|
|
|
|
btnShowLogo.Caption := '상시로고 끄기';
|
|
btnSetText.Visible := true;
|
|
{$IFEND}
|
|
end else begin
|
|
DispLogos_.Clear;
|
|
btnSetText.Visible := false;
|
|
btnShowLogo.Caption := '상시로고 켜기';
|
|
end;
|
|
Application.ProcessMessages;
|
|
end;
|
|
|
|
procedure TDlgDispLogoMain.chDefDateTimeClick(Sender: TObject);
|
|
begin
|
|
UpdateLogo;
|
|
edDtFormat.Enabled := not chDefDateTime.Checked;
|
|
end;
|
|
|
|
procedure TDlgDispLogoMain.crbBgChange(Sender: TObject);
|
|
begin
|
|
mmText.Font.Color := crbText.Selected;
|
|
UpdateLogo;
|
|
end;
|
|
|
|
end.
|