📄 win32musicbrowser.h
字号:
/*____________________________________________________________________________
FreeAmp - The Free MP3 Player
Portions Copyright (C) 1999 EMusic.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: Win32MusicBrowser.h,v 1.92 2001/01/18 17:30:55 ijr Exp $
____________________________________________________________________________*/
#ifndef INCLUDED_WIN32MUSICBROWSER_H_
#define INCLUDED_WIN32MUSICBROWSER_H_
// The debugger can't handle symbols more than 255 characters long.
// STL often creates symbols longer than that.
// When symbols are longer than 255 characters, the warning is disabled.
#ifdef WIN32
#pragma warning(disable:4786)
#endif
#include <windows.h>
#include <commctrl.h>
#include <dbt.h>
#include <vector>
#include <string>
#include <set>
using namespace std;
#include "config.h"
#include "ui.h"
#include "event.h"
#include "thread.h"
#include "playlist.h"
#include "musiccatalog.h"
#include "DataIndex.h"
#include "DropTarget.h"
#include "timer.h"
#include "FreeAmpStreams.h"
#include "ColumnInfo.h"
class FAContext;
#define STATE_COLLAPSED 0
#define STATE_EXPANDED 1
#define PLAYERSTATE_STOPPED 0
#define PLAYERSTATE_PLAYING 1
#define PLAYERSTATE_PAUSED 2
#define IDC_REBAR 13000
#define IDC_TOOLBAR 13001
#define TOOLBAR_INDENT 8
#define ALBUM_COLUMN "Album"
#define ARTIST_COLUMN "Artist"
#define COMMENT_COLUMN "Comment"
#define GENRE_COLUMN "Genre"
#define LOCATION_COLUMN "Location"
#define TIME_COLUMN "Time"
#define TITLE_COLUMN "Title"
#define YEAR_COLUMN "Year"
#define TRACK_COLUMN "Track"
bool operator<(const TreeData &A, const TreeData &b);
bool operator==(const TreeData &A, const TreeData &b);
void ClientToWindow(HWND hWnd, POINT *Pt);
extern HINSTANCE g_hinst;
class TrackSort : public binary_function<PlaylistItem*, PlaylistItem*, bool> {
public:
TrackSort(){ }
bool operator() (PlaylistItem* item1, PlaylistItem* item2) const;
};
LRESULT WINAPI
ListViewWndProc(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam);
LRESULT WINAPI
TreeViewWndProc(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam);
BOOL CALLBACK
MusicSearchDlgProc(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam);
BOOL CALLBACK
SavePlaylistDlgProc(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam);
BOOL CALLBACK
RemoveTracksDlgProc(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam);
BOOL CALLBACK
PerformDBCheckDlgProc(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam );
class MusicBrowserUI : public UserInterface
{
public:
MusicBrowserUI(FAContext *context,
MusicBrowserUI *parent,
HWND hParent,
const string &oPlaylistName);
MusicBrowserUI(FAContext *context,
MusicBrowserUI *parent,
HWND hParent,
DeviceInfo *pDevice);
virtual ~MusicBrowserUI();
virtual Error AcceptEvent(Event *);
virtual Error Init(int32);
static void UIThreadFunc(void* arg);
void InitDialog(HWND hwnd);
void SetMinMaxInfo();
void EditItemLabel(HWND hwnd, HTREEITEM item);
bool IntroductionWizard(vector<string>* searchPaths,
APSInterface *pInterface);
BOOL DialogProc(HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam);
LRESULT TreeViewWndProc(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam);
LRESULT ListViewWndProc(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam);
BOOL MusicSearchDlgProc(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam);
bool FileOpenDialog(HWND hwnd,
const char* title,
const char* filter,
vector<string>* fileList,
bool allowURL);
const PlaylistManager* PLManager() const { return m_plm; }
static void streams_timer(void* arg);
void StreamsTimer();
protected:
FAContext *m_context;
private:
void Init();
// Functions in Dialog.cpp
void ShowBrowser(bool bShowExpanded);
void HideBrowser();
void Close();
void Destroy();
void ExpandCollapseEvent();
void GetMinMaxInfo(MINMAXINFO *pInfo);
void SizeWindow(int type, int iWidth, int iHeight);
BOOL SetCursor(int hitTest, int mouseMsg);
void DropFiles(HDROP dropHandle, bool filesAreURLs);
void MouseMove(uint32 uFlags, POINT &sPoint);
void MouseButtonDown(int keys, int x, int y);
void MouseButtonUp(int keys, int x, int y);
BOOL DrawItem(int32 controlId, DRAWITEMSTRUCT* dis);
void SetStatusText(const char *text);
void CreateToolbar();
void AddToolbarButtons(bool textLabels, bool images);
void ToggleVisEvent();
void SetTitles();
void UpdateMenuStates();
void UpdateButtonStates();
void MoveControls(int iPixelsToMove);
bool CreateMainDialog();
Error CloseMainDialog();
uint32 CalcStringEllipsis(HDC hdc, string& displayString,
int32 columnWidth);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -