{ *************************************************************************** } { } { Jadro pluginu 2 Asseco Solutions } { } { *************************************************************************** } unit plgAbout; interface uses Classes, Controls, Forms, StdCtrls, ComCtrls, ExtCtrls, ActnList, ddPlugin_TLB, System.Actions, plgForm; type TfrmAbout = class(TfrmPlgPredek) bOK: TButton; PageControlMain: TPageControl; tsInfo: TTabSheet; tsTechPopis: TTabSheet; LV_Info: TListView; PaintBoxInfo: TPaintBox; bCopy: TButton; MemoTechPopis: TMemo; ActionList1: TActionList; A_Zalozka1: TAction; A_Zalozka2: TAction; tsLogo: TTabSheet; ImageLogoAbout: TImage; A_Zalozka3: TAction; tsHistorieVerzi: TTabSheet; MemoHistorieVerzi: TMemo; A_Zalozka4: TAction; procedure FormCreate(Sender: TObject); procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure bCopyClick(Sender: TObject); procedure LV_InfoCustomDrawItem(Sender: TCustomListView; Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean); procedure PaintBoxInfoPaint(Sender: TObject); procedure A_Zalozka_X_Execute(Sender: TObject); procedure LV_InfoDblClick(Sender: TObject); public function ShowModalEx(Helios: IHelios): TModalResult; end; { =========================================================================== } implementation {$R *.DFM} uses Windows, SysUtils, Menus, Graphics, plgType, plgMain, ComObj, plgDMGlob, ShellAPI, plgInstalace, Clipbrd; const proTlustyRadek = Pointer(-1); proCervenyRadek = Pointer(-2); proUmisteniDLL = Pointer(-3); { ########################################################################### } procedure TfrmAbout.FormCreate(Sender: TObject); begin inherited; LV_Info.Font.Name := plgTestMSSansSerifFont(LV_Info.Font.Name); bCopy.Caption := plgCtiOznam(plxJadroKopirovat); tsInfo.Caption := '1 - ' + plgCtiOznam(plxJadroZakladniInformace); tsLogo.Caption := '2 - ' + plgCtiOznam(plxJadroLogo); tsTechPopis.Caption := '3 - ' + plgCtiOznam(plxJadroTechnickyPopis); tsHistorieVerzi.Caption := '4 - ' + plgCtiOznam(plxJadroHistorieVerzi); // aby slo udelat tabulku napr. s popisem formatu importnich souboru apod. MemoTechPopis.Font.Name := 'Courier New'; MemoHistorieVerzi.Font.Name := 'Courier New'; LV_Info.Columns[0].Caption := plgCtiOznam(plxJadroAbout_Nazev); LV_Info.Columns[1].Caption := plgCtiOznam(plxJadroAbout_Hodnota); with TfrmInstalace.Create(nil) do try Self.ImageLogoAbout.Picture.Assign(ImageLogo.Picture); finally Free; end; ImageLogoAbout.Left := (tsLogo.Width - ImageLogoAbout.Width) div 2; ImageLogoAbout.Top := (tsLogo.Height - ImageLogoAbout.Height) div 2; end; { --------------------------------------------------------------------------- } procedure TfrmAbout.PaintBoxInfoPaint(Sender: TObject); begin DataModuleGlobPLG.ImageList32_32.Draw(PaintBoxInfo.Canvas, 0, 0, DataModuleGlobPLG.Idx.iiInfo); end; { --------------------------------------------------------------------------- } procedure TfrmAbout.A_Zalozka_X_Execute(Sender: TObject); begin case TAction(Sender).Tag of 1: PageControlMain.ActivePage := tsInfo; 2: PageControlMain.ActivePage := tsLogo; 3: if tsTechPopis.TabVisible then PageControlMain.ActivePage := tsTechPopis; 4: if tsHistorieVerzi.TabVisible then PageControlMain.ActivePage := tsHistorieVerzi; end; end; { --------------------------------------------------------------------------- } procedure TfrmAbout.LV_InfoCustomDrawItem(Sender: TCustomListView; Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean); begin if Item.Data = proTlustyRadek then Sender.Canvas.Font.Style := [fsBold] else if Item.Data = proCervenyRadek then Sender.Canvas.Font.Color := clRed; end; { --------------------------------------------------------------------------- } procedure TfrmAbout.LV_InfoDblClick(Sender: TObject); var Cesta: String; begin if Assigned(LV_Info.Selected) and (LV_Info.Selected.Data = proUmisteniDLL) then begin Cesta := ExtractFileDir(LV_Info.Selected.SubItems[0]); if Cesta <> '' then ShellExecute(0, 'open', PChar(Cesta), nil, nil, SW_SHOWNORMAL); end; end; { --------------------------------------------------------------------------- } procedure TfrmAbout.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if PageControlMain.ActivePage = tsInfo then begin // Ctrl+C nebo Ctrl+Insert if (ShortCut(Key, Shift) = ShortCut(ord('C'), [ssCtrl])) or (ShortCut(Key, Shift) = ShortCut(VK_INSERT, [ssCtrl])) then begin bCopyClick(nil); Key := 0; Exit; end; end; inherited; end; { --------------------------------------------------------------------------- } procedure TfrmAbout.bCopyClick(Sender: TObject); var Obsah: String; II: Integer; LI: TListItem; begin Obsah := ''; for II := 0 to LV_Info.Items.Count-1 do begin LI := LV_Info.Items[II]; Obsah := Format('%s'#13#10'%s'#9'%s', [Obsah, LI.Caption, LI.SubItems[0]]); end; Delete(Obsah, 1, 2); // zrus prvni CR+LF Clipboard.AsText := Obsah; end; { --------------------------------------------------------------------------- } function TfrmAbout.ShowModalEx(Helios: IHelios): TModalResult; var PomPointer: Pointer; VerzeZBD, PomStr: String; ZmenyOK: Boolean; { +++++++++++++++++++++++++++ } procedure _PridejText(const Nazev, Hodnota: String; TypRadku: Pointer = nil); begin with LV_Info.Items.Add do begin Caption := Nazev; SubItems.Add(Hodnota); Data := TypRadku; end; end; { +++++++++++++++++++++++++++ } begin PageControlMain.ActivePage := tsInfo; Caption := Format('%s [%s]', [plgCtiOznam(plxJadroAbout_OPluginu), PluginKonfig.PluginVerejneJmeno]); // naplneni informaci LV_Info.Items.BeginUpdate; try LV_Info.Items.Clear; _PridejText('PLUGIN', '', proTlustyRadek); _PridejText(plgCtiOznam(plxJadroAbout_Nazev), PluginKonfig.PluginVerejneJmeno); _PridejText(plgCtiOznam(plxJadroVerze), plgVerzePluginu(jvCelaUnicode){$IFnDEF BezLadit}+' (beta)'{$ENDIF}); if Helios.HeVersion < PluginKonfig.PluginMinimalniPozadovanaVerzeHeliosu then PomPointer := proCervenyRadek else PomPointer := nil; _PridejText(Format(plgCtiOznam(plxJadroAbout_MinVerze_X), [Cplg_ProductName]), plgObecnaVerze(PluginKonfig.PluginMinimalniPozadovanaVerzeHeliosu, jvCela), PomPointer); if Helios.SQLVersion < PluginKonfig.PluginMinimalniPozadovanaVerzeSQLServeru then PomPointer := proCervenyRadek else PomPointer := nil; _PridejText(plgCtiOznam(plxJadroMinVerzeSQLServeru), plgVerzeSQLServeru(PluginKonfig.PluginMinimalniPozadovanaVerzeSQLServeru), PomPointer); PomPointer := nil; VerzeZBD := plgNactiVerziPluginuZDB(Helios, ZmenyOK); if VerzeZBD = '000000000000' then VerzeZBD := plgCtiOznam(plxJadroNeinstalovano) else begin VerzeZBD := IntToStr(StrToIntDef(Copy(VerzeZBD, 1, 2),1)) + '.' + IntToStr(StrToIntDef(Copy(VerzeZBD, 3, 2),0)) + '.' + Copy(VerzeZBD, 5, 4) + '.' + Copy(VerzeZBD, 9, 4); if ZmenyOK then VerzeZBD := Format('%s (%s)', [VerzeZBD, plgCtiOznam(plxOK)]) else begin VerzeZBD := Format('%s (ERROR)', [VerzeZBD]); PomPointer := proCervenyRadek; end; end; _PridejText(plgCtiOznam(plxJadroInstalovanaVerze), VerzeZBD, PomPointer); _PridejText('', ''); _PridejText(AnsiUpperCase(plgCtiOznam(plxJadroAbout_Vyrobce)), '', proTlustyRadek); _PridejText(plgCtiOznam(plxJadroAbout_Vyrobce), PluginKonfig.PluginCopyrightVyrobce); _PridejText(plgCtiOznam(plxJadroAbout_IdentifikaceVyrobce), PluginKonfig.PartnerIdentification); _PridejText('', ''); _PridejText('PLUGIN (SYS)', '', proTlustyRadek); _PridejText('ClassID', GUIDToString(PluginKonfig.PluginClass_ID)); _PridejText('SysName', PluginKonfig.PluginSystemoveJmeno); _PridejText('ClassName', PluginKonfig.PluginClassName); if PluginKonfig.PluginIdentifikator <> '' then PomStr := PluginKonfig.PluginIdentifikator else PomStr := plgCtiOznam(plxJadro_Nepouzito_); _PridejText(plgCtiOznam(plxJadroIdentifikator), PomStr); _PridejText(plgCtiOznam(plxJadroUmisteni), plgGetPluginPathAndName, proUmisteniDLL); if Helios.HeVersion < Cplg_Jadro_MinimalniPozadovanaVerzeHeliosu then PomPointer := proCervenyRadek else PomPointer := nil; _PridejText('', ''); _PridejText(plgCtiOznam(plxJadroAbout_JADRO), '', proTlustyRadek); _PridejText(plgCtiOznam(plxJadroVerze), plgObecnaVerze(Cplg_VerzeJadra, jvCelaUnicode) + ' / IHePlugin3 / ' + plgGetIndependentSQLFloat('%.1f', System.CompilerVersion)); _PridejText(Format(plgCtiOznam(plxJadroAbout_MinVerze_X), [Cplg_ProductName]), plgObecnaVerze(Cplg_Jadro_MinimalniPozadovanaVerzeHeliosu, jvCela), PomPointer); // AJ, 8.12.2015 - Administrátorská podpora v HeO { podpora platí od uvolnění tohoto kódu, tudíž není nutná žádná podmínka, proto natvrdo } _PridejText(plgCtiOznam(plxJadroPodporaTicheInstalacePluginu), plgCtiOznam(plxJadroAno)); finally LV_Info.Items.EndUpdate; end; // technicky popis if PluginKonfig.PluginTechnickyPopis = '' then tsTechPopis.TabVisible := False else MemoTechPopis.Lines.Text := PluginKonfig.PluginTechnickyPopis; if PluginKonfig.PluginHistorieVerzi = '' then tsHistorieVerzi.TabVisible := False else MemoHistorieVerzi.Lines.Text := PluginKonfig.PluginHistorieVerzi; // vlastni zobrazeni Result := ShowModal; end; { ########################################################################### } end.