Changeset 465
Author: nrymanov@gmail.com
(2010/03/02 11:21) Almost 2 years ago
see #29 - Редизайн и унификация пользовательского интерфейса * форматирование текста * очень мелкие правки
Author: nrymanov@gmail.com
(2010/03/02 11:21) Almost 2 years ago
see #29 - Редизайн и унификация пользовательского интерфейса * форматирование текста * очень мелкие правки
SysUtils, Classes, ABSMain, DB, unit_globals;Classes,ABSMain,DB,unit_Globals;dsBooksS: TDataSource;FIsFavorites: boolean;FIsFavorites: Boolean;FActiveTable: TAbsTable;FActiveTable: TABSTable;{ Private declarations }procedure GetBookFileName(ID: integer; out AFile, AFolder, AExt: string;procedure GetBookFileName(ID: Integer; out AFile, AFolder, AExt: string; out ANo: Integer);out ANo: integer);procedure SetActiveTable(Tag: integer);procedure SetActiveTable(Tag: Integer);function GetBookGenres(BookID: Integer; FirstOnly: boolean): String;function GetBookGenres(BookID: Integer; FirstOnly: Boolean): string;function GetGenreCode(BookID: Integer): String;function GetGenreCode(BookID: Integer): string;procedure FieldByName(AID: integer; AField: String; out ARes: String); overload;procedure FieldByName(AID: Integer; AField: string; out ARes: string); overload;procedure FieldByName(AID: integer; AField: String; out ARes: integer); overload;procedure FieldByName(AID: Integer; AField: string; out ARes: Integer); overload;procedure FieldByName(AID: integer; AField: String; out Ares: boolean); overload;procedure FieldByName(AID: Integer; AField: string; out ARes: Boolean); overload;procedure GetBookFolder(ID: integer; out AFolder: String);procedure GetBookFolder(ID: Integer; out AFolder: string);procedure SetLocalStatus(AId: integer; AState: boolean);procedure SetLocalStatus(AID: Integer; AState: Boolean);property ActiveTable: TabsTable read FActiveTable;property ActiveTable: TABSTable read FActiveTable;procedure SetTableState(State: boolean);procedure SetTableState(State: Boolean);function AuthorID(BookID: Integer): integer;function AuthorID(BookID: Integer): Integer;tblAuthor_Master.Locate('AL_BookID', BookID, []);tblAuthor_Master.Locate('AL_BookID', BookID, []);S := trim(tblAuthor_DetailA_Family.Value + ' ' +{ TODO -oNickR : TAuthorRecord }tblAuthor_DetailA_Name.Value + ' ' +S := Trim(tblAuthor_DetailA_Family.Value + ' ' + tblAuthor_DetailA_Name.Value + ' ' + tblAuthor_DetailA_Middle.Value);tblAuthor_DetailA_Middle.Value);if BookID <> 0 then tblAuthor_Master.Locate('AL_BookID', BookID, []);Result := trim(tblAuthor_DetailA_Family.Value + ' ' +tblAuthor_Master.Locate('AL_BookID', BookID, []);tblAuthor_DetailA_Name.Value + ' ' +{ TODO -oNickR : TAuthorRecord }tblAuthor_DetailA_Middle.Value);Result := Trim(tblAuthor_DetailA_Family.Value + ' ' + tblAuthor_DetailA_Name.Value + ' ' + tblAuthor_DetailA_Middle.Value);procedure TDMCollection.FieldByName(AID: integer; AField: String; out ARes: String);procedure TDMCollection.FieldByName(AID: Integer; AField: String; out ARes: String);if AID<> 0 then FActiveTable.Locate('ID', AID, []);if AID <> 0 thenFActiveTable.Locate('ID', AID, []);procedure TDMCollection.FieldByName(AID: integer; AField: String; out ARes: integer);procedure TDMCollection.FieldByName(AID: Integer; AField: String; out ARes: Integer);if AID<> 0 then FActiveTable.Locate('ID', AID, []);if AID <> 0 thenFActiveTable.Locate('ID', AID, []);function TDMCollection.AuthorID(BookID: Integer): integer;function TDMCollection.AuthorID(BookID: Integer): Integer;if BookID <> 0 then tblAuthor_Master.Locate('AL_BookID', BookID, []);tblAuthor_Master.Locate('AL_BookID', BookID, []);// tblAuthors.EmptyTable;// tblAuthors.EmptyTable;// tblSeries.EmptyTable;// tblSeries.EmptyTable;procedure TDMCollection.FieldByName(AID: integer; AField: String; out Ares: boolean);procedure TDMCollection.FieldByName(AID: Integer; AField: String; out ARes: Boolean);if AID <> 0 then FActiveTable.Locate('ID', AID, []);FActiveTable.Locate('ID', AID, []);procedure TDMCollection.GetBookFileName(ID: integer; out AFile:string;procedure TDMCollection.GetBookFileName(ID: Integer; out AFile: string; out AFolder: string; out AExt: string; out ANo: Integer);out AFolder: string; out AExt: string;out ANo:integer);FActiveTable.Locate('ID', ID, []);FActiveTable.Locate('ID', ID, []);AExt := FActiveTable.FieldByName('Ext').AsString;AExt := FActiveTable.FieldByName('Ext').AsString;AFile := FActiveTable.FieldByName('FileName').AsString;AFile := FActiveTable.FieldByName('FileName').AsString;if ExtractFileExt(AFile) <> ZIP_EXTENSION then // !if ExtractFileExt(AFile) <> ZIP_EXTENSION then // !AFile := AFile + AExt;AFolder := FActiveTable.FieldByName('Folder').AsString;AFolder := FActiveTable.FieldByName('Folder').AsString;ANo := FActiveTable.FieldByName('InsideNo').AsInteger;ANo := FActiveTable.FieldByName('InsideNo').AsInteger;function TDMCollection.GetBookGenres(BookID: Integer; FirstOnly: boolean): String;function TDMCollection.GetBookGenres(BookID: Integer; FirstOnly: Boolean): String;s: String;S: String;i: integer;i: Integer;tblBooks_Genre_List.Locate('GL_BookID', BookID, []);tblBooks_Genre_List.Locate('GL_BookID', BookID, []);if FirstOnly and (i > 0) then Break;Break;s := s + tblBooks_GenresG_Alias.Value + ' / ';S := S + tblBooks_GenresG_Alias.Value + ' / ';Result := s;Result := S;BookID := ActiveTable.FieldByname('ID').Value;BookID := ActiveTable.FieldByName('ID').Value;R.Title := ActiveTable.FieldByname('Title').AsWideString;R.Title := ActiveTable.FieldByName('Title').AsWideString;R.Series := IfThen(ActiveTable.FieldByname('SerID').IsNull,R.Series := IfThen(ActiveTable.FieldByName('SerID').IsNull, NO_SERIES_TITLE, ActiveTable.FieldByName('Series').AsWideString);NO_SERIES_TITLE,R.SeqNumber := ActiveTable.FieldByName('SeqNumber').AsInteger;ActiveTable.FieldByname('Series').AsWideString);R.Folder := ActiveTable.FieldByName('Folder').AsWideString;R.SeqNumber := ActiveTable.FieldByname('SeqNumber').AsInteger;R.FileName := ActiveTable.FieldByName('FileName').AsWideString;R.Folder := ActiveTable.FieldByname('Folder').AsWideString;R.FileExt := ActiveTable.FieldByName('Ext').AsWideString;R.FileName := ActiveTable.FieldByname('FileName').AsWideString;R.Size := ActiveTable.FieldByName('Size').AsInteger;R.FileExt := ActiveTable.FieldByname('Ext').AsWideString;R.InsideNo := ActiveTable.FieldByName('InsideNo').AsInteger;R.Size := ActiveTable.FieldByname('Size').AsInteger;R.Local := ActiveTable.FieldByName('Local').AsBoolean;R.InsideNo := ActiveTable.FieldByname('InsideNo').AsInteger;R.Date := ActiveTable.FieldByName('Date').AsDateTime;R.Date := ActiveTable.FieldByname('Date').AsDateTime;R.Lang := ActiveTable.FieldByName('Lang').AsWideString;R.Lang := ActiveTable.FieldByname('Lang').AsWideString;if not FIsFavorites thenR.KeyWords := ActiveTable.FieldByname('KeyWords').AsWideString;R.KeyWords := ActiveTable.FieldByName('KeyWords').AsWideString;R.Code := ActiveTable.FieldByname('Code').AsInteger;R.Code := ActiveTable.FieldByName('Code').AsInteger;if tblExtra.Locate('E_BookID', BookID, []) thenif tblExtra.Locate('E_BookID', BookID, []) thenif ActiveTable.FieldByname('LibID').AsInteger <> 0 thenif ActiveTable.FieldByName('LibID').AsInteger <> 0 thenR.LibID := ActiveTable.FieldByname('LibID').AsIntegerR.LibID := ActiveTable.FieldByName('LibID').AsIntegerif not FIsFavorites thentblBooks_Genre_List.Locate('GL_BookID', BookID, []);tblBooks_Genre_List.Locate('GL_BookID', BookID, []);tblGenres.Locate('G_Code', tblBooks_GenresG_ParentCode.Value, []););(****************************************************************************(* **************************************************************************** Query .* .* , .** select A1."Family", A1."Name", A1."Middle"* from "Author_List" A2 inner join "Authors" A1 on (A2."AuthID" = A1."ID")* where (A2."BookID" = :BookID)**)tblAuthor_Master.Locate('AL_BookID', BookID, []);tblAuthor_Master.Locate('AL_BookID', BookID, []););R.AddGenreFB2('','',ActiveTable.FieldByname('Genres').AsWideString);R.AddGenreFB2('', '', ActiveTable.FieldByName('Genres').AsWideString);R.AddAuthor(ActiveTable.FieldByname('FullName').AsWideString,'','');R.AddAuthor(ActiveTable.FieldByName('FullName').AsWideString, '', '');varCode: integer;tblBooks_Genre_List.Locate('GL_BookID', BookID, []);tblBooks_Genre_List.Locate('GL_BookID', BookID, []);tblGenres.Locate('G_Code', tblBooks_GenresG_ParentCode.Value, []);tblGenres.Locate('G_Code', tblBooks_GenresG_ParentCode.Value, []);FilterStateA: boolean;FilterStateA: Boolean;FilterStateS: boolean;FilterStateS: Boolean;(* ***************************************************************************** 3 ,* ** *****************************************************************************)*************************************************************************** *)DMCollection.tblSeries.Filtered := False;DMCollection.tblSeries.Filtered := FilterStateS;procedure TDMCollection.SetActiveTable(Tag: integer);procedure TDMCollection.SetActiveTable(Tag: Integer);procedure TDMCollection.GetBookFolder(ID: integer; out AFolder: String);procedure TDMCollection.GetBookFolder(ID: Integer; out AFolder: String);FActiveTable.Locate('ID', ID, []);FActiveTable.Locate('ID', ID, []);AFolder := FActiveTable.FieldByName('Folder').AsString;AFolder := FActiveTable.FieldByName('Folder').AsString;procedure TDMCollection.SetLocalStatus(AId: integer; AState: boolean);procedure TDMCollection.SetLocalStatus(AID: Integer; AState: Boolean);if Aid <> 0 thenif AID <> 0 thenif FActiveTable.Locate('ID',AId,[]) thenif FActiveTable.Locate('ID', AID, []) thenbeginFActiveTable.Edit;FActiveTable.FieldByName('Local').AsBoolean := AState;FActiveTable.FieldByName('Local').AsBoolean := AState;FActiveTable.Post;if FActiveTable.Name = 'tblGrouppedBooks' thenif dmCollection.tblBooks.Locate('ID', FActiveTable.FieldByName('OuterID').AsInteger,[]) thenif DMCollection.tblBooks.Locate('ID', FActiveTable.FieldByName('OuterID').AsInteger, []) thenbegindmCollection.tblBooks.Edit;DMCollection.tblBooks.Edit;dmCollection.tblBooksLocal.Value := AState;DMCollection.tblBooksLocal.Value := AState;dmCollection.tblBooks.Post;DMCollection.tblBooks.Post;end;//////PostMessage(PostMessage(Application.MainFormHandle, WM_MHL_DOWNLOAD_COMPLETE, AID, Integer(LongBool(AState)));Application.MainFormHandle,end;WM_MHL_DOWNLOAD_COMPLETE,AId,Integer(LongBool(AState)));end;procedure TDMCollection.SetTableState(State: boolean);procedure TDMCollection.SetTableState(State: Boolean);{******************************************************************************}{ }{ MyHomeLib }{ }{ Version 0.9 }{ 20.08.2008 }{ Copyright (c) Aleksey Penkov alex.penkov@gmail.com }{ }{******************************************************************************}SysUtils, Classes, DB, ABSMain, unit_globals, ImgList, Controls, unit_Consts;Classes,DB,ABSMain,unit_globals,ImgList,Controls,unit_Consts;publicconstINVALID_COLLECTION_ID = -1;procedure SetUserTableState(Status: boolean);procedure SetTableState(State: boolean);procedure SetTableState(State: Boolean);function ActivateGroup(const ID: integer):boolean;function ActivateGroup(const ID: Integer): Boolean;procedure SetRate(ID,Rate: integer);procedure SetRate(ID, Rate: Integer);procedure SetLocal(ID: integer; Value: boolean);procedure SetLocal(ID: Integer; Value: Boolean);procedure SetFinished(ID, Progress: integer; ADBID: integer = 0);procedure SetFinished(ID, Progress: Integer; ADBID: Integer = 0);procedure DeleteRate(AID: integer; ADBID: integer = 0);procedure DeleteRate(AID: Integer; ADBID: Integer = 0);procedure DeleteFinished(AID: integer; ADBID: integer = 0);procedure DeleteFinished(AID: Integer; ADBID: Integer = 0);procedure InsertToGroupTable(ID : integer; Genre: string);procedure InsertToGroupTable(ID: Integer; Genre: string);procedure LoadRates(const SL: TStringList; var i: integer);procedure LoadRates(const SL: TStringList; var i: Integer);procedure LoadGroupedBooks(const SL: TStringList; var i: integer);procedure LoadGroupedBooks(const SL: TStringList; var i: Integer);procedure LoadFinished(const SL: TStringList; var i: integer);procedure LoadFinished(const SL: TStringList; var i: Integer);procedure LoadGroups(const SL: TStringList; var i: integer);procedure LoadGroups(const SL: TStringList; var i: Integer);procedure LoadReviews(const SL: TStringList; var i: integer);procedure LoadReviews(const SL: TStringList; var i: Integer);procedure CorrectExtra(OldID, NewID: integer);procedure CorrectExtra(OldID, NewID: Integer);procedure DeleteExtra(AID: integer);procedure DeleteExtra(AID: Integer);Variants,dm_Collection;{ TDMUser }{ TDMUser }function TDMUser.ActivateGroup(const ID: integer): boolean;function TDMUser.ActivateGroup(const ID: Integer): Boolean;Result := tblGroupList.Locate('Id',ID,[]);Result := tblGroupList.Locate('Id', ID, []);procedure TDMUser.CorrectExtra(OldID, NewID: integer);procedure TDMUser.CorrectExtra(OldID, NewID: Integer);if tblRates.Locate('BookID; DatabaseID', VarArrayOf([OldID, ActiveCollection.GetID]),[]) thenif tblRates.Locate('BookID; DatabaseID', VarArrayOf([OldID, ActiveCollection.GetID]), []) thentblratesBookID.Value := NewID;tblRatesBookID.Value := NewID;if tblFinished.Locate('BookID; DatabaseID', VarArrayOf([OldID, ActiveCollection.GetID]),[]) thenif tblFinished.Locate('BookID; DatabaseID', VarArrayOf([OldID, ActiveCollection.GetID]), []) thenif tblGrouppedBooks.Locate('OuterID; DatabaseID', VarArrayOf([OldID, ActiveCollection.GetID]),[]) thenif tblGrouppedBooks.Locate('OuterID; DatabaseID', VarArrayOf([OldID, ActiveCollection.GetID]), []) thenprocedure TDMUser.DeleteExtra(AID: integer);procedure TDMUser.DeleteExtra(AID: Integer);DbId: integer;DbId: Integer;DBid := ActiveCollection.IDDbId := ActiveCollection.IDDBid := ADbId;DbId := ADBID;if tblFinished.Locate('DataBaseID;BookID',if tblFinished.Locate('DataBaseID;BookID', VarArrayOf([DbId, AID]), []) thenVarArrayOf([DbId, AID]), []) thentblFinished.Delete;tblFinished.Delete;DBID: integer;DbId: Integer;DBid := ActiveCollection.IDDbId := ActiveCollection.IDDBid := ADbId;DbId := ADBID;if tblRates.Locate('DataBaseID;BookID',if tblRates.Locate('DataBaseID;BookID', VarArrayOf([DbId, AID]), []) thenVarArrayOf([DbId, AID]), []) thentblRates.Delete;tblRates.Delete;ID : integer;ID: Integer;case CollectionType of //{ TODO -oNickR -cRefactoring : !!! }65536: ID := 10001; // fb2case CollectionType of //65537: ID := 10002; // -fb265536: ID := 10001; // fb265537: ID := 10002; // -fb2elsebeginRandomize;ID := random(10000);ID := Random(10000);end;while tblBases.Locate('Id',ID,[]) do // ID := random(10000);//while tblBases.Locate('Id', ID, []) do // ID := Random(10000);tblBasesId.Value := ID;tblBasesID.Value := ID; // ... , ?Fields: array [TCollectionProp] of string = ('Name', 'DBFileName', 'RootFolder');'Name','DBFileName','RootFolder');tblGrouppedBooksDataBaseID.Value := ActiveCollection.ID;tblGrouppedBooksDatabaseID.Value := ActiveCollection.ID;tblGrouppedBooksSeries.Value := NO_SERIES_TITLEelsetblGrouppedBooksSeries.Value := dmCollection.tblBooksSeries.Value;tblGrouppedBooksFolder.Value := IncludeTrailingPathDelimiter(ActiveCollection.RootFolder) + CheckSymbols(dmCollection.tblBooksFolder.Value)elsetblGrouppedBooksFolder.Value := IncludeTrailingPathDelimiter(ActiveCollection.RootFolder);// tblGrouppedBooksKeyWords.Value := dmCollection.tblBooksKeyWords.Value;// tblGrouppedBooksKeyWords.Value := dmCollection.tblBooksKeyWords.Value;p, ID, Progress: integer;p, ID, Progress: Integer;while (i < SL.Count) and (pos('#',SL[i]) = 0) doInc(i);while (i < SL.Count) and (Pos('#', SL[i]) = 0) dop := pos(' ',SL[i]);p := Pos(' ', SL[i]);ID := StrToInt(copy(SL[i],1, p - 1));ID := StrToInt(Copy(SL[i], 1, p - 1));Progress := StrToInt(copy(SL[i],p + 1));Progress := StrToInt(Copy(SL[i], p + 1));DMCollection.tblBooks.Locate('LibID', ID, []);dmCollection.tblBooks.Locate('LibID', ID, []);ID := DMCollection.tblBooksID.Value;ID := dmCollection.tblBooksID.Value;if not tblFinished.Locate('DataBaseID; ID',if not tblFinished.Locate('DataBaseID; ID', VarArrayOf([ActiveCollection.ID, ID]), []) thenVarArrayOf([ActiveCollection.ID,ID]), [])theninc(i);Inc(i);p, ID, GroupID: integer;p, ID, GroupID: Integer;while (i < SL.Count) and (pos('#',SL[i]) = 0) doInc(i);while (i < SL.Count) and (Pos('#', SL[i]) = 0) dop := pos(' ',SL[i]);p := Pos(' ', SL[i]);ID := StrToInt(copy(SL[i],1, p - 1));ID := StrToInt(Copy(SL[i], 1, p - 1));Name := copy(SL[i], p + 1);Name := Copy(SL[i], p + 1);if not tblGroupList.Locate('Name', Name,[]) thenif not tblGroupList.Locate('Name', Name, []) thentblGroupList.Locate('ID',GroupID,[]);tblGroupList.Locate('ID', GroupID, []);if DMCollection.tblBooks.Locate('LibID', ID, []) thenif dmCollection.tblBooks.Locate('LibID', ID, []) thenInsertToGroupTable(DMCollection.tblBooksID.Value,InsertToGroupTable(dmCollection.tblBooksID.Value, dmCollection.GetBookGenres(dmCollection.tblBooksID.Value, False));dmCollection.GetBookGenres(DMCollection.tblBooksID.Value, false));Inc(i);inc(i);ID, p: integer;ID, p: Integer;S: string;//inc(i);Inc(i);while (i < SL.Count) and (pos('#',SL[i]) = 0) dowhile (i < SL.Count) and (Pos('#', SL[i]) = 0) dop := pos(' ',SL[i]);p := Pos(' ', SL[i]);ID := StrToInt(copy(SL[i],1, p - 1));ID := StrToInt(Copy(SL[i], 1, p - 1));S := copy(SL[i],p + 1);S := Copy(SL[i], p + 1);StrReplace('~',#13#10,S);StrReplace('~', #13#10, S);DMCollection.tblBooks.Locate('LibID', ID, []); // IDdmCollection.tblBooks.Locate('LibID', ID, []); // IDID := DMCollection.tblBooksID.Value;ID := dmCollection.tblBooksID.Value;if dmCollection.tblBooks.Locate('ID',ID,[]) thenif dmCollection.tblBooks.Locate('ID', ID, []) theninc(i);Inc(i);procedure TDMUser.LoadGroups(const SL: TStringList; var i: Integer);procedure TDMUser.LoadGroups(const SL: TStringList; var i: integer);k: integer;k: Integer;inc(i);Inc(i);while pos('#',SL[i]) = 0 dowhile Pos('#', SL[i]) = 0 doinc(k);Inc(k);inc(i);Inc(i);p, ID, LibID, Rate: integer;p, ID, LibID, Rate: Integer;inc(i);Inc(i);while pos('#',SL[i]) = 0 dowhile Pos('#', SL[i]) = 0 dop := pos(' ',SL[i]);p := Pos(' ', SL[i]);LibID := StrToInt(copy(SL[i],1, p - 1));LibID := StrToInt(Copy(SL[i], 1, p - 1));Rate := StrToInt(copy(SL[i],p + 1));Rate := StrToInt(Copy(SL[i], p + 1));DMCollection.tblBooks.Locate('LibID', LibID, []); // IDdmCollection.tblBooks.Locate('LibID', LibID, []); // IDID := DMCollection.tblBooksID.Value;ID := dmCollection.tblBooksID.Value;if not tblRates.Locate('DataBaseID; BookID', VarArrayOf([ActiveCollection.ID,ID]), []) thenif not tblRates.Locate('DataBaseID; BookID', VarArrayOf([ActiveCollection.ID, ID]), []) theninc(i);Inc(i);DBID: integer;DbId: Integer;DBid := ActiveCollection.IDDbId := ActiveCollection.IDDBid := ADbId;DbId := ADBID;if not tblFinished.Locate('DataBaseID;BookID',if not tblFinished.Locate('DataBaseID;BookID', VarArrayOf([DbId, ID]), []) thenVarArrayOf([DBID, ID]), []) thentblFinishedBookId.Value := ID;tblFinishedBookID.Value := ID;tblFinishedDataBaseID.Value := DBID;tblFinishedDataBaseID.Value := DbId;procedure TDMUser.SetLocal(ID: integer; Value: boolean);procedure TDMUser.SetLocal(ID: Integer; Value: Boolean);if tblGrouppedBooks.Locate('DataBaseID;OuterID',if tblGrouppedBooks.Locate('DataBaseID;OuterID', VarArrayOf([ActiveCollection.ID, ID]), []) thenVarArrayOf([ActiveCollection.ID, ID]), []) thenprocedure TDMUser.SetRate(ID, Rate: integer);procedure TDMUser.SetRate(ID, Rate: Integer);if not tblRates.Locate('DataBaseID;BookID',if not tblRates.Locate('DataBaseID;BookID', VarArrayOf([ActiveCollection.ID, ID]), []) thenVarArrayOf([ActiveCollection.ID, ID]), []) thentblRatesBookId.Value := ID;tblRatesBookID.Value := ID;procedure TDMUser.SetTableState(State: boolean);procedure TDMUser.SetTableState(State: Boolean);procedure TDMUser.SetUserTableState(Status: boolean);procedure TDMUser.SetUserTableState(Status: Boolean);Result := FSysDataModule.tblBases.Active and not FSysDataModule.tblBasesID.IsNull;FSysDataModule.tblBases.Active andnot FSysDataModule.tblBasesID.IsNull;{******************************************************************************}{ }{ MyHomeLib }{ }{ Version 0.9 }{ 20.08.2008 }{ Copyright (c) Aleksey Penkov alex.penkov@gmail.com }{ }{******************************************************************************}FBDAuthorTable, XPMan;XPManifest1: TXPManifest;procedure TreeGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; var CellText: String);Column: TColumnIndex; TextType: TVSTTextType; var CellText: String);procedure TreePaintText(Sender: TBaseVirtualTree; const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType);const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;TextType: TVSTTextType);procedure TreeCompareNodes(Sender: TBaseVirtualTree; Node1, Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);function FillFBDData: boolean;function FillFBDData: Boolean;function CheckEmptyFields(Data: PFileData): boolean;function CheckEmptyFields(Data: PFileData): Boolean;{$R *.dfm}{$R *.dfm}Author : TAuthorRecord;Author : TAuthorRecord;Author := alBookAuthors.ActiveRecord;alBookAuthors.ActiveRecord := Author;CanClose := true;CanClose := True;function TfrmAddnonfb2.FillFBDData:boolean;function TfrmAddnonfb2.FillFBDData: Boolean;Genre.Add(FBookRecord.Genres[i].GenreFb2Code);Genre.Add(FBookRecord.Genres[I].GenreFb2Code);Data := Tree.GetNodedata(Tree.GetFirstSelected);Data := Tree.GetNodeData(Tree.GetFirstSelected);function TfrmAddnonfb2.CheckEmptyFields(Data: PFileData):boolean;function TfrmAddnonfb2.CheckEmptyFields(Data: PFileData): Boolean;Next: PvirtualNode;Next: PVirtualNode;0: miClearAllClick(nil);1: alBookAuthors.Clear;miClearAllClick(nil);1:alBookAuthors.Clear;if (Data <> nil) and (Data.DataType = dtFile) thenfrmAddNonFB2.Enabled := False;frmAddnonfb2.Enabled := False;FBD.New(FRootPath + FBookrecord.Folder, FBookrecord.FileName, FBookrecord.FileExt);FBD.New(FRootPath + FBookRecord.Folder, FBookRecord.FileName, FBookRecord.FileExt);FBookrecord.FileName := FBookrecord.FileName + ZIP_EXTENSION;FBookRecord.FileName := FBookRecord.FileName + ZIP_EXTENSION;else CommitData;elseCommitData;frmAddNonFB2.Enabled := True;frmAddnonfb2.Enabled := True;NewName: string;Data: PFileData;NewName := CheckSymbols(alBookAuthors.ActiveRecord.Last + ' ' + alBookAuthors.ActiveRecord.First +NewName := CheckSymbols(alBookAuthors.ActiveRecord.Last + ' ' + alBookAuthors.ActiveRecord.First + ' ' + edT.Text);' ' + edT.Text);else MessageDlg(' !' + #13 +', .',MessageDlg(' !' + #13 + ', .', mtError, [mbOk], 0);mtError,[mbOk],0);if not CheckEmptyFields(Data) then Exit;Exit;elseFBookRecord.AddAuthor('','', '');FBookRecord.AddAuthor('', '', '');FBookRecord.SeqNumber := round(edSN.Value);FBookRecord.SeqNumber := Round(edSN.Value);FBookRecord.KeyWords := edKeyWords.Text;FBookRecord.Keywords := edKeyWords.Text;Row : TAuthorRecord;Data : PAuthorData;if frmAuthorList.ShowModal = mrOK thenif frmAuthorList.ShowModal = mrOk thenwhile node <> nil dowhile Node <> nil doif GetFileName(fnOpenCoverImage,FileName) then FBD.LoadCoverFromFile(FileName);if GetFileName(fnOpenCoverImage, FileName) thenFBD.LoadCoverFromFile(FileName);procedure InsertNodeData(Node: PVirtualNode);Data.Title := ExtractFileName(ExcludeTrailingPathdelimiter(Path));if Path = '' then Exit;Exit;ParentNode := FindParentInTree(Tree, ParentName);else if (FindParentInTree(Tree, Path) = nil) thenif (FindParentInTree(Tree,Path) = nil) thenbeginbeginCurrentNode := Tree.AddChild(Nil);CurrentNode := Tree.AddChild(Nil);InsertNodeData(CurrentNode);InsertNodeData(CurrentNode);end;end;if (F.Name = '.') or (F.Name = '..') then Exit;Exit;if Ext = '' then Exit;Exit;//// fb2- //// fb2- //if (CompareText(Ext, FB2_EXTENSION) = 0) or (CompareText(Ext, ZIP_EXTENSION) = 0) thenExit;ParentNode := FindParentInTree(Tree, Path);A, B: PVirtualNode;Data,DataA,DataB: PFileData;Data, DataA, DataB: PFileData;if (Data.DataType = dtFolder) and (Tree.HasChildren[Parent]) then(Tree.HasChildren[Parent]) thenif (A.Parent = B.Parent) and (DataA.DataType = dtFile) and (DataB.DataType = dtFolder) then(DataA.DataType = dtFile) and(DataB.DataType = dtFolder) thenTree.MoveTo(B, A, amInsertBefore, false);Tree.MoveTo(B, A, amInsertBefore, False);Tree.DeleteNode(Parent, True);Data := Tree.GetNodedata(Tree.GetFirstSelected);Data := Tree.GetNodeData(Tree.GetFirstSelected);ShellExecute(Handle, 'open', PChar(s), '', nil, SW_SHOWNORMAL);ShellExecute(Handle, 'open', PChar(S), '', nil, SW_SHOWNORMAL);procedure TfrmAddnonfb2.TreeChange(Sender: TBaseVirtualTree; Node: PVirtualNode);Node: PVirtualNode);Data: PFiledata;Data: PFileData;procedure TfrmAddnonfb2.TreeCompareNodes(Sender: TBaseVirtualTree; Node1, Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);// Result := CompareInt(Data1.DataType, Data1.DataType);// Result := CompareInt(Data1.DataType, Data1.DataType);// var// Data: PFileData;// S: string;// Data := Tree.GetNodedata(Tree.GetFirstSelected);// Data := Tree.GetNodedata(Tree.GetFirstSelected);// if Data <> nil then// if Data <> nil then// begin// begin// S := AnsiLowercase(Data.FullPath + Data.FileName + Data.Ext);// S := AnsiLowercase(Data.FullPath + Data.FileName + Data.Ext);// ShellExecute(Handle, 'open', PChar(s), '', nil, SW_SHOWNORMAL);// ShellExecute(Handle, 'open', PChar(s), '', nil, SW_SHOWNORMAL);// end;// end;procedure TfrmAddnonfb2.TreeGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; var CellText: String);Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;var CellText: String);dtFolder: if Column = 0 then CellText := Data.Titleelse CellText := '';if Column = 0 thendtFile: case Column ofCellText := Data.Title0: CellText := Data.FileName;else1: CellText := CleanExtension(Data.Ext);CellText := '';2: CellText := IntToStr(Data.Size);dtFile:3: CellText := '';case Column ofend;0: CellText := Data.FileName;1: CellText := CleanExtension(Data.Ext);2: CellText := GetFormattedSize(Data.Size);3: CellText := '';end;procedure TfrmAddnonfb2.TreePaintText(Sender: TBaseVirtualTree; const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType);const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;TextType: TVSTTextType);ActiveControl = RzPageControl1ActiveControl = pcBookInfoobject RzPageControl1: TPageControlobject pcBookInfo: TPageControlActivePage = tsFileInfoWidth = 47Width = 610Caption = #1040#1074#1090#1086#1088'('#1099')'Caption = #1040#1074#1090#1086#1088'('#1099')'Width = 55Width = 610