From 441bb00975dd3b3319eb1bb337282e9367a57bac Mon Sep 17 00:00:00 2001 From: Paul Date: Sun, 26 Apr 2020 10:29:39 -0400 Subject: [PATCH] Begin implementation of HoverStates (#1757) Begin implementation of HoverStates. This change 1. Plubms through hover state API on the skin engine 2. Implements a default hover state 3. Makes CHSwitch2 an accurate client of that 4. Adds bad hover graphics for filter and waveshaper switches Committing here so designers can start using this feature on the switches while we code up other elements. Addresses #1752 --- README.md | 3 + build-osx.sh | 19 ++- .../default.surge-skin/SVG/hover00108.svg | 23 ++++ .../default.surge-skin/SVG/hover00120.svg | 25 ++++ .../data/skins/default.surge-skin/skin.xml | 1 + src/common/gui/CHSwitch2.cpp | 43 +++++++ src/common/gui/CHSwitch2.h | 11 +- src/common/gui/CScalableBitmap.h | 3 +- src/common/gui/CSwitchControl.h | 3 +- src/common/gui/SkinSupport.cpp | 32 +++++ src/common/gui/SkinSupport.h | 13 ++- src/common/gui/SurgeGUIEditor.cpp | 110 +++++++++++------- 12 files changed, 241 insertions(+), 45 deletions(-) create mode 100644 resources/data/skins/default.surge-skin/SVG/hover00108.svg create mode 100644 resources/data/skins/default.surge-skin/SVG/hover00120.svg diff --git a/README.md b/README.md index fb05bbf0ab4..2cdcf5cc19e 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,9 @@ It's what the primary Mac developers use day to day. The simplest approach is to ./build-osx.sh ``` +`build-osx.sh` will give you better output if you first `gem install xcpretty`, the xcodebuild formatter, +and you have your gem environment running. If that doesn't work don't worry - you can still build. + this command will build, but not install, the VST3 and AU components. It has a variety of options which are documented in the `./build-osx.sh --help` screen but a few key ones are: diff --git a/build-osx.sh b/build-osx.sh index 1b3d9da51c7..538b023fdd8 100755 --- a/build-osx.sh +++ b/build-osx.sh @@ -87,6 +87,7 @@ NC=`tput init` prerequisite_check() { + if [ ! -f vst3sdk/LICENSE.txt ]; then echo echo ${RED}ERROR: You have not gotten the submodules required to build Surge. Run the following command to get them.${NC} @@ -100,10 +101,17 @@ prerequisite_check() echo echo ${RED}ERROR: You do not have cmake on your path${NC} echo - echo Please install cmake. "brew install cmake" or visit https://cmake.org + echo Please install cmake. "brew install cmake" or visit https://cmake.org echo exit 1 fi + + if [ ! $(which xcpretty) ]; then + echo + echo ${GREEN}You will get better output if you `brew install xcpretty`${NC} + echo + fi + } @@ -124,7 +132,14 @@ run_cmake_build() # Don't let TEE eat my return status mkdir -p build cmake -GXcode -Bbuild - xcodebuild build -configuration Release -project build/Surge.xcodeproj -target ${target} + + if [ $(which xcpretty) ]; then + set -o pipefail && xcodebuild build -configuration Release -project build/Surge.xcodeproj -target ${target} | xcpretty + else + xcodebuild build -configuration Release -project build/Surge.xcodeproj -target ${target} + fi + + build_suc=$? diff --git a/resources/data/skins/default.surge-skin/SVG/hover00108.svg b/resources/data/skins/default.surge-skin/SVG/hover00108.svg new file mode 100644 index 00000000000..dead29bbc1f --- /dev/null +++ b/resources/data/skins/default.surge-skin/SVG/hover00108.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/data/skins/default.surge-skin/SVG/hover00120.svg b/resources/data/skins/default.surge-skin/SVG/hover00120.svg new file mode 100644 index 00000000000..b0afae2b836 --- /dev/null +++ b/resources/data/skins/default.surge-skin/SVG/hover00120.svg @@ -0,0 +1,25 @@ + + + bmp00120 + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/data/skins/default.surge-skin/skin.xml b/resources/data/skins/default.surge-skin/skin.xml index cbd0ea4a606..da599954a4b 100644 --- a/resources/data/skins/default.surge-skin/skin.xml +++ b/resources/data/skins/default.surge-skin/skin.xml @@ -1,6 +1,7 @@ + diff --git a/src/common/gui/CHSwitch2.cpp b/src/common/gui/CHSwitch2.cpp index 213fe40b29a..7f9959c144e 100644 --- a/src/common/gui/CHSwitch2.cpp +++ b/src/common/gui/CHSwitch2.cpp @@ -3,6 +3,7 @@ //------------------------------------------------------------------------------------------------------- #include "CHSwitch2.h" #include +#include "CScalableBitmap.h" using namespace VSTGUI; @@ -14,6 +15,20 @@ void CHSwitch2::draw(CDrawContext* dc) CPoint where(0, heightOfOneImage * (long)(imgoffset + ((value * (float)(rows * columns - 1) + 0.5f)))); getBackground()->draw(dc, getViewSize(), where, 0xff); + + if( ! lookedForHover && skin.get() ) + { + lookedForHover = true; + hoverBmp = skin->hoverBitmapOverlayForBackgroundBitmap( skinControl, dynamic_cast( getBackground() ), associatedBitmapStore ); + } + + if( hoverBmp && doingHover ) + { + CPoint hwhere(0, heightOfOneImage * + (long)(imgoffset + ((hoverValue * (float)(rows * columns - 1) + 0.5f)))); + + hoverBmp->draw(dc, getViewSize(), hwhere, 0xff); + } } setDirty(false); } @@ -105,6 +120,34 @@ CMouseEventResult CHSwitch2::onMouseMoved(CPoint& where, const CButtonState& but return kMouseEventHandled; } + + if( doingHover ) + { + auto mouseableArea = getMouseableArea(); + double coefX, coefY; + coefX = (double)mouseableArea.getWidth() / (double)columns; + coefY = (double)mouseableArea.getHeight() / (double)rows; + + int y = (int)((where.y - mouseableArea.top) / coefY); + int x = (int)((where.x - mouseableArea.left) / coefX); + + x = limit_range(x, 0, columns - 1); + y = limit_range(y, 0, rows - 1); + + if (columns * rows > 1) + { + float nhoverValue = (float)(x + y * columns) / (float)(columns * rows - 1); + + nhoverValue = limit_range( nhoverValue, 0.f, 1.f ); + + if( nhoverValue != hoverValue ) + { + hoverValue = nhoverValue; + invalid(); + } + } + } + return kMouseEventNotHandled; } bool CHSwitch2::onWheel(const CPoint& where, const float& distance, const CButtonState& buttons) diff --git a/src/common/gui/CHSwitch2.h b/src/common/gui/CHSwitch2.h index dae22613611..cdad930b47f 100644 --- a/src/common/gui/CHSwitch2.h +++ b/src/common/gui/CHSwitch2.h @@ -3,8 +3,9 @@ //------------------------------------------------------------------------------------------------------- #pragma once #include "vstcontrols.h" +#include "SkinSupport.h" -class CHSwitch2 : public VSTGUI::CHorizontalSwitch +class CHSwitch2 : public VSTGUI::CHorizontalSwitch, public Surge::UI::SkinConsumingComponnt { public: CHSwitch2(const VSTGUI::CRect& size, @@ -35,6 +36,11 @@ class CHSwitch2 : public VSTGUI::CHorizontalSwitch bool dragable; bool usesMouseWheel; + bool lookedForHover = false; + CScalableBitmap *hoverBmp = nullptr; + bool doingHover = false; + float hoverValue = 0.0f; + virtual void draw(VSTGUI::CDrawContext* dc) override; virtual VSTGUI::CMouseEventResult onMouseDown(VSTGUI::CPoint& where, @@ -49,10 +55,13 @@ class CHSwitch2 : public VSTGUI::CHorizontalSwitch virtual VSTGUI::CMouseEventResult onMouseEntered (VSTGUI::CPoint& where, const VSTGUI::CButtonState& buttons) override { getFrame()->setCursor( VSTGUI::kCursorHand ); + doingHover = true; return VSTGUI::kMouseEventHandled; } virtual VSTGUI::CMouseEventResult onMouseExited (VSTGUI::CPoint& where, const VSTGUI::CButtonState& buttons) override { getFrame()->setCursor( VSTGUI::kCursorDefault ); + doingHover = false; + invalid(); return VSTGUI::kMouseEventHandled; } diff --git a/src/common/gui/CScalableBitmap.h b/src/common/gui/CScalableBitmap.h index 0e33b21769d..ae6dda89f44 100644 --- a/src/common/gui/CScalableBitmap.h +++ b/src/common/gui/CScalableBitmap.h @@ -50,6 +50,8 @@ class CScalableBitmap : public VSTGUI::CBitmap extraScaleFactor = a; } + int resourceID; + private: struct CPointCompare { @@ -66,7 +68,6 @@ class CScalableBitmap : public VSTGUI::CBitmap int lastSeenZoom, bestFitScaleGroup; int extraScaleFactor; - int resourceID; std::string fname; VSTGUI::CFrame* frame; diff --git a/src/common/gui/CSwitchControl.h b/src/common/gui/CSwitchControl.h index 7c06d394fa1..6c2c244aa0a 100644 --- a/src/common/gui/CSwitchControl.h +++ b/src/common/gui/CSwitchControl.h @@ -3,8 +3,9 @@ //------------------------------------------------------------------------------------------------------- #pragma once #include "vstcontrols.h" +#include "SkinSupport.h" -class CSwitchControl : public VSTGUI::CControl +class CSwitchControl : public VSTGUI::CControl, public Surge::UI::SkinConsumingComponnt { public: CSwitchControl(const VSTGUI::CRect& size, VSTGUI::IControlListener* listener, long tag, VSTGUI::CBitmap* background); diff --git a/src/common/gui/SkinSupport.cpp b/src/common/gui/SkinSupport.cpp index ba67578c063..f53ad47d818 100644 --- a/src/common/gui/SkinSupport.cpp +++ b/src/common/gui/SkinSupport.cpp @@ -8,6 +8,7 @@ #include "UserInteractions.h" #include "UserDefaults.h" #include "UIInstrumentation.h" +#include "CScalableBitmap.h" #if LINUX #include @@ -27,6 +28,9 @@ namespace Surge { namespace UI { + +const std::string Skin::defaultImageIDPrefix = "DEFAULT/"; + SkinDB& Surge::UI::SkinDB::get(SurgeStorage* s) { static SkinDB instance(s); @@ -384,6 +388,11 @@ void Skin::reloadSkin(std::shared_ptr bitmapStore) int idx = std::atoi(d.path().generic_string().c_str() + pos + 3); bitmapStore->loadBitmapByPathForID(d.path().generic_string(), idx); } + else + { + std::string id = defaultImageIDPrefix + d.path().filename().generic_string(); + bitmapStore->loadBitmapByPathForStringID(d.path().generic_string(), id); + } } } } @@ -591,5 +600,28 @@ CScalableBitmap *Skin::backgroundBitmapForControl( Skin::Control::ptr_t c, std:: return bmp; } +CScalableBitmap *Skin::hoverBitmapOverlayForBackgroundBitmap( Skin::Control::ptr_t c, CScalableBitmap *b, std::shared_ptr bitmapStore ) +{ + if( ! bitmapStore.get() ) + { + return nullptr; + } + if( c.get() ) + { + std::cout << "should ask control if it has an opinoin" << std::endl; + } + if( ! b ) + { + return nullptr; + } + std::ostringstream sid; + sid << defaultImageIDPrefix << "hover" << std::setw(5) << std::setfill('0') << b->resourceID << ".svg"; + auto bmp = bitmapStore->getBitmapByStringID( sid.str() ); + if( bmp ) + return bmp; + + return nullptr; +} + } // namespace UI } // namespace Surge diff --git a/src/common/gui/SkinSupport.h b/src/common/gui/SkinSupport.h index cd90facac6f..d16bbade232 100644 --- a/src/common/gui/SkinSupport.h +++ b/src/common/gui/SkinSupport.h @@ -176,6 +176,9 @@ class Skin } CScalableBitmap *backgroundBitmapForControl( Skin::Control::ptr_t c, std::shared_ptr bitmapStore ); + CScalableBitmap *hoverBitmapOverlayForBackgroundBitmap( Skin::Control::ptr_t c, CScalableBitmap *b, std::shared_ptr bitmapStore ); + + static const std::string defaultImageIDPrefix; private: static std::atomic instances; @@ -253,8 +256,16 @@ class SkinConsumingComponnt { virtual ~SkinConsumingComponnt() { } virtual void setSkin( Skin::ptr_t s ) { skin = s; } + virtual void setSkin( Skin::ptr_t s, std::shared_ptr b ) { + skin = s; + associatedBitmapStore = b; + } + virtual void setAssociatedSkinControl( Skin::Control::ptr_t c ) { skinControl = c; }; + virtual void setAssociatedBitmapStore( std::shared_ptr b ) { associatedBitmapStore = b; } protected: - Skin::ptr_t skin; + Skin::ptr_t skin = nullptr; + Skin::Control::ptr_t skinControl = nullptr; + std::shared_ptr associatedBitmapStore = nullptr; }; } } diff --git a/src/common/gui/SurgeGUIEditor.cpp b/src/common/gui/SurgeGUIEditor.cpp index ebb2e975bef..6e44e1e48c8 100644 --- a/src/common/gui/SurgeGUIEditor.cpp +++ b/src/common/gui/SurgeGUIEditor.cpp @@ -299,8 +299,8 @@ SurgeGUIEditor::SurgeGUIEditor(void* effect, SurgeSynthesizer* synth, void* user /* ** See the comment in SurgeParamConfig.h */ - if(Surge::ParamConfig::kHorizontal != VSTGUI::CSlider::kHorizontal || - Surge::ParamConfig::kVertical != VSTGUI::CSlider::kVertical + if((int)Surge::ParamConfig::kHorizontal != (int)VSTGUI::CSlider::kHorizontal || + (int)Surge::ParamConfig::kVertical != (int)VSTGUI::CSlider::kVertical ) { throw new Surge::Error("Software Error: Param MisMaptch" ); @@ -772,6 +772,8 @@ bool SurgeGUIEditor::isControlVisible(ControlGroup controlGroup, int controlGrou return (controlGroupEntry == modsource_editor); case cg_FX: return (controlGroupEntry == current_fx); + default: + return true; } return true; // visible by default @@ -823,10 +825,11 @@ void SurgeGUIEditor::openOrRecreateEditor() if( ( skinTagControl = layoutTagWithSkin( tag_osc_select ) ) == nullptr ) { CRect rect(0, 0, 75, 13); rect.offset(104 - 36, 69); - CControl* oscswitch = new CHSwitch2(rect, this, tag_osc_select, 3, 13, 1, 3, + auto oscswitch = new CHSwitch2(rect, this, tag_osc_select, 3, 13, 1, 3, bitmapStore->getBitmap(IDB_OSCSELECT), nopoint); oscswitch->setValue((float)current_osc / 2.0f); frame->addView(oscswitch); + oscswitch->setSkin(currentSkin,bitmapStore); } if( ( skinTagControl = layoutTagWithSkin( tag_fx_select ) ) == nullptr ) { @@ -903,7 +906,7 @@ void SurgeGUIEditor::openOrRecreateEditor() CRect vurect(763, 0, 763 + 123, 13); vurect.offset(0, 14); vu[0] = new CSurgeVuMeter(vurect); - ((CSurgeVuMeter*)vu[0])->setSkin(currentSkin); + ((CSurgeVuMeter*)vu[0])->setSkin(currentSkin,bitmapStore); ((CSurgeVuMeter*)vu[0])->setType(vut_vu_stereo); frame->addView(vu[0]); @@ -921,7 +924,7 @@ void SurgeGUIEditor::openOrRecreateEditor() vr.offset(0, yofs * synth->fx[current_fx]->vu_ypos(i)); vr.offset(0, 7); vu[i + 1] = new CSurgeVuMeter(vr); - ((CSurgeVuMeter*)vu[i + 1])->setSkin(currentSkin); + ((CSurgeVuMeter*)vu[i + 1])->setSkin(currentSkin,bitmapStore); ((CSurgeVuMeter*)vu[i + 1])->setType(t); frame->addView(vu[i + 1]); } @@ -938,7 +941,7 @@ void SurgeGUIEditor::openOrRecreateEditor() vr.offset(0, yofs * synth->fx[current_fx]->group_label_ypos(i)); CEffectLabel* lb = new CEffectLabel(vr); lb->setLabel(label); - lb->setSkin(currentSkin); + lb->setSkin(currentSkin,bitmapStore); frame->addView(lb); } } @@ -950,13 +953,13 @@ void SurgeGUIEditor::openOrRecreateEditor() .scene[synth->storage.getPatch().scene_active.val.i] .osc[current_osc], &synth->storage); - ((COscillatorDisplay*)oscdisplay)->setSkin( currentSkin ); + ((COscillatorDisplay*)oscdisplay)->setSkin( currentSkin, bitmapStore ); frame->addView(oscdisplay); // 150*b - 16 = 434 (b=3) patchname = new CPatchBrowser(CRect(156, 11, 547, 11 + 28), this, tag_patchname, &synth->storage); - ((CPatchBrowser*)patchname)->setSkin( currentSkin ); + ((CPatchBrowser*)patchname)->setSkin( currentSkin, bitmapStore ); ((CPatchBrowser*)patchname)->setLabel(synth->storage.getPatch().name); ((CPatchBrowser*)patchname)->setCategory(synth->storage.getPatch().category); ((CPatchBrowser*)patchname)->setIDs(synth->current_category_id, synth->patchid); @@ -966,7 +969,7 @@ void SurgeGUIEditor::openOrRecreateEditor() statuspanel = new CStatusPanel(CRect( 560, 1, 595, 54 ), this, tag_statuspanel, &synth->storage, bitmapStore); { CStatusPanel *pb = (CStatusPanel *)statuspanel; - pb->setSkin( currentSkin ); + pb->setSkin( currentSkin, bitmapStore ); pb->setDisplayFeature(CStatusPanel::mpeMode, synth->mpeEnabled); pb->setDisplayFeature(CStatusPanel::tuningMode, ! synth->storage.isStandardTuning); pb->setEditor(this); @@ -977,24 +980,28 @@ void SurgeGUIEditor::openOrRecreateEditor() CHSwitch2* mp_cat = new CHSwitch2(CRect(157, 41, 157 + 37, 41 + 12), this, tag_mp_category, 2, 12, 1, 2, bitmapStore->getBitmap(IDB_BUTTON_MINUSPLUS), nopoint, false); - mp_cat->setUsesMouseWheel(false); // mousewheel on category and patch buttons is undesirable + mp_cat->setUsesMouseWheel(false); // mousewheel on category and patch buttons is undesirable + mp_cat->setSkin( currentSkin, bitmapStore ); frame->addView(mp_cat); CHSwitch2* mp_patch = new CHSwitch2(CRect(242, 41, 242 + 37, 41 + 12), this, tag_mp_patch, 2, 12, 1, 2, bitmapStore->getBitmap(IDB_BUTTON_MINUSPLUS), nopoint, false); - mp_patch->setUsesMouseWheel(false);// mousewheel on category and patch buttons is undesirable + mp_patch->setUsesMouseWheel(false);// mousewheel on category and patch buttons is undesirable + mp_patch->setSkin( currentSkin, bitmapStore ); frame->addView(mp_patch); int jogx = 759 + 131 - 39, jogy = 182 + 15; CHSwitch2* mp_jogfx = new CHSwitch2(CRect(jogx, jogy, jogx + 37, jogy + 12), this, tag_mp_jogfx, 2, 12, 1, 2, bitmapStore->getBitmap(IDB_BUTTON_MINUSPLUS), nopoint, false); - mp_jogfx->setUsesMouseWheel(false); // mousewheel on category and patch buttons is undesirable + mp_jogfx->setUsesMouseWheel(false); // mousewheel on category and patch buttons is undesirable + mp_jogfx->setSkin( currentSkin, bitmapStore ); frame->addView(mp_jogfx); CHSwitch2* b_store = new CHSwitch2(CRect(547 - 37, 41, 547, 41 + 12), this, tag_store, 1, 12, 1, 1, bitmapStore->getBitmap(IDB_BUTTON_STORE), nopoint, false); + b_store->setSkin( currentSkin, bitmapStore ); frame->addView(b_store); memset(param, 0, n_paramslots * sizeof(void*)); @@ -1051,7 +1058,8 @@ void SurgeGUIEditor::openOrRecreateEditor() { CSurgeSlider* hs = new CSurgeSlider(CPoint(c->x, c->y), style, this, p->id + start_paramtags, true, bitmapStore); - hs->setSkin(currentSkin); + hs->setSkin(currentSkin,bitmapStore); + hs->setAssociatedSkinControl(c); hs->setMoveRate(p->moverate); if( p->can_temposync() ) hs->setTempoSync(p->temposync); @@ -1091,6 +1099,8 @@ void SurgeGUIEditor::openOrRecreateEditor() &synth->storage.getPatch().stepsequences[current_scene][lfo_id], bitmapStore); slfo->setSkin( currentSkin ); + slfo->setAssociatedSkinControl(c); + slfo->setAssociatedBitmapStore(bitmapStore); lfodisplay = slfo; frame->addView(slfo); nonmod_param[i] = slfo; @@ -1107,6 +1117,8 @@ void SurgeGUIEditor::openOrRecreateEditor() { CSwitchControl* hsw = new CSwitchControl(rect, this, p->id + start_paramtags, bmp ); hsw->setValue(p->get_value_f01()); + hsw->setSkin(currentSkin,bitmapStore); + hsw->setAssociatedSkinControl(c); frame->addView(hsw); nonmod_param[i] = hsw; @@ -1153,15 +1165,18 @@ void SurgeGUIEditor::openOrRecreateEditor() auto subpixmaps = currentSkin->propertyValue( c, "subpixmaps", "1" ); auto rows = currentSkin->propertyValue( c, "rows", "1" ); auto cols = currentSkin->propertyValue( c, "columns", "1" ); - CControl* hsw = new CHSwitch2(rect, this, p->id + start_paramtags, - std::atoi(subpixmaps.c_str()), c->h, - std::atoi(rows.c_str()), std::atoi(cols.c_str()), - bmp, nopoint, - true); // FIXME - this needs parameterization + auto hsw = new CHSwitch2(rect, this, p->id + start_paramtags, + std::atoi(subpixmaps.c_str()), c->h, + std::atoi(rows.c_str()), std::atoi(cols.c_str()), + bmp, nopoint, + true); // FIXME - this needs parameterization hsw->setValue(p->get_value_f01()); frame->addView(hsw); nonmod_param[i] = hsw; + hsw->setSkin( currentSkin, bitmapStore ); + hsw->setAssociatedSkinControl(c); } + } else { @@ -1210,12 +1225,14 @@ void SurgeGUIEditor::openOrRecreateEditor() { CRect rect(0, 0, 129, 18); rect.offset(p->posx - 2, p->posy + 1); - CControl* hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 10, 18, 1, 10, + auto hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 10, 18, 1, 10, bitmapStore->getBitmap(IDB_FILTERBUTTONS), nopoint, true); rect(3, 0, 124, 14); rect.offset(p->posx, p->posy); hsw->setMouseableArea(rect); hsw->setValue(p->get_value_f01()); + hsw->setSkin( currentSkin, bitmapStore ); + frame->addView(hsw); nonmod_param[i] = hsw; } @@ -1278,9 +1295,10 @@ void SurgeGUIEditor::openOrRecreateEditor() { CRect rect(0, 0, 22, 15); rect.offset(p->posx, p->posy); - CControl* hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 3, 15, 1, 3, + auto hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 3, 15, 1, 3, bitmapStore->getBitmap(IDB_OSCROUTE), nopoint, true); hsw->setValue(p->get_value_f01()); + hsw->setSkin( currentSkin, bitmapStore ); frame->addView(hsw); nonmod_param[i] = hsw; } @@ -1299,6 +1317,7 @@ void SurgeGUIEditor::openOrRecreateEditor() CHSwitch2* hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 3, 14, 1, 3, bitmapStore->getBitmap(IDB_ENVSHAPE), nopoint, true); hsw->setValue(p->get_value_f01()); + hsw->setSkin( currentSkin, bitmapStore ); if (p->name[0] == 'd') hsw->imgoffset = 3; else if (p->name[0] == 'r') @@ -1316,6 +1335,7 @@ void SurgeGUIEditor::openOrRecreateEditor() CHSwitch2* hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 2, 15, 2, 1, bitmapStore->getBitmap(IDB_ENVMODE), nopoint, false); hsw->setValue(p->get_value_f01()); + hsw->setSkin( currentSkin, bitmapStore ); frame->addView(hsw); nonmod_param[i] = hsw; @@ -1325,9 +1345,10 @@ void SurgeGUIEditor::openOrRecreateEditor() { CRect rect(0, 0, 51, 39); rect.offset(p->posx, p->posy); - CControl* hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 3, 39, 3, 1, + auto hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 3, 39, 3, 1, bitmapStore->getBitmap(IDB_LFOTRIGGER), nopoint, true); hsw->setValue(p->get_value_f01()); + hsw->setSkin( currentSkin, bitmapStore ); frame->addView(hsw); nonmod_param[i] = hsw; } @@ -1398,7 +1419,7 @@ void SurgeGUIEditor::openOrRecreateEditor() CControl* hsw = new COscMenu( rect, this, tag_osc_menu, &synth->storage, &synth->storage.getPatch().scene[current_scene].osc[current_osc], bitmapStore); - ((COscMenu*)hsw)->setSkin(currentSkin); + ((COscMenu*)hsw)->setSkin(currentSkin,bitmapStore); hsw->setValue(p->get_value_f01()); frame->addView(hsw); } @@ -1412,7 +1433,7 @@ void SurgeGUIEditor::openOrRecreateEditor() CControl* m = new CFxMenu(rect, this, tag_fx_menu, &synth->storage, &synth->storage.getPatch().fx[current_fx], &synth->fxsync[current_fx], current_fx); - ((CFxMenu*)m)->setSkin(currentSkin); + ((CFxMenu*)m)->setSkin(currentSkin,bitmapStore); ((CFxMenu*)m)->selectedIdx = this->selectedFX[current_fx]; m->setValue(p->get_value_f01()); frame->addView(m); @@ -1423,11 +1444,12 @@ void SurgeGUIEditor::openOrRecreateEditor() { CRect rect(0, 0, 28, 47); rect.offset(p->posx, p->posy); - CControl* hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 6, 47, 6, 1, + auto hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 6, 47, 6, 1, bitmapStore->getBitmap(IDB_WAVESHAPER), nopoint, true); rect(0, 0, 28, 47); rect.offset(p->posx, p->posy); hsw->setMouseableArea(rect); + hsw->setSkin( currentSkin, bitmapStore ); hsw->setValue(p->get_value_f01()); frame->addView(hsw); nonmod_param[i] = hsw; @@ -1437,10 +1459,11 @@ void SurgeGUIEditor::openOrRecreateEditor() { CRect rect(0, 0, 50, 47); rect.offset(p->posx, p->posy); - CControl* hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 6, 47, 6, 1, + auto hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 6, 47, 6, 1, bitmapStore->getBitmap(IDB_POLYMODE), nopoint, true); rect(0, 0, 50, 47); rect.offset(p->posx, p->posy); + hsw->setSkin( currentSkin, bitmapStore ); hsw->setMouseableArea(rect); hsw->setValue(p->get_value_f01()); frame->addView(hsw); @@ -1451,12 +1474,13 @@ void SurgeGUIEditor::openOrRecreateEditor() { CRect rect(0, 0, 135, 27); rect.offset(p->posx, p->posy); - CControl* hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 4, 27, 1, 4, + auto hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 4, 27, 1, 4, bitmapStore->getBitmap(IDB_FXBYPASS), nopoint, true); fxbypass_tag = p->id + start_paramtags; rect(2, 2, 133, 25); rect.offset(p->posx, p->posy); hsw->setMouseableArea(rect); + hsw->setSkin( currentSkin, bitmapStore ); hsw->setValue(p->get_value_f01()); frame->addView(hsw); nonmod_param[i] = hsw; @@ -1469,11 +1493,12 @@ void SurgeGUIEditor::openOrRecreateEditor() oid = IDB_OCTAVES_OSC; CRect rect(0, 0, 96, 18); rect.offset(p->posx, p->posy + 1); - CControl* hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 7, 18, 1, 7, + auto hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 7, 18, 1, 7, bitmapStore->getBitmap(oid), nopoint, true); rect(1, 0, 91, 14); rect.offset(p->posx, p->posy); hsw->setMouseableArea(rect); + hsw->setSkin( currentSkin, bitmapStore ); hsw->setValue(p->get_value_f01()); frame->addView(hsw); nonmod_param[i] = hsw; @@ -1483,9 +1508,10 @@ void SurgeGUIEditor::openOrRecreateEditor() { CRect rect(0, 0, 134, 52); rect.offset(p->posx, p->posy); - CControl* hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 8, 52, 1, 8, + auto hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 8, 52, 1, 8, bitmapStore->getBitmap(IDB_FBCONFIG), nopoint, true); hsw->setValue(p->get_value_f01()); + hsw->setSkin( currentSkin, bitmapStore ); frame->addView(hsw); nonmod_param[i] = hsw; filterblock_tag = p->id + start_paramtags; @@ -1495,9 +1521,10 @@ void SurgeGUIEditor::openOrRecreateEditor() { CRect rect(0, 0, 134, 52); rect.offset(p->posx, p->posy); - CControl* hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 4, 52, 1, 4, + auto hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 4, 52, 1, 4, bitmapStore->getBitmap(IDB_FMCONFIG), nopoint, true); hsw->setValue(p->get_value_f01()); + hsw->setSkin( currentSkin, bitmapStore ); frame->addView(hsw); nonmod_param[i] = hsw; } @@ -1506,11 +1533,12 @@ void SurgeGUIEditor::openOrRecreateEditor() { CRect rect(0, 0, 36, 33); rect.offset(p->posx, p->posy); - CControl* hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 4, 33, 4, 1, + auto hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 4, 33, 4, 1, bitmapStore->getBitmap(IDB_SCENEMODE), nopoint, true); rect(1, 1, 35, 32); rect.offset(p->posx, p->posy); hsw->setMouseableArea(rect); + hsw->setSkin( currentSkin, bitmapStore ); /* ** SceneMode is special now because we have a streaming vs UI difference. @@ -1545,6 +1573,7 @@ void SurgeGUIEditor::openOrRecreateEditor() &synth->storage.getPatch().stepsequences[current_scene][lfo_id], bitmapStore); slfo->setSkin( currentSkin ); + slfo->setAssociatedBitmapStore( bitmapStore ); lfodisplay = slfo; frame->addView(slfo); nonmod_param[i] = slfo; @@ -1555,8 +1584,9 @@ void SurgeGUIEditor::openOrRecreateEditor() { CRect rect(0, 0, 51, 27); rect.offset(p->posx, p->posy); - CControl* sceneswitch = new CHSwitch2(rect, this, tag_scene_select, 2, 27, 1, 2, + auto sceneswitch = new CHSwitch2(rect, this, tag_scene_select, 2, 27, 1, 2, bitmapStore->getBitmap(IDB_SCENESWITCH), nopoint); + sceneswitch->setSkin( currentSkin, bitmapStore ); sceneswitch->setValue(p->get_value_f01()); rect(1, 1, 50, 26); rect.offset(p->posx, p->posy); @@ -1568,9 +1598,10 @@ void SurgeGUIEditor::openOrRecreateEditor() { CRect rect(0, 0, 135, 12); rect.offset(p->posx, p->posy); - CControl* hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 3, 12, 1, 3, + auto hsw = new CHSwitch2(rect, this, p->id + start_paramtags, 3, 12, 1, 3, bitmapStore->getBitmap(IDB_CHARACTER), nopoint, true); hsw->setValue(p->get_value_f01()); + hsw->setSkin( currentSkin, bitmapStore ); frame->addView(hsw); nonmod_param[i] = hsw; } @@ -1580,7 +1611,7 @@ void SurgeGUIEditor::openOrRecreateEditor() CRect rect(0, 0, 43, 14); rect.offset(p->posx, p->posy); CNumberField* key = new CNumberField(rect, this, p->id + start_paramtags); - key->setSkin(currentSkin); + key->setSkin(currentSkin,bitmapStore); auto sm = this->synth->storage.getPatch().scenemode.val.i; switch(sm) @@ -1609,7 +1640,7 @@ void SurgeGUIEditor::openOrRecreateEditor() CRect rect(0, 0, 43, 14); rect.offset(p->posx, p->posy); CNumberField* key = new CNumberField(rect, this, p->id + start_paramtags); - key->setSkin(currentSkin); + key->setSkin(currentSkin,bitmapStore); key->setControlMode(cm_notename); // key->altlook = true; key->setValue(p->get_value_f01()); @@ -1622,7 +1653,7 @@ void SurgeGUIEditor::openOrRecreateEditor() CRect rect(0, 0, 24, 10); rect.offset(p->posx, p->posy); CNumberField* pbd = new CNumberField(rect, this, p->id + start_paramtags); - pbd->setSkin(currentSkin); + pbd->setSkin(currentSkin,bitmapStore); pbd->altlook = true; pbd->setControlMode(cm_pbdepth); pbd->setValue(p->get_value_f01()); @@ -1634,7 +1665,7 @@ void SurgeGUIEditor::openOrRecreateEditor() CRect rect(0, 0, 43, 14); rect.offset(p->posx, p->posy); CNumberField* key = new CNumberField(rect, this, p->id + start_paramtags); - key->setSkin(currentSkin); + key->setSkin(currentSkin,bitmapStore); key->setControlMode(cm_polyphony); // key->setLabel("POLY"); // key->setLabelPlacement(lp_below); @@ -1650,7 +1681,7 @@ void SurgeGUIEditor::openOrRecreateEditor() CSurgeSlider* hs = new CSurgeSlider(CPoint(p->posx, p->posy + p->posy_offset * yofs), style, this, p->id + start_paramtags, true, bitmapStore); - hs->setSkin(currentSkin); + hs->setSkin(currentSkin,bitmapStore); hs->setModMode(mod_editor ? 1 : 0); hs->setModValue(synth->getModulation(p->id, modsource)); hs->setModPresent(synth->isModDestUsed(p->id)); @@ -1672,7 +1703,7 @@ void SurgeGUIEditor::openOrRecreateEditor() // Even if current modsource isn't modulating me, something else may be hs->setModPresent(synth->isModDestUsed(p->id)); - hs->setSkin(currentSkin); + hs->setSkin(currentSkin,bitmapStore); hs->setValue(p->get_value_f01()); hs->setDefaultValue(p->get_default_value_f01()); hs->setLabel(p->get_name()); @@ -1720,6 +1751,7 @@ void SurgeGUIEditor::openOrRecreateEditor() CHSwitch2* b_settingsMenu = new CHSwitch2(aboutbrect, this, tag_settingsmenu, 1, 27, 1, 1, bitmapStore->getBitmap(IDB_BUTTON_MENU), nopoint, false); + b_settingsMenu->setSkin( currentSkin, bitmapStore ); frame->addView(b_settingsMenu); infowindow = new CParameterTooltip(CRect(0, 0, 0, 0)); @@ -1728,7 +1760,7 @@ void SurgeGUIEditor::openOrRecreateEditor() CRect wsize(0, 0, WINDOW_SIZE_X, WINDOW_SIZE_Y); aboutbox = new CAboutBox(aboutbrect, this, 0, 0, wsize, nopoint, bitmapStore->getBitmap(IDB_ABOUT)); - ((CAboutBox *)aboutbox)->setSkin(currentSkin); + ((CAboutBox *)aboutbox)->setSkin(currentSkin,bitmapStore); frame->addView(aboutbox);