mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 02:05:46 -04:00
Initial community commit
This commit is contained in:
65
Src/Plugins/Input/in_wv/wasabi/Winamp/DSP.H
Normal file
65
Src/Plugins/Input/in_wv/wasabi/Winamp/DSP.H
Normal file
@ -0,0 +1,65 @@
|
||||
#ifndef NULLSOFT_WINAMP_DSP_H
|
||||
#define NULLSOFT_WINAMP_DSP_H
|
||||
// DSP plugin interface
|
||||
|
||||
// notes:
|
||||
// any window that remains in foreground should optimally pass unused
|
||||
// keystrokes to the parent (winamp's) window, so that the user
|
||||
// can still control it. As for storing configuration,
|
||||
// Configuration data should be stored in <dll directory>\plugin.ini
|
||||
// (look at the vis plugin for configuration code)
|
||||
|
||||
typedef struct winampDSPModule {
|
||||
char *description; // description
|
||||
HWND hwndParent; // parent window (filled in by calling app)
|
||||
HINSTANCE hDllInstance; // instance handle to this DLL (filled in by calling app)
|
||||
|
||||
void (*Config)(struct winampDSPModule *this_mod); // configuration dialog (if needed)
|
||||
int (*Init)(struct winampDSPModule *this_mod); // 0 on success, creates window, etc (if needed)
|
||||
|
||||
// modify waveform samples: returns number of samples to actually write
|
||||
// (typically numsamples, but no more than twice numsamples, and no less than half numsamples)
|
||||
// numsamples should always be at least 128. should, but I'm not sure
|
||||
int (*ModifySamples)(struct winampDSPModule *this_mod, short int *samples, int numsamples, int bps, int nch, int srate);
|
||||
|
||||
void (*Quit)(struct winampDSPModule *this_mod); // called when unloading
|
||||
|
||||
void *userData; // user data, optional
|
||||
} winampDSPModule;
|
||||
|
||||
typedef struct {
|
||||
int version; // DSP_HDRVER
|
||||
char *description; // description of library
|
||||
winampDSPModule* (*getModule)(int); // module retrieval function
|
||||
int (*sf)(int key); // DSP_HDRVER == 0x21
|
||||
} winampDSPHeader;
|
||||
|
||||
// exported symbols
|
||||
#ifdef USE_DSP_HDR_HWND
|
||||
typedef winampDSPHeader* (*winampDSPGetHeaderType)(HWND);
|
||||
#define DSP_HDRVER 0x22
|
||||
|
||||
#else
|
||||
|
||||
typedef winampDSPHeader* (*winampDSPGetHeaderType)(HWND);
|
||||
// header version: 0x20 == 0.20 == winamp 2.0
|
||||
#define DSP_HDRVER 0x20
|
||||
#endif
|
||||
|
||||
// return values from the winampUninstallPlugin(HINSTANCE hdll, HWND parent, int param)
|
||||
// which determine if we can uninstall the plugin immediately or on winamp restart
|
||||
#define DSP_PLUGIN_UNINSTALL_NOW 0x0
|
||||
#define DSP_PLUGIN_UNINSTALL_REBOOT 0x1
|
||||
//
|
||||
// uninstall support was added from 5.0+ and uninstall now support from 5.5+
|
||||
// it is down to you to ensure that if uninstall now is returned that it will not cause a crash
|
||||
// (ie don't use if you've been subclassing the main window)
|
||||
|
||||
// Version note:
|
||||
//
|
||||
// Added passing of Winamp's main hwnd in the call to the exported winampDSPHeader()
|
||||
// which allows for primarily the use of localisation features with the bundled plugins.
|
||||
// If you want to use the new version then either you can edit you version of dsp.h or
|
||||
// you can add USE_DSP_HDR_HWND to your project's defined list or before use of dsp.h
|
||||
//
|
||||
#endif
|
37
Src/Plugins/Input/in_wv/wasabi/Winamp/GEN.H
Normal file
37
Src/Plugins/Input/in_wv/wasabi/Winamp/GEN.H
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef NULLSOFT_WINAMP_GEN_H
|
||||
#define NULLSOFT_WINAMP_GEN_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define GEN_INIT_SUCCESS 0
|
||||
|
||||
// return values from the winampUninstallPlugin(HINSTANCE hdll, HWND parent, int param)
|
||||
// which determine if we can uninstall the plugin immediately or on winamp restart
|
||||
//
|
||||
// uninstall support was added from 5.0+ and uninstall now support from 5.5+
|
||||
// it is down to you to ensure that if uninstall now is returned that it will not cause a crash
|
||||
// (ie don't use if you've been subclassing the main window)
|
||||
#define GEN_PLUGIN_UNINSTALL_NOW 0x1
|
||||
#define GEN_PLUGIN_UNINSTALL_REBOOT 0x0
|
||||
|
||||
typedef struct {
|
||||
int version;
|
||||
char *description;
|
||||
int (*init)();
|
||||
void (*config)();
|
||||
void (*quit)();
|
||||
HWND hwndParent;
|
||||
HINSTANCE hDllInstance;
|
||||
} winampGeneralPurposePlugin;
|
||||
|
||||
#define GPPHDR_VER 0x10
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
//extern winampGeneralPurposePlugin *gen_plugins[256];
|
||||
typedef winampGeneralPurposePlugin * (*winampGeneralPurposePluginGetter)();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
138
Src/Plugins/Input/in_wv/wasabi/Winamp/IN2.H
Normal file
138
Src/Plugins/Input/in_wv/wasabi/Winamp/IN2.H
Normal file
@ -0,0 +1,138 @@
|
||||
|
||||
#ifndef NULLSOFT_WINAMP_IN2H
|
||||
#define NULLSOFT_WINAMP_IN2H
|
||||
#include "out.h"
|
||||
|
||||
// note: exported symbol is now winampGetInModule2.
|
||||
|
||||
#define IN_UNICODE 0x0F000000
|
||||
|
||||
#ifdef UNICODE_INPUT_PLUGIN
|
||||
#define in_char wchar_t
|
||||
#define IN_VER (IN_UNICODE | 0x100)
|
||||
#else
|
||||
#define in_char char
|
||||
#define IN_VER 0x100
|
||||
#endif
|
||||
|
||||
#define IN_MODULE_FLAG_USES_OUTPUT_PLUGIN 1
|
||||
// By default, Winamp assumes that your input plugin wants to use Winamp's EQ, and doesn't do replay gain
|
||||
// if you handle any of these yourself (EQ, Replay Gain adjustments), then set these flags accordingly
|
||||
#define IN_MODULE_FLAG_EQ 2 // set this if you do your own EQ
|
||||
#define IN_MODULE_FLAG_REPLAYGAIN 8 // set this if you adjusted volume for replay gain
|
||||
// for tracks with no replay gain metadata, you should clear this flag
|
||||
// UNLESS you handle "non_replaygain" gain adjustment yourself
|
||||
#define IN_MODULE_FLAG_REPLAYGAIN_PREAMP 16 // use this if you queried for the replay gain preamp parameter and used it
|
||||
// this parameter is new to 5.54
|
||||
typedef struct
|
||||
{
|
||||
int version; // module type (IN_VER)
|
||||
char *description; // description of module, with version string
|
||||
|
||||
HWND hMainWindow; // winamp's main window (filled in by winamp)
|
||||
HINSTANCE hDllInstance; // DLL instance handle (Also filled in by winamp)
|
||||
|
||||
char *FileExtensions; // "mp3\0Layer 3 MPEG\0mp2\0Layer 2 MPEG\0mpg\0Layer 1 MPEG\0"
|
||||
// May be altered from Config, so the user can select what they want
|
||||
|
||||
int is_seekable; // is this stream seekable?
|
||||
int UsesOutputPlug; // does this plug-in use the output plug-ins? (musn't ever change, ever :)
|
||||
// note that this has turned into a "flags" field
|
||||
// see IN_MODULE_FLAG_*
|
||||
|
||||
void (*Config)(HWND hwndParent); // configuration dialog
|
||||
void (*About)(HWND hwndParent); // about dialog
|
||||
|
||||
void (*Init)(); // called at program init
|
||||
void (*Quit)(); // called at program quit
|
||||
|
||||
#define GETFILEINFO_TITLE_LENGTH 2048
|
||||
void (*GetFileInfo)(const in_char *file, in_char *title, int *length_in_ms); // if file == NULL, current playing is used
|
||||
|
||||
#define INFOBOX_EDITED 0
|
||||
#define INFOBOX_UNCHANGED 1
|
||||
int (*InfoBox)(const in_char *file, HWND hwndParent);
|
||||
|
||||
int (*IsOurFile)(const in_char *fn); // called before extension checks, to allow detection of mms://, etc
|
||||
// playback stuff
|
||||
int (*Play)(const in_char *fn); // return zero on success, -1 on file-not-found, some other value on other (stopping winamp) error
|
||||
void (*Pause)(); // pause stream
|
||||
void (*UnPause)(); // unpause stream
|
||||
int (*IsPaused)(); // ispaused? return 1 if paused, 0 if not
|
||||
void (*Stop)(); // stop (unload) stream
|
||||
|
||||
// time stuff
|
||||
int (*GetLength)(); // get length in ms
|
||||
int (*GetOutputTime)(); // returns current output time in ms. (usually returns outMod->GetOutputTime()
|
||||
void (*SetOutputTime)(int time_in_ms); // seeks to point in stream (in ms). Usually you signal your thread to seek, which seeks and calls outMod->Flush()..
|
||||
|
||||
// volume stuff
|
||||
void (*SetVolume)(int volume); // from 0 to 255.. usually just call outMod->SetVolume
|
||||
void (*SetPan)(int pan); // from -127 to 127.. usually just call outMod->SetPan
|
||||
|
||||
// in-window builtin vis stuff
|
||||
|
||||
void (*SAVSAInit)(int maxlatency_in_ms, int srate); // call once in Play(). maxlatency_in_ms should be the value returned from outMod->Open()
|
||||
// call after opening audio device with max latency in ms and samplerate
|
||||
void (*SAVSADeInit)(); // call in Stop()
|
||||
|
||||
|
||||
// simple vis supplying mode
|
||||
void (*SAAddPCMData)(void *PCMData, int nch, int bps, int timestamp);
|
||||
// sets the spec data directly from PCM data
|
||||
// quick and easy way to get vis working :)
|
||||
// needs at least 576 samples :)
|
||||
|
||||
// advanced vis supplying mode, only use if you're cool. Use SAAddPCMData for most stuff.
|
||||
int (*SAGetMode)(); // gets csa (the current type (4=ws,2=osc,1=spec))
|
||||
// use when calling SAAdd()
|
||||
int (*SAAdd)(void *data, int timestamp, int csa); // sets the spec data, filled in by winamp
|
||||
|
||||
|
||||
// vis stuff (plug-in)
|
||||
// simple vis supplying mode
|
||||
void (*VSAAddPCMData)(void *PCMData, int nch, int bps, int timestamp); // sets the vis data directly from PCM data
|
||||
// quick and easy way to get vis working :)
|
||||
// needs at least 576 samples :)
|
||||
|
||||
// advanced vis supplying mode, only use if you're cool. Use VSAAddPCMData for most stuff.
|
||||
int (*VSAGetMode)(int *specNch, int *waveNch); // use to figure out what to give to VSAAdd
|
||||
int (*VSAAdd)(void *data, int timestamp); // filled in by winamp, called by plug-in
|
||||
|
||||
|
||||
// call this in Play() to tell the vis plug-ins the current output params.
|
||||
void (*VSASetInfo)(int srate, int nch); // <-- Correct (benski, dec 2005).. old declaration had the params backwards
|
||||
|
||||
|
||||
// dsp plug-in processing:
|
||||
// (filled in by winamp, calld by input plug)
|
||||
|
||||
// returns 1 if active (which means that the number of samples returned by dsp_dosamples
|
||||
// could be greater than went in.. Use it to estimate if you'll have enough room in the
|
||||
// output buffer
|
||||
int (*dsp_isactive)();
|
||||
|
||||
// returns number of samples to output. This can be as much as twice numsamples.
|
||||
// be sure to allocate enough buffer for samples, then.
|
||||
int (*dsp_dosamples)(short int *samples, int numsamples, int bps, int nch, int srate);
|
||||
|
||||
|
||||
// eq stuff
|
||||
void (*EQSet)(int on, char data[10], int preamp); // 0-64 each, 31 is +0, 0 is +12, 63 is -12. Do nothing to ignore.
|
||||
|
||||
// info setting (filled in by winamp)
|
||||
void (*SetInfo)(int bitrate, int srate, int stereo, int synched); // if -1, changes ignored? :)
|
||||
|
||||
Out_Module *outMod; // filled in by winamp, optionally used :)
|
||||
} In_Module;
|
||||
|
||||
// return values from the winampUninstallPlugin(HINSTANCE hdll, HWND parent, int param)
|
||||
// which determine if we can uninstall the plugin immediately or on winamp restart
|
||||
//
|
||||
// uninstall support was added from 5.0+ and uninstall now support from 5.5+
|
||||
// it is down to you to ensure that if uninstall now is returned that it will not cause a crash
|
||||
// (ie don't use if you've been subclassing the main window)
|
||||
#define IN_PLUGIN_UNINSTALL_NOW 0x1
|
||||
#define IN_PLUGIN_UNINSTALL_REBOOT 0x0
|
||||
|
||||
#endif
|
65
Src/Plugins/Input/in_wv/wasabi/Winamp/api_audiostream.h
Normal file
65
Src/Plugins/Input/in_wv/wasabi/Winamp/api_audiostream.h
Normal file
@ -0,0 +1,65 @@
|
||||
#ifndef NULLSOFT_API_AUDIOSTREAM_H
|
||||
#define NULLSOFT_API_AUDIOSTREAM_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
|
||||
class api_audiostream : public Dispatchable
|
||||
{
|
||||
protected:
|
||||
api_audiostream() {}
|
||||
~api_audiostream() {}
|
||||
public:
|
||||
/* returns number of bytes written to buffer.
|
||||
* a return value of 0 means EOF
|
||||
*/
|
||||
size_t ReadAudio(void *buffer, size_t sizeBytes); // TODO: killswitch and error code
|
||||
|
||||
size_t ReadAudio(void *buffer, size_t, int *killswitch, int *errorCode);
|
||||
/* Seeks to a point in the stream in milliseconds
|
||||
* returns TRUE if successful, FALSE otherwise
|
||||
*/
|
||||
int SeekToTimeMs(int millisecs);
|
||||
|
||||
/* returns 1 if this stream is seekable using SeekToTime, 0 otherwise
|
||||
*/
|
||||
int CanSeek();
|
||||
public:
|
||||
DISPATCH_CODES
|
||||
{
|
||||
API_AUDIOSTREAM_READAUDIO = 10,
|
||||
API_AUDIOSTREAM_READAUDIO2 = 11,
|
||||
API_AUDIOSTREAM_SEEKTOTIMEMS = 20,
|
||||
API_AUDIOSTREAM_CANSEEK = 30,
|
||||
};
|
||||
};
|
||||
|
||||
inline size_t api_audiostream::ReadAudio(void *buffer, size_t sizeBytes)
|
||||
{
|
||||
return _call(API_AUDIOSTREAM_READAUDIO, (size_t)0, buffer, sizeBytes);
|
||||
}
|
||||
|
||||
inline size_t api_audiostream::ReadAudio(void *buffer, size_t sizeBytes, int *killswitch, int *errorCode)
|
||||
{
|
||||
void *params[4] = { &buffer, &sizeBytes, &killswitch, &errorCode};
|
||||
size_t retval;
|
||||
|
||||
if (_dispatch(API_AUDIOSTREAM_READAUDIO2, &retval, params, 4))
|
||||
return retval;
|
||||
else
|
||||
{
|
||||
*errorCode=0;
|
||||
return ReadAudio(buffer, sizeBytes);
|
||||
}
|
||||
}
|
||||
|
||||
inline int api_audiostream::SeekToTimeMs(int millisecs)
|
||||
{
|
||||
return _call(API_AUDIOSTREAM_SEEKTOTIMEMS, (int)0, millisecs);
|
||||
}
|
||||
|
||||
inline int api_audiostream::CanSeek()
|
||||
{
|
||||
return _call(API_AUDIOSTREAM_CANSEEK, (int)0);
|
||||
}
|
||||
|
||||
#endif
|
99
Src/Plugins/Input/in_wv/wasabi/Winamp/api_decodefile.h
Normal file
99
Src/Plugins/Input/in_wv/wasabi/Winamp/api_decodefile.h
Normal file
@ -0,0 +1,99 @@
|
||||
#ifndef NULLSOFT_API_DECODEFILE_H
|
||||
#define NULLSOFT_API_DECODEFILE_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <bfc/platform/types.h>
|
||||
#include "api_audiostream.h"
|
||||
|
||||
enum
|
||||
{
|
||||
API_DECODEFILE_SUCCESS = 0,
|
||||
API_DECODEFILE_FAILURE = 1,
|
||||
|
||||
API_DECODEFILE_UNSUPPORTED = 2, // type is unsupported
|
||||
API_DECODEFILE_NO_INTERFACE = 3, // type is supported, but plugin does provide any interfaces for direct decoding
|
||||
API_DECODEFILE_WINAMP_PRO = 4, // user has to pay $$$ to do this
|
||||
API_DECODEFILE_NO_RIGHTS = 5, // user is not allowed to decode this file (e.g. DRM)
|
||||
API_DECODEFILE_BAD_RESAMPLE = 6, // Winamp is unable to resample this file to CDDA format (stereo 16bit 44.1kHz)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AUDIOPARAMETERS_FLOAT = 1,
|
||||
};
|
||||
struct AudioParameters
|
||||
{
|
||||
public:
|
||||
AudioParameters() : bitsPerSample(0), channels(0), sampleRate(0), sampleRateReal(0.f), sizeBytes((size_t) - 1), errorCode(API_DECODEFILE_SUCCESS), flags(0)
|
||||
{}
|
||||
size_t bitsPerSample;
|
||||
size_t channels;
|
||||
size_t sampleRate;
|
||||
float sampleRateReal; // yes this is duplicate.
|
||||
int flags;
|
||||
size_t sizeBytes; // total size of decoded file, (size_t)-1 means don't know
|
||||
int errorCode;
|
||||
};
|
||||
|
||||
class api_decodefile : public Dispatchable
|
||||
{
|
||||
public:
|
||||
/* OpenAudioBackground gives you back an api_audiostream that you can use to get decompressed bits
|
||||
* if it returns 0, check parameters->errorCode for the failure reason
|
||||
* fill parameters with desired values (0 if you don't care)
|
||||
* the decoder will _do its best_ to satisfy your passed-in audio parameters
|
||||
* but this API does not guarantee them, so be sure to check the parameters struct after the function returns
|
||||
* it's **UP TO YOU** to do any necessary conversion (sample rate, channels, bits-per-sample) if the decoder can't do it
|
||||
*/
|
||||
api_audiostream *OpenAudioBackground(const wchar_t *filename, AudioParameters *parameters);
|
||||
/* OpenAudio is the same as OpenAudioBackground
|
||||
* but, it will use the input plugin system to decode if necessary
|
||||
* so it's best to use this in a separate winamp.exe
|
||||
* to be honest, it was designed for internal use in the CD burner
|
||||
* so it's best not to use this one at all
|
||||
*/
|
||||
api_audiostream *OpenAudio(const wchar_t *filename, AudioParameters *parameters);
|
||||
|
||||
void CloseAudio(api_audiostream *audioStream);
|
||||
/* verifies that a decoder exists to decompress this filename.
|
||||
this is not a guarantee tgat the file is openable, just that it can be matched to a decoder */
|
||||
bool DecoderExists(const wchar_t *filename);
|
||||
public:
|
||||
DISPATCH_CODES
|
||||
{
|
||||
API_DECODEFILE_OPENAUDIO = 10,
|
||||
API_DECODEFILE_OPENAUDIO2 = 11,
|
||||
API_DECODEFILE_CLOSEAUDIO = 20,
|
||||
API_DECODEFILE_DECODEREXISTS = 30,
|
||||
};
|
||||
};
|
||||
|
||||
inline api_audiostream *api_decodefile::OpenAudio(const wchar_t *filename, AudioParameters *parameters)
|
||||
{
|
||||
return _call(API_DECODEFILE_OPENAUDIO, (api_audiostream *)0, filename, parameters);
|
||||
}
|
||||
|
||||
inline api_audiostream *api_decodefile::OpenAudioBackground(const wchar_t *filename, AudioParameters *parameters)
|
||||
{
|
||||
return _call(API_DECODEFILE_OPENAUDIO2, (api_audiostream *)0, filename, parameters);
|
||||
}
|
||||
|
||||
|
||||
inline void api_decodefile::CloseAudio(api_audiostream *audioStream)
|
||||
{
|
||||
_voidcall(API_DECODEFILE_CLOSEAUDIO, audioStream);
|
||||
}
|
||||
|
||||
inline bool api_decodefile::DecoderExists(const wchar_t *filename)
|
||||
{
|
||||
return _call(API_DECODEFILE_DECODEREXISTS, (bool)true, filename); // we default to true so that an old implementation doesn't break completely
|
||||
}
|
||||
|
||||
// {9B4188F5-4295-48ab-B50C-F2B0BB56D242}
|
||||
static const GUID decodeFileGUID =
|
||||
{
|
||||
0x9b4188f5, 0x4295, 0x48ab, { 0xb5, 0xc, 0xf2, 0xb0, 0xbb, 0x56, 0xd2, 0x42 }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
78
Src/Plugins/Input/in_wv/wasabi/Winamp/api_random.h
Normal file
78
Src/Plugins/Input/in_wv/wasabi/Winamp/api_random.h
Normal file
@ -0,0 +1,78 @@
|
||||
#ifndef NULLSOFT_API_RANDOM_H
|
||||
#define NULLSOFT_API_RANDOM_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <bfc/platform/types.h>
|
||||
|
||||
typedef int (*RandomGenerator)(void);
|
||||
typedef unsigned long (*UnsignedRandomGenerator)(void);
|
||||
|
||||
class api_random : public Dispatchable
|
||||
{
|
||||
protected:
|
||||
api_random() {}
|
||||
~api_random() {}
|
||||
public:
|
||||
RandomGenerator GetFunction();
|
||||
UnsignedRandomGenerator GetUnsignedFunction();
|
||||
int GetNumber();
|
||||
int GetPositiveNumber();
|
||||
float GetFloat(); // [0-1]
|
||||
float GetFloat_LessThanOne(); // [0-1)
|
||||
float GetFloat_LessThanOne_NotZero(); // (0-1)
|
||||
double GetDouble(); // [0-1)
|
||||
public:
|
||||
DISPATCH_CODES
|
||||
{
|
||||
API_RANDOM_GETFUNCTION = 10,
|
||||
API_RANDOM_GETFUNCTION_UNSIGNED = 11,
|
||||
API_RANDOM_GETNUMBER = 20,
|
||||
API_RANDOM_GETPOSITIVENUMBER = 30,
|
||||
API_RANDOM_GETFLOAT = 40,
|
||||
API_RANDOM_GETFLOAT2 = 41,
|
||||
API_RANDOM_GETFLOAT3 = 42,
|
||||
API_RANDOM_GETDOUBLE = 50,
|
||||
};
|
||||
};
|
||||
|
||||
inline RandomGenerator api_random::GetFunction()
|
||||
{
|
||||
return _call(API_RANDOM_GETFUNCTION, (RandomGenerator )0);
|
||||
}
|
||||
inline UnsignedRandomGenerator api_random::GetUnsignedFunction()
|
||||
{
|
||||
return _call(API_RANDOM_GETFUNCTION_UNSIGNED, (UnsignedRandomGenerator )0);
|
||||
}
|
||||
|
||||
inline int api_random::GetNumber()
|
||||
{
|
||||
return _call(API_RANDOM_GETNUMBER, 0);
|
||||
}
|
||||
inline int api_random::GetPositiveNumber()
|
||||
{
|
||||
return _call(API_RANDOM_GETPOSITIVENUMBER, 0);
|
||||
}
|
||||
inline float api_random::GetFloat()
|
||||
{
|
||||
return _call(API_RANDOM_GETFLOAT, 0.f);
|
||||
}
|
||||
inline float api_random::GetFloat_LessThanOne()
|
||||
{
|
||||
return _call(API_RANDOM_GETFLOAT2, 0.f);
|
||||
}
|
||||
inline float api_random::GetFloat_LessThanOne_NotZero()
|
||||
{
|
||||
return _call(API_RANDOM_GETFLOAT3, 0.f);
|
||||
}
|
||||
inline double api_random::GetDouble()
|
||||
{
|
||||
return _call(API_RANDOM_GETDOUBLE, 0.);
|
||||
}
|
||||
|
||||
// {CB401CAB-CC10-48f7-ADB7-9D1D24B40E0C}
|
||||
static const GUID randomApiGUID =
|
||||
{ 0xcb401cab, 0xcc10, 0x48f7, { 0xad, 0xb7, 0x9d, 0x1d, 0x24, 0xb4, 0xe, 0xc } };
|
||||
|
||||
|
||||
#endif
|
||||
|
34
Src/Plugins/Input/in_wv/wasabi/Winamp/api_wa5component.h
Normal file
34
Src/Plugins/Input/in_wv/wasabi/Winamp/api_wa5component.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef __WASABI_API_WA5COMPONENT_H_
|
||||
#define __WASABI_API_WA5COMPONENT_H_
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
class api_service;
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
class NOVTABLE api_wa5component : public Dispatchable
|
||||
{
|
||||
public:
|
||||
DISPATCH_CODES
|
||||
{
|
||||
API_WA5COMPONENT_REGISTERSERVICES = 10,
|
||||
API_WA5COMPONENT_DEREEGISTERSERVICES = 20,
|
||||
};
|
||||
|
||||
void RegisterServices(api_service *service);
|
||||
void DeregisterServices(api_service *service);
|
||||
#ifdef WIN32 // this is a kind of a hack (might be better to create a function that winamp calls to pass it)
|
||||
HMODULE hModule;
|
||||
#endif
|
||||
};
|
||||
inline void api_wa5component::RegisterServices(api_service *service)
|
||||
{
|
||||
_voidcall(API_WA5COMPONENT_REGISTERSERVICES, service);
|
||||
}
|
||||
|
||||
inline void api_wa5component::DeregisterServices(api_service *service)
|
||||
{
|
||||
_voidcall(API_WA5COMPONENT_DEREEGISTERSERVICES, service);
|
||||
}
|
||||
#endif
|
56
Src/Plugins/Input/in_wv/wasabi/Winamp/ipc_pe.h
Normal file
56
Src/Plugins/Input/in_wv/wasabi/Winamp/ipc_pe.h
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef __IPC_PE_H
|
||||
#define __IPC_PE_H
|
||||
|
||||
#define IPC_PE_GETCURINDEX 100 // returns current idx
|
||||
#define IPC_PE_GETINDEXTOTAL 101 // returns number of items
|
||||
#define IPC_PE_GETINDEXINFO 102 // (copydata) lpData is of type callbackinfo, callback is called with copydata/fileinfo structure and msg IPC_PE_GETINDEXINFORESULT
|
||||
#define IPC_PE_GETINDEXINFORESULT 103 // callback message for IPC_PE_GETINDEXINFO
|
||||
#define IPC_PE_DELETEINDEX 104 // lParam = index
|
||||
#define IPC_PE_SWAPINDEX 105 // (lParam & 0xFFFF0000) >> 16 = from, (lParam & 0xFFFF) = to
|
||||
#define IPC_PE_INSERTFILENAME 106 // (copydata) lpData is of type fileinfo
|
||||
#define IPC_PE_GETDIRTY 107 // returns 1 if the playlist changed since the last IPC_PE_SETCLEAN
|
||||
#define IPC_PE_SETCLEAN 108 // resets the dirty flag until next modification
|
||||
#define IPC_PE_GETIDXFROMPOINT 109 // pass a point parm, return a playlist index
|
||||
#define IPC_PE_SAVEEND 110 // pass index to save from
|
||||
#define IPC_PE_RESTOREEND 111 // no parm
|
||||
#define IPC_PE_GETNEXTSELECTED 112 // same as IPC_PLAYLIST_GET_NEXT_SELECTED for the main window
|
||||
#define IPC_PE_GETSELECTEDCOUNT 113
|
||||
#define IPC_PE_INSERTFILENAMEW 114 // (copydata) lpData is of type fileinfoW
|
||||
#define IPC_PE_GETINDEXINFO_TITLE 115 // like IPC_PE_GETINDEXINFO, but writes the title to char file[MAX_PATH] instead of filename
|
||||
#define IPC_PE_GETINDEXINFORESULT_TITLE 116 // callback message for IPC_PE_GETINDEXINFO
|
||||
typedef struct {
|
||||
char file[MAX_PATH];
|
||||
int index;
|
||||
} fileinfo;
|
||||
|
||||
typedef struct {
|
||||
wchar_t file[MAX_PATH];
|
||||
int index;
|
||||
} fileinfoW;
|
||||
|
||||
typedef struct {
|
||||
HWND callback;
|
||||
int index;
|
||||
} callbackinfo;
|
||||
|
||||
// the following messages are in_process ONLY
|
||||
|
||||
#define IPC_PE_GETINDEXTITLE 200 // lParam = pointer to fileinfo2 struct
|
||||
#define IPC_PE_GETINDEXTITLEW 201 // lParam = pointer to fileinfo2W struct
|
||||
#define IPC_PE_GETINDEXINFO_INPROC 202 // lParam = pointer to fileinfo struct
|
||||
#define IPC_PE_GETINDEXINFOW_INPROC 203 // lParam = pointer to fileinfoW struct
|
||||
|
||||
typedef struct {
|
||||
int fileindex;
|
||||
char filetitle[256];
|
||||
char filelength[16];
|
||||
} fileinfo2;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int fileindex;
|
||||
wchar_t filetitle[256];
|
||||
wchar_t filelength[16];
|
||||
} fileinfo2W;
|
||||
|
||||
#endif
|
436
Src/Plugins/Input/in_wv/wasabi/Winamp/wa_dlg.h
Normal file
436
Src/Plugins/Input/in_wv/wasabi/Winamp/wa_dlg.h
Normal file
@ -0,0 +1,436 @@
|
||||
/*
|
||||
** 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.
|
||||
**
|
||||
** Permission is granted to anyone to use this software for any purpose, including commercial applications, and to
|
||||
** alter it and redistribute it freely, subject to the following restrictions:
|
||||
**
|
||||
** 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
|
||||
** If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
**
|
||||
** 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
**
|
||||
** 3. This notice may not be removed or altered from any source distribution.
|
||||
**
|
||||
*/
|
||||
|
||||
#ifndef _WA_DLG_H_
|
||||
#define _WA_DLG_H_
|
||||
|
||||
#include "wa_ipc.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
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
|
||||
highlight and no-highlight modes. The font is variable width,
|
||||
and it uses the first color before the letter A as the delimiter.
|
||||
The no-highlight form of letter must be the same width as the
|
||||
highlight form.
|
||||
2) genex.bmp has button and scrollbar images, as well as some individual
|
||||
pixels that describe the colors for the dialog. The button and
|
||||
scrollbar images should be self explanatory (note that the buttons
|
||||
have 4 pixel sized edges that are not stretched, and the center is
|
||||
stretched), and the scrollbars do something similar.
|
||||
The colors start at (48,0) and run every other pixel. The meaning
|
||||
of each pixel is:
|
||||
x=48: item background (background to edits, listviews etc)
|
||||
x=50: item foreground (text color of edit/listview, etc)
|
||||
x=52: window background (used to set the bg color for the dialog)
|
||||
x=54: button text color
|
||||
x=56: window text color
|
||||
x=58: color of dividers and sunken borders
|
||||
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
|
||||
x=68: listview header frame middle color
|
||||
x=70: listview header frame bottom color
|
||||
x=72: listview header empty color
|
||||
x=74: scrollbar foreground color
|
||||
x=76: scrollbar background color
|
||||
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
|
||||
|
||||
enum
|
||||
{
|
||||
WADLG_ITEMBG,
|
||||
WADLG_ITEMFG,
|
||||
WADLG_WNDBG,
|
||||
WADLG_BUTTONFG,
|
||||
WADLG_WNDFG,
|
||||
WADLG_HILITE,
|
||||
WADLG_SELCOLOR,
|
||||
WADLG_LISTHEADER_BGCOLOR,
|
||||
WADLG_LISTHEADER_FONTCOLOR,
|
||||
WADLG_LISTHEADER_FRAME_TOPCOLOR,
|
||||
WADLG_LISTHEADER_FRAME_MIDDLECOLOR,
|
||||
WADLG_LISTHEADER_FRAME_BOTTOMCOLOR,
|
||||
WADLG_LISTHEADER_EMPTY_BGCOLOR,
|
||||
WADLG_SCROLLBAR_FGCOLOR,
|
||||
WADLG_SCROLLBAR_BGCOLOR,
|
||||
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();
|
||||
|
||||
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=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(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];
|
||||
}
|
||||
|
||||
HBITMAP WADlg_getBitmap()
|
||||
{
|
||||
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 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);
|
||||
}
|
||||
}
|
||||
|
||||
void WADlg_close()
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT WADlg_handleDialogMsgs(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (uMsg == WM_DRAWITEM)
|
||||
{
|
||||
DRAWITEMSTRUCT *di = (DRAWITEMSTRUCT *)lParam;
|
||||
if (di->CtlType == ODT_BUTTON) {
|
||||
wchar_t wt[256];
|
||||
RECT r;
|
||||
GetDlgItemTextW(hwndDlg,(INT)wParam,wt,sizeof(wt)/sizeof(*wt));
|
||||
|
||||
HDC hdc = CreateCompatibleDC(di->hDC);
|
||||
HBITMAP hbmpOld = (HBITMAP)SelectObject(hdc, wadlg_bitmap);
|
||||
|
||||
r=di->rcItem;
|
||||
SetStretchBltMode(di->hDC,COLORONCOLOR);
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
// draw text
|
||||
SetBkMode(di->hDC,TRANSPARENT);
|
||||
|
||||
// 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 (LRESULT)wadlg_lastbrush;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int RectInRect(RECT *rect1, RECT *rect2)
|
||||
{
|
||||
// this has a bias towards true
|
||||
|
||||
// this could probably be optimized a lot
|
||||
return ((rect1->top >= rect2->top && rect1->top <= rect2->bottom) ||
|
||||
(rect1->bottom >= rect2->top && rect1->bottom <= rect2->bottom) ||
|
||||
(rect2->top >= rect1->top && rect2->top <= rect1->bottom) ||
|
||||
(rect2->bottom >= rect1->top && rect2->bottom <= rect1->bottom)) // vertical intersect
|
||||
&&
|
||||
((rect1->left >= rect2->left && rect1->left <= rect2->right) ||
|
||||
(rect1->right >= rect2->left && rect1->right <= rect2->right) ||
|
||||
(rect2->left >= rect1->left && rect2->left <= rect1->right) ||
|
||||
(rect2->right >= rect1->left && rect2->right <= rect1->right)) // horiz intersect
|
||||
;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void WADlg_DrawChildWindowBorders(HWND hwndDlg, int *tab, int tabsize)
|
||||
{
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif//_WA_DLG_H_
|
39
Src/Plugins/Input/in_wv/wasabi/Winamp/wa_hotkeys.h
Normal file
39
Src/Plugins/Input/in_wv/wasabi/Winamp/wa_hotkeys.h
Normal file
@ -0,0 +1,39 @@
|
||||
#ifndef WA_HOTKEYS
|
||||
#define WA_HOTKEYS
|
||||
|
||||
//#define IPC_GEN_HOTKEYS_ADD xxxx //pass a genHotkeysAddStruct * struct in data
|
||||
//
|
||||
//To get the IPC_GEN_HOTKEYS_ADD IPC number, do this:
|
||||
//
|
||||
// genhotkeys_add_ipc=SendMessage(winampWindow,WM_WA_IPC,(WPARAM)&"GenHotkeysAdd",IPC_REGISTER_WINAMP_IPCMESSAGE);
|
||||
//
|
||||
//Then you can use:
|
||||
//
|
||||
// PostMessage(winampWindow,WM_WA_IPC,(WPARAM)&myGenHotkeysAddStruct,genhotkeys_add_ipc);
|
||||
//
|
||||
|
||||
//flags for the genHotkeysAddStruct struct
|
||||
#define HKF_BRING_TO_FRONT 0x1 // calls SetForegroundWindow before sending the message
|
||||
#define HKF_HWND_WPARAM 0x2 // sets wParam with Winamp's window handle
|
||||
#define HKF_COPY 0x4 // copies returned text to the clipboard
|
||||
#define HKF_PLPOS_WPARAM 0x8 // sets wParam with current pledit position
|
||||
#define HKF_ISPLAYING_WL 0x10 // sets wParam to genHotkeysAddStruct's wParam if playing, lParam if not
|
||||
// uses IPC_ISPLAYING to check if playing
|
||||
#define HKF_SHOWHIDE 0x20 // brings Winamp to front or minimizes Winamp if already at front
|
||||
#define HKF_NOSENDMSG 0x40 // don't send any message to the winamp window
|
||||
|
||||
#define HKF_DISABLED 0x80000000
|
||||
|
||||
typedef struct {
|
||||
char *name; //name that will appear in the Global Hotkeys preferences panel
|
||||
DWORD flags; //one or more flags from above
|
||||
UINT uMsg; //message that will be sent to winamp's main window (must always be !=NULL)
|
||||
WPARAM wParam; //wParam that will be sent to winamp's main window
|
||||
LPARAM lParam; //lParam that will be sent to winamp's main window
|
||||
char *id; //unique string to identify this command - case insensitive
|
||||
HWND wnd; //set the HWND to send message (or 0 for main winamp window)
|
||||
|
||||
int extended[6]; //for future extension - always set to zero!
|
||||
} genHotkeysAddStruct;
|
||||
|
||||
#endif
|
2468
Src/Plugins/Input/in_wv/wasabi/Winamp/wa_ipc.h
Normal file
2468
Src/Plugins/Input/in_wv/wasabi/Winamp/wa_ipc.h
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user