Skip to content

Commit

Permalink
The Big UI Move and Namespace Refactor (surge-synthesizer#1154)
Browse files Browse the repository at this point in the history
* The Big UI Move and Namespace Refactor

Getting tired of it being organized wrong. So this commit
moves all the files, corrects the namespaces, does things
like rename "Multi" to "Edit", and more.

There is zero functional change here. This commit is just
file moves and renames.

I have some more refactors comingup but want them in separate
commits, so push this one.

Closes surge-synthesizer#1111
  • Loading branch information
baconpaul authored Aug 19, 2024
1 parent 987ba99 commit 9daa169
Show file tree
Hide file tree
Showing 59 changed files with 521 additions and 527 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ jobs:
juce_style: FALSE
installer_name: ""
installer_dir: clapfirst
- name: Juce Style
juce_style: TRUE
installer_name: "OldJuceStyle-"
installer_dir: jucestyle
#- name: Juce Style
# juce_style: TRUE
# installer_name: "OldJuceStyle-"
# installer_dir: jucestyle

steps:
- name: Checkout code
Expand Down
15 changes: 8 additions & 7 deletions clients/clap-first/scxt-juce-standalone/scxt-juce-standalone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "version.h"

#include "engine/engine.h"
#include "components/SCXTEditor.h"
#include "app/SCXTEditor.h"
#include "sst/voicemanager/midi1_to_voicemanager.h"

using namespace juce;
Expand All @@ -52,7 +52,8 @@ struct SCXTApplicationWindow : juce::DocumentWindow, juce::Button::Listener
void paint(juce::Graphics &g) override { g.fillAll(juce::Colours::red); }
void resized() override
{
onto.setBounds(0, 0, scxt::ui::SCXTEditor::edWidth, scxt::ui::SCXTEditor::edHeight);
onto.setBounds(0, 0, scxt::ui::app::SCXTEditor::edWidth,
scxt::ui::app::SCXTEditor::edHeight);
}
};
SCXTApplicationWindow()
Expand All @@ -65,15 +66,15 @@ struct SCXTApplicationWindow : juce::DocumentWindow, juce::Button::Listener
engine = std::make_unique<scxt::engine::Engine>();
engine->runningEnvironment = "Temporary SCXT Standalone";

editor = std::make_unique<scxt::ui::SCXTEditor>(
editor = std::make_unique<scxt::ui::app::SCXTEditor>(
*(engine->getMessageController()), *(engine->defaults), *(engine->getSampleManager()),
*(engine->getBrowser()), engine->sharedUIMemoryState);
editorHolder = std::make_unique<Intermediate>(*editor);
editor->onZoomChanged = [this](auto f) {
this->setSize(scxt::ui::SCXTEditor::edWidth * f,
scxt::ui::SCXTEditor::edHeight * f + getTitleBarHeight());
this->setSize(scxt::ui::app::SCXTEditor::edWidth * f,
scxt::ui::app::SCXTEditor::edHeight * f + getTitleBarHeight());
};
editor->setSize(scxt::ui::SCXTEditor::edWidth, scxt::ui::SCXTEditor::edHeight);
editor->setSize(scxt::ui::app::SCXTEditor::edWidth, scxt::ui::app::SCXTEditor::edHeight);
Component::addAndMakeVisible(*editorHolder);

setTitleBarButtonsRequired(DocumentWindow::minimiseButton | DocumentWindow::closeButton,
Expand Down Expand Up @@ -302,7 +303,7 @@ struct SCXTApplicationWindow : juce::DocumentWindow, juce::Button::Listener
AudioDeviceManager deviceManager;

std::unique_ptr<scxt::engine::Engine> engine;
std::unique_ptr<scxt::ui::SCXTEditor> editor;
std::unique_ptr<scxt::ui::app::SCXTEditor> editor;
std::unique_ptr<juce::PropertiesFile> properties;
std::unique_ptr<Intermediate> editorHolder;
};
Expand Down
10 changes: 5 additions & 5 deletions clients/clap-first/scxt-plugin/scxt-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include "scxt-plugin.h"
#include "version.h"
#include "components/SCXTEditor.h"
#include "app/SCXTEditor.h"

#include "sst/voicemanager/midi1_to_voicemanager.h"

Expand Down Expand Up @@ -86,23 +86,23 @@ SCXTPlugin::~SCXTPlugin()

std::unique_ptr<juce::Component> SCXTPlugin::createEditor()
{
auto ed = std::make_unique<scxt::ui::SCXTEditor>(
auto ed = std::make_unique<scxt::ui::app::SCXTEditor>(
*(engine->getMessageController()), *(engine->defaults), *(engine->getSampleManager()),
*(engine->getBrowser()), engine->sharedUIMemoryState);
ed->onZoomChanged = [this](auto f) {
if (_host.canUseGui() && clapJuceShim->isEditorAttached())
{
// SCLOG("On Zoom Changed with " << f << " - requesting resize of " <<
// scxt::ui::SCXTEditor::edWidth * f << "x" << scxt::ui::SCXTEditor::edHeight * f)
_host.guiRequestResize(scxt::ui::SCXTEditor::edWidth * f,
scxt::ui::SCXTEditor::edHeight * f);
_host.guiRequestResize(scxt::ui::app::SCXTEditor::edWidth * f,
scxt::ui::app::SCXTEditor::edHeight * f);
}
};
onShow = [e = ed.get()]() {
e->setZoomFactor(e->zoomFactor);
return true;
};
ed->setSize(scxt::ui::SCXTEditor::edWidth, scxt::ui::SCXTEditor::edHeight);
ed->setSize(scxt::ui::app::SCXTEditor::edWidth, scxt::ui::app::SCXTEditor::edHeight);
return ed;
}

Expand Down
8 changes: 4 additions & 4 deletions clients/juce-plugin/SCXTPluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include "SCXTProcessor.h"
#include "SCXTPluginEditor.h"
#include "components/SCXTEditor.h"
#include "app/SCXTEditor.h"
#include "engine/engine.h"

//==============================================================================
Expand All @@ -38,12 +38,12 @@ SCXTPluginEditor::SCXTPluginEditor(SCXTProcessor &p, scxt::messaging::MessageCon
const scxt::engine::Engine::SharedUIMemoryState &st)
: juce::AudioProcessorEditor(&p)
{
ed = std::make_unique<scxt::ui::SCXTEditor>(mc, d, s, br, st);
ed = std::make_unique<scxt::ui::app::SCXTEditor>(mc, d, s, br, st);
ed->onZoomChanged = [this](auto f) {
setSize(scxt::ui::SCXTEditor::edWidth * f, scxt::ui::SCXTEditor::edHeight * f);
setSize(scxt::ui::app::SCXTEditor::edWidth * f, scxt::ui::app::SCXTEditor::edHeight * f);
};
addAndMakeVisible(*ed);
setSize(scxt::ui::SCXTEditor::edWidth, scxt::ui::SCXTEditor::edHeight);
setSize(scxt::ui::app::SCXTEditor::edWidth, scxt::ui::app::SCXTEditor::edHeight);
ed->setBounds(0, 0, getWidth(), getHeight());
setResizable(false, false);
}
Expand Down
4 changes: 2 additions & 2 deletions clients/juce-plugin/SCXTPluginEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "SCXTProcessor.h"
#include "engine/engine.h"
#include "messaging/messaging.h"
#include "components/SCXTEditor.h"
#include "app/SCXTEditor.h"
#include "browser/browser.h"

//==============================================================================
Expand All @@ -50,7 +50,7 @@ class SCXTPluginEditor : public juce::AudioProcessorEditor
void resized() override;

private:
std::unique_ptr<scxt::ui::SCXTEditor> ed;
std::unique_ptr<scxt::ui::app::SCXTEditor> ed;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SCXTPluginEditor)
};
Expand Down
62 changes: 30 additions & 32 deletions src-ui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
project(scxt-ui LANGUAGES CXX)

add_library(${PROJECT_NAME} STATIC

components/SCXTEditor.cpp
components/SCXTEditorMenus.cpp
components/SCXTEditorResponseHandlers.cpp

components/HasEditor.cpp

components/HeaderRegion.cpp
components/MixerScreen.cpp
components/MultiScreen.cpp
components/SendFXScreen.cpp
components/AboutScreen.cpp
components/PlayScreen.cpp
components/LogScreen.cpp
components/WelcomeScreen.cpp

components/browser/BrowserPane.cpp

components/mixer/BusPane.cpp
components/mixer/PartEffectsPane.cpp
components/mixer/ChannelStrip.cpp

components/multi/AdsrPane.cpp
components/multi/LFOPane.cpp
components/multi/MappingPane.cpp
components/multi/ModPane.cpp
components/multi/OutputPane.cpp
components/multi/PartGroupSidebar.cpp
components/multi/PartSidebarCard.cpp
components/multi/ProcessorPane.cpp
components/multi/ProcessorPaneEQsFilters.cpp
components/multi/SingleMacroEditor.cpp
app/browser-ui/BrowserPane.cpp

app/editor-impl/HasEditor.cpp
app/editor-impl/SCXTEditor.cpp
app/editor-impl/SCXTEditorMenus.cpp
app/editor-impl/SCXTEditorResponseHandlers.cpp

app/edit-screen/EditScreen.cpp
app/edit-screen/components/AdsrPane.cpp
app/edit-screen/components/LFOPane.cpp
app/edit-screen/components/MappingPane.cpp
app/edit-screen/components/ModPane.cpp
app/edit-screen/components/OutputPane.cpp
app/edit-screen/components/PartGroupSidebar.cpp
app/edit-screen/components/ProcessorPane.cpp
app/edit-screen/components/ProcessorPaneEQsFilters.cpp

app/mixer-screen/MixerScreen.cpp
app/mixer-screen/components/BusPane.cpp
app/mixer-screen/components/ChannelStrip.cpp
app/mixer-screen/components/PartEffectsPane.cpp

app/other-screens/AboutScreen.cpp
app/other-screens/LogScreen.cpp
app/other-screens/WelcomeScreen.cpp
app/play-screen/PlayScreen.cpp

app/shared/HeaderRegion.cpp
app/shared/PartSidebarCard.cpp
app/shared/SingleMacroEditor.cpp

connectors/SCXTResources.cpp
connectors/JSONAssetSupport.cpp
Expand Down
4 changes: 2 additions & 2 deletions src-ui/components/HasEditor.h → src-ui/app/HasEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <cassert>
#include <type_traits>

namespace scxt::ui
namespace scxt::ui::app
{
struct SCXTEditor;

Expand All @@ -57,5 +57,5 @@ struct HasEditor
template <typename W, typename A>
void setupWidgetForValueTooltip(const W &widget, const A &attachment);
};
} // namespace scxt::ui
} // namespace scxt::ui::app
#endif // SHORTCIRCUIT_HASEDITOR_H
42 changes: 28 additions & 14 deletions src-ui/components/SCXTEditor.h → src-ui/app/SCXTEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <memory>
#include <type_traits>

#include "SCXTJuceLookAndFeel.h"
#include "app/editor-impl/SCXTJuceLookAndFeel.h"
#include "engine/engine.h"
#include "engine/patch.h"
#include "messaging/client/selection_messages.h"
Expand All @@ -58,17 +58,31 @@ namespace sst::jucegui::components
{
struct HasDiscreteParamMenuBuilder;
}
namespace scxt::ui
namespace scxt::ui::app
{

namespace shared
{
struct HeaderRegion;
struct MultiScreen;
}
namespace edit_screen
{
struct EditScreen;
}
namespace mixer_screen
{
struct MixerScreen;
struct AboutScreen;
struct WelcomeScreen;
}
namespace play_screen
{
struct PlayScreen;
}
namespace other_screens
{
struct WelcomeScreen;
struct AboutScreen;
struct LogScreen;
struct SCXTJuceLookAndFeel;
} // namespace other_screens

struct SCXTEditor : sst::jucegui::components::WindowPanel, juce::DragAndDropContainer
{
Expand Down Expand Up @@ -121,13 +135,13 @@ struct SCXTEditor : sst::jucegui::components::WindowPanel, juce::DragAndDropCont
};
std::unique_ptr<IdleTimer> idleTimer;

std::unique_ptr<HeaderRegion> headerRegion;
std::unique_ptr<MultiScreen> multiScreen;
std::unique_ptr<MixerScreen> mixerScreen;
std::unique_ptr<PlayScreen> playScreen;
std::unique_ptr<AboutScreen> aboutScreen;
std::unique_ptr<WelcomeScreen> welcomeScreen;
std::unique_ptr<LogScreen> logScreen;
std::unique_ptr<shared::HeaderRegion> headerRegion;
std::unique_ptr<edit_screen::EditScreen> editScreen;
std::unique_ptr<mixer_screen::MixerScreen> mixerScreen;
std::unique_ptr<play_screen::PlayScreen> playScreen;
std::unique_ptr<other_screens::AboutScreen> aboutScreen;
std::unique_ptr<other_screens::WelcomeScreen> welcomeScreen;
std::unique_ptr<other_screens::LogScreen> logScreen;

std::unique_ptr<sst::jucegui::components::ToolTip> toolTip;

Expand Down Expand Up @@ -325,6 +339,6 @@ inline void HasEditor::setupWidgetForValueTooltip(const W &w, const A &a)
};
w->onIdleHoverEnd = [this]() { editor->hideTooltip(); };
}
} // namespace scxt::ui
} // namespace scxt::ui::app

#endif // SCXT_SRC_UI_COMPONENTS_SCXTEDITOR_H
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
*/

#include "BrowserPane.h"
#include "components/SCXTEditor.h"
#include "app/SCXTEditor.h"
#include "browser/browser.h"
#include "sst/jucegui/components/Label.h"
#include "sst/jucegui/components/NamedPanelDivider.h"
#include "sst/jucegui/components/TextPushButton.h"
#include "sst/plugininfra/strnatcmp.h"

namespace scxt::ui::browser
namespace scxt::ui::app::browser_ui
{
namespace jcmp = sst::jucegui::components;

Expand Down Expand Up @@ -571,4 +571,4 @@ void BrowserPane::selectPane(int i)
searchPane->setVisible(i == 2);
repaint();
}
} // namespace scxt::ui::browser
} // namespace scxt::ui::app::browser_ui
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@

#include <juce_gui_basics/juce_gui_basics.h>
#include <sst/jucegui/components/NamedPanel.h>
#include "components/HasEditor.h"
#include "app/HasEditor.h"

#include "sst/jucegui/components/ToggleButtonRadioGroup.h"

namespace scxt::ui::browser
namespace scxt::ui::app::browser_ui // a bit clumsy to distinguis from scxt::browser
{
struct DevicesPane;
struct FavoritesPane;
struct SearchPane;
struct BrowserPane : public HasEditor, sst::jucegui::components::NamedPanel
struct BrowserPane : public app::HasEditor, sst::jucegui::components::NamedPanel
{
std::unique_ptr<sst::jucegui::components::ToggleButtonRadioGroup> selectedFunction;
std::unique_ptr<sst::jucegui::data::Discrete> selectedFunctionData;
Expand All @@ -61,6 +61,6 @@ struct BrowserPane : public HasEditor, sst::jucegui::components::NamedPanel
void selectPane(int);
int selectedPane{0};
};
} // namespace scxt::ui::browser
} // namespace scxt::ui::app::browser_ui

#endif // SHORTCIRCUITXT_BROWSERPANE_H
Loading

0 comments on commit 9daa169

Please sign in to comment.