1 #pragma once 2 #include "TabDlg.h" 3 #include "ListCtrlEx.h" 4 #include "IPropertyTabDlg.h" 5 6 7 // CPropertyAlbumCoverDlg 对话框 8 9 class CPropertyAlbumCoverDlg : public CTabDlg, public IPropertyTabDlg 10 { 11 DECLARE_DYNAMIC(CPropertyAlbumCoverDlg) 12 13 public: 14 CPropertyAlbumCoverDlg(vector<SongInfo>& all_song_info, int& index, bool show_out_album_cover = false, bool read_only = false, CWnd* pParent = nullptr); // 标准构造函数 15 CPropertyAlbumCoverDlg(vector<SongInfo>& all_song_info, CWnd* pParent = nullptr); //批量编辑 16 virtual ~CPropertyAlbumCoverDlg(); 17 18 virtual void PagePrevious() override; 19 virtual void PageNext() override; 20 virtual int SaveModified() override; 21 void AdjustColumnWidth(); 22 23 // 对话框数据 24 #ifdef AFX_DESIGN_TIME 25 enum { IDD = IDD_PROPERTY_ALBUM_COVER_DIALOG }; 26 #endif 27 28 protected: 29 enum RowIndex 30 { 31 RI_FILE_PATH, 32 RI_COVER_PATH, 33 RI_FORMAT, 34 RI_WIDTH, 35 RI_HEIGHT, 36 RI_BPP, 37 RI_SIZE, 38 //RI_COMPRESSED, 39 RI_MAX 40 }; 41 42 CListCtrlEx m_list_ctrl; 43 44 int& m_index; //当前显示项目的曲目序号 45 vector<SongInfo>& m_all_song_info; 46 bool m_read_only{}; 47 bool m_show_out_album_cover{}; 48 const bool m_batch_edit; 49 int m_no_use{}; 50 51 bool m_write_enable{}; 52 bool m_cover_changed{}; //是否手动浏览了一张图片作为专辑封面 53 bool m_cover_deleted{}; //是否删除了专辑封面 54 55 CImage m_cover_img; //内嵌专辑封面 56 CImage m_cover_out_img; //外部专辑封面 57 wstring m_out_img_path; //外部专辑图片的路径 58 59 protected: 60 void ShowInfo(); 61 const SongInfo& CurrentSong(); //当前查看的歌曲信息 62 CImage& GetCoverImage(); //当前显示的专辑封面图片 63 bool IsCurrentSong(); //当前查看的歌曲是否为正在播放的歌曲 64 bool IsShowOutAlbumCover(); //显示的专辑封面图片是否为外部图片 65 bool IsDeleteEnable(); //删除功能是否可用 66 bool HasAlbumCover(); 67 void SetWreteEnable(); 68 void EnableControls(); 69 void SetSaveBtnEnable(); //设置父窗口中的“保存到文件”按钮的可用或禁用状态 70 71 //写入专辑封面,如果delete_file为true则写入后删除图片文件。返回写入文件的个数 72 int SaveAlbumCover(const wstring& album_cover_path, bool delete_file = false); 73 int SaveEnbedLinkedCoverForBatchEdit(); //批量编辑模式下将关联的专辑封面嵌入到音频文件 74 75 void DeleteLinkedPic(const wstring& file_path, const wstring& album_cover_path); 76 77 virtual void OnTabEntered() override; //当标签切换到当前窗口时被调用 78 virtual bool InitializeControls() override; 79 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 80 81 DECLARE_MESSAGE_MAP() 82 public: 83 virtual BOOL OnInitDialog(); 84 afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); 85 afx_msg void OnPaint(); 86 afx_msg void OnBnClickedSaveAlbumCoverButton(); 87 afx_msg void OnBnClickedDeleteButton(); 88 afx_msg void OnBnClickedBrowseButton(); 89 afx_msg void OnRButtonUp(UINT nFlags, CPoint point); 90 afx_msg void OnCoverBrowse(); 91 afx_msg void OnCoverDelete(); 92 afx_msg void OnCoverSaveAs(); 93 afx_msg void OnInitMenu(CMenu* pMenu); 94 afx_msg void OnBnClickedShowOutAlbumCoverChk(); 95 afx_msg void OnCompressSize(); 96 protected: 97 afx_msg LRESULT OnTabletQuerysystemgesturestatus(WPARAM wParam, LPARAM lParam); 98 }; 99