forked from MegaV0lt/vdr-plugin-skinflatplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtextscroller.h
80 lines (69 loc) · 2.07 KB
/
textscroller.h
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
/*
* Skin flatPlus: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id$
*/
#pragma once
#include <cstring> // string.h
#include <vdr/thread.h>
#include <list>
#include "./flat.h"
#define WAITDELAY 1000 // In ms
class cTextScroll {
private:
cRect Position {0, 0, 0, 0};
tColor ColorFg {0}, ColorExtraTextFg {0}, ColorBg {0};
std::string Text{""};
cFont *Font {nullptr};
cPixmap *Pixmap {nullptr};
cOsd *m_Osd {nullptr};
int Layer {0};
int PixelsPerStep {0};
int WAITSTEPS {0}, WaitSteps {0};
bool IsReserveStep = false;
bool ResetX = false;
int ScrollType {0};
public:
cTextScroll(cOsd *osd, int type, int pixels, int waitsteps, int layer = 2) {
m_Osd = osd;
ScrollType = type;
PixelsPerStep = pixels;
WAITSTEPS = waitsteps;
Layer = layer;
}
~cTextScroll() {
m_Osd->DestroyPixmap(Pixmap);
Pixmap = nullptr;
}
void UpdateViewPortWidth(int w);
void Reset(void);
void SetText(const char *text, cRect position, tColor colorFg, tColor colorBg,
cFont *font, tColor ColorExtraTextFg = 0);
void DoStep(void);
void Draw(void);
};
class cTextScrollers : public cThread {
private:
std::vector<cTextScroll *> Scrollers;
cOsd *m_Osd {nullptr};
int ScrollStep {0}, ScrollDelay {0};
int ScrollType {0};
int Layer {0};
virtual void Action(void);
void StartScrolling(void);
public:
cTextScrollers();
~cTextScrollers();
void Clear(void);
void SetOsd(cOsd *osd) { m_Osd = osd;}
void SetPixmapLayer(int layer) { Layer = layer; }
void SetScrollStep(int step) { ScrollStep = step; }
void SetScrollDelay(int delay) { ScrollDelay = delay; }
void SetScrollType(int type) { ScrollType = type; }
void AddScroller(const char *text, cRect position, tColor colorFg, tColor colorBg,
cFont *font, tColor ColorExtraTextFg = 0);
void UpdateViewPortWidth(int w);
bool isActive(void) { return Active(); }
};