Skip to content

Instantly share code, notes, and snippets.

@mouseos
Created June 2, 2023 05:46
Show Gist options
  • Save mouseos/8fefa3f0cc8a1f6c49ff4faf50489ced to your computer and use it in GitHub Desktop.
Save mouseos/8fefa3f0cc8a1f6c49ff4faf50489ced to your computer and use it in GitHub Desktop.
faustのjuceプロジェクトで書きだすと色がおかしくなる問題を修正するスクリプト
#!/bin/bash
# ファイル名と置換前の行を指定します
file="FaustPluginProcessor.cpp"
target_line1="void FaustPlugInAudioProcessorEditor::paint (juce::Graphics& g)"
target_line2="virtual void paint(juce::Graphics& g) override"
target_line3="Name of the component is moved in Tab (so removed from component)"
target_line4="Drawing Scale"
target_line5="Display the name if it's needed"
target_line6="VUMeter Name"
target_line7="Label window"
# 指定した行を検索し、その2行後の行を変更します
sed -i "/$target_line1/{n;n;s/g.fillAll (juce::Colours::white);/g.fillAll (juce::Colours::black);/}" "$file"
sed -i "/$target_line2/{n;n;s/g.setColour(juce::Colours::black);/g.setColour(juce::Colours::white);/}" "$file"
sed -i "/$target_line3/{n;s/juce::TabbedComponent::addTab(comp->getName(), juce::Colours::white, comp, true);/juce::TabbedComponent::addTab(comp->getName(), juce::Colours::black, comp, true);/}" "$file"
sed -i "/$target_line4/{n;n;s/g.setColour(juce::Colours::white);/g.setColour(juce::Colours::black);/}" "$file"
sed -i "/$target_line5/{n;n;s/g.setColour(juce::Colours::black);/g.setColour(juce::Colours::white);/}" "$file"
sed -i "/$target_line6/{n;s/g.setColour(juce::Colours::black);/g.setColour(juce::Colours::white);/}" "$file"
sed -i "/$target_line7/{n;n;n;s/g.setColour(juce::Colours::white.withAlpha(0.8f));/g.setColour(juce::Colours::black.withAlpha(0.8f));/}" "$file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment