make a pattern for notifying subscribers about VST state save/load. but it seems to run too early for Editor to benefit.

This commit is contained in:
Alex Birch
2018-03-18 23:35:29 +00:00
parent 8459c48c63
commit 89b12b132a
6 changed files with 66 additions and 36 deletions

View File

@ -22,8 +22,9 @@ JuicySFAudioProcessorEditor::JuicySFAudioProcessorEditor (JuicySFAudioProcessor&
// set resize limits for this plug-in
setResizeLimits (400, 300, 800, 600);
setSize (p.getLastUIWidth(),
p.getLastUIHeight());
setSize (400, 300);
processor.subscribeToStateChanges(this);
midiKeyboard.setName ("MIDI Keyboard");
@ -39,6 +40,19 @@ JuicySFAudioProcessorEditor::JuicySFAudioProcessorEditor (JuicySFAudioProcessor&
JuicySFAudioProcessorEditor::~JuicySFAudioProcessorEditor()
{
processor.unsubscribeFromStateChanges(this);
}
void JuicySFAudioProcessorEditor::getStateInformation (XmlElement& xml) {
// save
xml.setAttribute ("uiWidth", getWidth());
xml.setAttribute ("uiHeight", getHeight());
}
void JuicySFAudioProcessorEditor::setStateInformation (XmlElement* xmlState) {
// load
setSize (xmlState->getIntAttribute ("uiWidth", getWidth()),
xmlState->getIntAttribute ("uiHeight", getHeight()));
}
//==============================================================================
@ -81,9 +95,6 @@ void JuicySFAudioProcessorEditor::resized()
// r3.removeFromTop(filePickerHeight);
//
// filePicker.setBounds(r3);
processor.setLastUIWidth(getWidth());
processor.setLastUIHeight(getHeight());
}
bool JuicySFAudioProcessorEditor::keyPressed(const KeyPress &key) {
@ -119,4 +130,4 @@ bool JuicySFAudioProcessorEditor::keyStateChanged (bool isKeyDown) {
// if (childComponent->keyStateChanged(isKeyDown)) return true;
// }
// return false;
}
}