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
|
#include "symbols/mute.xpm"
#include "displayvolume.h"
#include "config.h"
#include "helpers.h"
cNopacityVolumeBox::cNopacityVolumeBox(cOsd *osd, const cRect &Rect) {
this->osd = osd;
pixmapBackgroundVolume = osd->CreatePixmap(6, cRect(Rect));
pixmapBackgroundVolume->Fill(clrTransparent);
if (config.GetValue("displayType") == dtGraphical) {
cImage *imgBack = imgCache->GetSkinElement(seVolumeBackground);
if (imgBack) {
pixmapBackgroundVolume->DrawImage(cPoint(0, 0), *imgBack);
}
} else {
pixmapBackgroundVolume->Fill(Theme.Color(clrChannelBackground));
if (config.GetValue("displayType") == dtBlending) {
DrawBlendedBackground(pixmapBackgroundVolume,
0,
geoManager->volumeWidth,
Theme.Color(clrChannelBackground),
Theme.Color(clrChannelBackBlend),
true);
DrawBlendedBackground(pixmapBackgroundVolume,
0,
geoManager->volumeWidth,
Theme.Color(clrChannelBackground),
Theme.Color(clrChannelBackBlend),
false);
}
int cornerRadius = geoManager->volumeHeight/4;
if (cornerRadius > 2) {
DrawRoundedCorners(pixmapBackgroundVolume,
cornerRadius,
0,
0,
geoManager->volumeWidth,
geoManager->volumeHeight);
}
}
pixmapLabelVolume = osd->CreatePixmap(7, cRect(Rect.Left(), Rect.Top() + 5, geoManager->volumeWidth, geoManager->volumeLabelHeight));
pixmapProgressBarVolume = osd->CreatePixmap(7, cRect((Rect.Left() + (geoManager->volumeWidth - geoManager->volumeProgressBarWidth) / 2), Rect.Top() + ((geoManager->volumeHeight - geoManager->volumeProgressBarHeight) * 2 / 3), geoManager->volumeProgressBarWidth, geoManager->volumeProgressBarHeight));
}
cNopacityVolumeBox::~cNopacityVolumeBox(void) {
osd->DestroyPixmap(pixmapProgressBarVolume);
osd->DestroyPixmap(pixmapLabelVolume);
osd->DestroyPixmap(pixmapBackgroundVolume);
}
void cNopacityVolumeBox::SetVolume(int Current, int Total, bool Mute) {
pixmapLabelVolume->Fill(clrTransparent);
cString label = cString::sprintf("%s: %d", tr("Volume"), Current);
pixmapLabelVolume->DrawText(cPoint((geoManager->volumeWidth - fontManager->volumeText->Width(*label)) / 2, (geoManager->volumeLabelHeight - fontManager->volumeText->Height()) / 2), *label, Theme.Color(clrVolumeFont), clrTransparent, fontManager->volumeText);
if (Mute) {
cBitmap bmMute(mute_xpm);
pixmapLabelVolume->DrawBitmap(cPoint(geoManager->volumeWidth - 2 * bmMute.Width(), (geoManager->volumeLabelHeight - bmMute.Height()) / 2), bmMute, Theme.Color(clrDiskAlert), clrTransparent);
}
DrawProgressBarBackground(Current, Total);
}
void cNopacityVolumeBox::DrawProgressBarBackground(int Current, int Total) {
pixmapProgressBarVolume->Fill(clrTransparent);
if (geoManager->volumeProgressBarHeight < 5)
return;
if ((Current > 0) || (Total > 0)) {
pixmapProgressBarVolume->DrawEllipse(cRect(0,
0,
geoManager->volumeProgressBarHeight,
geoManager->volumeProgressBarHeight),
Theme.Color(clrProgressBarBack));
pixmapProgressBarVolume->DrawEllipse(cRect(geoManager->volumeProgressBarWidth - geoManager->volumeProgressBarHeight,
0,
geoManager->volumeProgressBarHeight,
geoManager->volumeProgressBarHeight),
Theme.Color(clrProgressBarBack));
pixmapProgressBarVolume->DrawRectangle(cRect(geoManager->volumeProgressBarHeight / 2,
0,
geoManager->volumeProgressBarWidth - geoManager->volumeProgressBarHeight,
geoManager->volumeProgressBarHeight),
Theme.Color(clrProgressBarBack));
int barWidth = geoManager->volumeProgressBarWidth - geoManager->volumeProgressBarHeight;
DrawProgressbar(pixmapProgressBarVolume, 1, 1, barWidth, geoManager->volumeProgressBarHeight - 2, Current, Total, Theme.Color(clrProgressBar), Theme.Color(clrProgressBarBlend), true);
}
}
void cNopacityVolumeBox::SetAlpha(int Alpha) {
pixmapBackgroundVolume->SetAlpha(Alpha);
pixmapProgressBarVolume->SetAlpha(Alpha);
pixmapLabelVolume->SetAlpha(Alpha);
}
|