Skip to content
Closed
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
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,24 @@ else
detected_OS := $(shell uname)
endif

VERSION := $(shell grep VERSION: .github/workflows/workflow.yml | cut -d ':' -f 2 | cut -d ' ' -f 2 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
BUNDLEID := $(shell grep BUNDLE_ID: .github/workflows/workflow.yml | cut -d ':' -f 2 | sed '1p;d' | cut -d ' ' -f 2 )
# Extract VERSION - prefer VERSION file, fallback to workflow.yml
ifeq ($(detected_OS),Windows)
# Windows: read from VERSION file using PowerShell (handles newlines properly)
VERSION := $(shell powershell -NoProfile -Command "(Get-Content VERSION -Raw -ErrorAction SilentlyContinue).Trim()" 2>NUL || echo 1.1.0)
# Windows: default BUNDLE_ID (can be overridden via environment variable or Makefile.variables)
BUNDLEID := com.mach1.notepad
else
# Unix/Linux/macOS: use VERSION file if available, otherwise parse workflow.yml
VERSION := $(shell if [ -f VERSION ]; then cat VERSION | tr -d '\r\n '; else grep VERSION: .github/workflows/workflow.yml 2>/dev/null | cut -d ':' -f 2 | cut -d ' ' -f 2 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' || echo 1.1.0; fi)
BUNDLEID := $(shell grep BUNDLE_ID: .github/workflows/workflow.yml 2>/dev/null | head -n 1 | cut -d ':' -f 2 | cut -d ' ' -f 2 || echo com.mach1.notepad)
endif

clean:
ifeq ($(detected_OS),Windows)
@powershell -NoProfile -Command "if (Test-Path build) { Remove-Item -Recurse -Force build }"
else
rm -rf build
endif

setup-codesigning:
ifeq ($(detected_OS),Darwin)
Expand Down
44 changes: 43 additions & 1 deletion Source/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
NotePadAudioProcessorEditor::NotePadAudioProcessorEditor (NotePadAudioProcessor& p)
: AudioProcessorEditor (&p), audioProcessor (p)
{
m1TextEditor.reset(new juce::TextEditor("new text editor"));
m1TextEditor.reset(new StrikethroughTextEditor("new text editor"));
addAndMakeVisible(m1TextEditor.get());
m1TextEditor->addListener(this);
m1TextEditor->setMultiLine(true);
Expand All @@ -25,6 +25,21 @@ NotePadAudioProcessorEditor::NotePadAudioProcessorEditor (NotePadAudioProcessor&
m1TextEditor->setTabKeyUsedAsCharacter(true);
m1TextEditor->setTextToShowWhenEmpty("Keep session notes here...", juce::Colours::white);
m1TextEditor->setText(audioProcessor.treeState.state.getProperty("SessionText")); // Grabs the string within property labeled "SessionText"

// Load strikethrough ranges if they exist
auto strikethroughData = audioProcessor.treeState.state.getProperty("StrikethroughRanges").toString();
if (strikethroughData.isNotEmpty())
{
m1TextEditor->deserializeStrikethroughRanges(strikethroughData);
}

// Set up callback to save strikethrough ranges when they change
m1TextEditor->onStrikethroughChanged = [this]()
{
auto strikethroughData = m1TextEditor->serializeStrikethroughRanges();
audioProcessor.treeState.state.setProperty("StrikethroughRanges", strikethroughData, nullptr);
};

m1TextEditor->setBounds(0, 0, 800, 512 - 20);
m1TextEditor->setColour(juce::TextEditor::backgroundColourId, juce::Colour::fromFloatRGBA(40.0f, 40.0f, 40.0f, 0.10f));
m1TextEditor->setColour(juce::TextEditor::textColourId, juce::Colour::fromFloatRGBA(251.0f, 251.0f, 251.0f, 1.0f));
Expand All @@ -37,6 +52,13 @@ NotePadAudioProcessorEditor::NotePadAudioProcessorEditor (NotePadAudioProcessor&
todoCheckbox->setToggleState(audioProcessor.isTodoMode(), juce::dontSendNotification);
todoCheckbox->setColour(juce::ToggleButton::textColourId, juce::Colours::white);

// Pass through button setup
passThroughButton.reset(new juce::ToggleButton("Audio Pass-Through"));
addAndMakeVisible(passThroughButton.get());
passThroughButton->addListener(this);
passThroughButton->setToggleState(audioProcessor.isAudioPassThrough(), juce::dontSendNotification);
passThroughButton->setColour(juce::ToggleButton::textColourId, juce::Colours::white);

// Todo input field setup
todoInputField.reset(new juce::TextEditor("todo input"));
addAndMakeVisible(todoInputField.get());
Expand Down Expand Up @@ -64,6 +86,7 @@ NotePadAudioProcessorEditor::~NotePadAudioProcessorEditor()
{
m1TextEditor = nullptr;
todoCheckbox = nullptr;
passThroughButton = nullptr;
todoInputField = nullptr;
todoItems.clear();
todoLabels.clear();
Expand Down Expand Up @@ -99,6 +122,9 @@ void NotePadAudioProcessorEditor::resized()
// Position the todo mode controls
todoCheckbox->setBounds(0, getHeight() - 50, 100, 24);

// Position the pass-through button next to the todo checkbox
passThroughButton->setBounds(110, getHeight() - 50, 150, 24);

// Position the todo input field and items if in todo mode
if (audioProcessor.isTodoMode())
{
Expand Down Expand Up @@ -130,6 +156,16 @@ void NotePadAudioProcessorEditor::textEditorTextChanged (juce::TextEditor &edito
{
// On key changes will save editor's string to property labeled/tagged "SessionText"
audioProcessor.treeState.state.setProperty("SessionText", editor.getText(), nullptr);

// Save strikethrough ranges if this is the main text editor
if (&editor == m1TextEditor.get())
{
// Adjust strikethrough ranges when text changes
m1TextEditor->adjustStrikethroughRanges();

auto strikethroughData = m1TextEditor->serializeStrikethroughRanges();
audioProcessor.treeState.state.setProperty("StrikethroughRanges", strikethroughData, nullptr);
}
}

void NotePadAudioProcessorEditor::textEditorReturnKeyPressed(juce::TextEditor& editor)
Expand Down Expand Up @@ -322,6 +358,12 @@ void NotePadAudioProcessorEditor::buttonClicked(juce::Button* button)

resized(); // Update layout
}
else if (button == passThroughButton.get())
{
// Toggle audio pass-through mode
bool passThrough = passThroughButton->getToggleState();
audioProcessor.setAudioPassThrough(passThrough);
}
else
{
// Check if it's one of the todo checkboxes
Expand Down
Loading
Loading