//============================================================================== ResourceEditorPanel::ResourceEditorPanel (JucerDocument& doc) : document (doc), addButton ("Add new resource..."), reloadAllButton ("Reload all resources"), delButton ("Delete selected resources") { addAndMakeVisible (addButton); addButton.onClick = [this] { document.getResources().browseForResource ("Select a file to add as a resource", "*", {}, {}); }; addAndMakeVisible (reloadAllButton); reloadAllButton.onClick = [this] { reloadAll(); }; addAndMakeVisible (delButton); delButton.setEnabled (false); delButton.onClick = [this] { document.getResources().remove (listBox->getSelectedRow (0)); }; listBox.reset (new TableListBox (String(), this)); addAndMakeVisible (listBox.get()); listBox->getHeader().addColumn ("name", 1, 150, 80, 400); listBox->getHeader().addColumn ("original file", 2, 350, 80, 800); listBox->getHeader().addColumn ("size", 3, 100, 40, 150); listBox->getHeader().addColumn ("reload", 4, 100, 100, 100, TableHeaderComponent::notResizableOrSortable); listBox->getHeader().setStretchToFitActive (true); listBox->setOutlineThickness (1); listBox->updateContent(); document.addChangeListener (this); handleCommandMessage (1); lookAndFeelChanged(); }
//============================================================================== ResourceEditorPanel::ResourceEditorPanel (JucerDocument& doc) : document (doc), addButton ("Add new resource..."), reloadAllButton ("Reload all resources"), delButton ("Delete selected resources") { addAndMakeVisible (&addButton); addButton.addListener (this); addAndMakeVisible (&reloadAllButton); reloadAllButton.addListener (this); addAndMakeVisible (&delButton); delButton.addListener (this); delButton.setEnabled (false); addAndMakeVisible (listBox = new TableListBox (String::empty, this)); listBox->getHeader().addColumn ("name", 1, 150, 80, 400); listBox->getHeader().addColumn ("original file", 2, 350, 80, 800); listBox->getHeader().addColumn ("size", 3, 100, 40, 150); listBox->getHeader().addColumn ("reload", 4, 100, 100, 100, TableHeaderComponent::notResizableOrSortable); listBox->getHeader().setStretchToFitActive (true); listBox->setColour (ListBox::backgroundColourId, Colours::lightgrey); listBox->setColour (ListBox::outlineColourId, Colours::darkgrey); listBox->setOutlineThickness (1); listBox->updateContent(); document.addChangeListener (this); handleCommandMessage (1); }
void SerialProtocolReader::serialInput(unsigned char c) { rx_buffer[rx_buffer_head++] = c; switch(getMessageType()){ // 3 byte messages case SET_LED_MESSAGE: if(rx_buffer_head == 3) handleSetLedMessage(); break; // 2 byte messages case SET_LED_ROW_MESSAGE: if(rx_buffer_head == 2) handleSetLedRowMessage(); break; case SET_LED_COL_MESSAGE: if(rx_buffer_head == 2) handleSetLedColumnMessage(); break; case WRITE_CHARACTER_MESSAGE: if(rx_buffer_head == 2) handleWriteCharacterMessage(); break; // 1 byte messages case FILL_MESSAGE: handleFillMessage(); break; case SHIFT_LEDS_MESSAGE: handleShiftLedsMessage(); break; case COMMAND_MESSAGE: handleCommandMessage(); break; default: // set parameter has a two-bit signature if((rx_buffer[0] & 0xc0) == SET_PARAMETER_MESSAGE){ // case SET_PARAMETER_MESSAGE: if(rx_buffer_head == 2) handleSetParameterMessage(); }else{ rx_buffer_head = 0; blipbox.message(MESSAGE_READ_ERROR); } } }