From 8f5aa5252fb673102cceb6fe08dc6c0fa0b76cb6 Mon Sep 17 00:00:00 2001 From: hsstraub Date: Wed, 11 Jan 2017 19:54:02 +0100 Subject: [PATCH 01/18] Merge from 0.3 colors: display keeycolors, open file via doubleclick --- Source/KeyboardDataStructure.cpp | 22 +++++++++-- Source/Main.cpp | 7 ++++ Source/ViewComponents.cpp | 64 +++++++++++++++++--------------- Source/ViewComponents.h | 3 +- Source/ViewConstants.h | 2 + 5 files changed, 65 insertions(+), 33 deletions(-) diff --git a/Source/KeyboardDataStructure.cpp b/Source/KeyboardDataStructure.cpp index 3d053440..489789cf 100644 --- a/Source/KeyboardDataStructure.cpp +++ b/Source/KeyboardDataStructure.cpp @@ -69,8 +69,6 @@ void TerpstraKeyMapping::fromStringArray(const StringArray& stringArray) else jassert(false); } - else - jassert(false); } else if ((pos1 = currentLine.indexOf("Chan_")) >= 0) { @@ -79,7 +77,7 @@ void TerpstraKeyMapping::fromStringArray(const StringArray& stringArray) { int keyIndex = currentLine.substring(pos1 + 5, pos2).getIntValue(); int keyValue = currentLine.substring(pos2 + 1).getIntValue(); - if (boardIndex >= 0 && boardIndex < NUMBEROFBOARDS && keyIndex >= 0 && keyIndex < TERPSTRABOARDSIZE ) + if (boardIndex >= 0 && boardIndex < NUMBEROFBOARDS && keyIndex >= 0 && keyIndex < TERPSTRABOARDSIZE) { sets[boardIndex].theKeys[keyIndex].channelNumber = keyValue; // XXX if keyValue is illegal: error status? @@ -88,6 +86,23 @@ void TerpstraKeyMapping::fromStringArray(const StringArray& stringArray) jassert(false); } } + else if ((pos1 = currentLine.indexOf("Col_")) >= 0) + { + pos2 = currentLine.indexOf("="); + if (pos2 >= 0 && pos2 > pos1) + { + int keyIndex = currentLine.substring(pos1 + 4, pos2).getIntValue(); + int colValue = currentLine.substring(pos2 + 1).getHexValue32(); + if (boardIndex >= 0 && boardIndex < NUMBEROFBOARDS && keyIndex >= 0 && keyIndex < TERPSTRABOARDSIZE) + { + sets[boardIndex].theKeys[keyIndex].colour = colValue; + } + else + jassert(false); + } + else + jassert(false); + } } } @@ -107,6 +122,7 @@ StringArray TerpstraKeyMapping::toStringArray() { result.add("Key_" + String(keyIndex) + "=" + String(sets[boardIndex].theKeys[keyIndex].noteNumber)); result.add("Chan_" + String(keyIndex) + "=" + String(sets[boardIndex].theKeys[keyIndex].channelNumber)); + result.add("Col_" + String(keyIndex) + "=" + String::toHexString( (sets[boardIndex].theKeys[keyIndex].colour))); } } diff --git a/Source/Main.cpp b/Source/Main.cpp index 89250f1a..e30cb6ad 100644 --- a/Source/Main.cpp +++ b/Source/Main.cpp @@ -51,6 +51,13 @@ void TerpstraSysExApplication::initialise(const String& commandLine) { // commandLine is supposed to contain a file name. Try to open it. currentFile = File(commandLine); + if (!currentFile.existsAsFile()) + { + // If file name is with quotes, try removing the quotes + if (commandLine.startsWithChar('"') && commandLine.endsWithChar('"')) + currentFile = File(commandLine.substring(1, commandLine.length() - 1)); + } + openFromCurrentFile(); } } diff --git a/Source/ViewComponents.cpp b/Source/ViewComponents.cpp index fd38df3b..5a3c4c31 100644 --- a/Source/ViewComponents.cpp +++ b/Source/ViewComponents.cpp @@ -18,23 +18,16 @@ TerpstraKeyEdit class */ TerpstraKeyEdit::TerpstraKeyEdit() -: isSelected(false) + : isSelected(false), keyColour(0) { midiNoteLabel = new Label("midiNoteLabel", "0"); addAndMakeVisible(midiNoteLabel); midiNoteLabel->setBounds((TERPSTRASINGLEKEYFLDSIZE - 30) / 2, TERPSTRASINGLEKEYFLDSIZE / 2 - 15, 30, STANDARDLABELHEIGTH); midiNoteLabel->setFont( midiNoteLabel->getFont().boldened()); - //channelTextLabel = new Label("channelTextLabel", "Ch."); - //addAndMakeVisible(channelTextLabel); - //channelTextLabel->setBounds(TERPSTRASINGLEKEYFLDSIZE / 2-10, 25, 10, 10); - //channelTextLabel->setText("Ch.", sendNotification); - midiChannelLabel = new Label("midiChannelLabel", "0"); addAndMakeVisible(midiChannelLabel); midiChannelLabel->setBounds((TERPSTRASINGLEKEYFLDSIZE - 25) / 2, TERPSTRASINGLEKEYFLDSIZE / 2, 25, STANDARDLABELHEIGTH); - - //channelTextLabel->attachToComponent(midiChannelLabel, true); } TerpstraKeyEdit::~TerpstraKeyEdit() @@ -47,7 +40,7 @@ TerpstraKey TerpstraKeyEdit::getValue() const TerpstraKey newValue; newValue.noteNumber = midiNoteLabel->getText().getIntValue(); newValue.channelNumber = midiChannelLabel->getText().getIntValue(); - // XXX colour + newValue.colour = keyColour; return newValue; } @@ -56,7 +49,7 @@ void TerpstraKeyEdit::setValue(TerpstraKey newValue) { midiNoteLabel->setText(String(newValue.noteNumber), juce::NotificationType::sendNotification); midiChannelLabel->setText(String(newValue.channelNumber), juce::NotificationType::sendNotification); - // XXX colour + keyColour = newValue.colour; repaint(); } @@ -76,14 +69,18 @@ void TerpstraKeyEdit::paint(Graphics& g) float w = this->getWidth(); float h = this->getHeight(); + // Selected or not: color and thickness of the line + float lineWidth = isSelected ? TERPSTRASELECTEDKEYFLDLINEWIDTH : TERPSTRASINGLEKEYFLDLINEWIDTH; + juce::Colour lineColor = isSelected ? Colour(TERPSTRASELECTEDFLDLINECOLOUR) : Colours::black; + // Draw hexagon Path hexPath; - hexPath.startNewSubPath(w / 2.0f, TERPSTRASINGLEKEYFLDLINEWIDTH ); - hexPath.lineTo(w - TERPSTRASINGLEKEYFLDLINEWIDTH, h / 4.0f); - hexPath.lineTo(w - TERPSTRASINGLEKEYFLDLINEWIDTH, 3.0f * h / 4.0f); - hexPath.lineTo(w / 2.0f, h - TERPSTRASINGLEKEYFLDLINEWIDTH); - hexPath.lineTo(TERPSTRASINGLEKEYFLDLINEWIDTH, 3.0f * h / 4.0f); - hexPath.lineTo(TERPSTRASINGLEKEYFLDLINEWIDTH, h / 4.0f); + hexPath.startNewSubPath(w / 2.0f, lineWidth); + hexPath.lineTo(w - lineWidth, h / 4.0f); + hexPath.lineTo(w - lineWidth, 3.0f * h / 4.0f); + hexPath.lineTo(w / 2.0f, h - lineWidth); + hexPath.lineTo(lineWidth, 3.0f * h / 4.0f); + hexPath.lineTo(lineWidth, h / 4.0f); hexPath.closeSubPath(); // Rotate slightly counterclockwise around the center @@ -92,21 +89,30 @@ void TerpstraKeyEdit::paint(Graphics& g) transform = transform.translated(w / 2.0f, h / 2.0f); hexPath.applyTransform(transform); - hexPath.scaleToFit(TERPSTRASINGLEKEYFLDLINEWIDTH, TERPSTRASINGLEKEYFLDLINEWIDTH, w - TERPSTRASINGLEKEYFLDLINEWIDTH, h - TERPSTRASINGLEKEYFLDLINEWIDTH, true ); - // Selected or not: fill - if (isSelected) - g.setColour(Colour(MAINWINDOWSELECTEDCOLOUR)); - else if (getValue().isEmpty() ) - //g.setColour(Colour(MAINWINDOWBGCOLOUR).withMultipliedSaturation(0.5)); - //g.setColour(Colour(MAINWINDOWBGCOLOUR).withMultipliedSaturation(0.5).darker()); - g.setColour(Colour(MAINWINDOWBGCOLOUR).darker(0.08f)); - else - g.setColour(Colour(MAINWINDOWBGCOLOUR)); - // XXX yet different colour if edited + hexPath.scaleToFit(lineWidth, lineWidth, w - lineWidth, h - lineWidth, true); + // Color: empty or the parametrized color + TerpstraKey currentValue = getValue(); + + // Parametrized colour + g.setColour(Colour(MAINWINDOWBGCOLOUR).overlaidWith(Colour(currentValue.colour).withAlpha((uint8)0x40))); g.fillPath(hexPath); - g.setColour(Colours::black); - g.strokePath(hexPath, PathStrokeType(TERPSTRASINGLEKEYFLDLINEWIDTH)); + + // Draw line + g.setColour(lineColor); + g.strokePath(hexPath, PathStrokeType(lineWidth)); + + // Something parametrized or not? + if (currentValue.isEmpty()) + { + midiChannelLabel->setAlpha(0.3); + midiNoteLabel->setAlpha(0.3); + } + else + { + midiChannelLabel->setAlpha(1.0); + midiNoteLabel->setAlpha(1.0); + } } void TerpstraKeyEdit::resized() diff --git a/Source/ViewComponents.h b/Source/ViewComponents.h index 3474da4a..83ed0955 100644 --- a/Source/ViewComponents.h +++ b/Source/ViewComponents.h @@ -39,8 +39,9 @@ class TerpstraKeyEdit : public Component bool isSelected; Label* midiNoteLabel; - //Label* channelTextLabel; Label* midiChannelLabel; + + int keyColour; }; diff --git a/Source/ViewConstants.h b/Source/ViewConstants.h index 2bcf1841..10873d9f 100644 --- a/Source/ViewConstants.h +++ b/Source/ViewConstants.h @@ -30,7 +30,9 @@ #define TERPSTRASINGLEKEYFIELDFIRSTYPOS 300 #define TERPSTRASINGLEKEYFLDSIZE 56 #define TERPSTRASINGLEKEYFLDLINEWIDTH 2.0f +#define TERPSTRASELECTEDKEYFLDLINEWIDTH 3.0f #define TERPSTRASINGLEKEYROTATIONANGLE -0.20f +#define TERPSTRASELECTEDFLDLINECOLOUR 0xfff7990d // Edit area #define EDITAREAFIRSTCOLPOS 480 From 023825ab664615f0a2a2b9194c8f256641eb9136 Mon Sep 17 00:00:00 2001 From: hsstraub Date: Fri, 3 Feb 2017 21:18:45 +0100 Subject: [PATCH 02/18] All note params optional. Prepared for colour picker. --- Source/Main.cpp | 2 +- Source/MainComponent.cpp | 7 +- Source/MidiEditArea.cpp | 19 +++-- Source/MidiEditArea.h | 16 ++-- Source/NoteAssignTab.cpp | 160 +++++++++++++++++++++++++++------------ Source/NoteAssignTab.h | 23 +++--- TerpstraSysEx.jucer | 4 +- 7 files changed, 150 insertions(+), 81 deletions(-) diff --git a/Source/Main.cpp b/Source/Main.cpp index e30cb6ad..d02a5954 100644 --- a/Source/Main.cpp +++ b/Source/Main.cpp @@ -328,7 +328,7 @@ bool TerpstraSysExApplication::aboutTerpstraSysEx() // XXX Version: there are the internal constants JUCE_APP_VERSION and JUCE_APP_VERSION_HEX... m << "Terpstra SysEx Utility" << newLine << newLine - << "Version 0.2.2" << newLine + << "Version 0.2.3" << newLine << newLine << "Original design @ Dylan Horvath 2007" << newLine << "Reengineered @ Hans Straub 2014" << newLine diff --git a/Source/MainComponent.cpp b/Source/MainComponent.cpp index 68dc5bd5..2c54415e 100644 --- a/Source/MainComponent.cpp +++ b/Source/MainComponent.cpp @@ -188,15 +188,14 @@ void MainContentComponent::mouseDown(const MouseEvent &event) changeSingleKeySelection(i); // Edit - TerpstraKey keyData = noteAssignTab->createKeyMapping(); - mappingData.sets[currentSetSelection].theKeys[i] = keyData; // Save data - terpstraKeyFields[i]->setValue(keyData); // Display + noteAssignTab->PerformMouseClickEdit(mappingData.sets[currentSetSelection].theKeys[i]); // Save data + terpstraKeyFields[i]->setValue(mappingData.sets[currentSetSelection].theKeys[i]); // Display // Mark that there are changes TerpstraSysExApplication::getApp().setHasChangesToSave(true); // Send to device - midiDriver.sendAndMaybeSaveKeyParam(currentSetSelection+1, i, keyData); + midiDriver.sendAndMaybeSaveKeyParam(currentSetSelection + 1, i, mappingData.sets[currentSetSelection].theKeys[i]); break; } } diff --git a/Source/MidiEditArea.cpp b/Source/MidiEditArea.cpp index 94da7e5c..99687524 100644 --- a/Source/MidiEditArea.cpp +++ b/Source/MidiEditArea.cpp @@ -1,18 +1,18 @@ /* ============================================================================== - This is an automatically generated GUI class created by the Introjucer! + This is an automatically generated GUI class created by the Projucer! Be careful when adding custom code to these files, as only the code within the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded and re-saved. - Created with Introjucer version: 3.1.0 + Created with Projucer version: 4.2.1 ------------------------------------------------------------------------------ - The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions" - Copyright 2004-13 by Raw Material Software Ltd. + The Projucer is part of the JUCE library - "Jules' Utility Class Extensions" + Copyright (c) 2015 - ROLI Ltd. ============================================================================== */ @@ -30,6 +30,9 @@ //============================================================================== MidiEditArea::MidiEditArea () { + //[Constructor_pre] You can add your own custom stuff here.. + //[/Constructor_pre] + addAndMakeVisible (lblMidiInput = new Label ("lblMidiInput", TRANS("MIDI Input Device"))); lblMidiInput->setFont (Font (15.00f, Font::plain)); @@ -42,7 +45,7 @@ MidiEditArea::MidiEditArea () cbMidiInput->setTooltip (TRANS("Is currently not used")); cbMidiInput->setEditableText (false); cbMidiInput->setJustificationType (Justification::centredLeft); - cbMidiInput->setTextWhenNothingSelected (String::empty); + cbMidiInput->setTextWhenNothingSelected (String()); cbMidiInput->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); cbMidiInput->addListener (this); @@ -58,7 +61,7 @@ MidiEditArea::MidiEditArea () cbMidiOutput->setTooltip (TRANS("Key mappings are sent to this port. This happens automatically if a valid MIDI port is selected.")); cbMidiOutput->setEditableText (false); cbMidiOutput->setJustificationType (Justification::centredLeft); - cbMidiOutput->setTextWhenNothingSelected (String::empty); + cbMidiOutput->setTextWhenNothingSelected (String()); cbMidiOutput->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); cbMidiOutput->addListener (this); @@ -206,9 +209,9 @@ void MidiEditArea::buttonClicked (Button* buttonThatWasClicked) //============================================================================== #if 0 -/* -- Introjucer information section -- +/* -- Projucer information section -- - This is where the Introjucer stores the metadata that describe this GUI layout, so + This is where the Projucer stores the metadata that describe this GUI layout, so make changes in here at your peril! BEGIN_JUCER_METADATA diff --git a/Source/MidiEditArea.h b/Source/MidiEditArea.h index 741bb487..15d04ab2 100644 --- a/Source/MidiEditArea.h +++ b/Source/MidiEditArea.h @@ -1,18 +1,18 @@ /* ============================================================================== - This is an automatically generated GUI class created by the Introjucer! + This is an automatically generated GUI class created by the Projucer! Be careful when adding custom code to these files, as only the code within the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded and re-saved. - Created with Introjucer version: 3.1.0 + Created with Projucer version: 4.2.1 ------------------------------------------------------------------------------ - The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions" - Copyright 2004-13 by Raw Material Software Ltd. + The Projucer is part of the JUCE library - "Jules' Utility Class Extensions" + Copyright (c) 2015 - ROLI Ltd. ============================================================================== */ @@ -51,10 +51,10 @@ class MidiEditArea : public Component, void addSendAllButtonListener(ButtonListener* listener) { buttonSendAll->addListener(listener); } //[/UserMethods] - void paint (Graphics& g); - void resized(); - void comboBoxChanged (ComboBox* comboBoxThatHasChanged); - void buttonClicked (Button* buttonThatWasClicked); + void paint (Graphics& g) override; + void resized() override; + void comboBoxChanged (ComboBox* comboBoxThatHasChanged) override; + void buttonClicked (Button* buttonThatWasClicked) override; diff --git a/Source/NoteAssignTab.cpp b/Source/NoteAssignTab.cpp index bd6580d5..383c236b 100644 --- a/Source/NoteAssignTab.cpp +++ b/Source/NoteAssignTab.cpp @@ -1,17 +1,17 @@ /* ============================================================================== - This is an automatically generated GUI class created by the Introjucer! + This is an automatically generated GUI class created by the Projucer! Be careful when adding custom code to these files, as only the code within the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded and re-saved. - Created with Introjucer version: 3.2.0 + Created with Projucer version: 4.2.1 ------------------------------------------------------------------------------ - The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions" + The Projucer is part of the JUCE library - "Jules' Utility Class Extensions" Copyright (c) 2015 - ROLI Ltd. ============================================================================== @@ -43,18 +43,10 @@ NoteAssignTab::NoteAssignTab () editInstructionText->setColour (TextEditor::textColourId, Colours::black); editInstructionText->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - addAndMakeVisible (noteLabel = new Label ("noteLabel", - TRANS("Note (0-127):"))); - noteLabel->setFont (Font (15.00f, Font::plain)); - noteLabel->setJustificationType (Justification::centredLeft); - noteLabel->setEditable (false, false, false); - noteLabel->setColour (TextEditor::textColourId, Colours::black); - noteLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - addAndMakeVisible (noteBox = new ComboBox ("noteBox")); noteBox->setEditableText (false); noteBox->setJustificationType (Justification::centredLeft); - noteBox->setTextWhenNothingSelected (String::empty); + noteBox->setTextWhenNothingSelected (String()); noteBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); noteBox->addListener (this); @@ -62,18 +54,10 @@ NoteAssignTab::NoteAssignTab () noteAutoIncrButton->setButtonText (TRANS("Auto Increment")); noteAutoIncrButton->addListener (this); - addAndMakeVisible (channelLabel = new Label ("channelLabel", - TRANS("Channel (1-16):"))); - channelLabel->setFont (Font (15.00f, Font::plain)); - channelLabel->setJustificationType (Justification::centredLeft); - channelLabel->setEditable (false, false, false); - channelLabel->setColour (TextEditor::textColourId, Colours::black); - channelLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - addAndMakeVisible (channelBox = new ComboBox ("channelBox")); channelBox->setEditableText (false); channelBox->setJustificationType (Justification::centredLeft); - channelBox->setTextWhenNothingSelected (String::empty); + channelBox->setTextWhenNothingSelected (String()); channelBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); channelBox->addListener (this); @@ -85,10 +69,35 @@ NoteAssignTab::NoteAssignTab () channelAutoIncrNoteBox->setTooltip (TRANS("After reaching this note, the channel is incremented and the note is reset to 0.")); channelAutoIncrNoteBox->setEditableText (false); channelAutoIncrNoteBox->setJustificationType (Justification::centredLeft); - channelAutoIncrNoteBox->setTextWhenNothingSelected (String::empty); + channelAutoIncrNoteBox->setTextWhenNothingSelected (String()); channelAutoIncrNoteBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); channelAutoIncrNoteBox->addListener (this); + addAndMakeVisible (setNoteToggleButton = new ToggleButton ("setNoteToggleButton")); + setNoteToggleButton->setButtonText (TRANS("Note (0-127):")); + setNoteToggleButton->addListener (this); + + addAndMakeVisible (setChannelToggleButton = new ToggleButton ("setChannelToggleButton")); + setChannelToggleButton->setButtonText (TRANS("Channel (1-16):")); + setChannelToggleButton->addListener (this); + + addAndMakeVisible (setColourToggleButton = new ToggleButton ("setColourToggleButton")); + setColourToggleButton->setButtonText (TRANS("Colour:")); + setColourToggleButton->addListener (this); + + addAndMakeVisible (colourTextEdit = new TextEditor ("colourTextEdit")); + colourTextEdit->setMultiLine (false); + colourTextEdit->setReturnKeyStartsNewLine (false); + colourTextEdit->setReadOnly (false); + colourTextEdit->setScrollbarsShown (true); + colourTextEdit->setCaretVisible (true); + colourTextEdit->setPopupMenuEnabled (true); + colourTextEdit->setText (String()); + + addAndMakeVisible (btnColourPicker = new TextButton ("btnColourPicker")); + btnColourPicker->setButtonText (TRANS("Colour picker")); + btnColourPicker->addListener (this); + //[UserPreSize] //[/UserPreSize] @@ -106,9 +115,10 @@ NoteAssignTab::NoteAssignTab () for (int i = 1; i <= 16; i++) channelBox->addItem(String(i), i); - noteLabel->attachToComponent(noteBox, true); - channelLabel->attachToComponent(channelBox, true); - //[/Constructor] + setNoteToggleButton->setToggleState(true, juce::NotificationType::sendNotification); + setChannelToggleButton->setToggleState(true, juce::NotificationType::sendNotification); + setColourToggleButton->setToggleState(true, juce::NotificationType::sendNotification); + //[/Constructor] } NoteAssignTab::~NoteAssignTab() @@ -118,13 +128,16 @@ NoteAssignTab::~NoteAssignTab() noteAndChannelAssGroup = nullptr; editInstructionText = nullptr; - noteLabel = nullptr; noteBox = nullptr; noteAutoIncrButton = nullptr; - channelLabel = nullptr; channelBox = nullptr; channelAutoIncrButton = nullptr; channelAutoIncrNoteBox = nullptr; + setNoteToggleButton = nullptr; + setChannelToggleButton = nullptr; + setColourToggleButton = nullptr; + colourTextEdit = nullptr; + btnColourPicker = nullptr; //[Destructor]. You can add your own custom destruction code here.. @@ -150,13 +163,16 @@ void NoteAssignTab::resized() noteAndChannelAssGroup->setBounds (0, 8, 424, 200); editInstructionText->setBounds (8, 32, 352, 24); - noteLabel->setBounds (16, 64, 96, 24); noteBox->setBounds (120, 64, 56, 24); noteAutoIncrButton->setBounds (192, 64, 160, 24); - channelLabel->setBounds (16, 96, 96, 24); channelBox->setBounds (120, 96, 56, 24); channelAutoIncrButton->setBounds (192, 96, 160, 24); channelAutoIncrNoteBox->setBounds (360, 96, 56, 24); + setNoteToggleButton->setBounds (8, 64, 112, 24); + setChannelToggleButton->setBounds (8, 96, 112, 24); + setColourToggleButton->setBounds (8, 128, 112, 24); + colourTextEdit->setBounds (120, 128, 56, 24); + btnColourPicker->setBounds (192, 128, 104, 24); //[UserResized] Add your own custom resize handling here.. //[/UserResized] } @@ -201,6 +217,36 @@ void NoteAssignTab::buttonClicked (Button* buttonThatWasClicked) //[UserButtonCode_channelAutoIncrButton] -- add your button handler code here.. //[/UserButtonCode_channelAutoIncrButton] } + else if (buttonThatWasClicked == setNoteToggleButton) + { + //[UserButtonCode_setNoteToggleButton] -- add your button handler code here.. + bool fieldActive = setNoteToggleButton->getToggleState(); + noteBox->setEnabled(fieldActive); + noteAutoIncrButton->setEnabled(fieldActive); + //[/UserButtonCode_setNoteToggleButton] + } + else if (buttonThatWasClicked == setChannelToggleButton) + { + //[UserButtonCode_setChannelToggleButton] -- add your button handler code here.. + bool fieldActive = setChannelToggleButton->getToggleState(); + channelBox->setEnabled(fieldActive); + channelAutoIncrButton->setEnabled(fieldActive); + channelAutoIncrNoteBox->setEnabled(fieldActive); + //[/UserButtonCode_setChannelToggleButton] + } + else if (buttonThatWasClicked == setColourToggleButton) + { + //[UserButtonCode_setColourToggleButton] -- add your button handler code here.. + bool fieldActive = setColourToggleButton->getToggleState(); + colourTextEdit->setEnabled(fieldActive); + btnColourPicker->setEnabled(fieldActive); + //[/UserButtonCode_setColourToggleButton] + } + else if (buttonThatWasClicked == btnColourPicker) + { + //[UserButtonCode_btnColourPicker] -- add your button handler code here.. + //[/UserButtonCode_btnColourPicker] + } //[UserbuttonClicked_Post] //[/UserbuttonClicked_Post] @@ -211,12 +257,26 @@ void NoteAssignTab::buttonClicked (Button* buttonThatWasClicked) //[MiscUserCode] You can add your own definitions of your custom methods or any other code here... // Called from MainComponent when one of the keys is clicked -TerpstraKey NoteAssignTab::createKeyMapping() +void NoteAssignTab::PerformMouseClickEdit(TerpstraKey& keyData) { - TerpstraKey keyData; - keyData.noteNumber = noteBox->getSelectedItemIndex(); //-1 for no selection or 0-127 - if (keyData.noteNumber < 0) keyData.noteNumber = 0; - keyData.channelNumber = channelBox->getSelectedId(); // 0 for no selection or 1-16 + // Set note if specified + if (setNoteToggleButton->getToggleState()) + { + keyData.noteNumber = noteBox->getSelectedItemIndex(); //-1 for no selection or 0-127 + if (keyData.noteNumber < 0) keyData.noteNumber = 0; + } + + // Set channel if specified + if (setChannelToggleButton->getToggleState()) + { + keyData.channelNumber = channelBox->getSelectedId(); // 0 for no selection or 1-16 + } + + // Set colour if specified + if (setColourToggleButton->getToggleState()) + { + // XXX + } // Auto increment note if (noteAutoIncrButton->getToggleState()) @@ -239,8 +299,6 @@ TerpstraKey NoteAssignTab::createKeyMapping() noteBox->setSelectedItemIndex(newNote); } - - return keyData; } //[/MiscUserCode] @@ -248,9 +306,9 @@ TerpstraKey NoteAssignTab::createKeyMapping() //============================================================================== #if 0 -/* -- Introjucer information section -- +/* -- Projucer information section -- - This is where the Introjucer stores the metadata that describe this GUI layout, so + This is where the Projucer stores the metadata that describe this GUI layout, so make changes in here at your peril! BEGIN_JUCER_METADATA @@ -267,22 +325,12 @@ BEGIN_JUCER_METADATA edBkgCol="0" labelText="Assign these values to a key by clicking on the desired key-face." editableSingleClick="0" editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font" fontsize="15" bold="0" italic="0" justification="33"/> -