summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--volumebox.c53
-rw-r--r--volumebox.h2
2 files changed, 24 insertions, 31 deletions
diff --git a/volumebox.c b/volumebox.c
index 4d7775c..5f3cefe 100644
--- a/volumebox.c
+++ b/volumebox.c
@@ -42,8 +42,14 @@ cNopacityVolumeBox::cNopacityVolumeBox(cOsd *osd, const cRect &Rect) {
geoManager->volumeHeight);
}
}
+
+ barWidth = geoManager->volumeProgressBarWidth;
+ barHeight = geoManager->volumeProgressBarHeight;
+
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));
+ pixmapLabelVolume->Fill(clrTransparent);
+ pixmapProgressBarVolume = osd->CreatePixmap(7, cRect((Rect.Left() + (geoManager->volumeWidth - barWidth) / 2), Rect.Top() + ((geoManager->volumeHeight - barHeight) * 2 / 3), barWidth, barHeight));
+ pixmapProgressBarVolume->Fill(clrTransparent);
}
cNopacityVolumeBox::~cNopacityVolumeBox(void) {
@@ -53,41 +59,28 @@ cNopacityVolumeBox::~cNopacityVolumeBox(void) {
}
void cNopacityVolumeBox::SetVolume(int Current, int Total, bool Mute) {
+ pixmapProgressBarVolume->Fill(clrTransparent);
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)
+ int barHeight = geoManager->volumeProgressBarHeight;
+ if ((Current == 0) && (Total == 0) || (barHeight < 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));
+ 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);
+ pixmapProgressBarVolume->DrawEllipse(cRect(0, 0, barHeight, barHeight), Theme.Color(clrProgressBarBack));
+ pixmapProgressBarVolume->DrawEllipse(cRect(barWidth - barHeight, 0, barHeight, barHeight), Theme.Color(clrProgressBarBack));
+ pixmapProgressBarVolume->DrawRectangle(cRect(barHeight / 2, 0, barWidth - barHeight, barHeight), 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);
+ DrawProgressbar(pixmapProgressBarVolume, 1, 1, barWidth - 2, barHeight - 2, Current, Total, Theme.Color(clrProgressBar), Theme.Color(clrProgressBarBlend), true);
+
+ if (Mute) {
+ cBitmap bmMute(mute_xpm);
+ pixmapLabelVolume->DrawBitmap(cPoint(geoManager->volumeWidth - 2 * bmMute.Width(), (geoManager->volumeLabelHeight - bmMute.Height()) / 2), bmMute, Theme.Color(clrDiskAlert), clrTransparent);
}
}
diff --git a/volumebox.h b/volumebox.h
index e2618bf..a9c42bd 100644
--- a/volumebox.h
+++ b/volumebox.h
@@ -7,10 +7,10 @@
class cNopacityVolumeBox {
private:
cOsd *osd;
+ int barWidth, barHeight;
cPixmap *pixmapBackgroundVolume;
cPixmap *pixmapProgressBarVolume;
cPixmap *pixmapLabelVolume;
- void DrawProgressBarBackground(int Current, int Total);
public:
cNopacityVolumeBox(cOsd *Osd, const cRect &Rect);
~cNopacityVolumeBox(void);