-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* More trigger prep Really just some more plumbing and etup for triggers. Kinda want to commit this though since its end of day here.
- Loading branch information
Showing
10 changed files
with
407 additions
and
29 deletions.
There are no files selected for viewing
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
123 changes: 123 additions & 0 deletions
123
src-ui/app/edit-screen/components/GroupSettingsCard.cpp
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,123 @@ | ||
/* | ||
* Shortcircuit XT - a Surge Synth Team product | ||
* | ||
* A fully featured creative sampler, available as a standalone | ||
* and plugin for multiple platforms. | ||
* | ||
* Copyright 2019 - 2024, Various authors, as described in the github | ||
* transaction log. | ||
* | ||
* ShortcircuitXT is released under the Gnu General Public Licence | ||
* V3 or later (GPL-3.0-or-later). The license is found in the file | ||
* "LICENSE" in the root of this repository or at | ||
* https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* | ||
* Individual sections of code which comprises ShortcircuitXT in this | ||
* repository may also be used under an MIT license. Please see the | ||
* section "Licensing" in "README.md" for details. | ||
* | ||
* ShortcircuitXT is inspired by, and shares code with, the | ||
* commercial product Shortcircuit 1 and 2, released by VemberTech | ||
* in the mid 2000s. The code for Shortcircuit 2 was opensourced in | ||
* 2020 at the outset of this project. | ||
* | ||
* All source for ShortcircuitXT is available at | ||
* https://github.com/surge-synthesizer/shortcircuit-xt | ||
*/ | ||
|
||
#include "GroupSettingsCard.h" | ||
#include "app/SCXTEditor.h" | ||
#include "connectors/PayloadDataAttachment.h" | ||
|
||
namespace scxt::ui::app::edit_screen | ||
{ | ||
namespace jcmp = sst::jucegui::components; | ||
|
||
GroupSettingsCard::GroupSettingsCard(SCXTEditor *e) : HasEditor(e) | ||
{ | ||
auto mkg = [this](auto gl) { | ||
auto res = std::make_unique<jcmp::GlyphPainter>(gl); | ||
addAndMakeVisible(*res); | ||
return res; | ||
}; | ||
auto mkm = [this](auto tx, auto cs) { | ||
auto res = std::make_unique<jcmp::MenuButton>(); | ||
res->setLabel(tx); | ||
res->setOnCallback(editor->makeComingSoon(std::string() + "Group Setting Pane " + cs)); | ||
addAndMakeVisible(*res); | ||
return res; | ||
}; | ||
auto mkd = [this](auto idx, auto tx) { | ||
auto res = connectors::makeConnectedToDummy<jcmp::DraggableTextEditableValue>( | ||
'ptlv', tx, 0.0, false, | ||
editor->makeComingSoon(std::string() + "Editing the Group Setting " + tx + " Control")); | ||
addAndMakeVisible(*res); | ||
return res; | ||
}; | ||
midiGlyph = mkg(jcmp::GlyphPainter::GlyphType::MIDI); | ||
midiMenu = mkm("PART", "Midi"); | ||
outputGlyph = mkg(jcmp::GlyphPainter::GlyphType::SPEAKER); | ||
outputMenu = mkm("PART", "Output"); | ||
polyGlygh = mkg(jcmp::GlyphPainter::GlyphType::POLYPHONY); | ||
polyMenu = mkm("PART", "Polyphony"); | ||
prioGlyph = mkg(jcmp::GlyphPainter::GlyphType::NOTE_PRIORITY); | ||
prioMenu = mkm("LAST", "Priority"); | ||
glideGlpyh = mkg(jcmp::GlyphPainter::GlyphType::CURVE); | ||
glideMenu = mkm("RATE", "Glide Rate Thingy"); | ||
glideDrag = mkd('gdrg', "Glide"); | ||
|
||
volGlyph = mkg(jcmp::GlyphPainter::GlyphType::VOLUME); | ||
volDrag = mkd('grvl', "Volume"); | ||
panGlyph = mkg(jcmp::GlyphPainter::GlyphType::PAN); | ||
panDrag = mkd('grpn', "Pan"); | ||
tuneGlyph = mkg(jcmp::GlyphPainter::GlyphType::TUNING); | ||
tuneDrag = mkd('grtn', "Tune"); | ||
} | ||
|
||
void GroupSettingsCard::paint(juce::Graphics &g) | ||
{ | ||
auto ft = editor->themeApplier.interMediumFor(13); | ||
auto co = editor->themeColor(theme::ColorMap::generic_content_low); | ||
g.setFont(ft); | ||
g.setColour(co); | ||
g.drawText("GROUP SETTINGS", getLocalBounds(), juce::Justification::topLeft); | ||
} | ||
|
||
void GroupSettingsCard::resized() | ||
{ | ||
int rowHeight = 24; | ||
int componentHeight = 16; | ||
auto b = getLocalBounds().withTrimmedTop(rowHeight - 4); | ||
|
||
auto lsw = 51; | ||
auto r = b.withHeight(componentHeight).withWidth(lsw); | ||
auto osr = b.withHeight(componentHeight).withTrimmedLeft(b.getWidth() - lsw); | ||
|
||
auto spair = [&r, componentHeight](auto &g, auto &m) { | ||
g->setBounds(r.withWidth(componentHeight)); | ||
m->setBounds(r.withTrimmedLeft(componentHeight + 2)); | ||
}; | ||
spair(midiGlyph, midiMenu); | ||
r = r.translated(0, rowHeight); | ||
spair(outputGlyph, outputMenu); | ||
r = r.translated(0, rowHeight); | ||
spair(polyGlygh, polyMenu); | ||
r = r.translated(0, rowHeight); | ||
spair(prioGlyph, prioMenu); | ||
r = r.translated(0, rowHeight); | ||
spair(glideGlpyh, glideMenu); | ||
glideDrag->setBounds(r.translated(r.getWidth() + 2, 0).withTrimmedRight(componentHeight + 2)); | ||
|
||
auto ospair = [&osr, componentHeight](auto &g, auto &m) { | ||
g->setBounds(osr.withWidth(componentHeight)); | ||
m->setBounds(osr.withTrimmedLeft(componentHeight + 2)); | ||
}; | ||
osr = osr.translated(0, rowHeight); | ||
ospair(volGlyph, volDrag); | ||
osr = osr.translated(0, rowHeight); | ||
ospair(panGlyph, panDrag); | ||
osr = osr.translated(0, rowHeight); | ||
ospair(tuneGlyph, tuneDrag); | ||
} | ||
|
||
} // namespace scxt::ui::app::edit_screen |
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,57 @@ | ||
/* | ||
* Shortcircuit XT - a Surge Synth Team product | ||
* | ||
* A fully featured creative sampler, available as a standalone | ||
* and plugin for multiple platforms. | ||
* | ||
* Copyright 2019 - 2024, Various authors, as described in the github | ||
* transaction log. | ||
* | ||
* ShortcircuitXT is released under the Gnu General Public Licence | ||
* V3 or later (GPL-3.0-or-later). The license is found in the file | ||
* "LICENSE" in the root of this repository or at | ||
* https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* | ||
* Individual sections of code which comprises ShortcircuitXT in this | ||
* repository may also be used under an MIT license. Please see the | ||
* section "Licensing" in "README.md" for details. | ||
* | ||
* ShortcircuitXT is inspired by, and shares code with, the | ||
* commercial product Shortcircuit 1 and 2, released by VemberTech | ||
* in the mid 2000s. The code for Shortcircuit 2 was opensourced in | ||
* 2020 at the outset of this project. | ||
* | ||
* All source for ShortcircuitXT is available at | ||
* https://github.com/surge-synthesizer/shortcircuit-xt | ||
*/ | ||
|
||
#ifndef SCXT_SRC_UI_APP_EDIT_SCREEN_COMPONENTS_GROUPSETTINGSCARD_H | ||
#define SCXT_SRC_UI_APP_EDIT_SCREEN_COMPONENTS_GROUPSETTINGSCARD_H | ||
|
||
#include <juce_gui_basics/juce_gui_basics.h> | ||
|
||
#include "sst/jucegui/components/MenuButton.h" | ||
#include "sst/jucegui/components/DraggableTextEditableValue.h" | ||
#include "sst/jucegui/components/Label.h" | ||
#include "sst/jucegui/components/GlyphButton.h" | ||
|
||
#include "app/HasEditor.h" | ||
|
||
namespace scxt::ui::app::edit_screen | ||
{ | ||
struct GroupSettingsCard : juce::Component, HasEditor | ||
{ | ||
GroupSettingsCard(SCXTEditor *e); | ||
void paint(juce::Graphics &g) override; | ||
void resized() override; | ||
|
||
std::unique_ptr<sst::jucegui::components::GlyphPainter> midiGlyph, outputGlyph, polyGlygh, | ||
prioGlyph, glideGlpyh, volGlyph, panGlyph, tuneGlyph; | ||
std::unique_ptr<sst::jucegui::components::Label> pbLabel, SRCLabel; | ||
std::unique_ptr<sst::jucegui::components::MenuButton> midiMenu, outputMenu, polyMenu, prioMenu, | ||
glideMenu, srcMenu; | ||
std::unique_ptr<sst::jucegui::components::DraggableTextEditableValue> pbDnVal, pbUpDrag, | ||
glideDrag, volDrag, panDrag, tuneDrag; | ||
}; | ||
} // namespace scxt::ui::app::edit_screen | ||
#endif // GROUPSETTINGSCARD_H |
120 changes: 120 additions & 0 deletions
120
src-ui/app/edit-screen/components/GroupTriggersCard.cpp
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,120 @@ | ||
/* | ||
* Shortcircuit XT - a Surge Synth Team product | ||
* | ||
* A fully featured creative sampler, available as a standalone | ||
* and plugin for multiple platforms. | ||
* | ||
* Copyright 2019 - 2024, Various authors, as described in the github | ||
* transaction log. | ||
* | ||
* ShortcircuitXT is released under the Gnu General Public Licence | ||
* V3 or later (GPL-3.0-or-later). The license is found in the file | ||
* "LICENSE" in the root of this repository or at | ||
* https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* | ||
* Individual sections of code which comprises ShortcircuitXT in this | ||
* repository may also be used under an MIT license. Please see the | ||
* section "Licensing" in "README.md" for details. | ||
* | ||
* ShortcircuitXT is inspired by, and shares code with, the | ||
* commercial product Shortcircuit 1 and 2, released by VemberTech | ||
* in the mid 2000s. The code for Shortcircuit 2 was opensourced in | ||
* 2020 at the outset of this project. | ||
* | ||
* All source for ShortcircuitXT is available at | ||
* https://github.com/surge-synthesizer/shortcircuit-xt | ||
*/ | ||
|
||
#include "GroupTriggersCard.h" | ||
#include "sst/jucegui/components/ToggleButton.h" | ||
#include "sst/jucegui/components/MenuButton.h" | ||
|
||
#include "app/SCXTEditor.h" | ||
|
||
namespace scxt::ui::app::edit_screen | ||
{ | ||
namespace jcmp = sst::jucegui::components; | ||
|
||
struct GroupTriggersCard::ConditionRow : juce::Component, HasEditor | ||
{ | ||
int index{-1}; | ||
bool withCondition{false}; | ||
ConditionRow(int index, bool withCond, SCXTEditor *ed) | ||
: index(index), withCondition(withCond), HasEditor(ed) | ||
{ | ||
activeB = std::make_unique<jcmp::ToggleButton>(); | ||
activeB->setLabel(std::to_string(index + 1)); | ||
addAndMakeVisible(*activeB); | ||
|
||
auto mkm = [this](auto tx, auto cs) { | ||
auto res = std::make_unique<jcmp::MenuButton>(); | ||
res->setLabel(tx); | ||
res->setOnCallback( | ||
editor->makeComingSoon(std::string() + "Trigger Condition Pane " + cs)); | ||
addAndMakeVisible(*res); | ||
return res; | ||
}; | ||
typeM = mkm("TYPE", "Trigger Mode"); | ||
a1M = mkm("A1", "Argument One"); | ||
a2M = mkm("A2", "Argument Two"); | ||
if (withCond) | ||
cM = mkm("&", "Conjunction"); | ||
} | ||
|
||
void resized() override | ||
{ | ||
auto rb = getLocalBounds().withHeight(16); | ||
auto tb = rb.withWidth(16); | ||
activeB->setBounds(tb); | ||
tb = tb.translated(tb.getWidth() + 2, 0).withWidth(72); | ||
typeM->setBounds(tb); | ||
tb = tb.translated(tb.getWidth() + 2, 0).withWidth(32); | ||
a1M->setBounds(tb); | ||
tb = tb.translated(tb.getWidth() + 2, 0).withWidth(32); | ||
a2M->setBounds(tb); | ||
|
||
if (cM) | ||
{ | ||
tb = tb.translated(tb.getWidth() + 2, 0).withWidth(16); | ||
cM->setBounds(tb); | ||
} | ||
} | ||
|
||
std::unique_ptr<jcmp::ToggleButton> activeB; | ||
std::unique_ptr<jcmp::MenuButton> typeM, a1M, a2M, cM; | ||
}; | ||
GroupTriggersCard::GroupTriggersCard(SCXTEditor *e) : HasEditor(e) | ||
{ | ||
for (int i = 0; i < scxt::triggerConditionsPerGroup; ++i) | ||
{ | ||
rows[i] = | ||
std::make_unique<ConditionRow>(i, i != scxt::triggerConditionsPerGroup - 1, editor); | ||
addAndMakeVisible(*rows[i]); | ||
} | ||
} | ||
GroupTriggersCard::~GroupTriggersCard() = default; | ||
|
||
void GroupTriggersCard::resized() | ||
{ | ||
int rowHeight = 24; | ||
int componentHeight = 16; | ||
auto b = getLocalBounds().withTrimmedTop(rowHeight - 4); | ||
|
||
auto r = b.withHeight(componentHeight); | ||
for (int i = 0; i < scxt::triggerConditionsPerGroup; ++i) | ||
{ | ||
rows[i]->setBounds(r); | ||
r = r.translated(0, rowHeight); | ||
} | ||
} | ||
|
||
void GroupTriggersCard::paint(juce::Graphics &g) | ||
{ | ||
auto ft = editor->themeApplier.interMediumFor(13); | ||
auto co = editor->themeColor(theme::ColorMap::generic_content_low); | ||
g.setFont(ft); | ||
g.setColour(co); | ||
g.drawText("TRIGGER CONDITIONS", getLocalBounds(), juce::Justification::topLeft); | ||
} | ||
|
||
} // namespace scxt::ui::app::edit_screen |
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,51 @@ | ||
/* | ||
* Shortcircuit XT - a Surge Synth Team product | ||
* | ||
* A fully featured creative sampler, available as a standalone | ||
* and plugin for multiple platforms. | ||
* | ||
* Copyright 2019 - 2024, Various authors, as described in the github | ||
* transaction log. | ||
* | ||
* ShortcircuitXT is released under the Gnu General Public Licence | ||
* V3 or later (GPL-3.0-or-later). The license is found in the file | ||
* "LICENSE" in the root of this repository or at | ||
* https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* | ||
* Individual sections of code which comprises ShortcircuitXT in this | ||
* repository may also be used under an MIT license. Please see the | ||
* section "Licensing" in "README.md" for details. | ||
* | ||
* ShortcircuitXT is inspired by, and shares code with, the | ||
* commercial product Shortcircuit 1 and 2, released by VemberTech | ||
* in the mid 2000s. The code for Shortcircuit 2 was opensourced in | ||
* 2020 at the outset of this project. | ||
* | ||
* All source for ShortcircuitXT is available at | ||
* https://github.com/surge-synthesizer/shortcircuit-xt | ||
*/ | ||
|
||
#ifndef SCXT_SRC_UI_APP_EDIT_SCREEN_COMPONENTS_GROUPTRIGGERSCARD_H | ||
#define SCXT_SRC_UI_APP_EDIT_SCREEN_COMPONENTS_GROUPTRIGGERSCARD_H | ||
|
||
#include <array> | ||
#include <memory> | ||
|
||
#include <juce_gui_basics/juce_gui_basics.h> | ||
|
||
#include "configuration.h" | ||
#include "app/HasEditor.h" | ||
|
||
namespace scxt::ui::app::edit_screen | ||
{ | ||
struct GroupTriggersCard : juce::Component, HasEditor | ||
{ | ||
struct ConditionRow; | ||
std::array<std::unique_ptr<ConditionRow>, scxt::triggerConditionsPerGroup> rows; | ||
GroupTriggersCard(SCXTEditor *e); | ||
~GroupTriggersCard(); | ||
void paint(juce::Graphics &g) override; | ||
void resized() override; | ||
}; | ||
} // namespace scxt::ui::app::edit_screen | ||
#endif // GROUPTRIGGERSCARD_H |
Oops, something went wrong.