-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tuning Patches, Status Panel, and Patch Versions (#1038)
This commit sets up a display of statuses in the synth so we can bring to the front thigns like MPE and Tuning and bind the menus more comprehensively. It also brings to bear the ability (optionally) to store a tuning in a patch and the correct state machine for what to do when loading a patch with tuning with tuning active. It almost completely addresses the remainder of #828 Addresses the streaming incompatability in #1035 Still outstanding is optionally a "lock" and to apply the streaming version option to FX (which is #1037) Handle streaming revision parameter set changes in OSCes. Deals with
- Loading branch information
Showing
14 changed files
with
454 additions
and
101 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#include "CStatusPanel.h" | ||
#include "RuntimeFont.h" | ||
#include "SurgeGUIEditor.h" | ||
|
||
using namespace VSTGUI; | ||
|
||
void CStatusPanel::draw( VSTGUI::CDrawContext *dc ) | ||
{ | ||
auto size = getViewSize(); | ||
|
||
dc->setFont(displayFont); | ||
auto sw = dc->getStringWidth("Status"); | ||
dc->setFontColor(kBlackCColor); | ||
dc->drawString("Status", CPoint( size.left + size.getWidth()/2 - sw/2, size.top + 8 ), true ); | ||
|
||
std::string labs[numDisplayFeatures]; | ||
labs[mpeMode] = "mpe"; | ||
labs[tuningMode] = "tun"; | ||
int y0 = 13; | ||
int boxSize = 13; | ||
for( int i=0; i<numDisplayFeatures; ++i ) | ||
{ | ||
int xp = size.left + 2; | ||
int yp = size.top + y0 + i * boxSize; | ||
int w = size.getWidth() - 4;; | ||
int h = boxSize - 2; | ||
if( i == mpeMode ) | ||
mpeBox = CRect(xp,yp,xp+w,yp+h); | ||
if( i == tuningMode ) | ||
tuningBox = CRect(xp,yp,xp+w,yp+h); | ||
|
||
auto hlbg = true; | ||
auto ol = CColor(0x97, 0x97, 0x97 ); | ||
auto bg = CColor(0xe3, 0xe3, 0xe3 ); | ||
auto fg = kBlackCColor; | ||
auto hl = CColor(0xff, 0x9A, 0x10 ); | ||
if( ! dispfeatures[i] ) | ||
{ | ||
hlbg = false; | ||
} | ||
|
||
dc->setFrameColor(bg);; | ||
auto p = dc->createRoundRectGraphicsPath(CRect(xp,yp,xp+w,yp+h), 5 ); | ||
dc->setFillColor(bg);; | ||
dc->drawGraphicsPath(p, CDrawContext::kPathFilled); | ||
dc->setFrameColor(ol); | ||
dc->drawGraphicsPath(p, CDrawContext::kPathStroked); | ||
p->forget(); | ||
|
||
if( hlbg ) | ||
{ | ||
auto p = dc->createRoundRectGraphicsPath(CRect(xp+2,yp+2,xp+w-2,yp+h-2), 3 ); | ||
dc->setFillColor(hl); | ||
dc->drawGraphicsPath(p, CDrawContext::kPathFilled); | ||
p->forget(); | ||
} | ||
dc->setFont(displayFont); | ||
auto sw = dc->getStringWidth(labs[i].c_str()); | ||
dc->setFontColor(fg); | ||
dc->drawString(labs[i].c_str(), CPoint( xp + w/2 - sw/2, yp + h - 2 ), true ); | ||
} | ||
} | ||
|
||
VSTGUI::CMouseEventResult CStatusPanel::onMouseDown(VSTGUI::CPoint& where, const VSTGUI::CButtonState& button) | ||
{ | ||
if( mpeBox.pointInside(where) && editor ) | ||
{ | ||
if( button & kLButton ) | ||
{ | ||
editor->toggleMPE(); | ||
} | ||
else if( button & kRButton ) | ||
{ | ||
editor->showMPEMenu(where); | ||
} | ||
return kMouseDownEventHandledButDontNeedMovedOrUpEvents; | ||
} | ||
|
||
if( tuningBox.pointInside(where) && editor ) | ||
{ | ||
if( button & kLButton ) | ||
{ | ||
editor->toggleTuning(); | ||
} | ||
else if( button & kRButton ) | ||
{ | ||
editor->showTuningMenu(where); | ||
} | ||
return kMouseDownEventHandledButDontNeedMovedOrUpEvents; | ||
} | ||
|
||
return CControl::onMouseDown(where, button); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
//------------------------------------------------------------------------------------------------------- | ||
// Copyright 2005 Claes Johanson & Vember Audio | ||
//------------------------------------------------------------------------------------------------------- | ||
#pragma once | ||
#include "SurgeStorage.h" | ||
#include "vstcontrols.h" | ||
|
||
class SurgeGUIEditor; | ||
|
||
class CStatusPanel : public VSTGUI::CControl | ||
{ | ||
public: | ||
|
||
typedef enum { | ||
mpeMode, | ||
tuningMode, | ||
numDisplayFeatures | ||
} DisplayFeatures; | ||
|
||
CStatusPanel(const VSTGUI::CRect& size, VSTGUI::IControlListener* listener, long tag, SurgeStorage* storage) | ||
: VSTGUI::CControl(size, listener, tag, 0) | ||
{ | ||
for( auto i=0; i<numDisplayFeatures; ++i ) | ||
dispfeatures[i] = false; | ||
|
||
} | ||
|
||
void setDisplayFeature( DisplayFeatures df, bool v ) | ||
{ | ||
if( dispfeatures[df] != v ) | ||
{ | ||
dispfeatures[df] = v; | ||
invalid(); | ||
} | ||
} | ||
|
||
void setEditor(SurgeGUIEditor *e) | ||
{ | ||
editor = e; | ||
} | ||
|
||
virtual void draw(VSTGUI::CDrawContext* dc); | ||
VSTGUI::CMouseEventResult onMouseDown(VSTGUI::CPoint& where, const VSTGUI::CButtonState& button); | ||
|
||
protected: | ||
bool dispfeatures[numDisplayFeatures]; | ||
SurgeStorage* storage = nullptr; | ||
SurgeGUIEditor *editor = nullptr; | ||
VSTGUI::CRect mpeBox, tuningBox, tuningLock; | ||
|
||
|
||
CLASS_METHODS(CStatusPanel, VSTGUI::CControl) | ||
}; |
Oops, something went wrong.