From 45007fc8d8d7149e8968668b93b041fc5eb4f656 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Fri, 29 Jul 2011 10:42:10 +0000 Subject: [PATCH] NowPlayingPlugin: - Fixed that the OpenPlayer bang didn't work correctly since r848 - Fixed that the "SetPosition +n" bang didn't work correctly --- Plugins/PluginNowPlaying/NowPlaying.cpp | 21 +++++++++----------- Plugins/PluginNowPlaying/PluginNowPlaying.rc | 4 ++-- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Plugins/PluginNowPlaying/NowPlaying.cpp b/Plugins/PluginNowPlaying/NowPlaying.cpp index 7d15f5ad..1417d209 100644 --- a/Plugins/PluginNowPlaying/NowPlaying.cpp +++ b/Plugins/PluginNowPlaying/NowPlaying.cpp @@ -447,14 +447,7 @@ void ExecuteBang(LPCTSTR bang, UINT id) ParentMeasure* parent = child->parent; CPlayer* player = parent->player; - if (!player->IsInitialized()) - { - if (_wcsicmp(bang, L"OpenPlayer") == 0 || _wcsicmp(bang, L"TogglePlayer") == 0) - { - player->OpenPlayer(parent->playerPath); - } - } - else if (_wcsicmp(bang, L"Pause") == 0) + if (_wcsicmp(bang, L"Pause") == 0) { player->Pause(); } @@ -474,14 +467,18 @@ void ExecuteBang(LPCTSTR bang, UINT id) { player->Next(); } - else if (_wcsicmp(bang, L"Previous") == 0) + else if (_wcsicmp(bang, L"OpenPlayer") == 0) { - player->Previous(); + player->OpenPlayer(parent->playerPath); } - else if (_wcsicmp(bang, L"ClosePlayer") == 0 || _wcsicmp(bang, L"TogglePlayer") == 0) + else if (_wcsicmp(bang, L"ClosePlayer") == 0) { player->ClosePlayer(); } + else if (_wcsicmp(bang, L"TogglePlayer") == 0) + { + player->IsInitialized() ? player->ClosePlayer() : player->OpenPlayer(parent->playerPath); + } else { LPCTSTR arg = wcschr(bang, L' '); @@ -492,7 +489,7 @@ void ExecuteBang(LPCTSTR bang, UINT id) if (wcsnicmp(bang, L"SetPosition", 11) == 0) { - int position = (_wtoi(arg) * player->GetDuration()) / 100; + int position = (_wtoi(arg) * (int)player->GetDuration()) / 100; if (arg[0] == L'+' || arg[0] == L'-') { position += player->GetPosition(); diff --git a/Plugins/PluginNowPlaying/PluginNowPlaying.rc b/Plugins/PluginNowPlaying/PluginNowPlaying.rc index 7b6b2191..54672d55 100644 --- a/Plugins/PluginNowPlaying/PluginNowPlaying.rc +++ b/Plugins/PluginNowPlaying/PluginNowPlaying.rc @@ -12,7 +12,7 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,1,3,2 + FILEVERSION 1,1,3,3 PRODUCTVERSION PRODUCTVER FILEFLAGSMASK 0x17L #ifdef _DEBUG @@ -29,7 +29,7 @@ BEGIN BLOCK "040904E4" BEGIN VALUE "FileDescription", "NowPlaying Plugin for Rainmeter" - VALUE "FileVersion", "1.1.3.2" + VALUE "FileVersion", "1.1.3.3" VALUE "InternalName", "NowPlaying" VALUE "LegalCopyright", "Copyright (C) 2011 - Birunthan Mohanathas" VALUE "OriginalFilename", "NowPlaying.dll"