|
|
@@ -6,8 +6,8 @@ interface
|
|
|
|
|
|
uses
|
|
|
Classes, Sysutils, Fileutil, Forms, Controls, Graphics, Dialogs, ExtCtrls, LazFileUtils,
|
|
|
- Book, BookCollection, LCLIntf, LResources, StdCtrls, Menus, LCLType, IniFiles, unitSettingsDialog,
|
|
|
- unitCoverWorker, unitStorageXML, unitMetadata, UnitBookDialog, LazUTF8;
|
|
|
+ Book, BookCollection, LCLIntf, LResources, StdCtrls, LCLType, IniFiles, unitSettingsDialog,
|
|
|
+ unitCoverWorker, unitStorageXML, unitMetadata, LazUTF8;
|
|
|
|
|
|
|
|
|
type
|
|
|
@@ -16,8 +16,6 @@ type
|
|
|
TForm1 = class(TForm)
|
|
|
EditSearch: Tedit;
|
|
|
ComboSort: TComboBox;
|
|
|
- PopupBook: TPopupMenu;
|
|
|
- MenuEditBook: TMenuItem;
|
|
|
ButtonSettings: Timage;
|
|
|
ImageToolBar: Timage;
|
|
|
ButtonAdd: Timage;
|
|
|
@@ -48,7 +46,6 @@ type
|
|
|
function GetBookIndexAtPoint(X,Y:Integer):Integer;
|
|
|
procedure UnselectAll;
|
|
|
function GetCoverIndex(cover:TImage):Integer;
|
|
|
- procedure PopupEditBookClick({%H-}Sender: TObject);
|
|
|
private
|
|
|
mAdd,mAddHover,mGear,mGearHover:TPicture;
|
|
|
LayoutTimer: TTimer;
|
|
|
@@ -311,31 +308,6 @@ begin
|
|
|
result:=-1;
|
|
|
end;
|
|
|
|
|
|
-procedure TForm1.PopupEditBookClick({%H-}Sender: TObject);
|
|
|
-var
|
|
|
- img: TImage;
|
|
|
- idx: Integer;
|
|
|
- dlg: TBookEditDialog;
|
|
|
-begin
|
|
|
- if (PopupBook = nil) or (PopupBook.PopupComponent = nil) then Exit;
|
|
|
- if not (PopupBook.PopupComponent is TImage) then Exit;
|
|
|
- img := TImage(PopupBook.PopupComponent);
|
|
|
- idx := GetCoverIndex(img);
|
|
|
- if idx < 0 then Exit;
|
|
|
-
|
|
|
- dlg := TBookEditDialog.Create(Self);
|
|
|
- try
|
|
|
- dlg.LoadBook(bookList.Books[idx]);
|
|
|
- if dlg.ShowModal = mrOK then
|
|
|
- begin
|
|
|
- // reflect changes visually
|
|
|
- bookList.Books[idx].EnsureScaledToCoverSize;
|
|
|
- ApplyFilterAndLayout;
|
|
|
- end;
|
|
|
- finally
|
|
|
- dlg.Free;
|
|
|
- end;
|
|
|
-end;
|
|
|
|
|
|
|
|
|
procedure TForm1.FormClose({%H-}Sender: TObject; var CloseAction: TCloseAction);
|
|
|
@@ -427,7 +399,6 @@ var
|
|
|
book.Cover.Width:=coverWidth;
|
|
|
book.Cover.Height:=coverHeight;
|
|
|
book.Cover.Parent:=PanelBackground;
|
|
|
- book.Cover.PopupMenu := PopupBook;
|
|
|
// Ensure the pre-scaled image matches the final cover size
|
|
|
book.EnsureScaledToCoverSize;
|
|
|
CoverWorkerEnqueueBookIfMissing(book);
|
|
|
@@ -591,7 +562,6 @@ begin
|
|
|
Cover.Width:=coverWidth;
|
|
|
Cover.Height:=coverHeight;
|
|
|
Cover.Parent:=PanelBackground;
|
|
|
- Cover.PopupMenu := PopupBook;
|
|
|
EnsureScaledToCoverSize;
|
|
|
end;
|
|
|
end;
|