diff --git a/Source/AllKeysOverview.cpp b/Source/AllKeysOverview.cpp index bc72cd96..54ec9ed3 100644 --- a/Source/AllKeysOverview.cpp +++ b/Source/AllKeysOverview.cpp @@ -93,6 +93,12 @@ void KeyMiniDisplayInsideAllKeysOverview::mouseDown(const MouseEvent& e) { Component::mouseDown(e); + // Select this octave board + jassert(getParentComponent() != nullptr); + jassert(getParentComponent()->getParentComponent() != nullptr); + dynamic_cast(getParentComponent()->getParentComponent())-> + getOctaveBoardSelectorTab()->setCurrentTabIndex(boardIndex); + // ToDo NoteOn MIDI message (here or in parent component) } diff --git a/Source/CurvesArea.cpp b/Source/CurvesArea.cpp index b1a606a8..3b8b0b48 100644 --- a/Source/CurvesArea.cpp +++ b/Source/CurvesArea.cpp @@ -7,7 +7,7 @@ the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded and re-saved. - Created with Projucer version: 6.0.4 + Created with Projucer version: 6.0.5 ------------------------------------------------------------------------------ @@ -26,6 +26,17 @@ //[MiscUserDefs] You can add your own user definitions and misc code here... + +CurvesArea::CurvesTabComponent::CurvesTabComponent(TabbedButtonBar::Orientation orientation) + : TabbedComponent::TabbedComponent(orientation) +{ +} + +void CurvesArea::CurvesTabComponent::currentTabChanged(int newCurrentTabIndex, const String &newCurrentTabName) +{ + dynamic_cast(getTabContentComponent(newCurrentTabIndex))->loadFromMapping(); +} + //[/MiscUserDefs] //============================================================================== @@ -45,7 +56,7 @@ CurvesArea::CurvesArea () labelWindowTitle->setBounds (8, 8, 150, 24); - curvesTab.reset (new juce::TabbedComponent (juce::TabbedButtonBar::TabsAtTop)); + curvesTab.reset (new CurvesTabComponent (juce::TabbedButtonBar::TabsAtTop)); addAndMakeVisible (curvesTab.get()); curvesTab->setTabBarDepth (30); curvesTab->addTab (TRANS("Note Velocity"), juce::Colours::lightgrey, new NoteOnOffVelocityCurveDialog(), true); @@ -114,9 +125,7 @@ void CurvesArea::resized() void CurvesArea::loadFromMapping() { - dynamic_cast(curvesTab->getTabContentComponent(curvesTabIndex::noteOnOffVelocityCurve))->loadFromMapping(); - dynamic_cast(curvesTab->getTabContentComponent(curvesTabIndex::faderConfig))->loadFromMapping(); - dynamic_cast(curvesTab->getTabContentComponent(curvesTabIndex::aftertouchConfig))->loadFromMapping(); + dynamic_cast(curvesTab->getCurrentContentComponent())->loadFromMapping(); } //[/MiscUserCode] @@ -142,8 +151,8 @@ BEGIN_JUCER_METADATA focusDiscardsChanges="0" fontname="Default font" fontsize="18.0" kerning="0.0" bold="0" italic="0" justification="33"/> + virtualName="CurvesTabComponent" explicitFocusOrder="0" pos="8 40 464 200" + orientation="top" tabBarDepth="30" initialTab="0"> labelWindowTitle; - std::unique_ptr curvesTab; + std::unique_ptr curvesTab; //============================================================================== diff --git a/Source/IsomorphicMassAssign.cpp b/Source/IsomorphicMassAssign.cpp index 7a33f266..984c7ecb 100644 --- a/Source/IsomorphicMassAssign.cpp +++ b/Source/IsomorphicMassAssign.cpp @@ -641,16 +641,16 @@ bool IsomorphicMassAssign::performMouseDown(int setSelection, int keySelection) for ( auto octaveBoardIndex = setSelection+1; octaveBoardIndex < NUMBEROFBOARDS; octaveBoardIndex++) { // Find a field that can be filled, from the values of the preceding octave board - for ( auto horizLine : linesWithRightContinuation) + for ( auto succeedinghorizLine : linesWithRightContinuation) { int noteIndex = this->mappingLogic->terpstraKeyToIndex( - mainComponent->getMappingInEdit().sets[octaveBoardIndex-1].theKeys[horizLine.getLast()]); + mainComponent->getMappingInEdit().sets[octaveBoardIndex-1].theKeys[succeedinghorizLine.getLast()]); if ( noteIndex >= 0 ) { // A field in preceding octave board with an assigned value has been found- // Value can be assigned to continuation on current board. - auto newHorizLine = boardGeometry.continuationOfHorizontalLine(horizLine, 1); + auto newHorizLine = boardGeometry.continuationOfHorizontalLine(succeedinghorizLine, 1); setSaveSend(octaveBoardIndex, newHorizLine.getFirst(), noteIndex + horizStepSize); diff --git a/Source/KeyboardDataStructure.cpp b/Source/KeyboardDataStructure.cpp index eeb2d62f..649c3cb3 100644 --- a/Source/KeyboardDataStructure.cpp +++ b/Source/KeyboardDataStructure.cpp @@ -154,7 +154,6 @@ String TerpstraVelocityCurveConfig::createConfigStringForSaving() } default: - jassertfalse; return ""; } } diff --git a/Source/MainComponent.cpp b/Source/MainComponent.cpp index 44ddf081..26657099 100644 --- a/Source/MainComponent.cpp +++ b/Source/MainComponent.cpp @@ -183,37 +183,44 @@ void MainContentComponent::midiMessageReceived(const MidiMessage& midiMessage) // Velocity curves if (TerpstraSysExApplication::getApp().getMidiDriver().messageIsVelocityIntervalConfigReceptionMessage(midiMessage)) { - auto sysExData = midiMessage.getSysExData(); - auto answerState = sysExData[5]; + // After the answer state byte there must be 254 bytes of data + jassert(midiMessage.getSysExDataSize() >= (6 + 2 * VELOCITYINTERVALTABLESIZE)); // ToDo display error otherwise - if (answerState == TerpstraMidiDriver::ACK) - { - // After the answer state byte there must be 254 bytes of data - jassert(midiMessage.getSysExDataSize() >= (6 + 2 * VELOCITYINTERVALTABLESIZE)); // ToDo display error otherwise - - for (int i = 0; i < VELOCITYINTERVALTABLESIZE; i++) - this->mappingData.velocityIntervalTableValues[i] = (sysExData[6 + 2 * i] << 6) + sysExData[7 + 2 * i]; - } + for (int i = 0; i < VELOCITYINTERVALTABLESIZE; i++) + this->mappingData.velocityIntervalTableValues[i] = (sysExData[6 + 2 * i] << 6) + sysExData[7 + 2 * i]; curvesArea->resized(); curvesArea->repaint(); } else if (TerpstraSysExApplication::getApp().getMidiDriver().messageIsTerpstraVelocityConfigReceptionMessage(midiMessage, TerpstraMidiDriver::VelocityCurveType::noteOnNoteOff)) { - auto sysExData = midiMessage.getSysExData(); - auto answerState = sysExData[5]; - - if (answerState == TerpstraMidiDriver::ACK) - { - // After the answer state byte there must be 128 bytes of data - jassert(midiMessage.getSysExDataSize() >= 134); // ToDo display error otherwise - - // XXX Same logic as in VelocityCurveFreeDrawingStrategy::createPropertiesStringForSaving() - curvesArea->loadFromMapping(); - } + // After the answer state byte there must be 128 bytes of data + jassert(midiMessage.getSysExDataSize() >= 134); // ToDo display error otherwise + this->mappingData.noteOnOffVelocityCurveConfig.editStrategy = TerpstraVelocityCurveConfig::EDITSTRATEGYINDEX::freeDrawing; + for (int x = 0; x < 128; x++) + this->mappingData.noteOnOffVelocityCurveConfig.velocityValues[x] = sysExData[6 + x]; + curvesArea->loadFromMapping(); + } + else if (TerpstraSysExApplication::getApp().getMidiDriver().messageIsTerpstraVelocityConfigReceptionMessage(midiMessage, TerpstraMidiDriver::VelocityCurveType::fader)) + { + // After the answer state byte there must be 128 bytes of data + jassert(midiMessage.getSysExDataSize() >= 134); // ToDo display error otherwise + this->mappingData.faderConfig.editStrategy = TerpstraVelocityCurveConfig::EDITSTRATEGYINDEX::freeDrawing; + for (int x = 0; x < 128; x++) + this->mappingData.faderConfig.velocityValues[x] = sysExData[6 + x]; + curvesArea->loadFromMapping(); + } + else if (TerpstraSysExApplication::getApp().getMidiDriver().messageIsTerpstraVelocityConfigReceptionMessage(midiMessage, TerpstraMidiDriver::VelocityCurveType::afterTouch)) + { + // After the answer state byte there must be 128 bytes of data + jassert(midiMessage.getSysExDataSize() >= 134); // ToDo display error otherwise + this->mappingData.afterTouchConfig.editStrategy = TerpstraVelocityCurveConfig::EDITSTRATEGYINDEX::freeDrawing; + for (int x = 0; x < 128; x++) + this->mappingData.afterTouchConfig.velocityValues[x] = sysExData[6 + x]; + curvesArea->loadFromMapping(); } - // ToDo more curve data + // Key configurations else if (midiCmd == GET_RED_LED_CONFIG || midiCmd == GET_GREEN_LED_CONFIG || midiCmd == GET_BLUE_LED_CONFIG || midiCmd == GET_CHANNEL_CONFIG || midiCmd == GET_NOTE_CONFIG || midiCmd == GET_KEYTYPE_CONFIG) { diff --git a/Source/MainComponent.h b/Source/MainComponent.h index 1cb141a3..211ef41e 100644 --- a/Source/MainComponent.h +++ b/Source/MainComponent.h @@ -46,6 +46,8 @@ class MainContentComponent : public Component, public TerpstraMidiDriver::Listen void getData(TerpstraKeyMapping& newData); TerpstraKeyMapping& getMappingInEdit() { return this->mappingData; } + TabbedButtonBar* getOctaveBoardSelectorTab() { return noteEditArea->getOctaveBoardSelectorTab(); } + // Board edit operations bool deleteCurrentSubBoardData(); bool copyCurrentSubBoardData(); diff --git a/Source/MidiEditArea.cpp b/Source/MidiEditArea.cpp index 5baafb5a..471d2269 100644 --- a/Source/MidiEditArea.cpp +++ b/Source/MidiEditArea.cpp @@ -26,6 +26,10 @@ //[MiscUserDefs] You can add your own user definitions and misc code here... + +// Index in edit mode tab coincides with sysExSendingMode. In case that changes in the future, modify this here. +TerpstraMidiDriver::sysExSendingMode editModeTabIndexToMidiSysExSendingMode(int tabIndex) { return static_cast(tabIndex); } + //[/MiscUserDefs] //============================================================================== @@ -279,23 +283,22 @@ void MidiEditArea::changeListenerCallback(ChangeBroadcaster *source) { if (source == editModeSelector.get()) { - auto editMode = editModeSelector->getCurrentTabIndex(); + auto sysExSendingMode = editModeTabIndexToMidiSysExSendingMode(editModeSelector->getCurrentTabIndex()); - switch (editMode) + TerpstraSysExApplication::getApp().getMidiDriver().setSysExSendingMode(sysExSendingMode); + + switch (sysExSendingMode) { - case midiEditMode::liveEditor: + case TerpstraMidiDriver::sysExSendingMode::liveEditor: onOpenConnectionToDevice(); break; - case midiEditMode::offlineEditor: + case TerpstraMidiDriver::sysExSendingMode::offlineEditor: lblConnectionState->setText("Offline mode", NotificationType::dontSendNotification); errorVisualizer.setErrorLevel( *lblConnectionState.get(), HajuErrorVisualizer::ErrorLevel::noError, "Offline mode"); - - // Remove all MIDI messages in queue waiting to be sent - TerpstraSysExApplication::getApp().getMidiDriver().clearMIDIMessageBuffer(); break; default: diff --git a/Source/MidiEditArea.h b/Source/MidiEditArea.h index ebc7d355..0052a583 100644 --- a/Source/MidiEditArea.h +++ b/Source/MidiEditArea.h @@ -68,6 +68,7 @@ class MidiEditArea : public Component, private: //[UserVariables] -- You can add your own custom variables in this section. + // Indices of the editModeSelector tab enum midiEditMode { liveEditor = 0, diff --git a/Source/TerpstraMidiDriver.cpp b/Source/TerpstraMidiDriver.cpp index da7c9659..40d3adf9 100644 --- a/Source/TerpstraMidiDriver.cpp +++ b/Source/TerpstraMidiDriver.cpp @@ -36,6 +36,20 @@ void TerpstraMidiDriver::removeListener(TerpstraMidiDriver::Listener* listener) listeners.remove(listener); } +void TerpstraMidiDriver::setSysExSendingMode(sysExSendingMode newMode) +{ + if (newMode != currentSysExSendingMode) + { + currentSysExSendingMode = newMode; + if (currentSysExSendingMode == sysExSendingMode::offlineEditor) + { + clearMIDIMessageBuffer(); // ToDo remove only SysEx messages (leave NoteOn/NoteOff)? + stopTimer(); + hasMsgWaitingForAck = false; + } + } +} + /* ============================================================================== Combined (hi-level) commands @@ -296,8 +310,8 @@ Low-level SysEx calls void TerpstraMidiDriver::sendSysEx(int boardIndex, unsigned char cmd, unsigned char data1, unsigned char data2, unsigned char data3, unsigned char data4) { - // Send only if output device is there - if (midiOutput != nullptr) + // Send only if output device is there and SysEx sending is meant to be active + if (midiOutput != nullptr & currentSysExSendingMode == sysExSendingMode::liveEditor) { unsigned char sysExData[9]; sysExData[0] = (manufacturerId >> 16) & 0xff; diff --git a/Source/TerpstraMidiDriver.h b/Source/TerpstraMidiDriver.h index 01c7d18c..7f655c09 100644 --- a/Source/TerpstraMidiDriver.h +++ b/Source/TerpstraMidiDriver.h @@ -105,6 +105,13 @@ class TerpstraMidiDriver : public HajuMidiDriver, public MidiInputCallback, publ ERROR = 0x03, // Error } TerpstraMIDIAnswerReturnCode; + enum sysExSendingMode + { + liveEditor = 0, + offlineEditor = 1 + }; + + private: typedef enum { @@ -125,6 +132,9 @@ class TerpstraMidiDriver : public HajuMidiDriver, public MidiInputCallback, publ void addListener(Listener* listenerToAdd); void removeListener(Listener* listenerToRemove); + sysExSendingMode getSysExSendingMode() const { return currentSysExSendingMode; } + void setSysExSendingMode(sysExSendingMode newMode); + ////////////////////////////////// // Combined (hi-level) commands @@ -201,8 +211,8 @@ class TerpstraMidiDriver : public HajuMidiDriver, public MidiInputCallback, publ // Handle timeout void timerCallback() override; - // Clear MIDI message buffer; - void clearMIDIMessageBuffer() { messageBuffer.clear(); this->listeners.call(&Listener::midiSendQueueSize, 0); hasMsgWaitingForAck = false; stopTimer(); } + // Clear MIDI message buffer + void clearMIDIMessageBuffer() { messageBuffer.clear(); this->listeners.call(&Listener::midiSendQueueSize, 0); } // Message is an answer to a sent message yes/no static bool messageIsResponseToMessage(const MidiMessage& answer, const MidiMessage& originalMessage); @@ -244,6 +254,9 @@ class TerpstraMidiDriver : public HajuMidiDriver, public MidiInputCallback, publ Array messageBuffer; + // Whether SysEx messages are sent or not + sysExSendingMode currentSysExSendingMode = sysExSendingMode::liveEditor; + const int receiveTimeoutInMilliseconds = 2000; const int busyTimeDelayInMilliseconds = 20; TimerType timerType; diff --git a/Source/VelocityCurveComponents.h b/Source/VelocityCurveComponents.h index 433804eb..92df66ec 100644 --- a/Source/VelocityCurveComponents.h +++ b/Source/VelocityCurveComponents.h @@ -17,7 +17,7 @@ Display of one beam in a velocity curve table ============================================================================== */ -class VelocityCurveBeam : public Component +class VelocityCurveBeam : public Component, public SettableTooltipClient { public: VelocityCurveBeam(); diff --git a/Source/VelocityCurveDlgBase.cpp b/Source/VelocityCurveDlgBase.cpp index 97c5dd2c..d9084020 100644 --- a/Source/VelocityCurveDlgBase.cpp +++ b/Source/VelocityCurveDlgBase.cpp @@ -137,7 +137,8 @@ void VelocityCurveDlgBase::paint (juce::Graphics& g) auto currentDrawingStrategy = getCurrentDrawingStrategy(); if (currentDrawingStrategy != nullptr) { - //lblDescription->setText(currentCurveEditStrategy->getDescriptionText(), juce::NotificationType::dontSendNotification); + for (int x = 0; x < 128; x++) + velocityBeamTable[x]->setTooltip(currentDrawingStrategy->getDescriptionText()); currentDrawingStrategy->paint(g, getLookAndFeel()); } //[/UserPaint] @@ -224,17 +225,14 @@ void VelocityCurveDlgBase::loadFromMapping() } else { - jassert(false); cbEditMode->setSelectedItemIndex(TerpstraVelocityCurveConfig::EDITSTRATEGYINDEX::none, juce::NotificationType::dontSendNotification); } - // Set edit config according to current values of velocity table, of possible + // Set edit config according to current values of velocity table, if possible auto currentDrawingStrategy = getCurrentDrawingStrategy(); if (currentDrawingStrategy != nullptr) { - currentDrawingStrategy->setValueTable(configInEdit->velocityValues); - - currentDrawingStrategy->setEditConfigFromVelocityTable(); + currentDrawingStrategy->setEditConfig(configInEdit->velocityValues); } else { @@ -244,43 +242,6 @@ void VelocityCurveDlgBase::loadFromMapping() } } -// ToDo Write to *.LMT file -// -//void VelocityCurveDlgBase::saveStateToPropertiesFile(PropertiesFile* propertiesFile) -//{ -// String velocityCurveString; -// -// if (currentCurveEditStrategy != nullptr) -// { -// velocityCurveString = currentCurveEditStrategy->createPropertiesStringForSaving(); -// } -// else -// { -// jassertfalse; -// velocityCurveString = String(); -// } -// -// String keyName; -// switch(velocityCurveType) -// { -// case TerpstraMidiDriver::VelocityCurveType::noteOnNoteOff: -// keyName = "NoteOnOffVelocityCurveTable"; -// break; -// case TerpstraMidiDriver::VelocityCurveType::fader: -// keyName = "FaderVelocityCurveTable"; -// break; -// case TerpstraMidiDriver::VelocityCurveType::afterTouch: -// keyName = "AfterTouchCurveTable"; -// break; -// default: -// jassert(false); -// break; -// } -// -// propertiesFile->setValue(keyName, velocityCurveString); -// -//} - void VelocityCurveDlgBase::sendVelocityTableToController() { unsigned char velocityValues[128]; @@ -293,11 +254,6 @@ void VelocityCurveDlgBase::sendVelocityTableToController() TerpstraSysExApplication::getApp().getMidiDriver().sendVelocityConfig(velocityCurveType, velocityValues); } -void VelocityCurveDlgBase::sendVelocityConfigurationRequest() -{ - TerpstraSysExApplication::getApp().getMidiDriver().sendVelocityConfigurationRequest(velocityCurveType); -} - bool VelocityCurveDlgBase::showBeamValueOfMousePosition(juce::Point localPoint) { if (beamTableFrame.contains(localPoint)) @@ -399,12 +355,17 @@ void VelocityCurveDlgBase::mouseUp(const MouseEvent &event) auto currentDrawingStrategy = getCurrentDrawingStrategy(); if (currentDrawingStrategy != nullptr) + { currentDrawingStrategy->mouseUp(event, localPoint); - TerpstraSysExApplication::getApp().setHasChangesToSave(true); - - // Send velocity table to controller - sendVelocityTableToController(); + auto configInEdit = getConfigInEdit(); + if (configInEdit != nullptr) + { + currentDrawingStrategy->exportEditConfig(configInEdit->velocityValues); + TerpstraSysExApplication::getApp().setHasChangesToSave(true); + sendVelocityTableToController(); + } + } repaint(); } diff --git a/Source/VelocityCurveDlgBase.h b/Source/VelocityCurveDlgBase.h index b391791b..82197a8b 100644 --- a/Source/VelocityCurveDlgBase.h +++ b/Source/VelocityCurveDlgBase.h @@ -51,11 +51,8 @@ class VelocityCurveDlgBase : public Component, // New mapping is loaded. Display data. void loadFromMapping(); - // ToDo - //void saveStateToPropertiesFile(PropertiesFile* propertiesFile); virtual void sendVelocityTableToController(); - virtual void sendVelocityConfigurationRequest(); bool showBeamValueOfMousePosition(juce::Point localPoint); diff --git a/Source/VelocityCurveEditStrategy.cpp b/Source/VelocityCurveEditStrategy.cpp index 3680f26a..7c12c9b2 100644 --- a/Source/VelocityCurveEditStrategy.cpp +++ b/Source/VelocityCurveEditStrategy.cpp @@ -36,7 +36,7 @@ VelocityCurveFreeDrawingStrategy::VelocityCurveFreeDrawingStrategy( { } -bool VelocityCurveFreeDrawingStrategy::setValueTable(int velocityTableValues[]) +bool VelocityCurveFreeDrawingStrategy::setEditConfig(int velocityTableValues[]) { for (int x = 0; x < 128; x++) velocityBeamTable[x]->setValue(velocityTableValues[x]); @@ -44,14 +44,12 @@ bool VelocityCurveFreeDrawingStrategy::setValueTable(int velocityTableValues[]) return true; } -String VelocityCurveFreeDrawingStrategy::createPropertiesStringForSaving() +bool VelocityCurveFreeDrawingStrategy::exportEditConfig(int velocityTableValues[]) { - String velocityCurveString; - for (int x = 0; x < 128; x++) - velocityCurveString += String(velocityBeamTable[x]->getValue()) + " "; + velocityTableValues[x] = velocityBeamTable[x]->getValue(); - return velocityCurveString; + return true; } void VelocityCurveFreeDrawingStrategy::paint(Graphics& g, LookAndFeel& lookAndFeel) @@ -147,7 +145,7 @@ VelocityCurveSegmentEditStrategyBase::VelocityCurveSegmentEditStrategyBase( fixPointBeamHeights[127] = 127; } -bool VelocityCurveSegmentEditStrategyBase::setValueTable(int velocityTableValues[]) +bool VelocityCurveSegmentEditStrategyBase::setEditConfig(int velocityTableValues[]) { for (int x = 0; x < 128; x++) fixPointBeamHeights[x] = velocityTableValues[x]; @@ -156,6 +154,13 @@ bool VelocityCurveSegmentEditStrategyBase::setValueTable(int velocityTableValues return true; } +bool VelocityCurveSegmentEditStrategyBase::exportEditConfig(int velocityTableValues[]) +{ + for (int x = 0; x < 128; x++) + velocityTableValues[x] = fixPointBeamHeights[x]; + + return true; +} void VelocityCurveSegmentEditStrategyBase::paint(Graphics& g, LookAndFeel& lookAndFeel) { @@ -391,16 +396,6 @@ void VelocityCurveLinearDrawingStrategy::setVelocityTableValuesFromEditConfig() clearSuperfluousPoints(); } -String VelocityCurveLinearDrawingStrategy::createPropertiesStringForSaving() -{ - String velocityCurveString = "LINEAR"; - - for (int x = 0; x < 128; x++) - velocityCurveString += String(fixPointBeamHeights[x]) + " "; - - return velocityCurveString; -} - Path VelocityCurveLinearDrawingStrategy::createCurveToDraw() { Array> segmentPoints = getSegmentPoints(); @@ -518,17 +513,6 @@ void VelocityCurveQuadraticDrawingStrategy::setVelocityTableValuesFromEditConfig } } -// ToDO -String VelocityCurveQuadraticDrawingStrategy::createPropertiesStringForSaving() -{ - String velocityCurveString = "Quadratic"; - - for (int x = 0; x < 128; x++) - velocityCurveString += String(fixPointBeamHeights[x]) + " "; - - return velocityCurveString; -} - Path VelocityCurveQuadraticDrawingStrategy::createCurveToDraw() { Array> segmentPoints = getSegmentPoints(); diff --git a/Source/VelocityCurveEditStrategy.h b/Source/VelocityCurveEditStrategy.h index 6e483804..a96171c1 100644 --- a/Source/VelocityCurveEditStrategy.h +++ b/Source/VelocityCurveEditStrategy.h @@ -25,14 +25,14 @@ class VelocityCurveEditStrategyBase public: VelocityCurveEditStrategyBase(Path& beamTableFrameRef, std::unique_ptr* velocityBeamTablePtr); + // Set value table (e. g. from LMT file) + virtual bool setEditConfig(int velocityTableValues[]) = 0; + // Export value table (for saving in LMT file) + virtual bool exportEditConfig(int velocityTableValues[]) = 0; // Takes a given velocity table and tries to extract edit parameters. Returns whether it was successful. virtual bool setEditConfigFromVelocityTable() { return true; } // Sets velocity table values from edit parameters virtual void setVelocityTableValuesFromEditConfig() {} - // Set value table from LMT file - virtual bool setValueTable(int velocityTableValues[]) = 0; - // ToDo return a value table for saving in LMT file - virtual String createPropertiesStringForSaving() = 0; virtual String getDescriptionText() { return "Click with the mouse in the graphics to draw the velocity curve."; } @@ -61,9 +61,8 @@ class VelocityCurveFreeDrawingStrategy : public VelocityCurveEditStrategyBase public: VelocityCurveFreeDrawingStrategy(Path& beamTableFrameRef, std::unique_ptr* velocityBeamTablePtr); - bool setValueTable(int velocityTableValues[]) override; - // ToDO - String createPropertiesStringForSaving() override; + bool setEditConfig(int velocityTableValues[]) override; + bool exportEditConfig(int velocityTableValues[]) override; void paint(Graphics& g, LookAndFeel& lookAndFeel) override; void resized() override; @@ -86,7 +85,8 @@ class VelocityCurveSegmentEditStrategyBase : public VelocityCurveEditStrategyBas public: VelocityCurveSegmentEditStrategyBase(Path& beamTableFrameRef, std::unique_ptr* velocityBeamTablePtr); - bool setValueTable(int velocityTableValues[]) override; + bool setEditConfig(int velocityTableValues[]) override; + bool exportEditConfig(int velocityTableValues[]) override; String getDescriptionText() override { return "Click with the mouse in the graphics to draw the velocity curve. Right-click to delete a segment point."; } @@ -127,8 +127,6 @@ class VelocityCurveLinearDrawingStrategy : public VelocityCurveSegmentEditStrate bool setEditConfigFromVelocityTable() override; void setVelocityTableValuesFromEditConfig() override; - // ToDo - String createPropertiesStringForSaving() override; protected: Path createCurveToDraw() override; @@ -151,8 +149,6 @@ class VelocityCurveQuadraticDrawingStrategy : public VelocityCurveSegmentEditStr bool setEditConfigFromVelocityTable() override; void setVelocityTableValuesFromEditConfig() override; - // ToDo - String createPropertiesStringForSaving() override; protected: Path createCurveToDraw() override;