1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
#ifndef NULLSOFT_GEN_FF_WA2SONGTICKER_H
#define NULLSOFT_GEN_FF_WA2SONGTICKER_H
//#include <api/wnd/wndclass/bufferpaintwnd.h>
#include <api/skin/widgets/textbase.h>
#include <api/syscb/callbacks/corecbi.h>
#include <tataki/color/skinclr.h>
#include <bfc/depend.h>
#define SONGTICKER_PARENT TextBase
class SongTicker
: public SONGTICKER_PARENT, /* provides basic wasabi windowing functinoality */
public CoreCallbackI, /* to get title change updates */
public DependentViewerI /* for config callbacks*/
{
public:
SongTicker();
~SongTicker();
enum TickerMode
{
TICKER_OFF,
TICKER_SCROLL,
TICKER_BOUNCE,
};
int onAction(const wchar_t *action, const wchar_t *param, int x, int y, intptr_t p1, intptr_t p2, void *data, size_t datalen, ifc_window *source);
protected:
/* BaseWnd */
virtual int onInit();
virtual int onBufferPaint(BltCanvas *canvas, int w, int h); // draw the song ticker here
/* TimerClient */
virtual void timerCallback(int id); // scroll the song ticker every # seconds
/* media core callbacks */
/* TODO: benski> some thoughts... this differs from current behaviour but might be an interesting idea
virtual int corecb_onStarted(); // start the ticker
virtual int corecb_onStopped(); // go back to showing Winamp version string
virtual int corecb_onPaused(); // pause the ticker
virtual int corecb_onUnpaused(); // unpause the ticker
// benski> currently unused in Winamp 5... might be worth implementing so we can draw text here
virtual int corecb_onStatusMsg(const wchar_t *text);
virtual int corecb_onWarningMsg(const wchar_t *text);
virtual int corecb_onErrorMsg(const wchar_t *text);
*/
virtual int corecb_onTitleChange(const wchar_t *title);
// benski> not sure what the difference here is - virtual int corecb_onTitle2Change(const wchar_t *title2);
virtual int corecb_onLengthChange(int newlength);
void getBufferPaintSource(RECT *r);
virtual void getBufferPaintSize(int *w, int *h);
/* TextBase */
void invalidateTextBuffer()
{
invalidateBuffer();
}
int viewer_onEvent(api_dependent *item, const GUID *classguid, int event, intptr_t param, void *ptr, size_t ptrlen);
int onLeftButtonDown(int x, int y);
int onMouseMove(int x, int y);
int onLeftButtonUp(int x, int y);
/*static */void CreateXMLParameters(int master_handle);
virtual int onResize();
private:
int grab_x;
/* Title */
void BuildTitle();
wchar_t song_title[1024];
int song_length;
int position;
StringW display, rotatingDisplay;
int width_of_str, width_of_str_padded;
/* */
int textW;
bool buffer_hw_valid;
/* scroll timer */
TimerToken scroll_timer_id;
int ticker_direction;
TickerMode tickerMode;
int skipTimers;
uint32_t last_tick;
/* XML Parameters */
enum
{
SONGTICKER_TICKER,
};
static XMLParamPair params[];
int xuihandle;
int setXuiParam(int _xuihandle, int attrid, const wchar_t *name, const wchar_t *strval);
};
extern const wchar_t songtickerXuiObjectStr[];
extern char songtickerXuiSvcName[];
class SongTickerXuiSvc : public XuiObjectSvc<SongTicker, songtickerXuiObjectStr, songtickerXuiSvcName> {};
#endif
|