From 84b7b11186b5704f894786ab49e49836bde374b4 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. Former-commit-id: a2a858c26719c32a55904661ee9b7ca12eefdc66 [formerly 40e18d14aa997b9e10ae22ac71160c92864b4f2b] Former-commit-id: 40ef5151482e5843a0503ce5d2fb87d0a0d19eaa Former-commit-id: df1b0bc9beb018eb159d39e1000c085d465c2378 --- 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) };