Changeset 464
Author: nrymanov@gmail.com
(2010/03/01 16:47) Almost 2 years ago
see #29 - Редизайн и унификация пользовательского интерфейса
Author: nrymanov@gmail.com
(2010/03/01 16:47) Almost 2 years ago
see #29 - Редизайн и унификация пользовательского интерфейса
fictionbook_21 in 'fictionbook_21.pas';fictionbook_21 in 'fictionbook_21.pas',unit_FB2Utils in 'unit_FB2Utils.pas';<ProjectGuid>{D86FD5A7-BE1F-417C-BEB7-6020DDD97B5F}</ProjectGuid><ProjectGuid>{D86FD5A7-BE1F-417C-BEB7-6020DDD97B5F}</ProjectGuid><Config Condition="'$(Config)'==''">Release</Config><Config Condition="'$(Config)'==''">Debug</Config>{******************************************************************************}(* *****************************************************************************{ }*{ Package MyHomeLib Components }* MyHomeLib{ }*{ Version 1 }* Copyright (C) 2008-2010 Aleksey Penkov{ }*{ Copyright (c) 2008, 2009 Aleksey Penkov alex.penkov@gmail.com }* Created 19.02.2010{ }* Description{******************************************************************************}* Author(s) Aleksey Penkov alex.penkov@gmail.com* Nick Rymanov nrymanov@gmail.com** History* NickR 27.02.2010 unit_FB2Utils::GetBookCover******************************************************************************* *)StdCtrls ,{ Private declarations }{ Private declarations }FText : TMemo;FInfo : TPanel;FFile : string;FTmp : string;FNo: Integer;FNo: integer;FAColor : TColor;{ Protected declarations }{ Protected declarations }function UnPack(var FS: TMemoryStream): boolean;function Show(Folder, FileName: string; No: integer): boolean;{ Published declarations }{ Published declarations }property TmpFolder: string read FTmp write FTmp;property Fb2InfoVisible: boolean read FFb2InfoVisible write Set_Fb2InfoVisible;property FontSize: integer read FFontSize write Set_FontSize;unit_MHLHelpers;unit_MHLHelpers,unit_FB2Utils;{ TMHLCoverPanel }{ TMHLCoverPanel }FCity.Caption := '';FYear.Caption := '';FISBN.Caption := '';FDate.Caption := '';FVersion.Caption := '';FAuthor.Caption := '';Parent := AOwner as TWinControl;Align := alRight;Caption := '';Width := 250;BorderInner := fsNone;BorderOuter := fsFlatRounded;ParentFont := False;Font.Size := 8;SizeBarWidth := 5;Margins.Left := 0;MarginMin := 150;FCover := TImage.Create(Self);FCover.Align := alTop;FCover.Margins.Top := 5;FCover.Parent := Self;FCover.Height := 255;FCover.Center := True;FCover.Stretch := True;FCover.Proportional := True;FCover.PopupMenu := FMenu;FText := TMemo.Create(Self);FText.Parent := Self;FText.Align := alClient;FText.ScrollBars := ssVertical;FText.ReadOnly := True;FText.TabStop := False;FText.PopupMenu := FMenu;// -----------------------------FInfo := TPanel.Create(Self);FInfo.Parent := Self;FInfo.Align := alBottom;FInfo.Height := 100;FInfo.BevelOuter := bvNone;lbl := TLabel.Create(FInfo);lbl.Parent := FInfo;lbl.Caption := '-:';lbl.Top := 0;lbl.Tag := 1;lbl.Left := 5;lbl.Width := W;lbl.Alignment := taRightJustify;lbl := TLabel.Create(FInfo);lbl.Parent := FInfo;lbl.Caption := ':';lbl.Top := 15;lbl.Tag := 2;lbl.Left := 5;lbl.Width := W;lbl.Alignment := taRightJustify;lbl := TLabel.Create(FInfo);lbl.Parent := FInfo;lbl.Caption := ':';lbl.Top := 30;lbl.Tag := 3;lbl.Left := 5;lbl.Width := W;lbl.Alignment := taRightJustify;lbl := TLabel.Create(FInfo);lbl.Parent := FInfo;lbl.Caption := 'ISBN:';lbl.Top := 45;lbl.Tag := 4;lbl.Left := 5;lbl.Width := W;lbl.Alignment := taRightJustify;lbl := TLabel.Create(FInfo);lbl.Parent := FInfo;lbl.Caption := ':';lbl.Top := 65;lbl.Tag := 5;lbl.Left := 5;lbl.Width := W;lbl.Alignment := taRightJustify;FVerTitle := TLabel.Create(FInfo);FVerTitle.Parent := FInfo;FVerTitle.Caption := 'v. ';FVerTitle.Tag := 6;FVerTitle.Top := 65;FVerTitle.Left := Width - 70;lbl := TLabel.Create(FInfo);lbl.Parent := FInfo;lbl.Caption := ':';lbl.Top := 80;lbl.Tag := 7;lbl.Left := 5;lbl.Width := W;lbl.Alignment := taRightJustify;FPublisher := TLabel.Create(FInfo);FPublisher.Parent := FInfo;FPublisher.Width := 180;FPublisher.Top := 0;FPublisher.Left := W + 10;FPublisher.PopupMenu := FMenu;FCity := TLabel.Create(FInfo);FCity.Top := 15;FCity.Left := W + 10;FYear := TLabel.Create(FInfo);FYear.Top := 30;FYear.Left := W + 10;FISBN := TLabel.Create(FInfo);FISBN.Parent := FInfo;FISBN.Top := 45;FISBN.Left := W + 10;FISBN.Width := 180;FDate := TLabel.Create(FInfo);FDate.Parent := FInfo;FDate.Width := 65;FDate.Top := 65;FDate.Left := W + 10;FVersion := TLabel.Create(FInfo);FVersion.Top := 65;FVersion.Left := Width - 55;FAuthor := TLabel.Create(FInfo);FAuthor.Parent := FInfo;FAuthor.Width := Width - W - 30;FAuthor.Top := 80;FAuthor.Left := W + 10;bvl := TRzBorder.Create(FInfo);bvl.Parent := FInfo;bvl.BorderOuter := fsFlatRounded;bvl.Align := alBottom;bvl.Height := 36;FAColor := Value;FInfo.Visible := Value;FFontSize := Value;if (Not Visible) or FOnProgress then Exit;Exit;FOnProgress := true;FOnProgress := True;FNo := No;S : string;s := GetFileNameZip(Zip,FNo);S := GetFileNameZip(Zip, FNo);Zip.ExtractToStream(s,FS);Zip.ExtractToStream(S, FS);else if ExtractFileExt(FFile) = '.zip' thenif ExtractFileExt(FFile) = '.zip' thenbeginif not FileExists(FFolder + FFile) thenZip.FindFirst('*.fbd', F);FS.LoadFromFile(FFolder + FFile);Zip := TZipForge.Create(nil);Result := True;tryfinallyZip.FileName := FFolder + FFile;FOnProgress := False;tryend;Zip.OpenArchive;zip.FindFirst('*.fbd',F);Zip.ExtractToStream(F.FileName,FS);Result := True;except//end;finallyFOnProgress := False;Zip.Free;end;endelseif ExtractFileExt(FFile) = '.fb2' thentryif not FileExists(FFolder + FFile) thenbeginFOnProgress := False;Exit;end;FS.LoadFromFile(FFolder + FFile);Result := True;finallyFOnProgress := False;end;{ TODO : ; + }{ TODO : ; + }S, outStr: AnsiString;imgBookCover: TGraphic;CoverID, Short : string;ImgVisible: boolean;MS: TMemoryStream;IMG: TGraphic;EXT: string;StrLen: integer;ImgVisible := False;MS := TMemoryStream.Create;if FBook.Description.Titleinfo.Coverpage.Count > 0 thenbeginCoverID := FBook.Description.Titleinfo.Coverpage.ImageList[0].xlinkHref;Delete(CoverID,1,1);for i := 0 to FBook.Binary.Count - 1 dobeginif FBook.Binary.Items[i].Id = CoverID thenbeginS := FBook.Binary.Items[i].Text;outStr := DecodeBase64(S);StrLen := Length(outStr);//MS.Write(PAnsiChar(outStr)^, StrLen);// ( )ImgVisible := True;//end;imgBookCover := GetBookCover(FBook);if Assigned(imgBookCover) thenbegintryFCover.Picture.Assign(imgBookCover);finallyimgBookCover.Free;end;elseShowEmptyCover;for I := 0 to Titleinfo.Annotation.P.Count - 1 doFText.SelStart := 0;Ftext.Lines.Add(Titleinfo.Annotation.P.Items[i].Text);FText.SelLength := 0;FAuthor.Caption := Documentinfo.Author.Items[0].Nickname.Text;Hint := '' + #13#10 + ': ' + Publishinfo.City.Text + #13#10 + ' :' + Publishinfo.City.Text;': ' + Publishinfo.City.Text + #13#10 +' :' + Publishinfo.City.Text;if ImgVisible thenbeginExt := LowerCase(ExtractFileExt(CoverID));tryif Ext = '.png' thenIMG := TPngImage.Createelseif (Ext = '.jpg') or (Ext = '.jpeg') thenIMG := TJPEGImage.Create;if Assigned(IMG) thenbeginMS.Seek(0,soFromBeginning);IMG.LoadFromStream(MS);FCover.Picture.Assign(IMG);FCover.Invalidate;end;finallyIMG.Free;end;endelse ShowEmptyCover;FText.Lines.Add(Short);FText.SelStart := 0;FText.SelLength := 1;FText.SelLength := 0;MS.Free;if Sender is TLabel then Clipboard.AsText := (Sender as TLabel).Caption;Clipboard.AsText := (Sender as TLabel).Caption;FVersion.Left := Width - 47;FDate.Width := FVerTitle.Left - FDate.Left - 5;function GetFileNameZip(Zip: TZipForge; No: integer): string;function GetFileNameZip(Zip: TZipForge; No: Integer): string;function DecodeBase64(const CinLine: ansistring): ansistring;function DecodeBase64(const CinLine: AnsiString): AnsiString;StoredC4: array[0..3] of SmallInt;StoredC4: array [0 .. 3] of SmallInt;'+': x := 62;'/': x := 63;'0'..'9': x := Ord(c) - (Ord('0') - 52);'0' .. '9': x := Ord(c) - (Ord('0') - 52);'=': x := -1;'A'..'Z': x := Ord(c) - Ord('A');'A' .. 'Z': x := Ord(c) - Ord('A');'a'..'z': x := Ord(c) - (Ord('a') - 26);'a' .. 'z': x := Ord(c) - (Ord('a') - 26);function GetFileNameZip(Zip: TZipForge; No: integer): string;function GetFileNameZip(Zip: TZipForge; No: Integer): string;i: integer;i: Integer;if (Zip.FindFirst('*.*', ArchItem, faAnyFile - faDirectory)) thenif (Zip.FindFirst('*.*', ArchItem, faAnyFile - faDirectory)) thenwhile i <> No dobeginZip.FindNext(ArchItem);Zip.FindNext(ArchItem); { TODO : }Inc(i);end;strSizes: array [0 .. 3] of string = ('GB', 'MB', 'KB', 'Bytes');strSz := Format('%u', [c1])strSz := Format('%u.%u', [c1, c2]);Result := Format('%s %s (%u Bytes)', [strSz, strSizes[nIndex], sizeInBytes]) { TODO : } elseResult := Format('%s %s', [strSz, strSizes[nIndex]]);BorderStyle = bsToolWindowActiveControl = RzPageControl1ClientHeight = 475ClientHeight = 481ClientWidth = 582ClientWidth = 628OnKeyDown = FormKeyDownOnCreate = FormCreateOnShow = FormShowobject RzPageControl1: TRzPageControlLeft = 0AlignWithMargins = TrueTop = 0Left = 3Width = 582Top = 53Height = 438Width = 622ActivePage = TabSheet2Height = 388ActivePage = tsInfoTabIndex = 1DoubleBuffered = TrueParentDoubleBuffered = FalseFixedDimension = 19object tsInfo: TTabSheetobject TabSheet1: TRzTabSheetDisabledIndex = 0object Img: TImageExplicitLeft = 0Left = 8ExplicitTop = 0Top = 13ExplicitWidth = 0Width = 201ExplicitHeight = 0Height = 281object imgCover: TImageAlignWithMargins = TrueLeft = 3Top = 3Width = 214Height = 233Left = 8AlignWithMargins = TrueTop = 300Left = 3Width = 560Top = 242Height = 113Width = 608Height = 115Align = alBottomobject mmInfo: TRzRichEditobject lvInfo: TListViewLeft = 215AlignWithMargins = TrueTop = 13Left = 223Width = 353Top = 3Height = 281Width = 388Font.Charset = RUSSIAN_CHARSETHeight = 233Font.Color = clWindowTextAlign = alClientFont.Height = -11Columns = <Font.Name = 'Tahoma'itemFont.Style = []Caption = #1055#1086#1083#1077ParentFont = FalseWidth = 175ScrollBars = ssVerticalenditemCaption = #1047#1085#1072#1095#1077#1085#1080#1077Width = 150end>ColumnClick = FalseGroupView = TrueReadOnly = TrueRowSelect = Trueobject TabSheet2: TRzTabSheetobject tsReview: TTabSheetobject btnLoadReview: TRzBitBtnExplicitLeft = 0Left = 8ExplicitTop = 0Top = 384ExplicitWidth = 0Width = 129ExplicitHeight = 0Caption = #1047#1072#1075#1088#1091#1079#1080#1090#1100object mmReview: TMemoTabOrder = 0Visible = FalseOnClick = btnLoadReviewClickGlyph.Data = {36040000424D36040000000000003600000028000000100000001000000001002000000000000004000000000000000000000000000000000000FF00FF00F1EFF000A49E9700DDD3CC00F5F0F000444250009E9DA5009E9B9D0028476A002F5377002B5B8C004E627A00E6E0D800E7E1DC00F0F0F000E7E2DD00E7EAF100D9DCE90088868600DEDFDF00F5EDE700423D4A00D3CCC700CFCBC900285482004386C60099B4CD0096AABE00D1CCC500D8D2CC00F0EDE800E2DDD800F7F4F100F7F1ED00B0ACA900DDDEDC00FBF5F100383F4200BCB3A700C9C3BF0021486B00527C9B00F0ECE600D2CAC400B9ADA400D3C9C200E7DDD500D5CCC400F5EFEA008E837900CCC9C5008C887A00404E42001F3F3E002E454800393F43001A353E003D595200BEB49F00E0D8CC003B4864009FA9D200F0F0EE00E5DFD900D8D4D40054657D009194980038424100142347002A2D49003F3E530049485E0046466000383F6400504E7900DFD4C600526CA6005B7AC500A5A5B100E6E2DD005377B600435C8600746E7F0013155E003F3E6100978C8A00B7AFAD00C1B8B600BBB3B200AEA5A400837E87007F6E6A00435862002B4F8700788CB500E3DCD6003C6380008497A2003B385A0027405A007E797700CAC1C200D3C9C900D3C9C800D8CBCA00D3C9C800A3A0A20061667100465D54006B72790098979700B6AA9E0041665E007A8E7D00435752004A736B0097919200BBB6BD00C9C1C100CAC5C500A59D990095959B00536CB400426CD800657AB100DAD0C700B0AAA400C0BEBB007384750063786C0042594F0050777400A29C9E00A1A3AE008E93A60082899C004F5C7700375AA7004C80F0005C94FF006285DA00DFD6CA0097928D00F6F3F000EFEAE8005B7A7100486C61003A5E5B00838594006B78A500495C8500355EB4003F71D3005798FF0064A9FF005794FB00BABDCD00E5DFD90078787600E5E1DD0093A0B900758899005A6E6E00475C70006783C800B7BCCE00A0A2A5002E54A4004776CF00628BC200879DBF00D0D1D500E6E2DF00E7E2DE00B9BAB900979290007A9AC1003D89E100407CC8004C619E006166B600A0B2DB008595C3003F62B800394B850058525E00D2C0AC00D9D2CD00D9D4CF00DFD9D400F0EFE900B4ABA300849AA7004EABFF0060CBFF0059A6F900826D9D003562B3002B4699002D50A0002F5AAF003A69B60087ACD000C3C2C200D8CEC400DBCFC700EFE4DA00D9D0C700E1DBD4006E93D60059A3EA005874A100645F83006A8FC300477FBE00558ABF005E90BF0086A5C700DBDEE300D5D0CA00E0D9D300DFD9D300F0F0E900E4DFD900988574006F6FF30056529D006F798800ACA9BC00C4A58C00999BA000C3A18300C5A88F00C5A28400D6AD8A00C59E7C00C49C7A00C19A7700D1A78200C49C7B00626066007F81B600CBC2DE00AAE9DA00DFC0A300D6A77F00D5A88000D1A78100D2A78100D2A78100E5B68D00D5AA8400D2A88200D2A88400E3B58E00D5AE8A00}endobject mmReview: TRzMemoWidth = 572Width = 608Height = 377Height = 321Margins.Bottom = 35TabOrder = 1TabOrder = 0ReadOnlyColor = 15794175ReadOnlyColorOnFocus = Trueobject btnClearReview: TRzBitBtnobject pnReviewButtons: TPanelLeft = 158Left = 0Top = 384Top = 327Width = 91Width = 614Caption = #1054#1095#1080#1089#1090#1080#1090#1100Height = 33TabOrder = 2Align = alBottomBevelOuter = bvNoneCaption = 'pnReviewButtons'ShowCaption = FalseTabOrder = 1OnClick = btnClearReviewClickDesignSize = (Glyph.Data = {61436060000424D360600000000000036040000280000002000000010000000010033)0800000000000002000000000000000000000001000000000000000000003300object btnLoadReview: TButton00006600000099000000CC000000FF0000000033000033330000663300009933Left = 4560000CC330000FF33000000660000336600006666000099660000CC660000FF66Top = 3000000990000339900006699000099990000CC990000FF99000000CC000033CCWidth = 75000066CC000099CC0000CCCC0000FFCC000000FF000033FF000066FF000099FFHeight = 250000CCFF0000FFFF000000003300330033006600330099003300CC003300FF00Anchors = [akTop, akRight]330000333300333333006633330099333300CC333300FF333300006633003366Caption = #1047#1072#1075#1088#1091#1079#1080#1090#110033006666330099663300CC663300FF6633000099330033993300669933009999TabOrder = 03300CC993300FF99330000CC330033CC330066CC330099CC3300CCCC3300FFCCOnClick = btnLoadReviewClick330000FF330033FF330066FF330099FF3300CCFF3300FFFF3300000066003300end66006600660099006600CC006600FF0066000033660033336600663366009933object btnClearReview: TButton6600CC336600FF33660000666600336666006666660099666600CC666600FF66Left = 537660000996600339966006699660099996600CC996600FF99660000CC660033CCTop = 3660066CC660099CC6600CCCC6600FFCC660000FF660033FF660066FF660099FFWidth = 756600CCFF6600FFFF660000009900330099006600990099009900CC009900FF00Height = 25990000339900333399006633990099339900CC339900FF339900006699003366Anchors = [akTop, akRight]99006666990099669900CC669900FF6699000099990033999900669999009999Caption = #1054#1095#1080#1089#1090#1080#1090#11009900CC999900FF99990000CC990033CC990066CC990099CC9900CCCC9900FFCCTabOrder = 1990000FF990033FF990066FF990099FF9900CCFF9900FFFF99000000CC003300OnClick = btnClearReviewClickCC006600CC009900CC00CC00CC00FF00CC000033CC003333CC006633CC009933endCC00CC33CC00FF33CC000066CC003366CC006666CC009966CC00CC66CC00FF66CC000099CC003399CC006699CC009999CC00CC99CC00FF99CC0000CCCC0033CCCC0066CCCC0099CCCC00CCCCCC00FFCCCC0000FFCC0033FFCC0066FFCC0099FFCC00CCFFCC00FFFFCC000000FF003300FF006600FF009900FF00CC00FF00FF00FF000033FF003333FF006633FF009933FF00CC33FF00FF33FF000066FF003366FF006666FF009966FF00CC66FF00FF66FF000099FF003399FF006699FF009999FF00CC99FF00FF99FF0000CCFF0033CCFF0066CCFF0099CCFF00CCCCFF00FFCCFF0000FFFF0033FFFF0066FFFF0099FFFF00CCFFFF00FFFFFF00000080000080000000808000800000008000800080800000C0C0C00080808000191919004C4C4C00B2B2B200E5E5E5005A1E1E00783C3C0096646400C8969600FFC8C800465F82005591B9006EB9D7008CD2E600B4E6F000D8E9EC0099A8AC00646F7100E2EFF100C56A310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE7E5E5E5E5EEEEEEEEEEEEEEEEEEEEEEAC81818181EEEEEEEEEEEEEEEEEEEEE7E5EEEEEEEEE5E5EEEEEEE5EEEEEEEEAC81EEEEEEEE8181EEEEEE81EEEEEEEEE5EEEEEEEEEEEEEEE5EEE5E5EEEEEEEE81EEEEEEEEEEEEEE81EE8181EEEEEEEEE5EEEEEEEEEEEEEEEEE5E5E5EEEEEEEE81EEEEEEEEEEEEEEEE818181EEEEEEEEE5EEEEEEEEEEEEEEE5E5E5E5EEEEEEEE81EEEEEEEEEEEEEE81818181EEEEEEEEE7E5EEEEEEEEEEE5E5E5E5E5EEEEEEEEAC81EEEEEEEEEE8181818181EEEEEEEEEEE5E7EEEEEEEEEEEEEEEEEEEEEEEEEEEE81ACEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE7E5EEEEEEEEEEEEEEEEEEEEEEEEEEEEAC81EEEEEEEEEEE5E5E5E5E5EEEEEEEEEEE5E7EEEEEEEE8181818181EEEEEEEEEE81ACEEEEEEEEE5E5E5E5EEEEEEEEEEEEEEE5EEEEEEEE81818181EEEEEEEEEEEEEE81EEEEEEEEE5E5E5EEEEEEEEEEEEEEEEE5EEEEEEEE818181EEEEEEEEEEEEEEEE81EEEEEEEEE5E5EEE5EEEEEEEEEEEEEEE5EEEEEEEE8181EE81EEEEEEEEEEEEEE81EEEEEEEEE5EEEEEEE5E5EEEEEEEEE5E7EEEEEEEE81EEEEEE8181EEEEEEEE81ACEEEEEEEEEEEEEEEEEEEEE5E5E5E5E7EEEEEEEEEEEEEEEEEEEEEE81818181ACEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE}NumGlyphs = 2object RzPanel1: TRzPanelobject pnButtons: TPanelTop = 438Top = 444Width = 582Width = 628BorderOuter = fsFlatBoldBevelOuter = bvNone58062835)37)object RzBitBtn1: TRzBitBtnobject btnClose: TButtonLeft = 465Left = 545Top = 7Top = 4Width = 104Width = 75Height = 25OnClick = RzBitBtn1ClickKind = bkCloseCaption = #1040#1074#1090#1086#1088'('#1099')'{******************************************************************************}{ }{ MyHomeLib }{ }{ Version 0.9 }{ 20.08.2008 }{ Copyright (c) Aleksey Penkov alex.penkov@gmail.com }{ }{******************************************************************************}Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, xmldom, XMLIntf, msxmldom, XMLDoc, ExtCtrls, RzPanel, RzButton,Messages,StdCtrls, RzLabel, RzEdit, ComCtrls, RzTabs;SysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs,xmldom,XMLIntf,msxmldom,XMLDoc,ExtCtrls,StdCtrls,ComCtrls,unit_Globals;RzPageControl1: TRzPageControl;TabSheet1: TRzTabSheet;tsInfo: TTabSheet;TabSheet2: TRzTabSheet;tsReview: TTabSheet;Img: TImage;imgCover: TImage;RzPanel1: TRzPanel;pnButtons: TPanel;RzBitBtn1: TRzBitBtn;btnClose: TButton;btnLoadReview: TRzBitBtn;btnLoadReview: TButton;mmReview: TRzMemo;btnClearReview: TRzBitBtn;btnClearReview: TButton;mmInfo: TRzRichEdit;pnTitle: TPanel;procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);lblAuthors: TLabel;procedure RzBitBtn1Click(Sender: TObject);lvInfo: TListView;lblTitle: TLabel;pnReviewButtons: TPanel;procedure FormCreate(Sender: TObject);procedure FormShow(Sender: TObject);{ Private declarations }FReviewChanged : boolean;FReviewChanged: Boolean;//FBookRecord: TBookRecord;procedure Setreview(const Value: string);procedure SetReview(const Value: string);//procedure SetBookRecord(const Value: TBookRecord);procedure ShowBookInfo(FS: TMemoryStream);procedure FillBookInfo(bookInfo: TBookRecord; bookStream: TMemoryStream);property Review: string read GetReview write Setreview;property ReviewChanged: boolean read FReviewChanged write FReviewChanged;property Review: string read GetReview write SetReview;property URL: string write FURL;property ReviewChanged: Boolean read FReviewChanged write FReviewChanged;{ Public declarations }property URL: string read FUrl write FUrl;//property Book: TBookRecord read FBookRecord write SetBookRecord;{ Private declarations }FReview : TStringList;FURL : string;FUrl: string;property URL: string write FURL;property URL: string write FUrl;procedure DownloadReview(Form: TfrmBookDetails; URL: string);unit_globals,unit_MHLHelpers,jpeg,CommCtrl,pngimage,StrUtils,strutils;unit_MHLHelpers,unit_FB2Utils;{$R *.dfm}{$R *.dfm}btnLoadReview.Visible := True;pnReviewButtons.Visible := True;btnClearReview.Visible := True;procedure TfrmBookDetails.FormKeyDown(Sender: TObject; var Key: Word;Shift: TShiftState);beginif key=27 then Close;end;reviewParser : TReviewParser;review : TStringList;Review: TStringList;reviewParser := TReviewParser.Create;review := TStringList.Create;reviewParser.Parse(FURL, review);reviewParser := TReviewParser.Create;mmReview.Clear;trymmReview.Lines.AddStrings(review);Review := TStringList.Create;FReviewChanged := True;tryreviewParser.Parse(FUrl, Review);mmReview.Lines.Assign(Review);FReviewChanged := True;finallyReview.Free;end;finallyreviewParser.Free;end;review.Free;reviewParser.Free;procedure TfrmBookDetails.RzBitBtn1Click(Sender: TObject);beginClose;end;procedure TfrmBookDetails.Setreview(const Value: string);//procedure TfrmBookDetails.SetBookRecord(const Value: TBookRecord);//begin// FBookRecord := Value;// lblTitle.Caption := FBookRecord.Title;{ TODO -oNickR -cUsability : ? }// lblAuthors.Caption := FBookRecord.Authors[0].GetFullName;//end;procedure TfrmBookDetails.SetReview(const Value: string);procedure TfrmBookDetails.ShowBookInfo(FS: TMemoryStream);procedure TfrmBookDetails.FillBookInfo(bookInfo: TBookRecord; bookStream: TMemoryStream);book: IXMLFictionBook;i,p:integer;i: integer;S, outStr: AnsiString;imgBookCover: TGraphic;CoverID:String;tmpStr: string;Ext: string;ImgVisible : boolean;procedure AddItem(const Field: string; const Value: string; GroupID: integer = -1);MS : TMemoryStream;varitem: TListItem;beginitem := lvInfo.Items.Add;item.Caption := Field;item.SubItems.Add(Value);item.GroupID := GroupID;end;TmpImg: TGraphic;begin//// TBookRecord//lblTitle.Caption := bookInfo.Title;lblAuthors.Caption := bookInfo.Authors[0].GetFullName;StrLen : integer;with lvInfo.Groups.Add doImageType: TCoverImageType;beginHeader := ' ';AddItem('', bookInfo.Folder, GroupID);AddItem('', bookInfo.FileName, GroupID);AddItem('', GetFormattedSize(bookInfo.Size, True), GroupID);AddItem('', DateToStr(bookInfo.Date), GroupID);end;{ TODO -oNickR -cUsability : }// libID: Integer; ???// LibRate: Integer; ???// URI: string; ???//procedure WriteString(Title, Text: string);// //if not Assigned(bookStream) or (bookStream.Size = 0) thenmmInfo.SelAttributes.Style := [fsBold];imgCover.Visible := False;mmInfo.SetSelText(Title + ': ' + #9);mmShort.Visible := False;mmInfo.SelAttributes.Style := [];Exit;if Text <> '' then mmInfo.SetSelText(Text);mmInfo.SetSelText(#13#10)//FS.SaveToFile('C:\temp\book.xml');beginFReviewChanged := False;Img.Picture.Bitmap.Canvas.FrameRect(Img.ClientRect);mmInfo.Lines.Clear;mmShort.Lines.Clear;book := LoadFictionbook(FS);book := LoadFictionbook(bookStream);tryMS := TMemoryStream.Create;CoverID := Book.Description.Titleinfo.Coverpage.XML;p := pos('"#', CoverID);if p <> 0 thenbeginDelete(CoverId, 1, p + 1);p := pos('"', CoverID);CoverID := Copy(CoverID, 1, p - 1);for i := 0 to Book.Binary.Count - 1 dobeginif Book.Binary.Items[i].Id = CoverID thenbeginS := Book.Binary.Items[i].Text;outStr := DecodeBase64(S);StrLen := Length(outStr);//MS.Write(PAnsiChar(outStr)^, StrLen);// ( )ImgVisible := True;//end;imgBookCover := GetBookCover(book);end;if Assigned(imgBookCover) then//MS.SaveToFile('E:\temp\' + CoverID);begintryimgCover.Picture.Assign(imgBookCover);imgCover.Visible := True;finallyimgBookCover.Free;if ImgVisible thenwith book.Description.Titleinfo dobegin// ---------------------------------------------with lvInfo.Groups.Add doCreateImage(ExtractFileExt(CoverID), TmpImg, ImageType);Header := ' ';if Assigned(TmpImg) thenbeginMS.Seek(0,soFromBeginning);TmpImg.LoadFromStream(MS);IMG.Picture.Assign(TmpImg);IMG.Invalidate;TmpImg.Free;end;endelseIMG.Picture := nil;finallyMS.Free;end;with Book.Description.Titleinfo do{ TODO -oNickR -cUsability : ? }begin//if Author.Count > 0 then// lblAuthors.Caption := Author[0].Lastname.Text + ' ' + Author[0].Firstname.Text + ' ' + Author[0].MiddleName.Text;mmInfo.SelAttributes.Size := 10;{ TODO -oNickR -cUsability : + }mmInfo.SelAttributes.Style := [fsBold];if Sequence.Count > 0 thenAddItem('', Sequence[0].Name, GroupID);if Author.Count>0 then{ TODO -oNickR -cUsability : + }mmInfo.SetSelText(Author[0].Lastname.Text+' '+Author[0].Firstname.Text+' '+Author[0].MiddleName.Text+#13#10);if Genre.Count > 0 thenAddItem('', Genre[0], GroupID);end;mmInfo.SelAttributes.Size := 12;// ---------------------------------------------mmInfo.SelAttributes.Color := clNavy;with lvInfo.Groups.Add, book.Description.Publishinfo dommInfo.SetSelText(Booktitle.Text+#13#10);beginHeader := ' ';AddItem('', Publisher.Text, GroupID);AddItem('', City.Text, GroupID);AddItem('', Year, GroupID);AddItem('ISBN', Isbn.Text, GroupID);end;if Sequence.Count > 0 then// ---------------------------------------------WriteString('',Sequence[0].Name);with lvInfo.Groups.Add, book.Description.Documentinfo dobeginHeader := ' (OCR)';for i := 0 to Author.Count - 1 dobegin{ TODO -oNickR -cUsability : }tmpStr := Author[i].Firstname.Text + ' ' + Author[i].Lastname.Text + '(' + Author[i].NickName.Text + ')';AddItem(IfThen(i = 0, ''), tmpStr, GroupID);end;mmInfo.SetSelText(#13#10);AddItem('', Programused.Text, GroupID);WriteString('',IfThen(Genre.Count > 0, Genre[0], ''));AddItem('', Date.Text, GroupID);mmInfo.SetSelText(#13#10);AddItem('ID', Id, GroupID);AddItem('', Version, GroupID);WriteString('PublishInfo','');for i := 0 to History.p.Count - 1 dommInfo.SetSelText('-: '+ #9 + Book.Description.Publishinfo.Publisher.Text+#13#10);AddItem(IfThen(i = 0, ''), History.p[i].OnlyText, GroupID);mmInfo.SetSelText(': '+ #9 + Book.Description.Publishinfo.City.Text+#13#10);end;mmInfo.SetSelText(': '+ #9 + Book.Description.Publishinfo.Year+#13#10);mmInfo.SetSelText('ISBN: '+ #9 + Book.Description.Publishinfo.Isbn.Text+#13#10);mmInfo.SetSelText(#13#10);// ---------------------------------------------WriteString('DocumentInfo (OCR)','');{ TODO -oNickR -cUsability : ? } for i := 0 to Annotation.p.Count - 1 dommInfo.SetSelText(': '+#13#10);mmShort.Lines.Add(Annotation.p[i].OnlyText);for I := 0 to Book.Description.Documentinfo.Author.Count - 1 dowith Book.Description.Documentinfo.Author.Items[i] dommInfo.SetSelText(Firstname.Text + ' ' +Lastname.Text + '(' + NickName.Text + ')' + #13#10);mmInfo.SetSelText('');mmInfo.SetSelText(': '+ Book.Description.Documentinfo.Programused.Text + #13#10);mmInfo.SetSelText(': '+ #9 + Book.Description.Documentinfo.Date.Text + #13#10);mmInfo.SetSelText('ID: '+ #9 + Book.Description.Documentinfo.ID + #13#10);mmInfo.SetSelText('Version: '+ #9 + Book.Description.Documentinfo.Version + #13#10);mmInfo.SetSelText('History: '+ #9 + Book.Description.Documentinfo.History.P.Text + #13#10);for I := 0 to Annotation.P.Count - 1 dommShort.SetSelText(Annotation.P.Items[i].OnlyText);{-------------------- TReviewDownloadThread -----------------------------------}{-------------------- TReviewDownloadThread ----------------------------------- }reviewParser : TReviewParser;Freview := TStringList.Create;FReview := TStringList.Create;reviewParser.Parse(FURL, Freview);reviewParser.Parse(FUrl, FReview);if FForm.mmReview = Nil then Exit; // FForm - nil .if FForm.mmReview = nil then// ,Exit; // FForm - nil .// ,FForm.mmReview.Clear;FForm.mmReview.Lines := FReview;FForm.mmReview.Lines.AddStrings(Freview);//FForm.RzPageControl1.ActivePageIndex := 1;procedure TReviewDownloadThread.StartDownload;// ------------------------------------------------------------------------------beginFForm.btnLoadReview.Enabled := False;end;//------------------------------------------------------------------------------procedure DownloadReview(Form: TfrmBookDetails; URL: string);procedure DownloadReview (Form: TfrmBookDetails; URL: string) ;Worker : TReviewDownloadThread;