root/trunk/Forms/frm_main.pas
| 476 | 479 | ||
|---|---|---|---|
422 | procedure tvGenresChange(Sender: TBaseVirtualTree; Node: PVirtualNode); | 422 | procedure tvGenresChange(Sender: TBaseVirtualTree; Node: PVirtualNode); |
423 | 423 | ||
424 | // | 424 | // |
425 | // Код следующих 4-х методов совпадает с точностью до названия объектов
| ||
426 | // НО! внутри обрабатываются разные наборы контролов
| ||
427 | // | 425 | // |
428 | procedure tvAuthorsPaintText(Sender: TBaseVirtualTree; const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType); | ||
429 | |||
430 | // | 426 | // |
431 | // | ||
432 | // | ||
433 | procedure tvBooksTreeBeforeCellPaint(Sender: TBaseVirtualTree; TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect); | 427 | procedure tvBooksTreeBeforeCellPaint(Sender: TBaseVirtualTree; TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect); |
434 | procedure tvBooksTreeAfterCellPaint(Sender: TBaseVirtualTree; TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; CellRect: TRect); | 428 | procedure tvBooksTreeAfterCellPaint(Sender: TBaseVirtualTree; TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; CellRect: TRect); |
435 | 429 | ||
... | ... | ||
2077 | 2071 | ||
2078 | ReadINIData; | 2072 | ReadINIData; |
2079 | 2073 | ||
2080 | CreateDir(Settings.TempDir); | 2074 | TDirectory.CreateDirectory(Settings.TempDir); |
2081 | CreateDir(Settings.DataDir); | 2075 | TDirectory.CreateDirectory(Settings.DataDir); |
2082 | 2076 | ||
2083 | SetColumns; | 2077 | SetColumns; |
2084 | SetHeaderPopUp; | 2078 | SetHeaderPopUp; |
... | ... | ||
2802 | end; | 2796 | end; |
2803 | end; | 2797 | end; |
2804 | 2798 | ||
2805 | procedure TfrmMain.tvAuthorsPaintText(Sender: TBaseVirtualTree; const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType); | ||
2806 | begin | ||
2807 | if Sender.Selected[Node] then | ||
2808 | TargetCanvas.Font.Color := clWhite; | ||
2809 | end; | ||
2810 | |||
2811 | procedure TfrmMain.tvBooksTreeBeforeCellPaint(Sender: TBaseVirtualTree; TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect); | 2799 | procedure TfrmMain.tvBooksTreeBeforeCellPaint(Sender: TBaseVirtualTree; TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect); |
2812 | var | 2800 | var |
2813 | Data: PBookData; | 2801 | Data: PBookData; |
... | ... | ||
3283 | SaveDeviceDir := Settings.DeviceDir; | 3271 | SaveDeviceDir := Settings.DeviceDir; |
3284 | SaveFolderTemplate := Settings.FolderTemplate; | 3272 | SaveFolderTemplate := Settings.FolderTemplate; |
3285 | // dlgFolder.Directory := Settings.DeviceDir; | 3273 | // dlgFolder.Directory := Settings.DeviceDir; |
3286 | ScriptID := (Sender as TComponent).tag; | 3274 | ScriptID := (Sender as TComponent).Tag; |
3287 | 3275 | ||
3288 | if isFB2Collection(DMUser.ActiveCollection.CollectionType) then | 3276 | if isFB2Collection(DMUser.ActiveCollection.CollectionType) then |
3289 | begin | 3277 | begin |
... | ... | ||
3304 | Dec(ScriptID, 901); | 3292 | Dec(ScriptID, 901); |
3305 | 3293 | ||
3306 | if (ScriptID < 1) and (Settings.PromptDevicePath) then | 3294 | if (ScriptID < 1) and (Settings.PromptDevicePath) then |
3307 | // if not dlgFolder.Execute then | 3295 | begin |
3308 | if not GetFolderName(Handle, 'Укажите путь', AFolder) then | 3296 | if not GetFolderName(Handle, 'Укажите путь', AFolder) then |
3309 | Exit | 3297 | Exit |
3310 | else | 3298 | else |
... | ... | ||
3313 | параметрами этих функций | 3301 | параметрами этих функций |
3314 | } | 3302 | } |
3315 | Settings.DeviceDir := AFolder; | 3303 | Settings.DeviceDir := AFolder; |
3304 | end; | ||
3316 | 3305 | ||
3317 | if ScriptID >= 0 then | 3306 | if ScriptID >= 0 then |
3318 | begin | 3307 | begin |
... | ... | ||
3333 | begin | 3322 | begin |
3334 | StrReplace('%FOLDER ', '', TMPParams); | 3323 | StrReplace('%FOLDER ', '', TMPParams); |
3335 | p := Pos('%', TMPParams); | 3324 | p := Pos('%', TMPParams); |
3336 | S := copy(TMPParams, 1, p - 1); | 3325 | S := Copy(TMPParams, 1, p - 1); |
3337 | Settings.DeviceDir := S; | 3326 | Settings.DeviceDir := S; |
3338 | Delete(TMPParams, 1, p); | 3327 | Delete(TMPParams, 1, p); |
3339 | end; | 3328 | end; |
3340 | 3329 | ||
3341 | if (Settings.Scripts[ScriptID].Path = '%COPY%') and (trim(TMPParams) <> '') then | 3330 | if (Settings.Scripts[ScriptID].Path = '%COPY%') and (Trim(TMPParams) <> '') then |
3342 | Settings.DeviceDir := Trim(TMPParams); | 3331 | Settings.DeviceDir := Trim(TMPParams); |
3343 | 3332 | ||
3344 | Settings.Scripts[ScriptID].TMPParams := TMPParams; | 3333 | Settings.Scripts[ScriptID].TMPParams := TMPParams; |
... | ... | ||
3353 | end; | 3342 | end; |
3354 | 3343 | ||
3355 | if ActiveView <> FavoritesView then | 3344 | if ActiveView <> FavoritesView then |
3356 | unit_ExportToDevice.ExportToDevice(dmCollection.ActiveTable, BookIDList, ExportMode, Files) | 3345 | unit_ExportToDevice.ExportToDevice(DMCollection.ActiveTable, BookIDList, ExportMode, Files) |
3357 | else | 3346 | else |
3358 | unit_ExportToDevice.ExportToDevice(DMUser.tblGrouppedBooks, BookIDList, ExportMode, Files); | 3347 | unit_ExportToDevice.ExportToDevice(DMUser.tblGrouppedBooks, BookIDList, ExportMode, Files); |
3359 | 3348 | ||
... | ... | ||
3635 | 3624 | ||
3636 | procedure TfrmMain.tbtnShowCoverClick(Sender: TObject); | 3625 | procedure TfrmMain.tbtnShowCoverClick(Sender: TObject); |
3637 | var | 3626 | var |
3638 | Visible: Boolean; | 3627 | ShowCover: Boolean; |
3639 | begin | 3628 | begin |
3640 | Settings.ShowInfoPanel := not Settings.ShowInfoPanel; | 3629 | Settings.ShowInfoPanel := not Settings.ShowInfoPanel; |
3641 | 3630 | ||
... | ... | ||
3643 | // or (Settings.ShowInfoPanel and isNonFB2Collection(DMUser.ActiveCollection.CollectionType) | 3632 | // or (Settings.ShowInfoPanel and isNonFB2Collection(DMUser.ActiveCollection.CollectionType) |
3644 | // and Settings.AllowMixed)); | 3633 | // and Settings.AllowMixed)); |
3645 | 3634 | ||
3646 | Visible := Settings.ShowInfoPanel; | 3635 | ShowCover := Settings.ShowInfoPanel; |
3647 | 3636 | ||
3648 | SetCoversVisible(Visible); | 3637 | SetCoversVisible(ShowCover); |
3649 | if Visible then | 3638 | if ShowCover then |
3650 | tvBooksTreeChange(nil, nil); | 3639 | tvBooksTreeChange(nil, nil); |
3651 | end; | 3640 | end; |
3652 | 3641 | ||
... | ... | ||
5680 | 5669 | ||
5681 | if ActiveView <> FavoritesView then | 5670 | if ActiveView <> FavoritesView then |
5682 | begin | 5671 | begin |
5672 | // | ||
5683 | // если книга есть в избранном - синхронизируем | 5673 | // если книга есть в избранном - синхронизируем |
5674 | // | ||
5684 | if DMUser.tblGrouppedBooks.Locate('DataBaseID;OuterID;', VarArrayOf([DMUser.ActiveCollection.ID, Data.ID]), []) then | 5675 | if DMUser.tblGrouppedBooks.Locate('DataBaseID;OuterID;', VarArrayOf([DMUser.ActiveCollection.ID, Data.ID]), []) then |
5685 | begin | 5676 | begin |
5686 | DMUser.tblGrouppedBooks.Edit; | 5677 | DMUser.tblGrouppedBooks.Edit; |
5687 | DMUser.tblGrouppedBooksCode.Value := Table.FieldByName('Code').AsInteger; | 5678 | DMUser.tblGrouppedBooksCode.Value := Table.FieldByName('Code').AsInteger; |
5688 | DMUser.tblGrouppedBooks.Post; | 5679 | DMUser.tblGrouppedBooks.Post; |
5689 | 5680 | ||
5681 | { TODO -oNickR -cBug : #46 - в таблице User.Extra нет поля ID } | ||
5690 | if DMUser.tblExtra.Locate(ID_FIELD, DMUser.tblGrouppedBooksID.Value, []) then | 5682 | if DMUser.tblExtra.Locate(ID_FIELD, DMUser.tblGrouppedBooksID.Value, []) then |
5691 | begin | 5683 | begin |
5692 | case Table.FieldByName('Code').AsInteger of | 5684 | case Table.FieldByName('Code').AsInteger of |
... | ... | ||
5724 | 0: | 5716 | 0: |
5725 | if dmCollection.tblExtra.RecordCount <> 0 then | 5717 | if dmCollection.tblExtra.RecordCount <> 0 then |
5726 | dmCollection.tblExtra.Delete; | 5718 | dmCollection.tblExtra.Delete; |
5719 | |||
5727 | 1: | 5720 | 1: |
5728 | begin | 5721 | begin |
5729 | dmCollection.tblExtra.Edit; | 5722 | dmCollection.tblExtra.Edit; |
... | ... | ||
6034 | end; | 6027 | end; |
6035 | 6028 | ||
6036 | procedure TfrmMain.N34Click(Sender: TObject); | 6029 | procedure TfrmMain.N34Click(Sender: TObject); |
6030 | var | ||
6031 | dirPath: string; | ||
6037 | begin | 6032 | begin |
6038 | if DirectoryExists(Settings.ReadDir) then | 6033 | dirPath := ExcludeTrailingPathDelimiter(Settings.ReadPath); |
6039 | ClearDir(Settings.ReadDir); | 6034 | if DirectoryExists(dirPath) then |
6035 | ClearDir(dirPath); | ||
6040 | end; | 6036 | end; |
6041 | 6037 | ||
6042 | procedure TfrmMain.miEditToolbarVisibleClick(Sender: TObject); | 6038 | procedure TfrmMain.miEditToolbarVisibleClick(Sender: TObject); |
Download diff