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