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