Skip to content

Commit

Permalink
Implement a variety of small UI changes (#1019)
Browse files Browse the repository at this point in the history
1. Mouse wheel adjusts control region (Addressed #1009)
2. Add a "set default zoom to..." option for users on hosts
   where zoom doesn't work. Closes #1013.
  • Loading branch information
baconpaul authored Aug 12, 2019
1 parent 058318b commit 9a2e69e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/common/gui/CModulationSourceButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,4 +343,15 @@ double CModulationSourceButton::getMouseDeltaScaling(CPoint& where, const CButto
return scaling;
}

bool CModulationSourceButton::onWheel(const VSTGUI::CPoint& where, const float &distance, const VSTGUI::CButtonState& buttons)
{
value += distance / (double)(getWidth());
value = limit_range(value, 0.f, 1.f);
event_is_drag = true;
invalid();
if (listener)
listener->valueChanged(this);
return true;
}

//------------------------------------------------------------------------------------------------
1 change: 1 addition & 0 deletions src/common/gui/CModulationSourceButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class CModulationSourceButton : public CCursorHidingControl

virtual void onMouseMoveDelta(VSTGUI::CPoint& where, const VSTGUI::CButtonState& buttons, double dx, double dy);
virtual double getMouseDeltaScaling(VSTGUI::CPoint& where, const VSTGUI::CButtonState& buttons);
virtual bool onWheel(const VSTGUI::CPoint& where, const float &distance, const VSTGUI::CButtonState& buttons);

int state, msid, controlstate;

Expand Down
12 changes: 11 additions & 1 deletion src/common/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2703,7 +2703,17 @@ void SurgeGUIEditor::showSettingsMenu(CRect &menuRect)
zoomSubMenu->addEntry(defaultZ);
zid++;

settingsMenu->addEntry(zoomSubMenu, "Zoom");
addCallbackMenu(zoomSubMenu, "Set default zoom to ...", [this]() {
// FIXME! This won't work on linux
char c[256];
snprintf(c, 256, "%d", this->zoomFactor );
spawn_miniedit_text(c, 16);
int newVal = ::atoi(c);
Surge::Storage::updateUserDefaultValue(&(this->synth->storage), "defaultZoom", newVal);
});
zid++;

settingsMenu->addEntry(zoomSubMenu, "Zoom" );
eid++;
}

Expand Down

0 comments on commit 9a2e69e

Please sign in to comment.