Reintegrated 2.3 branch into trunk

This commit is contained in:
Birunthan Mohanathas
2012-01-08 17:35:29 +00:00
parent c3335adec5
commit c3ed2e5fa3
87 changed files with 5379 additions and 2732 deletions

View File

@ -37,7 +37,7 @@ void CInternet::Initialize()
if (!c_NetHandle)
{
LSLog(LOG_ERROR, NULL, L"NowPlaying.dll: Unable to open net handle");
RmLog(LOG_ERROR, L"NowPlaying.dll: Unable to open net handle");
}
}

File diff suppressed because it is too large Load Diff

View File

@ -24,51 +24,37 @@
struct ParentMeasure
{
ParentMeasure() :
player(NULL),
childCount(1),
trackCount(0),
player(),
data(),
skin(),
ownerName(),
measureCount(1),
trackCount(1),
disableLeadingZero(false)
{}
UINT id;
UINT childCount;
UINT trackCount;
CPlayer* player;
HWND window;
std::wstring name;
std::wstring iniFile;
void* data;
void* skin;
LPCWSTR ownerName;
std::wstring trackChangeAction;
std::wstring playerPath;
UINT measureCount;
UINT trackCount;
bool disableLeadingZero;
};
struct ChildMeasure
struct Measure
{
ChildMeasure() :
type(MEASURE_NONE),
parent(NULL)
Measure() :
parent(),
type(MEASURE_NONE)
{}
MEASURETYPE type;
ParentMeasure* parent;
MeasureType type;
};
void SecondsToTime(UINT seconds, bool leadingZero, WCHAR* buffer);
void ExecuteCommand(std::wstring& command, HWND wnd);
bool BelongToSameProcess(HWND wnd);
HWND FindMeterWindow(HWND parent);
HWND FindMeterWindow(const std::wstring& iniFile);
/* The exported functions */
extern "C"
{
__declspec( dllexport ) UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id);
__declspec( dllexport ) void Finalize(HMODULE instance, UINT id);
__declspec( dllexport ) UINT Update(UINT id);
__declspec( dllexport ) LPCTSTR GetString(UINT id, UINT flags);
__declspec( dllexport ) LPCTSTR GetPluginAuthor();
__declspec( dllexport ) UINT GetPluginVersion();
__declspec( dllexport ) void ExecuteBang(LPCTSTR bang, UINT id);
}
#endif

View File

@ -162,7 +162,7 @@ void CPlayer::FindLyrics()
}
else
{
LSLog(LOG_DEBUG, NULL, L"NowPlaying.dll: Failed to start lyrics thread");
RmLog(LOG_DEBUG, L"NowPlaying.dll: Failed to start lyrics thread");
}
}
}
@ -214,7 +214,7 @@ unsigned __stdcall CPlayer::LyricsThreadProc(void* pParam)
*/
void CPlayer::ClearData()
{
m_State = PLAYER_STOPPED;
m_State = STATE_STOPPED;
m_Artist.clear();
m_Album.clear();
m_Title.clear();

View File

@ -25,14 +25,14 @@
#include "Internet.h"
#include "Lyrics.h"
enum PLAYSTATE
enum StateType
{
PLAYER_STOPPED,
PLAYER_PLAYING,
PLAYER_PAUSED
STATE_STOPPED,
STATE_PLAYING,
STATE_PAUSED
};
enum MEASURETYPE
enum MeasureType
{
MEASURE_NONE = 0x00000000,
MEASURE_ARTIST = 0x00000001,
@ -64,8 +64,8 @@ public:
void AddMeasure(INT type);
virtual void UpdateData() = 0;
bool IsInitialized() { return m_Initialized; }
UINT GetTrackCount() { return m_TrackCount; }
bool IsInitialized() const { return m_Initialized; }
UINT GetTrackCount() const { return m_TrackCount; }
void FindCover();
void FindLyrics();
@ -83,19 +83,19 @@ public:
virtual void OpenPlayer(std::wstring& path) {}
virtual void ClosePlayer() {}
PLAYSTATE GetState() { return m_State; }
LPCTSTR GetArtist() { return m_Artist.c_str(); }
LPCTSTR GetAlbum() { return m_Album.c_str(); }
LPCTSTR GetTitle() { return m_Title.c_str(); }
LPCTSTR GetLyrics() { return m_Lyrics.c_str(); }
LPCTSTR GetCoverPath() { return m_CoverPath.c_str(); }
LPCTSTR GetFilePath() { return m_FilePath.c_str(); }
UINT GetDuration() { return m_Duration; }
UINT GetPosition() { return m_Position; }
UINT GetRating() { return m_Rating; }
UINT GetVolume() { return m_Volume; }
bool GetShuffle() { return m_Shuffle; }
bool GetRepeat() { return m_Repeat; }
StateType GetState() const { return m_State; }
LPCTSTR GetArtist() const{ return m_Artist.c_str(); }
LPCTSTR GetAlbum() const{ return m_Album.c_str(); }
LPCTSTR GetTitle() const{ return m_Title.c_str(); }
LPCTSTR GetLyrics() const{ return m_Lyrics.c_str(); }
LPCTSTR GetCoverPath() const{ return m_CoverPath.c_str(); }
LPCTSTR GetFilePath() const{ return m_FilePath.c_str(); }
UINT GetDuration() const{ return m_Duration; }
UINT GetPosition() const{ return m_Position; }
UINT GetRating() const{ return m_Rating; }
UINT GetVolume() const{ return m_Volume; }
bool GetShuffle() const { return m_Shuffle; }
bool GetRepeat() const { return m_Repeat; }
protected:
void ClearData();
@ -107,7 +107,7 @@ protected:
std::wstring m_TempCoverPath;
INT m_Measures;
PLAYSTATE m_State;
StateType m_State;
std::wstring m_Artist;
std::wstring m_Title;
std::wstring m_Album;

View File

@ -124,8 +124,8 @@ void CPlayerAIMP::UpdateData()
}
// If initialized
m_State = (PLAYSTATE)SendMessage(m_Window, WM_AIMP_COMMAND, WM_AIMP_STATUS_GET, AIMP_STS_Player);
if (m_State == PLAYER_STOPPED)
m_State = (StateType)SendMessage(m_Window, WM_AIMP_COMMAND, WM_AIMP_STATUS_GET, AIMP_STS_Player);
if (m_State == STATE_STOPPED)
{
// Make sure AIMP is still active
if (!IsWindow(m_Window))
@ -270,7 +270,7 @@ void CPlayerAIMP::SetPosition(int position)
void CPlayerAIMP::SetRating(int rating)
{
// Set rating through the AIMP Winamp API
if (m_State != PLAYER_STOPPED)
if (m_State != STATE_STOPPED)
{
SendMessage(m_WinampWindow, WM_WA_IPC, rating, IPC_SETRATING);
m_Rating = rating;

View File

@ -178,9 +178,9 @@ void CPlayerCAD::Initialize()
}
SendMessage(m_PlayerWindow, WM_USER, (WPARAM)m_Window, IPC_SET_CALLBACK_HWND);
m_State = (PLAYSTATE)SendMessage(m_PlayerWindow, WM_USER, 0, IPC_GET_STATE);
m_State = (StateType)SendMessage(m_PlayerWindow, WM_USER, 0, IPC_GET_STATE);
if (m_State != PLAYER_STOPPED)
if (m_State != STATE_STOPPED)
{
SendMessage(m_PlayerWindow, WM_USER, 0, IPC_GET_CURRENT_TRACK);
}
@ -235,8 +235,8 @@ LRESULT CALLBACK CPlayerCAD::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case IPC_STATE_CHANGED_NOTIFICATION:
{
player->m_State = (PLAYSTATE)wParam;
if (player->m_State == PLAYER_STOPPED)
player->m_State = (StateType)wParam;
if (player->m_State == STATE_STOPPED)
{
player->ClearData();
}
@ -363,9 +363,9 @@ LRESULT CALLBACK CPlayerCAD::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
{
player->m_Initialized = true;
player->m_ExtendedAPI = (classSz && wcscmp(classSz, L"CD Art Display IPC Class") == 0);
player->m_State = (PLAYSTATE)SendMessage(player->m_PlayerWindow, WM_USER, 0, IPC_GET_STATE);
player->m_State = (StateType)SendMessage(player->m_PlayerWindow, WM_USER, 0, IPC_GET_STATE);
if (player->m_State != PLAYER_STOPPED)
if (player->m_State != STATE_STOPPED)
{
PostMessage(player->m_PlayerWindow, WM_USER, 0, IPC_GET_CURRENT_TRACK);
}
@ -388,7 +388,7 @@ LRESULT CALLBACK CPlayerCAD::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
*/
void CPlayerCAD::UpdateData()
{
if (m_State != PLAYER_STOPPED)
if (m_State != STATE_STOPPED)
{
m_Position = SendMessage(m_PlayerWindow, WM_USER, 0, IPC_GET_POSITION);
m_Volume = SendMessage(m_PlayerWindow, WM_USER, 0, IPC_GET_VOLUME);

View File

@ -155,8 +155,8 @@ LRESULT CALLBACK CPlayerFoobar::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
case FOO_STATECHANGE:
{
PLAYSTATE ps = (PLAYSTATE)wParam;
if (ps == PLAYER_STOPPED)
StateType ps = (StateType)wParam;
if (ps == STATE_STOPPED)
{
player->ClearData();
}
@ -199,9 +199,9 @@ LRESULT CALLBACK CPlayerFoobar::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
if (cds->dwData == FOO_TRACKCHANGE)
{
if (player->m_State != PLAYER_PLAYING)
if (player->m_State != STATE_PLAYING)
{
player->m_State = PLAYER_PLAYING;
player->m_State = STATE_PLAYING;
}
// In the format "TITLE ARTIST ALBUM LENGTH RATING" (seperated by \t)
@ -331,7 +331,7 @@ void CPlayerFoobar::Pause()
*/
void CPlayerFoobar::Play()
{
SendMessage(m_FooWindow, WM_USER, 0, (m_State == PLAYER_PAUSED) ? FOO_PLAYPAUSE : FOO_PLAY);
SendMessage(m_FooWindow, WM_USER, 0, (m_State == STATE_PAUSED) ? FOO_PLAYPAUSE : FOO_PLAY);
}
/*

View File

@ -224,13 +224,13 @@ void CPlayerITunes::Initialize()
if (position != 0)
{
m_State = PLAYER_PAUSED;
m_State = STATE_PAUSED;
OnTrackChange();
}
}
else if (state == ITPlayerStatePlaying)
{
m_State = PLAYER_PLAYING;
m_State = STATE_PLAYING;
OnTrackChange();
}
}
@ -337,7 +337,7 @@ bool CPlayerITunes::CheckWindow()
*/
void CPlayerITunes::UpdateData()
{
if ((m_Initialized || CheckWindow()) && m_State != PLAYER_STOPPED)
if ((m_Initialized || CheckWindow()) && m_State != STATE_STOPPED)
{
long position;
m_iTunes->get_PlayerPosition(&position);
@ -487,12 +487,12 @@ void CPlayerITunes::OnStateChange(bool playing)
{
if (playing)
{
m_State = PLAYER_PLAYING;
m_State = STATE_PLAYING;
}
else
{
// Guess if paused or stopped from track time
m_State = (m_Position == 0) ? PLAYER_STOPPED : PLAYER_PAUSED;
m_State = (m_Position == 0) ? STATE_STOPPED : STATE_PAUSED;
}
}

View File

@ -110,7 +110,7 @@ void CPlayerSpotify::UpdateData()
if (track != m_Title || artist != m_Artist)
{
m_State = PLAYER_PLAYING;
m_State = STATE_PLAYING;
m_Title = track;
m_Artist = artist;
++m_TrackCount;
@ -125,7 +125,7 @@ void CPlayerSpotify::UpdateData()
}
else if (IsWindow(m_Window))
{
m_State = PLAYER_PAUSED;
m_State = STATE_PAUSED;
}
else
{

View File

@ -117,7 +117,7 @@ LRESULT CALLBACK CPlayerWLM::WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
if (playing)
{
++player->m_TrackCount;
player->m_State = PLAYER_PLAYING;
player->m_State = STATE_PLAYING;
data.erase(0, 3); // Get rid of the status
// TODO: Handle invalid

View File

@ -116,15 +116,15 @@ void CPlayerWMP::CRemoteHost::PlayStateChange(long NewState)
break;
case wmppsPaused:
m_Player->m_State = PLAYER_PAUSED;
m_Player->m_State = STATE_PAUSED;
break;
case wmppsPlaying:
if (m_Player->m_State == PLAYER_STOPPED)
if (m_Player->m_State == STATE_STOPPED)
{
m_Player->m_TrackChanged = true;
}
m_Player->m_State = PLAYER_PLAYING;
m_Player->m_State = STATE_PLAYING;
break;
default:
@ -329,14 +329,14 @@ void CPlayerWMP::Initialize()
m_IPlayer->get_playState(&state);
if (state == wmppsPlaying)
{
m_State = PLAYER_PLAYING;
m_State = STATE_PLAYING;
}
else if (state == wmppsPaused)
{
m_State = PLAYER_PAUSED;
m_State = STATE_PAUSED;
}
if (m_State != PLAYER_STOPPED)
if (m_State != STATE_STOPPED)
{
m_TrackChanged = true;
}
@ -380,7 +380,7 @@ void CPlayerWMP::UpdateData()
m_ISettings->get_volume(&volume);
m_Volume = (UINT)volume;
if (m_State != PLAYER_STOPPED)
if (m_State != STATE_STOPPED)
{
double position;
m_IControls->get_currentPosition(&position);
@ -520,7 +520,7 @@ void CPlayerWMP::Stop()
{
m_IControls->stop();
// TODO: FIXME
m_State = PLAYER_STOPPED;
m_State = STATE_STOPPED;
}
/*
@ -564,7 +564,7 @@ void CPlayerWMP::SetPosition(int position)
*/
void CPlayerWMP::SetRating(int rating)
{
if (m_State != PLAYER_STOPPED)
if (m_State != STATE_STOPPED)
{
CComPtr<IWMPMedia> spMedia;
m_IPlayer->get_currentMedia(&spMedia);

View File

@ -125,7 +125,7 @@ void CPlayerWinamp::UpdateData()
if (m_WinampHandle) CloseHandle(m_WinampHandle);
}
if (m_State != PLAYER_STOPPED)
if (m_State != STATE_STOPPED)
{
ClearData();
}
@ -135,7 +135,7 @@ void CPlayerWinamp::UpdateData()
}
else
{
m_State = (playing == 1) ? PLAYER_PLAYING : PLAYER_PAUSED;
m_State = (playing == 1) ? STATE_PLAYING : STATE_PAUSED;
m_Position = SendMessage(m_Window, WM_WA_IPC, 0, IPC_GETOUTPUTTIME) / 1000; // ms to secs
m_Volume = (SendMessage(m_Window, WM_WA_IPC, -666, IPC_SETVOLUME) * 100) / 255; // 0 - 255 to 0 - 100
}

View File

@ -1,10 +1,5 @@
// Microsoft Developer Studio generated resource script.
//
#include <windows.h>
#include "../../Version.h"
#define APSTUDIO_READONLY_SYMBOLS
#include "windows.h"
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
@ -20,7 +15,7 @@ VS_VERSION_INFO VERSIONINFO
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT_UNKNOWN
BEGIN
@ -28,10 +23,8 @@ BEGIN
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "FileDescription", "NowPlaying Plugin for Rainmeter"
VALUE "FileVersion", "1.1.3.7"
VALUE "InternalName", "NowPlaying"
VALUE "LegalCopyright", "Copyright (C) 2011 - Birunthan Mohanathas"
VALUE "LegalCopyright", "<22> 2011 - Birunthan Mohanathas"
VALUE "OriginalFilename", "NowPlaying.dll"
VALUE "ProductName", "Rainmeter"
#ifdef _WIN64

View File

@ -68,10 +68,10 @@
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)TestBench\x32\$(Configuration)\Plugins\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\x32\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)TestBench\x64\$(Configuration)\Plugins\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\x64\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)TestBench\x32\$(Configuration)\Plugins\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\x32\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>