NowPlayingPlugin: Added support for MusicBee, fixed Debug build, and updated Winamp SDK.

This commit is contained in:
Birunthan Mohanathas 2011-05-24 18:20:35 +00:00
parent 31e3091e34
commit 2ba2e95736
15 changed files with 1896 additions and 406 deletions

View File

@ -77,6 +77,7 @@
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Rainmeter</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Rainmeter</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Rainmeter</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Rainmeter</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

View File

@ -20,6 +20,7 @@
#include "../../Library/DisableThreadLibraryCalls.h" // contains DllMain entry point
#include "NowPlaying.h"
#include "PlayerAIMP.h"
#include "PlayerCAD.h"
#include "PlayerFoobar.h"
#include "PlayerITunes.h"
#include "PlayerSpotify.h"
@ -27,6 +28,7 @@
#include "PlayerWMP.h"
CPlayer* g_AIMP = NULL;
CPlayer* g_CAD = NULL;
CPlayer* g_Foobar = NULL;
CPlayer* g_iTunes = NULL;
CPlayer* g_Spotify = NULL;
@ -122,6 +124,14 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
}
data->player = g_AIMP;
}
else if (_wcsicmp(L"MusicBee", str) == 0)
{
if (!g_CAD)
{
g_CAD = new CPlayerCAD;
}
data->player = g_CAD;
}
else if (_wcsicmp(L"iTunes", str) == 0)
{
if (!g_iTunes)

View File

@ -18,6 +18,8 @@
#include "StdAfx.h"
#include "PlayerAIMP.h"
#include "AIMP/aimp2_sdk.h"
#include "Winamp/wa_ipc.h"
extern CPlayer* g_AIMP;
@ -347,7 +349,7 @@ void CPlayerAIMP::SetRating(int rating)
}
/*
** Previous
** SetVolume
**
** Handles the SetVolume bang.
**
@ -366,7 +368,7 @@ void CPlayerAIMP::SetVolume(int volume)
void CPlayerAIMP::ChangeVolume(int volume)
{
volume += m_Volume;
SendMessage(m_Window, WM_AIMP_COMMAND, WM_AIMP_STATUS_SET, MAKELPARAM(volume, AIMP_STS_VOLUME));
SetVolume(volume);
}
/*

View File

@ -19,12 +19,8 @@
#ifndef __PLAYERAIMP_H__
#define __PLAYERAIMP_H__
#include <windows.h>
#include "Player.h"
#include "AIMP/aimp2_sdk.h"
#include "Winamp/wa_ipc.h"
class CPlayerAIMP : public CPlayer
{
public:

View File

@ -0,0 +1,434 @@
/*
Copyright (C) 2011 Birunthan Mohanathas (www.poiru.net)
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "StdAfx.h"
#include "PlayerCAD.h"
// This player emulates the CD Art Display IPC API. For now, only MusicBee
// is supported, but this can easily be extended.
extern CPlayer* g_CAD;
/*
** CPlayerCAD
**
** Constructor.
**
*/
CPlayerCAD::CPlayerCAD() : CPlayer(),
m_HasCoverMeasure(false),
m_Window(),
m_PlayerWindow()
{
Initialize();
}
/*
** ~CPlayerCAD
**
** Constructor.
**
*/
CPlayerCAD::~CPlayerCAD()
{
Uninitialize();
}
/*
** AddInstance
**
** Called during initialization of each measure.
**
*/
void CPlayerCAD::AddInstance(MEASURETYPE type)
{
++m_InstanceCount;
if (type == MEASURE_COVER)
{
m_HasCoverMeasure = true;
}
}
/*
** RemoveInstance
**
** Called during destruction of each measure.
**
*/
void CPlayerCAD::RemoveInstance()
{
if (--m_InstanceCount == 0)
{
g_CAD = NULL;
delete this;
}
}
/*
** Initialize
**
** Create receiver window.
**
*/
void CPlayerCAD::Initialize()
{
HINSTANCE hInstance = GetModuleHandle(NULL);
// Create windows class
WNDCLASS wc = {0};
wc.hInstance = hInstance;
wc.lpfnWndProc = WndProc;
wc.lpszClassName = L"NowPlayingCADClass";
RegisterClass(&wc);
// Create dummy window
m_Window = CreateWindow(L"NowPlayingCADClass",
L"CD Art Display 1.x Class",
WS_DISABLED,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
this);
HWND wnd = FindWindow(L"WindowsForms10.Window.8.app.0.378734a", NULL);
if (wnd)
{
// Let's check if it's MusicBee
WCHAR buffer[256];
GetWindowText(wnd, buffer, 256);
if (wcsstr(buffer, L"MusicBee"))
{
m_PlayerWindow = wnd;
SendMessage(m_PlayerWindow, WM_USER, (WPARAM)m_Window, IPC_SET_CALLBACK_HWND);
SendMessage(m_PlayerWindow, WM_USER, 0, IPC_GET_CURRENT_TRACK);
}
else
{
LSLog(LOG_DEBUG, L"Rainmeter", L"NowPlayingPlugin: MusicBee class found with invalid title.");
}
}
}
/*
** Uninitialize
**
** Destroy reciever window.
**
*/
void CPlayerCAD::Uninitialize()
{
DestroyWindow(m_Window);
UnregisterClass(L"NowPlayingCADClass", GetModuleHandle(NULL));
}
/*
** WndProc
**
** Window procedure for the reciever window.
**
*/
LRESULT CALLBACK CPlayerCAD::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static CPlayerCAD* p;
switch (msg)
{
case WM_CREATE:
// Get pointer to the CPlayerCAD class from the CreateWindow call
p = (CPlayerCAD*)((CREATESTRUCT*)lParam)->lpCreateParams;
return 0;
case WM_DESTROY:
SendMessage(p->m_PlayerWindow, WM_USER, 0, IPC_SHUTDOWN_NOTIFICATION);
return 0;
case WM_USER:
switch (lParam)
{
case IPC_TRACK_CHANGED_NOTIFICATION:
SendMessage(p->m_PlayerWindow, WM_USER, 0, IPC_GET_CURRENT_TRACK);
break;
case IPC_PLAYER_STATE_CHANGED_NOTIFICATION:
p->m_State = (PLAYERSTATE)wParam;
if (p->m_State == PLAYER_STOPPED)
{
p->ClearInfo();
}
break;
case IPC_SHUTDOWN_NOTIFICATION:
p->m_PlayerWindow = NULL;
break;
}
return 0;
case WM_COPYDATA:
{
PCOPYDATASTRUCT cds = (PCOPYDATASTRUCT)lParam;
if (cds->dwData == IPC_CURRENT_TRACK_INFO)
{
p->m_TrackChanged = true;
std::wstring data = (WCHAR*)cds->lpData;
std::wstring::size_type len = data.find_first_of(L'\t');
p->m_Title.assign(data, 0, len);
data.erase(0, ++len);
len = data.find_first_of(L'\t');
p->m_Artist.assign(data, 0, len);
data.erase(0, ++len);
len = data.find_first_of(L'\t');
p->m_Album.assign(data, 0, len);
data.erase(0, ++len);
len = data.find_first_of(L'\t'); // Skip genre
len = data.find_first_of(L'\t', ++len); // Skip year
len = data.find_first_of(L'\t', ++len); // Skip comments
len = data.find_first_of(L'\t', ++len); // Skip track no
data.erase(0, ++len);
len = data.find_first_of(L'\t');
p->m_Duration = _wtoi(data.substr(0, len).c_str());
data.erase(0, ++len);
len = data.find_first_of(L'\t');
p->m_FilePath.assign(data, 0, len);
data.erase(0, ++len);
len = data.find_first_of(L'\t');
UINT rating = _wtoi(data.substr(0, len).c_str()) + 1;
rating /= 2; // From 0 - 10 to 0 - 5
p->m_Rating = rating;
data.erase(0, ++len);
len = data.find_first_of(L'\t');
p->m_CoverPath.assign(data, 0, len);
data.erase(0, ++len);
}
else if (cds->dwData == IPC_REGISTER_PLAYER && !p->m_PlayerWindow)
{
std::wstring data = (WCHAR*)cds->lpData;
if (data[0] == L'1')
{
data.erase(0, 2); // Get rid of the 1\t at the beginning
std::wstring::size_type len = data.find_first_of(L'\t');
std::wstring className = data.substr(0, len);
data.erase(0, ++len);
len = data.find_first_of(L'\t');
std::wstring windowName = data.substr(0, len);
data.erase(0, ++len);
len = data.find_first_of(L'\t');
p->m_PlayerPath.assign(data, 0, len);
data.erase(0, ++len);
p->m_PlayerWindow = FindWindow(className.empty() ? NULL : className.c_str(),
windowName.empty() ? NULL : windowName.c_str());
}
}
}
return 0;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
}
/*
** UpdateData
**
** Called during each update of the main measure.
**
*/
void CPlayerCAD::UpdateData()
{
if (m_PlayerWindow)
{
m_Position = SendMessage(m_PlayerWindow, WM_USER, 0, IPC_GET_POSITION);
m_Volume = SendMessage(m_PlayerWindow, WM_USER, 0, IPC_GET_VOLUME);
if (m_TrackChanged)
{
ExecuteTrackChangeAction();
m_TrackChanged = false;
}
}
}
/*
** Play
**
** Handles the Play bang.
**
*/
void CPlayerCAD::Play()
{
if (m_PlayerWindow)
{
SendMessage(m_PlayerWindow, WM_USER, 0, IPC_PLAY);
}
}
/*
** PlayPause
**
** Handles the PlayPause bang.
**
*/
void CPlayerCAD::PlayPause()
{
if (m_PlayerWindow)
{
SendMessage(m_PlayerWindow, WM_USER, 0, IPC_PLAYPAUSE);
}
}
/*
** Stop
**
** Handles the Stop bang.
**
*/
void CPlayerCAD::Stop()
{
if (m_PlayerWindow)
{
SendMessage(m_PlayerWindow, WM_USER, 0, IPC_STOP);
}
}
/*
** Next
**
** Handles the Next bang.
**
*/
void CPlayerCAD::Next()
{
if (m_PlayerWindow)
{
SendMessage(m_PlayerWindow, WM_USER, 0, IPC_NEXT);
}
}
/*
** Previous
**
** Handles the Previous bang.
**
*/
void CPlayerCAD::Previous()
{
if (m_PlayerWindow)
{
SendMessage(m_PlayerWindow, WM_USER, 0, IPC_PREVIOUS);
}
}
/*
** SetRating
**
** Handles the SetVolume bang.
**
*/
void CPlayerCAD::SetRating(int rating)
{
if (m_PlayerWindow)
{
m_Rating = rating;
rating *= 2; // From 0 - 5 to 0 - 10
SendMessage(m_PlayerWindow, WM_USER, rating, IPC_RATING_CHANGED_NOTIFICATION);
}
}
/*
** SetVolume
**
** Handles the SetVolume bang.
**
*/
void CPlayerCAD::SetVolume(int volume)
{
if (m_PlayerWindow)
{
volume += m_Volume;
if (volume < 0)
{
volume = 0;
}
else if (volume > 100)
{
volume = 100;
}
SendMessage(m_PlayerWindow, WM_USER, volume, IPC_SET_VOLUME);
}
}
/*
** ChangeVolume
**
** Handles the ChangeVolume bang.
**
*/
void CPlayerCAD::ChangeVolume(int volume)
{
volume += m_Volume;
SetVolume(volume);
}
/*
** ClosePlayer
**
** Handles the ClosePlayer bang.
**
*/
void CPlayerCAD::ClosePlayer()
{
SendMessage(m_PlayerWindow, WM_USER, 0, IPC_CLOSE_PLAYER);
}
/*
** OpenPlayer
**
** Handles the OpenPlayer bang.
**
*/
void CPlayerCAD::OpenPlayer()
{
}
/*
** TogglePlayer
**
** Handles the TogglePlayer bang.
**
*/
void CPlayerCAD::TogglePlayer()
{
m_PlayerWindow ? ClosePlayer() : OpenPlayer();
}

View File

@ -0,0 +1,99 @@
/*
Copyright (C) 2011 Birunthan Mohanathas (www.poiru.net)
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PLAYERIPC_H__
#define __PLAYERIPC_H__
#include "Player.h"
class CPlayerCAD : public CPlayer
{
public:
CPlayerCAD();
~CPlayerCAD();
virtual void Play();
virtual void PlayPause();
virtual void Stop();
virtual void Next();
virtual void Previous();
virtual void SetRating(int rating);
virtual void SetVolume(int volume);
virtual void ChangeVolume(int volume);
virtual void ClosePlayer();
virtual void OpenPlayer();
virtual void TogglePlayer();
virtual void AddInstance(MEASURETYPE type);
virtual void RemoveInstance();
virtual void UpdateData();
private:
enum IPCMESSAGE
{
IPC_PLAY = 100,
IPC_PLAYPAUSE,
IPC_FORCEPAUSE,
IPC_STOP,
IPC_NEXT,
IPC_PREVIOUS,
IPC_SET_VOLUME = 108,
IPC_GET_VOLUME,
IPC_GET_CURRENT_TRACK,
IPC_GET_DURATION = 113,
IPC_SET_POSITION,
IPC_IS_PLAYING,
IPC_IS_PAUSED,
IPC_GET_LIST_LENGTH,
IPC_SET_LIST_POS,
IPC_GET_LIST_ITEM,
IPC_SET_CALLBACK_HWND, // Recieved by player. wParam is handle to CAD window.
IPC_GET_LIST_POS,
IPC_GET_POSITION,
IPC_TRACK_CHANGED_NOTIFICATION, // Sent by player.
IPC_SHOW_PLAYER_WINDOW,
IPC_GET_PLAYER_STATE,
IPC_PLAYER_STATE_CHANGED_NOTIFICATION, // Sent by player.
IPC_AUTOENQUEUE_OPTIONS, // Ignored.
IPC_SET_REPEAT,
IPC_SHUTDOWN_NOTIFICATION, // Sent by/to player on exit. Player should NULL the CAD window handle.
IPC_GET_REPEAT,
IPC_CLOSE_PLAYER, // Player should exit upon receival.
IPC_GET_SHUFFLE = 140,
IPC_SET_SHUFFLE,
IPC_RATING_CHANGED_NOTIFICATION = 639, // Sent by/to player.
IPC_REGISTER_PLAYER = 700, // Sent by player to CAD on startup.
IPC_CURRENT_TRACK_INFO,
IPC_SEND_LYRICS,
IPC_SEND_NEW_LYRICS,
IPC_NEW_COVER_NOTIFICATION = 800, // Sent by player (ignored).
IPC_GET_CURRENT_LYRICS,
IPC_ADDFILE_PLAY_PLAYLIST,
IPC_ADDFILE_QUEUE_PLAYLIST
};
void Initialize();
void Uninitialize();
static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
bool m_HasCoverMeasure;
HWND m_Window; // Our reciever window
HWND m_PlayerWindow; // CAD receiver window
};
#endif

View File

@ -320,9 +320,9 @@ void CPlayerFoobar::UpdateData()
}
/*
** PlayPause
** Play
**
** Handles the PlayPause bang.
** Handles the Play bang.
**
*/
void CPlayerFoobar::Play()
@ -397,11 +397,8 @@ void CPlayerFoobar::Previous()
*/
void CPlayerFoobar::ChangeVolume(int volume)
{
if (m_FooWindow)
{
volume += m_Volume;
SendMessage(m_FooWindow, WM_USER, volume, FOO_SETVOLUME);
}
volume += m_Volume;
SetVolume(volume);
}
/*

View File

@ -554,12 +554,8 @@ void CPlayerITunes::SetVolume(int volume)
*/
void CPlayerITunes::ChangeVolume(int volume)
{
if (m_Initialized)
{
int newVolume = m_Volume;
newVolume += volume;
m_iTunes->put_SoundVolume(newVolume);
}
volume += m_Volume;
SetVolume(volume);
}
/*

View File

@ -672,19 +672,15 @@ void CPlayerWMP::SetVolume(int volume)
}
/*
** ClosePlayer
** ChangeVolume
**
** Handles the ClosePlayer bang.
** Handles the ChangeVolume bang.
**
*/
void CPlayerWMP::ChangeVolume(int volume)
{
if (m_IPlayer)
{
int newVolume = m_Volume;
newVolume += volume;
m_ISettings->put_volume(newVolume);
}
volume += m_Volume;
SetVolume(volume);
}
/*

View File

@ -18,6 +18,8 @@
#include "StdAfx.h"
#include "PlayerWinamp.h"
#include "Winamp/wa_ipc.h"
#include "Winamp/wa_cmd.h"
extern CPlayer* g_Winamp;
@ -197,8 +199,7 @@ void CPlayerWinamp::UpdateData()
else
{
// TagLib couldn't parse the file, try title instead
int pos = SendMessage(m_Window, WM_WA_IPC, 0, IPC_GETLISTPOS);
LPCVOID address = (LPCVOID)SendMessage(m_Window, WM_WA_IPC, pos, IPC_GETPLAYLISTTITLEW);
LPCVOID address = (LPCVOID)SendMessage(m_Window, WM_WA_IPC, 0, IPC_GET_PLAYING_TITLE);
if (ReadProcessMemory(m_WinampHandle, address, &buffer, MAX_PATH, NULL))
{
std::wstring title = buffer;

View File

@ -20,10 +20,6 @@
#define __PLAYERWINAMP_H__
#include "Player.h"
#include "Winamp/wa_cmd.h"
#include "Winamp/wa_dlg.h"
#include "Winamp/wa_hotkeys.h"
#include "Winamp/wa_ipc.h"
class CPlayerWinamp : public CPlayer
{

View File

@ -95,7 +95,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;PluginNowPlaying_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;PluginNowPlaying_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
@ -108,6 +108,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4018;4090;4114;4351;4786;4800;4996</DisableSpecificWarnings>
<AdditionalIncludeDirectories>.\sha2;.\taglib;.\taglib\toolkit;.\taglib\mpeg\id3v2\frames;.\taglib\ogg;.\taglib\asf;.\taglib\mp4;.\taglib\ogg\vorbis;.\taglib\ogg\flac;.\taglib\ogg\speex;.\taglib\riff;.\taglib\riff\wav;.\taglib\riff\aiff;.\taglib\flac;.\taglib\mpeg;.\taglib\mpeg\id3v1;.\taglib\mpeg\id3v2;.\taglib\mpc;.\taglib\ape;.\taglib\trueaudio;.\taglib\wavpack;.\SDKs\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -135,7 +136,7 @@
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NowPlaying_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;NowPlaying_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
@ -148,6 +149,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4018;4090;4114;4351;4786;4800;4996</DisableSpecificWarnings>
<AdditionalIncludeDirectories>.\sha2;.\taglib;.\taglib\toolkit;.\taglib\mpeg\id3v2\frames;.\taglib\ogg;.\taglib\asf;.\taglib\mp4;.\taglib\ogg\vorbis;.\taglib\ogg\flac;.\taglib\ogg\speex;.\taglib\riff;.\taglib\riff\wav;.\taglib\riff\aiff;.\taglib\flac;.\taglib\mpeg;.\taglib\mpeg\id3v1;.\taglib\mpeg\id3v2;.\taglib\mpc;.\taglib\ape;.\taglib\trueaudio;.\taglib\wavpack;.\SDKs\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -175,7 +177,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;TAGLIB_WITH_MP4;WITH_MP4;TAGLIB_WITH_ASF;WITH_ASF;PluginNowPlaying_EXPORTS;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;PluginNowPlaying_EXPORTS;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
@ -256,6 +258,7 @@
<ClCompile Include="NowPlaying.cpp" />
<ClCompile Include="Player.cpp" />
<ClCompile Include="PlayerAIMP.cpp" />
<ClCompile Include="PlayerCAD.cpp" />
<ClCompile Include="PlayerFoobar.cpp" />
<ClCompile Include="PlayerITunes.cpp" />
<ClCompile Include="PlayerSpotify.cpp" />
@ -343,6 +346,7 @@
<ClInclude Include="NowPlaying.h" />
<ClInclude Include="Player.h" />
<ClInclude Include="PlayerAIMP.h" />
<ClInclude Include="PlayerCAD.h" />
<ClInclude Include="PlayerFoobar.h" />
<ClInclude Include="PlayerITunes.h" />
<ClInclude Include="PlayerSpotify.h" />

View File

@ -257,6 +257,9 @@
<ClCompile Include="taglib\mpc\mpcfile.cpp">
<Filter>taglib</Filter>
</ClCompile>
<ClCompile Include="PlayerCAD.cpp">
<Filter>Players</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="SDKs\AIMP\aimp2_sdk.h">
@ -306,6 +309,9 @@
<ClInclude Include="sha2\sha2.h">
<Filter>sha2</Filter>
</ClInclude>
<ClInclude Include="PlayerCAD.h">
<Filter>Players</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="PluginNowPlaying.rc" />

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2003 Nullsoft, Inc.
** Copyright (C) 2003-2008 Nullsoft, Inc.
**
** This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held
** liable for any damages arising from the use of this software.
@ -20,10 +20,10 @@
#define _WA_DLG_H_
#include "wa_ipc.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
dont know where to put this yet :)
1) gen.bmp has a generic window frame for plugins to use.
its format is similar to the minibrowser's.
In addition gen.bmp includes a font for the titlebar, in both
@ -44,7 +44,7 @@
x=54: button text color
x=56: window text color
x=58: color of dividers and sunken borders
x=60: selection color for listviews/playlists/etc
x=60: selection color for playlists
x=62: listview header background color
x=64: listview header text color
x=66: listview header frame top color
@ -56,9 +56,14 @@
x=78: inverse scrollbar foreground color
x=80: inverse scrollbar background color
x=82: scrollbar dead area color
x=84: listview/treeview selection bar text color (active)
x=86: listview/treeview selection bar back color (active)
x=88: listview/treeview selection bar text color (inactive)
x=90: listview/treeview selection bar back color (inactive)
x=92: alternate item background
x=94: alternate item foreground
*/
#define DCW_SUNKENBORDER 0x00010000
#define DCW_DIVIDER 0x00020000
@ -82,178 +87,263 @@ enum
WADLG_SCROLLBAR_INV_FGCOLOR,
WADLG_SCROLLBAR_INV_BGCOLOR,
WADLG_SCROLLBAR_DEADAREA_COLOR,
WADLG_SELBAR_FGCOLOR,
WADLG_SELBAR_BGCOLOR,
WADLG_INACT_SELBAR_FGCOLOR,
WADLG_INACT_SELBAR_BGCOLOR,
WADLG_ITEMBG2,
WADLG_ITEMFG2,
WADLG_NUM_COLORS
};
typedef enum _WACURSOR // used in IPC_GETSKINCURSORS
{
WACURSOR_VOLUME = 0, // volume & balane
WACURSOR_POSITION = 1, // position
WACURSOR_BTN_WINSHADE = 2, // winshade
WACURSOR_BTN_MINIMIZE = 3, // minimize
WACURSOR_BTN_CLOSE = 4, // close
WACURSOR_MENU = 5, // main menu
WACURSOR_TITLEBAR = 6, // title bar
WACURSOR_SONGNAME = 7,
WACURSOR_NORMAL = 8,
WACURSOR_WINSHADE_BTN_WINSHADE = 9,
WACURSOR_WINSHADE_BTN_MINIMIZE = 10,
WACURSOR_WINSHADE_POSITION = 11,
WACURSOR_WINSHADE_BTN_CLOSE = 12,
WACURSOR_WINSHADE_MENU = 13,
WACURSOR_WINSHADE_NORMAL = 14,
WACURSOR_PL_BTN_WINSHADE = 15,
WACURSOR_PL_BTN_CLOSE = 16,
WACURSOR_PL_TITLEBAR = 17,
WACURSOR_PL_VSCROLL = 18,
WACURSOR_PL_RESIZE = 19,
WACURSOR_PL_NORMAL = 20,
WACURSOR_PL_WINSHADE_BTN_WINSHADE = 21,
WACURSOR_PL_WINSHADE_BTN_CLOSE = 22,
WACURSOR_PL_WINSHADE_HSIZE = 23,
WACURSOR_PL_WINSHADE_NORMAL = 24,
WACURSOR_EQ_SLIDER = 25,
WACURSOR_EQ_BTN_CLOSE = 26,
WACURSOR_EQ_TITLEBAR = 27,
WACURSOR_EQ_NORMAL = 28,
} WACURSOR;
void WADlg_init(HWND hwndWinamp); // call this on init, or on WM_DISPLAYCHANGE
void WADlg_close();
int WADlg_getColor(int idx);
int WADlg_initted();
int WADlg_handleDialogMsgs(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); //
LRESULT WADlg_handleDialogMsgs(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); //
void WADlg_DrawChildWindowBorders(HWND hwndDlg, int *tab, int tabsize); // each entry in tab would be the id | DCW_*
HBITMAP WADlg_getBitmap();
/// define WA_DLG_IMPLEMENT in one of your source files before including this .h
// if you are making a media library plugin, you dont need to do this, look at view_ex for
// an example of how to get the function *'s via an IPC message.
#ifdef __cplusplus
}
#endif
#ifdef WA_DLG_IMPLEMENT
static HBRUSH wadlg_lastbrush;
static HBITMAP wadlg_bitmap; // load this manually
static HBRUSH wadlg_lastbrush=0;
static HBITMAP wadlg_bitmap=0; // load this manually
static int wadlg_colors[WADLG_NUM_COLORS];
static int wadlg_defcolors[WADLG_NUM_COLORS]=
{
RGB(0,0,0),
RGB(0,255,0),
RGB(36,36,60),
RGB(57,56,66),
RGB(255,255,255),
RGB(132,148,165),
RGB(0,0,198),
RGB(36*2,36*2,60*2),
RGB(255,255,255),
RGB(36*3,36*3,60*3),
RGB(36,36,60),
RGB(36*0.5,36*0.5,60*0.5),
RGB(36,36,60),
RGB(36*1,36*1,60*1),
RGB(36*1,36*1,60*1),
RGB(121,130,150),
RGB(78,88,110),
RGB(36*1,36*1,60*1),
RGB(0,0,0),
RGB(0,255,0),
RGB(36,36,60),
RGB(57,56,66),
RGB(255,255,255),
RGB(132,148,165),
RGB(0,0,198),
RGB(36*2,36*2,60*2),
RGB(255,255,255),
RGB(36*3,36*3,60*3),
RGB(36,36,60),
RGB(36*0.5,36*0.5,60*0.5),
RGB(36,36,60),
RGB(36*1,36*1,60*1),
RGB(36*1,36*1,60*1),
RGB(121,130,150),
RGB(78,88,110),
RGB(36*1,36*1,60*1),
RGB(255,255,255),
RGB(0,0,180),
RGB(0,255,0),
RGB(0,0,128),
RGB(0,0,0),
RGB(0,255,0),
};
int WADlg_initted()
{
return !!wadlg_bitmap;
}
int WADlg_getColor(int idx)
{
if (idx < 0 || idx >= WADLG_NUM_COLORS) return 0;
return wadlg_colors[idx];
if (idx < 0 || idx >= WADLG_NUM_COLORS) return 0;
return wadlg_colors[idx];
}
HBITMAP WADlg_getBitmap()
{
return wadlg_bitmap;
return wadlg_bitmap;
}
void WADlg_init(HWND hwndWinamp) // call this on init, or on WM_DISPLAYCHANGE
{
if (wadlg_bitmap) DeleteObject(wadlg_bitmap);
wadlg_bitmap = (HBITMAP) SendMessage(hwndWinamp,WM_WA_IPC,0,IPC_GET_GENSKINBITMAP);
if (wadlg_bitmap)
{
HDC tmpDC=CreateCompatibleDC(NULL);
HGDIOBJ o=SelectObject(tmpDC,(HGDIOBJ)wadlg_bitmap);
int x;
for (x = 0; x < WADLG_NUM_COLORS; x ++)
{
int a=GetPixel(tmpDC,48+x*2,0);
if (a == CLR_INVALID || a == RGB(0,198,255)) a=wadlg_defcolors[x];
wadlg_colors[x]=a;
}
if (wadlg_bitmap) DeleteObject(wadlg_bitmap);
wadlg_bitmap = (HBITMAP) SendMessage(hwndWinamp,WM_WA_IPC,0,IPC_GET_GENSKINBITMAP);
if (wadlg_bitmap)
{
HDC tmpDC=CreateCompatibleDC(NULL);
HGDIOBJ o=SelectObject(tmpDC,(HGDIOBJ)wadlg_bitmap);
int defbgcol=GetPixel(tmpDC,111,0);
for (int x = 0; x < WADLG_NUM_COLORS; x ++)
{
int a=GetPixel(tmpDC,48+x*2,0);
if (a == CLR_INVALID || a == RGB(0,198,255) || a == defbgcol)
{
//defaults for old skins
if (x == WADLG_SELBAR_FGCOLOR || x == WADLG_INACT_SELBAR_FGCOLOR) a=wadlg_colors[WADLG_WNDFG];
else if (x == WADLG_SELBAR_BGCOLOR || x == WADLG_INACT_SELBAR_BGCOLOR)
{
a=wadlg_colors[WADLG_SELCOLOR];
if (x == WADLG_INACT_SELBAR_BGCOLOR)
a=((a/2)&0x7F7F7F)+(((wadlg_colors[WADLG_WNDBG])/2)&0x7F7F7F);
}
else if (x == WADLG_ITEMBG2)
{
a=wadlg_colors[WADLG_ITEMBG];
}
else if (x == WADLG_ITEMFG2)
{
a=wadlg_colors[WADLG_ITEMFG];
}
else a=wadlg_defcolors[x];
}
wadlg_colors[x]=a;
}
SelectObject(tmpDC,o);
DeleteDC(tmpDC);
}
SelectObject(tmpDC,o);
DeleteDC(tmpDC);
}
}
void WADlg_close()
{
if (wadlg_bitmap) DeleteObject(wadlg_bitmap);
wadlg_bitmap=0;
if (wadlg_lastbrush) DeleteObject(wadlg_lastbrush);
wadlg_lastbrush=0;
if (wadlg_bitmap) DeleteObject(wadlg_bitmap);
wadlg_bitmap=0;
if (wadlg_lastbrush) DeleteObject(wadlg_lastbrush);
wadlg_lastbrush=0;
}
void WADlg_dotLine(HDC hdc, int left, int top, int len, int vert)
{
for(int i=(top&1);i<len-1;i+=2)
{
if(vert) {
MoveToEx(hdc,left,top+i,NULL);
LineTo(hdc,left,top+i+1);
} else {
MoveToEx(hdc,left+i,top,NULL);
LineTo(hdc,left+i+1,top);
}
}
for(int i=(top&1);i<len-1;i+=2)
{
if(vert)
{
MoveToEx(hdc,left,top+i,NULL);
LineTo(hdc,left,top+i+1);
}
else
{
MoveToEx(hdc,left+i,top,NULL);
LineTo(hdc,left+i+1,top);
}
}
}
int WADlg_handleDialogMsgs(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT WADlg_handleDialogMsgs(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_DRAWITEM)
{
DRAWITEMSTRUCT *di = (DRAWITEMSTRUCT *)lParam;
if (di->CtlType == ODT_BUTTON) {
char wt[256];
wchar_t wt[256];
RECT r;
GetDlgItemText(hwndDlg,wParam,wt,sizeof(wt));
GetDlgItemTextW(hwndDlg,(INT)wParam,wt,sizeof(wt)/sizeof(*wt));
HDC hdc = CreateCompatibleDC(di->hDC);
SelectObject(hdc,wadlg_bitmap);
HDC hdc = CreateCompatibleDC(di->hDC);
HBITMAP hbmpOld = (HBITMAP)SelectObject(hdc, wadlg_bitmap);
r=di->rcItem;
SetStretchBltMode(di->hDC,COLORONCOLOR);
SetStretchBltMode(di->hDC,COLORONCOLOR);
int yoffs = (di->itemState & ODS_SELECTED) ? 15 : 0;
int yoffs = (di->itemState & ODS_SELECTED) ? 15 : 0;
BitBlt(di->hDC,r.left,r.top,4,4,hdc,0,yoffs,SRCCOPY); // top left
StretchBlt(di->hDC,r.left+4,r.top,r.right-r.left-4-4,4,hdc,4,yoffs,47-4-4,4,SRCCOPY); // top center
BitBlt(di->hDC,r.right-4,r.top,4,4,hdc,47-4,yoffs,SRCCOPY); // top right
BitBlt(di->hDC,r.left,r.top,4,4,hdc,0,yoffs,SRCCOPY); // top left
StretchBlt(di->hDC,r.left+4,r.top,r.right-r.left-4-4,4,hdc,4,yoffs,47-4-4,4,SRCCOPY); // top center
BitBlt(di->hDC,r.right-4,r.top,4,4,hdc,47-4,yoffs,SRCCOPY); // top right
StretchBlt(di->hDC,r.left,r.top+4,4,r.bottom-r.top-4-4,hdc,0,4+yoffs,4,15-4-4,SRCCOPY); // left edge
StretchBlt(di->hDC,r.right-4,r.top+4,4,r.bottom-r.top-4-4,hdc,47-4,4+yoffs,4,15-4-4,SRCCOPY); // right edge
StretchBlt(di->hDC,r.left,r.top+4,4,r.bottom-r.top-4-4,hdc,0,4+yoffs,4,15-4-4,SRCCOPY); // left edge
StretchBlt(di->hDC,r.right-4,r.top+4,4,r.bottom-r.top-4-4,hdc,47-4,4+yoffs,4,15-4-4,SRCCOPY); // right edge
// center
StretchBlt(di->hDC,r.left+4,r.top+4,r.right-r.left-4-4,r.bottom-r.top-4-4,hdc,4,4+yoffs,47-4-4,15-4-4,SRCCOPY);
BitBlt(di->hDC,r.left,r.bottom-4,4,4,hdc,0,15-4+yoffs,SRCCOPY); // bottom left
StretchBlt(di->hDC,r.left+4,r.bottom-4,r.right-r.left-4-4,4,hdc,4,15-4+yoffs,47-4-4,4,SRCCOPY); // bottom center
BitBlt(di->hDC,r.right-4,r.bottom-4,4,4,hdc,47-4,15-4+yoffs,SRCCOPY); // bottom right
// center
StretchBlt(di->hDC,r.left+4,r.top+4,r.right-r.left-4-4,r.bottom-r.top-4-4,hdc,4,4+yoffs,47-4-4,15-4-4,SRCCOPY);
BitBlt(di->hDC,r.left,r.bottom-4,4,4,hdc,0,15-4+yoffs,SRCCOPY); // bottom left
StretchBlt(di->hDC,r.left+4,r.bottom-4,r.right-r.left-4-4,4,hdc,4,15-4+yoffs,47-4-4,4,SRCCOPY); // bottom center
BitBlt(di->hDC,r.right-4,r.bottom-4,4,4,hdc,47-4,15-4+yoffs,SRCCOPY); // bottom right
// draw text
SetBkMode(di->hDC,TRANSPARENT);
SetTextColor(di->hDC,wadlg_colors[WADLG_BUTTONFG]);
if (di->itemState & ODS_SELECTED) {r.left+=2; r.top+=2;}
DrawText(di->hDC,wt,-1,&r,DT_VCENTER|DT_SINGLELINE|DT_CENTER);
DeleteDC(hdc);
SetBkMode(di->hDC,TRANSPARENT);
if(GetFocus()==di->hwndItem) {
HPEN pen=CreatePen(PS_SOLID,0,RGB(0,0,0));
SelectObject(di->hDC,pen);
WADlg_dotLine(di->hDC,r.left+2,r.top+2,r.right-r.left-3,0);
WADlg_dotLine(di->hDC,r.right-3,r.top+2,r.bottom-r.top-3,1);
WADlg_dotLine(di->hDC,r.left+2,r.top+2,r.bottom-r.top-3,1);
WADlg_dotLine(di->hDC,r.left+2,r.bottom-3,r.right-r.left-3,0);
DeleteObject(pen);
}
// this will do a different style for the button text depending on enabled state of the button
COLORREF colour = wadlg_colors[WADLG_BUTTONFG];
if(!IsWindowEnabled(di->hwndItem)){
COLORREF fg = wadlg_colors[WADLG_WNDFG],
bg = wadlg_colors[WADLG_WNDBG];
colour = RGB((GetRValue(fg)+GetRValue(bg))/2,
(GetGValue(fg)+GetGValue(bg))/2,
(GetBValue(fg)+GetBValue(bg))/2);
}
SetTextColor(di->hDC,colour);
if (di->itemState & ODS_SELECTED) {r.left+=2; r.top+=2;}
DrawTextW(di->hDC,wt,-1,&r,DT_VCENTER|DT_SINGLELINE|DT_CENTER);
SelectObject(hdc, hbmpOld);
DeleteDC(hdc);
if(GetFocus()==di->hwndItem) {
HPEN hpen, hpenOld;
hpen =CreatePen(PS_SOLID,0,RGB(0,0,0));
hpenOld = (HPEN)SelectObject(di->hDC, hpen);
WADlg_dotLine(di->hDC,r.left+2,r.top+2,r.right-r.left-3,0);
WADlg_dotLine(di->hDC,r.right-3,r.top+2,r.bottom-r.top-3,1);
WADlg_dotLine(di->hDC,r.left+2,r.top+2,r.bottom-r.top-3,1);
WADlg_dotLine(di->hDC,r.left+2,r.bottom-3,r.right-r.left-3,0);
SelectObject(di->hDC, hpenOld);
DeleteObject(hpen);
}
}
}
switch(uMsg)
{
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORDLG:
case WM_CTLCOLORBTN:
case WM_CTLCOLORSTATIC:
case WM_CTLCOLOREDIT:
{
int bgcolor=(uMsg == WM_CTLCOLOREDIT || uMsg == WM_CTLCOLORLISTBOX) ? wadlg_colors[WADLG_ITEMBG] : (uMsg == WM_CTLCOLORBTN ? wadlg_colors[WADLG_ITEMBG] : wadlg_colors[WADLG_WNDBG]);
LOGBRUSH lb={BS_SOLID,GetNearestColor((HDC)wParam,bgcolor)};
if (wadlg_lastbrush) DeleteObject(wadlg_lastbrush);
wadlg_lastbrush=CreateBrushIndirect(&lb);
SetTextColor((HDC)wParam,uMsg == WM_CTLCOLORSTATIC ? wadlg_colors[WADLG_WNDFG] : wadlg_colors[WADLG_ITEMFG]);
SetBkColor((HDC)wParam,lb.lbColor);
return (int)wadlg_lastbrush;
}
}
return 0;
switch(uMsg)
{
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORDLG:
case WM_CTLCOLORBTN:
case WM_CTLCOLORSTATIC:
case WM_CTLCOLOREDIT:
{
int bgcolor=(uMsg == WM_CTLCOLOREDIT || uMsg == WM_CTLCOLORLISTBOX) ? wadlg_colors[WADLG_ITEMBG] : (uMsg == WM_CTLCOLORBTN ? wadlg_colors[WADLG_ITEMBG] : wadlg_colors[WADLG_WNDBG]);
LOGBRUSH lb={BS_SOLID,GetNearestColor((HDC)wParam,bgcolor)};
if (wadlg_lastbrush) DeleteObject(wadlg_lastbrush);
wadlg_lastbrush=CreateBrushIndirect(&lb);
SetTextColor((HDC)wParam,uMsg == WM_CTLCOLORSTATIC ? wadlg_colors[WADLG_WNDFG] : wadlg_colors[WADLG_ITEMFG]);
SetBkColor((HDC)wParam,lb.lbColor);
return (LRESULT)wadlg_lastbrush;
}
}
return 0;
}
static int RectInRect(RECT *rect1, RECT *rect2)
@ -275,78 +365,71 @@ static int RectInRect(RECT *rect1, RECT *rect2)
static void WADlg_removeFromRgn(HRGN hrgn, int left, int top, int right, int bottom)
{
HRGN rgn2=CreateRectRgn(left,top,right,bottom);
CombineRgn(hrgn,hrgn,rgn2,RGN_DIFF);
DeleteObject(rgn2);
HRGN rgn2=CreateRectRgn(left,top,right,bottom);
CombineRgn(hrgn,hrgn,rgn2,RGN_DIFF);
DeleteObject(rgn2);
}
void WADlg_DrawChildWindowBorders(HWND hwndDlg, int *tab, int tabsize)
{
PAINTSTRUCT ps;
BeginPaint(hwndDlg,&ps);
PAINTSTRUCT ps;
BeginPaint(hwndDlg,&ps);
HRGN hrgn = (ps.fErase) ? CreateRectRgnIndirect(&ps.rcPaint) : NULL;
HPEN pen = CreatePen(PS_SOLID, 0, wadlg_colors[WADLG_HILITE]);
HGDIOBJ o = SelectObject(ps.hdc, pen);
HRGN hrgn=NULL;
if(ps.fErase)
{
RECT r=ps.rcPaint;
hrgn=CreateRectRgn(r.left,r.top,r.right,r.bottom);
}
while (tabsize--)
{
RECT r;
int a = *tab++;
GetWindowRect(GetDlgItem(hwndDlg, a & 0xffff),&r);
MapWindowPoints(HWND_DESKTOP, hwndDlg, (LPPOINT)&r, 2);
if (RectInRect(&ps.rcPaint,&r))
{
if ((a & 0xffff0000) == DCW_SUNKENBORDER)
{
MoveToEx(ps.hdc,r.left,r.bottom,NULL);
LineTo(ps.hdc,r.right,r.bottom);
LineTo(ps.hdc,r.right,r.top-1);
if(hrgn)
{
WADlg_removeFromRgn(hrgn,r.left,r.bottom,r.right,r.bottom+1);
WADlg_removeFromRgn(hrgn,r.right,r.top,r.right+1,r.bottom);
}
}
else if ((a & 0xffff0000) == DCW_DIVIDER)
{
if (r.right - r.left < r.bottom - r.top) // vertical
{
int left=(r.left+r.right)/2;
MoveToEx(ps.hdc,left,r.top,NULL);
LineTo(ps.hdc,left,r.bottom+1);
if(hrgn) WADlg_removeFromRgn(hrgn,left,r.top,left+1,r.bottom);
}
else // horiz
{
int top=(r.top+r.bottom)/2;
MoveToEx(ps.hdc,r.left,top,NULL);
LineTo(ps.hdc,r.right+1,top);
if(hrgn) WADlg_removeFromRgn(hrgn,r.left,top,r.right,top+1);
}
}
}
}
HPEN pen=CreatePen(PS_SOLID,0,wadlg_colors[WADLG_HILITE]);
HGDIOBJ o=SelectObject(ps.hdc,pen);
SelectObject(ps.hdc, o);
DeleteObject(pen);
while (tabsize--)
{
RECT r;
int a=*tab++;
GetWindowRect(GetDlgItem(hwndDlg,a&0xffff),&r);
ScreenToClient(hwndDlg,(LPPOINT)&r);
ScreenToClient(hwndDlg,((LPPOINT)&r)+1);
if (RectInRect(&ps.rcPaint,&r))
{
if ((a & 0xffff0000) == DCW_SUNKENBORDER)
{
MoveToEx(ps.hdc,r.left,r.bottom,NULL);
LineTo(ps.hdc,r.right,r.bottom);
LineTo(ps.hdc,r.right,r.top-1);
if(hrgn)
{
WADlg_removeFromRgn(hrgn,r.left,r.bottom,r.right,r.bottom+1);
WADlg_removeFromRgn(hrgn,r.right,r.top,r.right+1,r.bottom);
}
}
else if ((a & 0xffff0000) == DCW_DIVIDER)
{
if (r.right - r.left < r.bottom - r.top) // vertical
{
int left=(r.left+r.right)/2;
MoveToEx(ps.hdc,left,r.top,NULL);
LineTo(ps.hdc,left,r.bottom+1);
if(hrgn) WADlg_removeFromRgn(hrgn,left,r.top,left+1,r.bottom);
}
else // horiz
{
int top=(r.top+r.bottom)/2;
MoveToEx(ps.hdc,r.left,top,NULL);
LineTo(ps.hdc,r.right+1,top);
if(hrgn) WADlg_removeFromRgn(hrgn,r.left,top,r.right,top+1);
}
}
}
}
SelectObject(ps.hdc,o);
DeleteObject(pen);
if(hrgn) {
//erase bkgnd while clipping out our own drawn stuff (for flickerless display)
HBRUSH b=CreateSolidBrush(wadlg_colors[WADLG_WNDBG]);
FillRgn(ps.hdc,hrgn,b);
DeleteObject(b);
DeleteObject(hrgn);
}
EndPaint(hwndDlg,&ps);
if(hrgn)
{
//erase bkgnd while clipping out our own drawn stuff (for flickerless display)
HBRUSH b = CreateSolidBrush(wadlg_colors[WADLG_WNDBG]);
FillRgn(ps.hdc,hrgn,b);
DeleteObject(b);
DeleteObject(hrgn);
}
EndPaint(hwndDlg,&ps);
}
#endif

File diff suppressed because it is too large Load Diff