const bool Win32NotificationWindow::createTrapWindow() { WNDCLASSEXA wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = Win32NotificationWindow::WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = GetModuleHandle(NULL); wcex.hIcon = 0; wcex.hCursor = 0; wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wcex.lpszMenuName = 0; wcex.lpszClassName = classname; wcex.hIconSm = 0; RegisterClassExA(&wcex); hWindow = CreateWindowEx ( 0, (LPCSTR)classname, (LPCSTR)"EDO", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 544, 375, HWND_DESKTOP, NULL, GetModuleHandle(NULL), NULL ); if (NULL == hWindow) { lastError = GetLastError(); return (false); } else { const KeyPress kp = KeyPress::createFromDescription (keyCodeDescription); if ( ! RegisterHotKey(hWindow, 0x0aff, kp.getModifiers().getRawFlags(), kp.getKeyCode()) ) { lastError = GetLastError(); return (false); } } return (true); }
const Result ctrlr_sendKeyPressEvent (const KeyPress &keyPress) { Display *display = XOpenDisplay(0); if(display == NULL) return (Result::fail("Can't open display")); Window winRoot = XDefaultRootWindow(display); Window winFocus; int revert; if (!XGetInputFocus(display, &winFocus, &revert)) { return (Result::fail("XGetInputFocus failed")); } XKeyEvent event = createKeyEvent(display, winFocus, winRoot, true, keyPress.getKeyCode(), keyPress.getModifiers().getRawFlags()); if (XSendEvent(event.display, event.window, True, KeyPressMask, (XEvent *)&event) == 0) { return (Result::fail("XSendEvent failed")); } event = createKeyEvent(display, winFocus, winRoot, false, keyPress.getKeyCode(), keyPress.getModifiers().getRawFlags()); if (XSendEvent(event.display, event.window, True, KeyPressMask, (XEvent *)&event) == 0) { return (Result::fail("XSendEvent failed")); } XCloseDisplay(display); return (Result::ok()); }
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here... bool CtrlrLuaConsole::keyPressed (const KeyPress& key, Component* originatingComponent) { if (key.getKeyCode() == 13 && originatingComponent == luaConsoleInput && !key.getModifiers().isCtrlDown()) { runCode(inputDocument.getAllContent()); if ((bool)owner.getProperty(Ids::uiLuaConsoleInputRemoveAfterRun)) { inputDocument.replaceAllContent(String::empty); } return (true); } else if (key.getKeyCode() == 13 && originatingComponent == luaConsoleInput && key.getModifiers().isCtrlDown()) { luaConsoleInput->insertTextAtCaret ("\n"); return (true); } else if (key.getKeyCode() == KeyPress::upKey && key.getModifiers().isCtrlDown() && originatingComponent == luaConsoleInput ) { if(inputHistory.size()) { // Prev command if (nextUpKeyPressWillbeFirst) { currentInputString = inputDocument.getAllContent(); nextUpKeyPressWillbeFirst = false; } luaConsoleInput->loadContent(inputHistory[lastCommandNumInHistory]); /* Put text at pointer into console */ lastCommandNumInHistory = ( ((lastCommandNumInHistory - 1) < 0) ? 0 : (lastCommandNumInHistory - 1) ); lastMoveDirection = UP; } return (true); } else if (key.getKeyCode() == KeyPress::downKey && key.getModifiers().isCtrlDown() && originatingComponent == luaConsoleInput) { if(inputHistory.size()) { // next command if (lastCommandNumInHistory == (inputHistory.size() - 1)) // at last command only { if (!currentInputString.isEmpty()) { luaConsoleInput->loadContent(currentInputString); nextUpKeyPressWillbeFirst = true; // if user changes this restored text we need to capture it at up key again } return true; } lastCommandNumInHistory += 1; luaConsoleInput->loadContent(inputHistory[lastCommandNumInHistory]); /* Put text at pointer into console */ lastMoveDirection = DOWN; } return (true); } return (false); }
bool MainContentComponent::keyPressed (const KeyPress& key) { //[UserCode_keyPressed] -- Add your code here... if (key.getKeyCode() == 95 && key.getModifiers().isCtrlDown()) { changeGain(-1.00); } if (key.getKeyCode() == 43 && key.getModifiers().isCtrlDown()) { changeGain(+1.00); } return FALSE; // Return true if your handler uses this key event, or false to allow it to be passed-on. //[/UserCode_keyPressed] }
bool GenericEditor::keyPressed (const KeyPress& key) { //std::cout << name << " received " << key.getKeyCode() << std::endl; if (key.getKeyCode() == key.deleteKey || key.getKeyCode() == key.backspaceKey) { //std::cout << name << " should be deleted." << std::endl; viewport->deleteNode(this); } else if (key.getKeyCode() == key.leftKey || key.getKeyCode() == key.rightKey) { viewport->moveSelection(key); } }
bool ControlPanel::keyPressed(const KeyPress& key) { std::cout << "Control panel received" << key.getKeyCode() << std::endl; return false; }
bool FileBrowserComponent::keyPressed (const KeyPress& key) { (void) key; #if JUCE_LINUX || JUCE_WINDOWS if (key.getModifiers().isCommandDown() && (key.getKeyCode() == 'H' || key.getKeyCode() == 'h')) { fileList->setIgnoresHiddenFiles (! fileList->ignoresHiddenFiles()); fileList->refresh(); return true; } #endif return false; }
bool VstPluginExternalEditor::keyPressed (const KeyPress &key) { #if defined(LINUX) if (! handle) return false; XEvent ev; zerostruct (ev); ev.xkey.type = 2; // KeyPress ev.xkey.display = display; ev.xkey.window = handle; ev.xkey.root = RootWindow (display, DefaultScreen (display)); ev.xkey.subwindow = None; ev.xkey.time = CurrentTime; // ev.xkey.x = e.x; // ev.xkey.y = e.y; // ev.xkey.x_root = e.getScreenX (); // ev.xkey.y_root = e.getScreenY (); // ev.xkey.state = e.y; ev.xkey.keycode = key.getKeyCode(); ev.xkey.same_screen = True; sendEventToChild (& ev); return true; #else return false; #endif }
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here... bool CtrlrLuaConsole::keyPressed (const KeyPress& key, Component* originatingComponent) { if (key.getKeyCode() == 13 && originatingComponent == luaConsoleInput && !key.getModifiers().isCtrlDown()) { runCode(inputDocument.getAllContent()); if ((bool)owner.getProperty(Ids::uiLuaConsoleInputRemoveAfterRun)) { inputDocument.replaceAllContent(String::empty); } return (true); } else if (key.getKeyCode() == 13 && originatingComponent == luaConsoleInput && key.getModifiers().isCtrlDown()) { luaConsoleInput->insertTextAtCaret ("\n"); } return (false); }
bool TextBuffer::keyPressed (const KeyPress& key) { //std::cout << "keyPressed: " << key.getTextDescription().toUTF8() << T("\n"); if (isMatching()) stopMatching(); TextEditor::keyPressed(key); juce_wchar chr=key.getTextCharacter(); CommandID com=CommandIDs::EditorTextChanged; if (key.getKeyCode()==KeyPress::returnKey) com=CommandIDs::EditorNewline; else if (key.getKeyCode()==KeyPress::backspaceKey) com=CommandIDs::EditorBackspace; else if (!testFlag(EditFlags::MatchingOff) && (chr==')' || ((textid==TextIDs::Sal) && chr=='}') || ((textid==TextIDs::Sal2) && chr=='}'))) matchParens(); colorizeAfterChange(com); setFlag(EditFlags::NeedsSave); return true; }
bool CtrlrLuaMethodEditor::keyPressed (const KeyPress& key, Component* originatingComponent) { if (key.getModifiers().isCommandDown()) { if (key.getKeyCode() == 70) { // CTRL + F methodEditArea->showFindDialog(); } if (key.getKeyCode() == 72) { methodEditArea->replaceNextMatch(); } } if (key.getKeyCode() == 65650) // F3 { methodEditArea->findNextMatch(); } return false; }
static void sendKey(const KeyPress &event) { INPUT input; input.type = INPUT_KEYBOARD; input.ki.time = 0; input.ki.dwExtraInfo = 0; input.ki.wScan = 0; input.ki.dwFlags = 0; // Modifier Down if (event.getModifiers().isCommandDown()) { input.ki.wVk = VK_CONTROL; SendInput(1, &input, sizeof(INPUT)); } if (event.getModifiers().isAltDown()) { input.ki.wVk = VK_MENU; SendInput(1, &input, sizeof(INPUT)); } if (event.getModifiers().isShiftDown()) { input.ki.wVk = VK_SHIFT; SendInput(1, &input, sizeof(INPUT)); } // KEY Down input.ki.wVk = event.getKeyCode(); SendInput(1, &input, sizeof(INPUT)); // KEY Up input.ki.dwFlags = KEYEVENTF_KEYUP; SendInput(1, &input, sizeof(INPUT)); // MODIFIER Up if (event.getModifiers().isCommandDown()) { input.ki.wVk = VK_CONTROL; SendInput(1, &input, sizeof(INPUT)); } if (event.getModifiers().isAltDown()) { input.ki.wVk = VK_MENU; SendInput(1, &input, sizeof(INPUT)); } if (event.getModifiers().isShiftDown()) { input.ki.wVk = VK_SHIFT; SendInput(1, &input, sizeof(INPUT)); } }
bool keyPressed( const KeyPress& keyPress ) { int iKeyCode = toupper(keyPress.getKeyCode()); if ( iKeyCode == KeyPress::escapeKey ) { JUCEApplication::quit(); return true; } if ( iKeyCode == KeyPress::upKey ) { m_camera.RotateOrbit( 0, 0, LeapUtil::kfHalfPi * -0.05f ); return true; } if ( iKeyCode == KeyPress::downKey ) { m_camera.RotateOrbit( 0, 0, LeapUtil::kfHalfPi * 0.05f ); return true; } if ( iKeyCode == KeyPress::leftKey ) { m_camera.RotateOrbit( 0, LeapUtil::kfHalfPi * -0.05f, 0 ); return true; } if ( iKeyCode == KeyPress::rightKey ) { m_camera.RotateOrbit( 0, LeapUtil::kfHalfPi * 0.05f, 0 ); return true; } switch( iKeyCode ) { case ' ': resetCamera(); break; case 'H': m_bShowHelp = !m_bShowHelp; break; case 'P': m_bPaused = !m_bPaused; break; default: return false; } return true; }
bool StateMachineView::keyPressed(const KeyPress & e) { if (BaseManagerViewUI::keyPressed(e)) return true; if (e.getKeyCode() == KeyPress::createFromDescription("a").getKeyCode()) { if (itemsUI.size() >= 2) { manager->stm.addItem(itemsUI[0]->item, itemsUI[1]->item); } return true; } return false; }
bool SpikeDisplayCanvas::keyPressed(const KeyPress& key) { KeyPress c = KeyPress::createFromDescription("c"); if (key.isKeyCode(c.getKeyCode())) // C { spikeDisplay->clear(); std::cout << "Clearing display" << std::endl; return true; } return false; }
bool ScannerManagerComponent::keyPressed (const KeyPress &k, Component* originatingComponent) { if (k.getKeyCode() == k.backspaceKey) { for (unsigned i = 0; i < cues.size(); i++) { if (cues[i]->isSelected()) { removeCue (i); repaint (); return true; } } return false; } return false; }
void CtrlrValueTreeEditorItem::keyPressed (const KeyPress &key) { if (key.getKeyCode() == 65649) // F2 { if (!provider.canBeRenamed(treeToEdit)) return; AlertWindow wnd("Rename item","Rename current item type: " + treeToEdit.getType().toString(), AlertWindow::QuestionIcon, getOwnerView()); wnd.addTextEditor ("name", treeToEdit.getProperty(nameIdentifier), "Name:", false); wnd.addButton ("OK", 1, KeyPress(KeyPress::returnKey)); wnd.addButton ("Cancel", 0, KeyPress(KeyPress::escapeKey)); if (wnd.runModalLoop()) { if (provider.renameItem (treeToEdit, wnd.getTextEditorContents("name"))) { treeToEdit.setProperty (Ids::name, wnd.getTextEditorContents("name"), nullptr); } provider.triggerAsyncUpdate(); } } }
bool PointEditor::keyPressed (const KeyPress &k, Component *c) { if (k.getKeyCode() == k.backspaceKey) { if (selectedPoint > -1) { points.erase(points.begin() + selectedPoint); if (points.size() > selectedPoint - 1 && selectedPoint - 1 > -1) selectedPoint = selectedPoint - 1; else if (points.size() < selectedPoint) selectedPoint = -1; sendChangeMessage(); repaint(); return true; } } return false; }
bool CtrlrLuaMethodCodeEditor::keyPressed (const KeyPress &key, Component *originatingComponent) { if (key.getModifiers().isCommandDown() ) { if(key.getKeyCode() == 9) { owner.keyPressed (key, originatingComponent); return (true); } if (key.getKeyCode() == 83) // CTRL + S { saveDocument(); return (true); } if (CharacterFunctions::toUpperCase ((juce_wchar) (key.getKeyCode())) == 70) // CTRL + F { // Show search Dialog editorComponent->showFindPanel(); return (true); } if (CharacterFunctions::toUpperCase ((juce_wchar) (key.getKeyCode())) == 71) // CTRL + G { // Show Go To Dialog editorComponent->showGoTOPanel(); return (true); } if (CharacterFunctions::toUpperCase ((juce_wchar) (key.getKeyCode())) == 72) // CTRL + H { // Show search Dialog editorComponent->showFindPanel(true); return (true); } if (key.getKeyCode() == KeyPress::deleteKey) // CTRL + Delete { owner.keyPressed(key, originatingComponent); return (true); } // search selected previous in current if (key.getModifiers().isShiftDown() && key.getKeyCode() == KeyPress::F3Key) // CTRL + SHIFT + F3 { editorComponent->findSelection(false); return (true); } } // search selected next in current if (key.getModifiers().isShiftDown() && key.getKeyCode() == KeyPress::F3Key) // SHIFT + F3 { editorComponent->findSelection(true); return (true); } if (key.getKeyCode() == KeyPress::F7Key) { saveAndCompileDocument(); return (true); } if (key.getKeyCode() == KeyPress::F8Key) { owner.saveAndCompilAllMethods(); return (true); } CodeDocument::Position pos = editorComponent->getCaretPos(); owner.setPositionLabelText ("Line: " + String(pos.getLineNumber()+1) + " Column: " + String(pos.getIndexInLine())); return (false); }
bool CtrlrLuaMethodEditor::keyPressed (const KeyPress& key, Component* originatingComponent) { if (key.getModifiers().isCommandDown()) { if (key.getKeyCode() == 9) { // CTRL + TAB if (methodEditArea) { return (methodEditArea->keyPressed (key, originatingComponent)); } } if (CharacterFunctions::toUpperCase ((juce_wchar) (key.getKeyCode())) == 70) { // CTRL + F if (getCurrentEditor()) { getCurrentEditor()->getCodeComponent()->showFindPanel(false); } else { methodEditArea->showFindDialog(); } return (true); } if (CharacterFunctions::toUpperCase ((juce_wchar) (key.getKeyCode())) == 71) { // CTRL + G if (getCurrentEditor()) { getCurrentEditor()->getCodeComponent()->showGoTOPanel(); } return (true); } if (CharacterFunctions::toUpperCase ((juce_wchar) (key.getKeyCode())) == 72) { // CTRL + H if (getCurrentEditor()) { getCurrentEditor()->getCodeComponent()->showFindPanel(true); } else { methodEditArea->replaceNextMatch(); } return (true); } if (key.getKeyCode() == KeyPress::deleteKey) { // CTRL + delete methodEditArea->clearOutputText(); return (true); } } if (key.getKeyCode() == KeyPress::F3Key) // F3 { methodEditArea->findNextMatch(); return (true); } if (getCurrentEditor()) { return (getCurrentEditor()->keyPressed (key,originatingComponent)); } return false; }