Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cmake_minimum_required(VERSION 3.22)
# cmake --build build --config Release
# ============================================================================

project(Anamorph VERSION 0.6.0 LANGUAGES C CXX)
project(Anamorph VERSION 0.6.1 LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
209 changes: 154 additions & 55 deletions src/PluginEditor.cpp

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/PluginEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ class AnamorphAudioProcessorEditor : public juce::AudioProcessorEditor,
void registerAnimated (juce::Component&);
void mouseWheelMove (const juce::MouseEvent&, const juce::MouseWheelDetails&) override; // Persist scroll reveal (#1)
void applyUiScale(); // whole-window XS..XL transform scale (F4)
void refreshPresetDisplay(); // preset name + dirty dot (F2)
void refreshPresetDisplay(); // preset name + dirty mark (F2)
void showPresetMenu();
void showSavePreset (bool);
void showLoadPreset(); // OS file chooser (#3)
void setupRotary (juce::Slider&, juce::Label&, const juce::String& name, const juce::String& tip);
void attachSlider (juce::Slider&, const char* id);
void setupCombo (juce::ComboBox&, const char* id, const juce::String& tip);
Expand Down Expand Up @@ -169,11 +170,12 @@ class AnamorphAudioProcessorEditor : public juce::AudioProcessorEditor,
juce::Label settingsTitle;
juce::Label persistLabel; // Persist moved into Settings as a bar (#21)

// Save-preset overlay (F2)
// Save-preset overlay (F2) + the OS Load chooser (#3)
Backdrop savePresetBackdrop;
juce::Label saveTitle;
juce::TextEditor saveNameEditor;
juce::TextButton saveOkButton { "Save" }, saveCancelButton { "Cancel" };
std::unique_ptr<juce::FileChooser> fileChooser;

juce::OwnedArray<SliderAttachment> sliderAtts;
juce::OwnedArray<ButtonAttachment> buttonAtts;
Expand All @@ -199,8 +201,6 @@ class AnamorphAudioProcessorEditor : public juce::AudioProcessorEditor,
// coarse timer tick is what stuttered (#6). Same ease curve, time-based.
juce::VBlankAttachment meterVBlank;
double lastFrameTime = 0.0;
float meterAnimFrom = 0.0f, meterAnimTarget = -1.0f; // ease-out reveal state (#3)
double meterAnimT = 1.0;

// Micro-animation driver (F3): per-frame eased "hovA"/"actA"/"onA" component
// properties the LookAndFeel blends with; repaints fire only while moving.
Expand Down
12 changes: 11 additions & 1 deletion src/PresetManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace
return presets;
}

constexpr const char* kPresetExt = ".anamorph";
const juce::String kPresetExt = PresetManager::fileSuffix();
}

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -147,6 +147,16 @@ void PresetManager::load (int index)
sigAtLoad = soundSig();
}

bool PresetManager::loadFile (const juce::File& f)
{
auto xml = juce::parseXML (f);
if (xml == nullptr) return false;
applySoundTree (juce::ValueTree::fromXml (*xml));
current = f.getFileNameWithoutExtension();
sigAtLoad = soundSig();
return true;
}

void PresetManager::step (int delta)
{
if (list.isEmpty()) return;
Expand Down
2 changes: 2 additions & 0 deletions src/PresetManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class PresetManager
// Win %APPDATA%/RollyTech/Anamorph/Presets
// Linux ~/.config/RollyTech/Anamorph/Presets
static juce::File presetDirectory();
static juce::String fileSuffix() { return ".anamorph"; } // shared with the OS chooser filter (#3)

void refresh(); // rescan the user folder
const juce::Array<Entry>& entries() const noexcept { return list; }
Expand All @@ -44,6 +45,7 @@ class PresetManager
bool isDirty() const; // sound edited since load/save

void load (int index); // message thread only
bool loadFile (const juce::File&); // load an arbitrary .anamorph file (OS chooser, #3)
void step (int delta); // prev/next with wrap-around
bool saveUser (const juce::String& name); // write + select; false on IO error

Expand Down
53 changes: 53 additions & 0 deletions src/gui/LookAndFeel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ void AnamorphLookAndFeel::drawRotarySlider (juce::Graphics& g, int x, int y, int
const auto bounds = juce::Rectangle<float> ((float) x, (float) y, (float) w, (float) h).reduced (4.0f);
const auto radius = juce::jmin (bounds.getWidth(), bounds.getHeight()) * 0.5f;
const auto centre = bounds.getCentre();
// Draw at the EASED visual position when the micro-anim driver is publishing
// one (preset / A-B sweep, #5); falls back to the live position otherwise.
if (const auto* v = s.getProperties().getVarPointer ("vpos"))
pos = juce::jlimit (0.0f, 1.0f, (float) (double) *v);
const auto angle = startAngle + pos * (endAngle - startAngle);
const float thick = juce::jmax (3.0f, radius * 0.16f);

Expand Down Expand Up @@ -572,6 +576,55 @@ void AnamorphLookAndFeel::positionComboBoxText (juce::ComboBox& box, juce::Label
label.setFont (getComboBoxFont (box));
}

// Text fields carrying a "glow" property (the Save-Preset name box) get a
// rounded, faintly accent-lit border when focused -- the same micro-glow as an
// open combo, so it reads premium rather than a thin default rectangle (#11).
void AnamorphLookAndFeel::fillTextEditorBackground (juce::Graphics& g, int width, int height,
juce::TextEditor& ed)
{
if (! (bool) ed.getProperties().getWithDefault ("glow", false))
{
juce::LookAndFeel_V4::fillTextEditorBackground (g, width, height, ed);
return;
}
auto b = juce::Rectangle<float> (0.0f, 0.0f, (float) width, (float) height).reduced (0.5f);
g.setColour (ed.findColour (juce::TextEditor::backgroundColourId));
g.fillRoundedRectangle (b, 5.0f);
}

void AnamorphLookAndFeel::drawTextEditorOutline (juce::Graphics& g, int width, int height,
juce::TextEditor& ed)
{
if (! (bool) ed.getProperties().getWithDefault ("glow", false))
{
juce::LookAndFeel_V4::drawTextEditorOutline (g, width, height, ed); // value boxes unchanged
return;
}

auto b = juce::Rectangle<float> (0.0f, 0.0f, (float) width, (float) height).reduced (0.5f);
const float radius = 5.0f;

if (ed.hasKeyboardFocus (true))
{
// Faint accent bloom just inside the rim + a thin vertical-gradient border.
for (int i = 3; i >= 1; --i)
{
g.setColour (colours::accent.withAlpha (0.045f * (float) i));
g.drawRoundedRectangle (b.reduced ((float) (4 - i)),
juce::jmax (1.5f, radius - (float) (4 - i)), 1.8f);
}
juce::ColourGradient og (colours::accent.brighter (0.20f), b.getX(), b.getY(),
colours::accent.withAlpha (0.55f), b.getX(), b.getBottom(), false);
g.setGradientFill (og);
g.drawRoundedRectangle (b, radius, 1.2f);
}
else
{
g.setColour (colours::outline);
g.drawRoundedRectangle (b, radius, 1.0f);
}
}

juce::Font AnamorphLookAndFeel::getLabelFont (juce::Label&)
{
return juce::Font (juce::FontOptions (13.0f));
Expand Down
5 changes: 5 additions & 0 deletions src/gui/LookAndFeel.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ class AnamorphLookAndFeel : public juce::LookAndFeel_V4
// A value box you can drag (up/down) to change the value, like the knob (#2).
juce::Label* createSliderTextBox (juce::Slider&) override;

// Focused text fields tagged with a "glow" property get the combo's subtle
// accent micro-glow instead of a plain hard outline (#11).
void drawTextEditorOutline (juce::Graphics&, int width, int height, juce::TextEditor&) override;
void fillTextEditorBackground (juce::Graphics&, int width, int height, juce::TextEditor&) override;

// Uniform, compact font for every combo + its pop-up list (#13).
juce::Font getComboBoxFont (juce::ComboBox&) override;
juce::Font getPopupMenuFont() override;
Expand Down
Loading