generated from sudara/pamplejuce
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP add crush button and slider to new center panel
- Loading branch information
1 parent
6c25f36
commit 1a9b6d4
Showing
5 changed files
with
59 additions
and
8 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
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 |
---|---|---|
@@ -1,26 +1,66 @@ | ||
// 2023 Tote Bag Labs | ||
|
||
#include "ValentineCenterPanel.h" | ||
#include "BinaryData.h" | ||
#include "PluginProcessor.h" | ||
|
||
#include "tote_bag/juce_gui/lookandfeel/LookAndFeelConstants.h" | ||
#include "tote_bag/juce_gui/utilities/GraphicsUtilities.h" | ||
|
||
namespace detail | ||
{ | ||
// Get ratio of svg dimensions so we can correctly resize it. | ||
inline constexpr auto kButtonWidth = 108.1f; | ||
inline constexpr auto kButtonHeight = 201.84f; | ||
inline constexpr auto kButtonRatio = kButtonWidth / kButtonHeight; | ||
|
||
inline const juce::String kCrushSliderText = "CRUSH"; | ||
} // namespace detail | ||
|
||
namespace tote_bag | ||
{ | ||
namespace valentine | ||
{ | ||
CenterPanel::CenterPanel (ValentineAudioProcessor& processor) | ||
: crushSlider (detail::kCrushSliderText, | ||
parameterID (VParameter::bitCrush), | ||
processor.treeState) | ||
, crushEnableButton ( | ||
juce::Drawable::createFromImageData (BinaryData::on_button_svg, | ||
BinaryData::on_button_svgSize) | ||
.get(), | ||
juce::Drawable::createFromImageData (BinaryData::off_button_svg, | ||
BinaryData ::off_button_svgSize) | ||
.get(), | ||
parameterID (VParameter::crushEnable), | ||
processor.treeState) | ||
{ | ||
addAndMakeVisible (crushSlider); | ||
addAndMakeVisible (crushEnableButton); | ||
} | ||
|
||
CenterPanel::~CenterPanel() | ||
{ | ||
} | ||
|
||
void CenterPanel::paint (juce::Graphics&) | ||
void CenterPanel::paint (juce::Graphics& g) | ||
{ | ||
gui_utils::drawRoundedRect (g, | ||
topRowBorderBounds.toFloat(), | ||
laf_constants::vPinkDark); | ||
} | ||
|
||
void CenterPanel::resized() | ||
{ | ||
auto localBounds = getLocalBounds(); | ||
const auto margin = localBounds.getHeight() * .05f; | ||
|
||
const auto topRowHeight = localBounds.getHeight() * .6f; | ||
const auto topRowWidth = localBounds.getWidth(); | ||
|
||
auto topRowBounds = localBounds.removeFromTop (juce::roundToInt (topRowHeight)); | ||
topRowBorderBounds = topRowBounds; | ||
topRowBounds.reduce (margin, margin); | ||
} | ||
} // namespace tote_bag | ||
} // namespace valentine |
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