xref: /MusicPlayer2/MusicPlayer2/FindDlg.h (revision 443d2d2511be730d1b1dd3181942b7fa6539aa1a)
1 #pragma once
2 #include "AudioCommon.h"
3 #include "ListCtrlEx.h"
4 #include "Common.h"
5 #include "BaseDialog.h"
6 
7 
8 // CFindDlg 对话框
9 
10 class CFindDlg : public CBaseDialog
11 {
12     DECLARE_DYNAMIC(CFindDlg)
13 
14 public:
15     CFindDlg(CWnd* pParent = NULL);   // 标准构造函数
16     virtual ~CFindDlg();
17 
18     //wstring m_config_path;
19 
20     // 根据多选索引m_find_result从m_find_result查找歌曲放入songs
21     void GetSongsSelected(vector<SongInfo>& songs) const;
22     void SaveConfig();
23     void LoadConfig();
24 
25 // 对话框数据
26 #ifdef AFX_DESIGN_TIME
27     enum { IDD = IDD_FIND_DIALOG };
28 #endif
29 
30 protected:
31     enum ColumeIndex
32     {
33         COL_INDEX = 0,
34         COL_FILE_NAME,
35         COL_TITLE,
36         COL_ARTIST,
37         COL_ALBUM,
38         COL_PATH,
39     };
40 
41     wstring m_key_word;             //查找的字符串
42     vector<SongInfo> m_find_result;     //储存所有播放列表的查找结果
43 
44     CListCtrlEx m_find_result_list;     //查找结果控件
45     int m_item_selected{ -1 };      //鼠标选中的项目序号
46     vector<int> m_items_selected;   // 多选列表
47 
48     CButton m_find_file_check;
49     CButton m_find_title_check;
50     CButton m_find_artist_check;
51     CButton m_find_album_check;
52 
53     bool m_find_current_playlist{ true };       //如果查找范围为当前播放列表(设置情况),则为true,如果是所有播放列表,则为false
54     bool m_find_file{ true };
55     bool m_find_title{ true };
56     bool m_find_artist{ true };
57     bool m_find_album{ true };
58 
59     int m_find_option_data{};       //保存查找选项的数据,用每一个bit位表示每个查找选项是否选中
60 
61     CString m_selected_string;
62 
63     virtual CString GetDialogName() const override;
64     virtual bool InitializeControls() override;
65     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
66     void ShowFindResult();
67     void ShowFindInfo();
68     bool _OnAddToNewPlaylist(std::wstring& playlist_path);       //执行添加到新建播放列表命令,成功返回true,playlist_path用于接收新播放列表的路径
69     static UINT ViewOnlineThreadFunc(LPVOID lpParam);   //执行在线查看的线程函数
70 
71 public:
72     void ClearFindResult();
73 
74     DECLARE_MESSAGE_MAP()
75 
76     afx_msg void OnEnChangeFindEdit();
77     afx_msg void OnNMClickFindList(NMHDR *pNMHDR, LRESULT *pResult);
78     afx_msg void OnBnClickedFindButton();
79     virtual BOOL OnInitDialog();
80     afx_msg void OnNMDblclkFindList(NMHDR *pNMHDR, LRESULT *pResult);
81     virtual BOOL PreTranslateMessage(MSG* pMsg);
82 public:
83     afx_msg void OnBnClickedFindFileCheck();
84     afx_msg void OnBnClickedFindTitleCheck();
85     afx_msg void OnBnClickedFindArtistCheck();
86     afx_msg void OnBnClickedFindAlbumCheck();
87     afx_msg void OnBnClickedFindCurrentPlaylistRadio();
88     afx_msg void OnBnClickedFindAllPlaylistRadio();
89     afx_msg void OnSize(UINT nType, int cx, int cy);
90     afx_msg void OnPlayItem();
91     afx_msg void OnExploreTrack();
92     afx_msg void OnNMRClickFindList(NMHDR *pNMHDR, LRESULT *pResult);
93     afx_msg void OnCopyText();
94     afx_msg void OnPlayItemInFolderMode();
95     afx_msg void OnAddToNewPlaylist();
96     afx_msg void OnExploreOnline();
97     afx_msg void OnFormatConvert();
98     afx_msg void OnItemProperty();
99     virtual void OnOK();
100     afx_msg void OnAddToNewPlaylistAndPlay();
101 private:
102 public:
103     afx_msg void OnInitMenu(CMenu* pMenu);
104     virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
105     afx_msg void OnDeleteFromDisk();
106     afx_msg void OnPlayAsNext();
107 };
108