bool ProjectContentComponent::perform (const InvocationInfo& info) { switch (info.commandID) { case CommandIDs::saveProject: case CommandIDs::closeProject: case CommandIDs::saveDocument: case CommandIDs::saveDocumentAs: case CommandIDs::closeDocument: case CommandIDs::goToPreviousDoc: case CommandIDs::goToNextDoc: case CommandIDs::goToCounterpart: case CommandIDs::saveAndOpenInIDE: if (reinvokeCommandAfterCancellingModalComps (info)) { grabKeyboardFocus(); // to force any open labels to close their text editors return true; } break; default: break; } if (isCurrentlyBlockedByAnotherModalComponent()) return false; switch (info.commandID) { case CommandIDs::saveProject: saveProject(); break; case CommandIDs::closeProject: closeProject(); break; case CommandIDs::saveDocument: saveDocument(); break; case CommandIDs::saveDocumentAs: saveAs(); break; case CommandIDs::closeDocument: closeDocument(); break; case CommandIDs::goToPreviousDoc: goToPreviousFile(); break; case CommandIDs::goToNextDoc: goToNextFile(); break; case CommandIDs::goToCounterpart: goToCounterpart(); break; case CommandIDs::showFilePanel: showFilesTab(); break; case CommandIDs::showConfigPanel: showConfigTab(); break; case CommandIDs::showProjectSettings: showProjectSettings(); break; case CommandIDs::showProjectModules: showModules(); break; case CommandIDs::openInIDE: openInIDE (false); break; case CommandIDs::saveAndOpenInIDE: openInIDE (true); break; case CommandIDs::createNewExporter: showNewExporterMenu(); break; case CommandIDs::deleteSelectedItem: deleteSelectedTreeItems(); break; case CommandIDs::showTranslationTool: showTranslationTool(); break; default: return false; } return true; }
void AudioEditor::select() { isSelected = true; repaint(); setWantsKeyboardFocus(true); grabKeyboardFocus(); }
void HelmStandaloneEditor::handleMessage(const Message& message) { #ifdef JUCE_MAC Thread::sleep(100); if(!hasKeyboardFocus(false)) { postMessage(new Message()); grabKeyboardFocus(); } #endif }
void CodeFileListComponent::filesDropped (const juce::StringArray& incomingFiles, const int, const int) { codeFiles.addFiles (incomingFiles); fileListBox.updateContent(); setColour (juce::ListBox::outlineColourId, juce::Colours::white.withAlpha (0.5f)); grabKeyboardFocus(); }
void timerCallback() override { if (renderComponent.currentTest == nullptr) return; grabKeyboardFocus(); checkKeys(); renderComponent.currentTest->m_world->Step (1.0f / 60.0f, 6, 2); repaint(); }
void BCMLabel::mouseDown(const MouseEvent& event) { if (event.mods.isPopupMenu()) { grabKeyboardFocus(); showPopupMenu(); } else { Label::mouseDown(event); } }
HelmStandaloneEditor::HelmStandaloneEditor() { setSynth(&synth_); setGuiState(&gui_state_); keyboard_state_ = new MidiKeyboardState(); midi_manager_ = new MidiManager(&synth_, keyboard_state_, &gui_state_, &critical_section_, this); computer_keyboard_ = new HelmComputerKeyboard(&synth_, keyboard_state_, &critical_section_); output_memory_ = new mopo::Memory(MAX_OUTPUT_MEMORY); memory_offset_ = 0; Startup::doStartupChecks(midi_manager_, computer_keyboard_); setAudioChannels(0, mopo::NUM_CHANNELS); AudioDeviceManager::AudioDeviceSetup setup; deviceManager.getAudioDeviceSetup(setup); setup.sampleRate = mopo::DEFAULT_SAMPLE_RATE; deviceManager.initialise(0, mopo::NUM_CHANNELS, nullptr, true, "", &setup); if (deviceManager.getCurrentAudioDevice() == nullptr) { const OwnedArray<AudioIODeviceType>& device_types = deviceManager.getAvailableDeviceTypes(); for (AudioIODeviceType* device_type : device_types) { deviceManager.setCurrentAudioDeviceType(device_type->getTypeName(), true); if (deviceManager.getCurrentAudioDevice()) break; } } const StringArray all_midi_ins(MidiInput::getDevices()); for (int i = 0; i < all_midi_ins.size(); ++i) deviceManager.setMidiInputEnabled(all_midi_ins[i], true); deviceManager.addMidiInputCallback("", midi_manager_); setLookAndFeel(DefaultLookAndFeel::instance()); gui_ = new FullInterface(synth_.getControls(), synth_.getModulationSources(), synth_.getMonoModulations(), synth_.getPolyModulations(), keyboard_state_); gui_->setOutputMemory(output_memory_.get()); addAndMakeVisible(gui_); setSize(WIDTH, HEIGHT); grabKeyboardFocus(); setWantsKeyboardFocus(true); addKeyListener(computer_keyboard_); postMessage(new Message()); setOpaque(true); }
//============================================================================== void Joystick::mouseDown(const MouseEvent& e) { mouseWasHidden = false; if (isEnabled()) { if (e.mods.isPopupMenu() && menuEnabled) { menuShown = true; PopupMenu m; m.addItem (1, TRANS ("velocity-sensitive mode"), true, isVelocityBased); m.addSeparator(); const int r = m.show(); if (r == 1) { setVelocityBasedMode (! isVelocityBased); } else if (r == 2) { // setSliderStyle (RotaryHorizontalDrag); } else if (r == 3) { // setSliderStyle (RotaryVerticalDrag); } } else if (e.mods.isLeftButtonDown() || e.mods.isMiddleButtonDown()) { menuShown = false; // unbound mouse movements if (isVelocityBased) { e.source.enableUnboundedMouseMovement (true, false); mouseWasHidden = true; } startPressX = e.x; startPressY = e.y; // In case it was a click without a drag, do the drag anyway mouseDrag (e); } // So arrow keys works grabKeyboardFocus(); } }
KeyEntryWindow (KeyMappingEditorComponent& kec) : AlertWindow (TRANS("New key-mapping"), TRANS("Please press a key combination now..."), AlertWindow::NoIcon), owner (kec) { addButton (TRANS("OK"), 1); addButton (TRANS("Cancel"), 0); // (avoid return + escape keys getting processed by the buttons..) for (int i = getNumChildComponents(); --i >= 0;) getChildComponent (i)->setWantsKeyboardFocus (false); setWantsKeyboardFocus (true); grabKeyboardFocus(); }
bool PizKeyboardComponent::mouseDownOnKey(int midiNoteNumber, const MouseEvent &e) { midiKeyboardEditor* editor = ((midiKeyboardEditor*)(this->getParentComponent())); if (e.mods.isAltDown()) { editor->getFilter()->setParameter(kHidePanel,1.f-editor->getFilter()->getParameter(kHidePanel)); return false; } int l = isBlackKey(midiNoteNumber) ? this->getBlackNoteLength() : getHeight(); float velocity = editor->getFilter()->getParameter(kUseY)>=0.5f ? (float)e.getMouseDownY()/(float)l : editor->getFilter()->getParameter(kVelocity); if (e.mods.isCtrlDown() || e.mods.isMiddleButtonDown()) { s->allNotesOff(this->getMidiChannel()); _keysPressed.clear(); return false; } else if (e.mods.isShiftDown()) { if (!e.mods.isPopupMenu()) setKeyPressBaseOctave(midiNoteNumber/12); grabKeyboardFocus(); repaint(); return false; } else if (e.mods.isPopupMenu()!=toggle) { if (s->isNoteOn(this->getMidiChannel(),midiNoteNumber)) { s->noteOff(this->getMidiChannel(),midiNoteNumber); } else { s->noteOn(this->getMidiChannel(),midiNoteNumber,velocity); } return false; } else { if (!s->isNoteOn(this->getMidiChannel(),midiNoteNumber)) { //s->noteOn(this->getMidiChannel(),midiNoteNumber,velocity); this->setVelocity(velocity,false); return true; } else { s->noteOff(this->getMidiChannel(),midiNoteNumber); return false; } } return true; }
HelmStandaloneEditor::HelmStandaloneEditor() : SynthGuiInterface(this) { computer_keyboard_ = new HelmComputerKeyboard(&engine_, keyboard_state_); setAudioChannels(0, mopo::NUM_CHANNELS); AudioDeviceManager::AudioDeviceSetup setup; deviceManager.getAudioDeviceSetup(setup); setup.sampleRate = mopo::DEFAULT_SAMPLE_RATE; deviceManager.initialise(0, mopo::NUM_CHANNELS, nullptr, true, "", &setup); if (deviceManager.getCurrentAudioDevice() == nullptr) { const OwnedArray<AudioIODeviceType>& device_types = deviceManager.getAvailableDeviceTypes(); for (AudioIODeviceType* device_type : device_types) { deviceManager.setCurrentAudioDeviceType(device_type->getTypeName(), true); if (deviceManager.getCurrentAudioDevice()) break; } } const StringArray all_midi_ins(MidiInput::getDevices()); for (int i = 0; i < all_midi_ins.size(); ++i) deviceManager.setMidiInputEnabled(all_midi_ins[i], true); deviceManager.addMidiInputCallback("", midi_manager_); setLookAndFeel(DefaultLookAndFeel::instance()); addAndMakeVisible(gui_); gui_->setOutputMemory(getOutputMemory()); gui_->animate(LoadSave::shouldAnimateWidgets()); setSize(WIDTH, HEIGHT); setWantsKeyboardFocus(true); grabKeyboardFocus(); addKeyListener(computer_keyboard_); postMessage(new Message()); setOpaque(true); }
bool ProjectContentComponent::perform (const InvocationInfo& info) { switch (info.commandID) { case CommandIDs::saveProject: case CommandIDs::closeProject: case CommandIDs::saveDocument: case CommandIDs::saveDocumentAs: case CommandIDs::closeDocument: case CommandIDs::goToPreviousDoc: case CommandIDs::goToNextDoc: case CommandIDs::goToCounterpart: case CommandIDs::saveAndOpenInIDE: if (reinvokeCommandAfterCancellingModalComps (info)) { grabKeyboardFocus(); // to force any open labels to close their text editors return true; } break; default: break; } if (isCurrentlyBlockedByAnotherModalComponent()) return false; switch (info.commandID) { case CommandIDs::saveProject: saveProject(); break; case CommandIDs::closeProject: closeProject(); break; case CommandIDs::saveDocument: saveDocument(); break; case CommandIDs::saveDocumentAs: saveAs(); break; case CommandIDs::closeDocument: closeDocument(); break; case CommandIDs::goToPreviousDoc: goToPreviousFile(); break; case CommandIDs::goToNextDoc: goToNextFile(); break; case CommandIDs::goToCounterpart: goToCounterpart(); break; case CommandIDs::showProjectSettings: showProjectSettings(); break; case CommandIDs::showProjectTab: showProjectTab(); break; case CommandIDs::showBuildTab: showBuildTab(); break; case CommandIDs::showFileExplorerPanel: showFilesPanel(); break; case CommandIDs::showModulesPanel: showModulesPanel(); break; case CommandIDs::showExportersPanel: showExportersPanel(); break; case CommandIDs::showExporterSettings: showCurrentExporterSettings(); break; case CommandIDs::openInIDE: openInSelectedIDE (false); break; case CommandIDs::saveAndOpenInIDE: openInSelectedIDE (true); break; case CommandIDs::createNewExporter: showNewExporterMenu(); break; case CommandIDs::deleteSelectedItem: deleteSelectedTreeItems(); break; case CommandIDs::showTranslationTool: showTranslationTool(); break; case CommandIDs::cleanAll: cleanAll(); break; case CommandIDs::toggleBuildEnabled: setBuildEnabled (! isBuildEnabled()); break; case CommandIDs::buildNow: rebuildNow(); break; case CommandIDs::toggleContinuousBuild: setContinuousRebuildEnabled (! isContinuousRebuildEnabled()); break; case CommandIDs::launchApp: launchApp(); break; case CommandIDs::killApp: killApp(); break; case CommandIDs::reinstantiateComp: reinstantiateLivePreviewWindows(); break; case CommandIDs::showWarnings: toggleWarnings(); break; case CommandIDs::nextError: showNextError(); break; case CommandIDs::prevError: showPreviousError(); break; default: return false; } return true; }