From 40e18d14aa997b9e10ae22ac71160c92864b4f2b Mon Sep 17 00:00:00 2001 From: rghvdberg Date: Wed, 13 Feb 2019 00:45:33 +0100 Subject: [PATCH] fix #544 Inactive buttons [Linux] (#588) Solo, Mute, and other CSwitchControl buttons were inactive on Linux because CScalableBitmap returns size 0,0 for all bitmaps on Linux. This diff doesn't solve that problem but accommodates it by making CSwitchControl work like the other switch controls; using a constructor specified size (in this case the size of the view rectangle) to determine how much to translate the switching image. This makes solo, mute, and others work on Linux. Closes #544 by making those buttons inactive. --- src/common/gui/CSwitchControl.cpp | 5 +++-- src/common/gui/CSwitchControl.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/gui/CSwitchControl.cpp b/src/common/gui/CSwitchControl.cpp index dbf46dc1389..acc92a03937 100644 --- a/src/common/gui/CSwitchControl.cpp +++ b/src/common/gui/CSwitchControl.cpp @@ -10,7 +10,8 @@ CSwitchControl::CSwitchControl(const CRect& size, { down = false; is_itype = false; -} + heightOfSingleImage = size.getHeight(); + } void CSwitchControl::draw(CDrawContext* dc) { @@ -26,7 +27,7 @@ void CSwitchControl::draw(CDrawContext* dc) } else { - CPoint where(0, (down ? (pBackground->getHeight() / 2) : 0)); + CPoint where(0, (down ? heightOfSingleImage : 0)); pBackground->draw(dc, size, where, 0xff); } } diff --git a/src/common/gui/CSwitchControl.h b/src/common/gui/CSwitchControl.h index 28c348985b4..ea5081f562c 100644 --- a/src/common/gui/CSwitchControl.h +++ b/src/common/gui/CSwitchControl.h @@ -23,6 +23,7 @@ class CSwitchControl : public VSTGUI::CControl private: bool down; + float heightOfSingleImage; CLASS_METHODS(CSwitchControl, VSTGUI::CControl) };