Skip to content

Commit

Permalink
Add a content menu to both the patch browser and WT browser.
Browse files Browse the repository at this point in the history
Seems like a simple change, but I wanted the URL in one location
so had to clean up some fragile headers when I changed the link pattern
of SurgeGUIEditor also

Closes surge-synthesizer#1182
  • Loading branch information
baconpaul committed Sep 17, 2019
1 parent 659e681 commit 8f70926
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/common/dsp/AdsrEnvelope.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//-------------------------------------------------------------------------------------------------------
#pragma once

#include <algorithm> // for std::min
#include "DspUtilities.h"
#include "SurgeStorage.h"
#include "SurgeVoiceState.h"
Expand Down
2 changes: 2 additions & 0 deletions src/common/dsp/Oscillator.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include "SurgeStorage.h"
#include "DspUtilities.h"
#include <vt_dsp/lipol.h>
Expand Down
9 changes: 9 additions & 0 deletions src/common/gui/COscillatorDisplay.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//-------------------------------------------------------------------------------------------------------
// Copyright 2005 Claes Johanson & Vember Audio
//-------------------------------------------------------------------------------------------------------
#include "SurgeGUIEditor.h"
#include "COscillatorDisplay.h"
#include "Oscillator.h"
#include <time.h>
Expand Down Expand Up @@ -692,6 +693,14 @@ void COscillatorDisplay::populateMenu(COptionMenu* contextMenu, int selectedItem
auto action = [this](CCommandMenuItem* item) { this->loadWavetableFromFile(); };
actionItem->setActions(action, nullptr);
contextMenu->addEntry(actionItem);

auto contentItem = new CCommandMenuItem(CCommandMenuItem::Desc("Download Additional Content"));
auto contentAction = [](CCommandMenuItem *item)
{
Surge::UserInteractions::openURL(SurgeGUIEditor::additionalContentURL);
};
contentItem->setActions(contentAction,nullptr);
contextMenu->addEntry(contentItem);
}

bool COscillatorDisplay::populateMenuForCategory(COptionMenu* contextMenu,
Expand Down
13 changes: 12 additions & 1 deletion src/common/gui/CPatchBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// Copyright 2005 Claes Johanson & Vember Audio
//-------------------------------------------------------------------------------------------------------
#include "CPatchBrowser.h"

#include "UserInteractions.h"
#include "SurgeGUIEditor.h"
#include <vector>

using namespace VSTGUI;
Expand Down Expand Up @@ -109,6 +110,16 @@ CMouseEventResult CPatchBrowser::onMouseDown(CPoint& where, const CButtonState&
}
// contextMenu->addEntry("refresh list");


contextMenu->addSeparator();
auto contentItem = new CCommandMenuItem(CCommandMenuItem::Desc("Download Additional Content"));
auto contentAction = [](CCommandMenuItem *item)
{
Surge::UserInteractions::openURL(SurgeGUIEditor::additionalContentURL);
};
contentItem->setActions(contentAction,nullptr);
contextMenu->addEntry(contentItem);

getFrame()->addView(contextMenu); // add to frame
contextMenu->setDirty();
contextMenu->popup();
Expand Down
7 changes: 5 additions & 2 deletions src/common/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3003,8 +3003,8 @@ void SurgeGUIEditor::showSettingsMenu(CRect &menuRect)
});
eid++;

addCallbackMenu(settingsMenu, "Download Extra Content", []() {
Surge::UserInteractions::openURL("https://github.com/surge-synthesizer/surge-synthesizer.github.io/wiki/Additional-Content");
addCallbackMenu(settingsMenu, "Download Additional Content", []() {
Surge::UserInteractions::openURL(SurgeGUIEditor::additionalContentURL);
});
eid++;

Expand Down Expand Up @@ -3173,4 +3173,7 @@ Steinberg::tresult PLUGIN_API SurgeGUIEditor::onSize(Steinberg::ViewRect* newSiz

#endif

std::string SurgeGUIEditor::additionalContentURL = "https://github.com/surge-synthesizer/surge-synthesizer.github.io/wiki/Additional-Content";
;

//------------------------------------------------------------------------------------------------
7 changes: 7 additions & 0 deletions src/common/gui/SurgeGUIEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ typedef VSTGUI::PluginGUIEditor EditorType;
#include "SurgeSynthesizer.h"

#include <vector>
#include <string>

class SurgeGUIEditor : public EditorType, public VSTGUI::IControlListener, public VSTGUI::IKeyboardHook
{
Expand Down Expand Up @@ -183,6 +184,12 @@ class SurgeGUIEditor : public EditorType, public VSTGUI::IControlListener, publi
void showTuningMenu(VSTGUI::CPoint &where);
void tuningFileDropped(std::string fn);
std::string tuningCacheForToggle = "";

/*
** Menu and Manual URLs
*/
public:
static std::string additionalContentURL;

private:
/**
Expand Down

0 comments on commit 8f70926

Please sign in to comment.