xref: /MusicPlayer2/MusicPlayer2/FindDlg.h (revision ed4a559c3ee49bf03b919e20bf10573dada4b52f)
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 	void GetSongsSelected(vector<wstring>& files) const;
25 	void GetSongsSelected(vector<SongInfo>& files) 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 	//const vector<SongInfo>& m_playlist;		//播放列表
46 	//vector<int> m_find_result;			//储存当前播放列表的查找结果(曲目序号)
47 	wstring m_key_word;				//查找的字符串
48 	vector<SongInfo> m_find_result;		//储存所有播放列表的查找结果
49 
50 	CListCtrlEx m_find_result_list;		//查找结果控件
51 	int m_item_selected{ -1 };		//鼠标选中的项目序号
52     vector<int> m_items_selected;
53 	//CMenu m_menu;
54 
55 	//int m_dpi;
56 
57 	CButton m_find_file_check;
58 	CButton m_find_title_check;
59 	CButton m_find_artist_check;
60 	CButton m_find_album_check;
61 
62 	bool m_find_current_playlist{ true };		//如果查找范围为当前播放列表,则为true,如果是所有播放列表,则为false
63     bool m_result_in_current_playlist{ true };  //查找结果是否为当前播放列表
64 	bool m_find_file{ true };
65 	bool m_find_title{ true };
66 	bool m_find_artist{ true };
67 	bool m_find_album{ true };
68 
69 	int m_find_option_data{};		//保存查找选项的数据,用每一个bit位表示每个查找选项是否选中
70 
71 	CString m_selected_string;
72 
73     virtual CString GetDialogName() const override;
74     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
75 	void ShowFindResult();
76 	void ShowFindInfo();
77     bool _OnAddToNewPlaylist(std::wstring& playlist_path);       //执行添加到新建播放列表命令,成功返回true,playlist_path用于接收新播放列表的路径
78     static UINT ViewOnlineThreadFunc(LPVOID lpParam);	//执行在线查看的线程函数
79     void GetCurrentSongList(std::vector<SongInfo>& song_list);
80 
81 public:
82 	void ClearFindResult();
83 
84 	DECLARE_MESSAGE_MAP()
85 
86 	afx_msg void OnEnChangeFindEdit();
87 	afx_msg void OnNMClickFindList(NMHDR *pNMHDR, LRESULT *pResult);
88 	afx_msg void OnBnClickedFindButton();
89 	virtual BOOL OnInitDialog();
90 	afx_msg void OnNMDblclkFindList(NMHDR *pNMHDR, LRESULT *pResult);
91 	virtual BOOL PreTranslateMessage(MSG* pMsg);
92 public:
93 	afx_msg void OnBnClickedFindFileCheck();
94 	afx_msg void OnBnClickedFindTitleCheck();
95 	afx_msg void OnBnClickedFindArtistCheck();
96 	afx_msg void OnBnClickedFindAlbumCheck();
97 	afx_msg void OnBnClickedFindCurrentPlaylistRadio();
98 	afx_msg void OnBnClickedFindAllPlaylistRadio();
99 	afx_msg void OnSize(UINT nType, int cx, int cy);
100 	afx_msg void OnPlayItem();
101 	afx_msg void OnExploreTrack();
102 	afx_msg void OnNMRClickFindList(NMHDR *pNMHDR, LRESULT *pResult);
103 	afx_msg void OnCopyText();
104     afx_msg void OnPlayItemInFolderMode();
105     afx_msg void OnAddToNewPlaylist();
106     afx_msg void OnExploreOnline();
107     afx_msg void OnFormatConvert();
108     afx_msg void OnItemProperty();
109     virtual void OnOK();
110     afx_msg void OnAddToNewPalylistAndPlay();
111 private:
112 public:
113     afx_msg void OnInitMenu(CMenu* pMenu);
114     virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
115     afx_msg void OnDeleteFromDisk();
116 };
117