xref: /MusicPlayer2/MusicPlayer2/FindDlg.h (revision 9cffa0df29e4d7309e6a99c32ae9bd86c2ad1b1e)
1 #pragma once
2 #include "AudioCommon.h"
3 #include "ListCtrlEx.h"
4 #include "Common.h"
5 #include "TabDlg.h"
6 
7 
8 // CFindDlg 对话框
9 
10 class CFindDlg : public CTabDlg
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 void OnTabEntered() 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     void SetPlaySelectedEnable(bool enable);
72 
73 public:
74     void ClearFindResult();
75 
76     DECLARE_MESSAGE_MAP()
77 
78     afx_msg void OnEnChangeFindEdit();
79     afx_msg void OnNMClickFindList(NMHDR *pNMHDR, LRESULT *pResult);
80     afx_msg void OnBnClickedFindButton();
81     virtual BOOL OnInitDialog();
82     afx_msg void OnNMDblclkFindList(NMHDR *pNMHDR, LRESULT *pResult);
83     virtual BOOL PreTranslateMessage(MSG* pMsg);
84 public:
85     afx_msg void OnBnClickedFindFileCheck();
86     afx_msg void OnBnClickedFindTitleCheck();
87     afx_msg void OnBnClickedFindArtistCheck();
88     afx_msg void OnBnClickedFindAlbumCheck();
89     afx_msg void OnBnClickedFindCurrentPlaylistRadio();
90     afx_msg void OnBnClickedFindAllPlaylistRadio();
91     afx_msg void OnSize(UINT nType, int cx, int cy);
92     afx_msg void OnPlayItem();
93     afx_msg void OnExploreTrack();
94     afx_msg void OnNMRClickFindList(NMHDR *pNMHDR, LRESULT *pResult);
95     afx_msg void OnCopyText();
96     afx_msg void OnPlayItemInFolderMode();
97     afx_msg void OnAddToNewPlaylist();
98     afx_msg void OnExploreOnline();
99     afx_msg void OnFormatConvert();
100     afx_msg void OnItemProperty();
101     virtual void OnOK();
102     afx_msg void OnAddToNewPlaylistAndPlay();
103 private:
104 public:
105     afx_msg void OnInitMenu(CMenu* pMenu);
106     virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
107     afx_msg void OnDeleteFromDisk();
108     afx_msg void OnPlayAsNext();
109 };
110