/**************************************************************************** Name: defaultKeyAction Desc: *****************************************************************************/ void F_DynamicList::defaultKeyAction( FLMUINT uiKey) { switch( uiKey) { case FKB_UP: cursorUp(); break; case FKB_DOWN: cursorDown(); break; case FKB_PGUP: pageUp(); break; case FKB_PGDN: pageDown(); break; case FKB_HOME: home(); break; case FKB_END: end(); break; case 'd': case 'D': { RCODE rc = NE_FLM_OK; rc = this->dumpToFile(); break; } } refresh(); }
void upISR(){ if(isr_mode == SET_MODE || isr_mode == VAR_MODE || isr_mode == APP_MODE) cursorUp(); else if(EDIT_MODE) incInput(); }
void twinkle::findLimbusContour(cv::Mat mat, Point* pupil) { Point cursorUp(*pupil); Point cursorDown(cursorUp.x, cursorUp.y+1); Point cursorLeft(cursorUp); Point cursorRight(cursorUp.x+1, cursorUp.y); std::vector<Point> limbusContourLR, limbusContourUD; bool debug = true; Mat debMatLR(mat.rows, mat.cols, CV_8U); Mat debMatUD(mat.rows, mat.cols, CV_8U); mat.copyTo(debMatLR); mat.copyTo(debMatUD); if(debug) { namedWindow("Limbus contour LR", CV_WINDOW_NORMAL); namedWindow("Limbus contour UD", CV_WINDOW_NORMAL); } mat.at<uchar>(cursorUp) = 0; std::cout<<"limbusContourLR.size() = "<<limbusContourLR.size()<<std::endl; moveCursor(cursorUp, mat, &limbusContourLR, debug, debMatLR, UP_DIR); std::cout<<"After moveUp limbusContourLR.size() = "<<limbusContourLR.size()<<std::endl; moveCursor(cursorDown, mat, &limbusContourLR, debug, debMatLR, DOWN_DIR); std::cout<<"After moveDown limbusContourLR.size() = "<<limbusContourLR.size()<<std::endl; moveCursor(cursorLeft, mat, &limbusContourUD, debug, debMatUD, LEFT_DIR); std::cout<<"After moveLeft limbusContourUD.size() = "<<limbusContourUD.size()<<std::endl; moveCursor(cursorRight, mat, &limbusContourUD, debug, debMatUD, RIGHT_DIR); std::cout<<"After moveRight limbusContourUD.size() = "<<limbusContourUD.size()<<std::endl; }
void cursorLeft(){ if (cursorX > 0){ cursorX--; } else{ cursorX = width - 1; cursorUp(); } }
void leftISR(){ if(isr_mode == SET_MODE || isr_mode == VAR_MODE || isr_mode == APP_MODE) cursorUp(); else if(isr_mode = EDIT_MODE){ if(input_cursor > 0) input_cursor--; } }
void Region::addrandom() { double x = ((double)rand())/RAND_MAX; double y = ((double)rand())/RAND_MAX; double depth = ((double)rand())/RAND_MAX; depth /= 3.0; // fake input shouldn't be very deep NosuchVector pos = NosuchVector(x,y); int sidnum = 2001; // std::string sid = sidString(sidnum,""); Cursor* c = new Cursor(palette, sidnum, "random", this, pos, depth, 1.0f); NosuchDebug("Addrandom creating new Cursor"); cursorDown(c); cursorUp(c); }
bool ClientConsole::onKeyPress (int32_t key, int16_t modifier) { switch (key) { case SDLK_TAB: if (modifier & KMOD_SHIFT) { toggleConsole(); return true; } } if (!_active) return false; switch (key) { case SDLK_ESCAPE: toggleConsole(); break; case SDLK_RETURN: executeCommandLine(); break; case SDLK_BACKSPACE: cursorDelete(); break; case SDLK_DELETE: cursorDelete(false); break; case SDLK_INSERT: _overwrite ^= true; break; case SDLK_LEFT: cursorLeft(); break; case SDLK_RIGHT: cursorRight(); break; case SDLK_UP: cursorUp(); break; case SDLK_DOWN: cursorDown(); break; case SDLK_TAB: autoComplete(); break; default: return false; } return true; }
void Region::processCursor(SpaceCursor* c, int downdragup) { if ( isButton() ) { DEBUGPRINT(("Region::processCursor BUTTON!")); switch ( downdragup ) { case CURSOR_DOWN: buttonDown(); break; case CURSOR_UP: buttonUp(); break; } } else { DEBUGPRINT(("Region::processCursor SURFACE!")); switch ( downdragup ) { case CURSOR_DOWN: cursorDown(c); break; case CURSOR_DRAG: cursorDrag(c); break; case CURSOR_UP: cursorUp(c); break; } } }
void Region::checkCursorUp(int millinow) { if ( ! cursorlist_lock_write() ) { NosuchDebug("Region::checkCursorUp, unable to lock cursorlist"); return; } for ( std::list<Cursor*>::iterator i = _cursors.begin(); i!=_cursors.end(); ) { Cursor* c = *i; NosuchAssert(c); int dt = millinow - c->touched(); if (dt > 4) { // NosuchDebug("checkCursorUp, dt>4 = %d",dt); cursorUp(c); i = _cursors.erase(i); // XXX - should c be deleted? delete c; } else { i++; } } cursorlist_unlock(); }
//============================================================================== bool CodeEditorComponent::keyPressed (const KeyPress& key) { const bool moveInWholeWordSteps = key.getModifiers().isCtrlDown() || key.getModifiers().isAltDown(); const bool shiftDown = key.getModifiers().isShiftDown(); if (key.isKeyCode (KeyPress::leftKey)) { cursorLeft (moveInWholeWordSteps, shiftDown); } else if (key.isKeyCode (KeyPress::rightKey)) { cursorRight (moveInWholeWordSteps, shiftDown); } else if (key.isKeyCode (KeyPress::upKey)) { if (key.getModifiers().isCtrlDown() && ! shiftDown) scrollDown(); #if JUCE_MAC else if (key.getModifiers().isCommandDown()) goToStartOfDocument (shiftDown); #endif else cursorUp (shiftDown); } else if (key.isKeyCode (KeyPress::downKey)) { if (key.getModifiers().isCtrlDown() && ! shiftDown) scrollUp(); #if JUCE_MAC else if (key.getModifiers().isCommandDown()) goToEndOfDocument (shiftDown); #endif else cursorDown (shiftDown); } else if (key.isKeyCode (KeyPress::pageDownKey)) { pageDown (shiftDown); } else if (key.isKeyCode (KeyPress::pageUpKey)) { pageUp (shiftDown); } else if (key.isKeyCode (KeyPress::homeKey)) { if (moveInWholeWordSteps) goToStartOfDocument (shiftDown); else goToStartOfLine (shiftDown); } else if (key.isKeyCode (KeyPress::endKey)) { if (moveInWholeWordSteps) goToEndOfDocument (shiftDown); else goToEndOfLine (shiftDown); } else if (key.isKeyCode (KeyPress::backspaceKey)) { backspace (moveInWholeWordSteps); } else if (key.isKeyCode (KeyPress::deleteKey)) { deleteForward (moveInWholeWordSteps); } else if (key == KeyPress (T('c'), ModifierKeys::commandModifier, 0)) { copy(); } else if (key == KeyPress (T('x'), ModifierKeys::commandModifier, 0)) { copyThenCut(); } else if (key == KeyPress (T('v'), ModifierKeys::commandModifier, 0)) { paste(); } else if (key == KeyPress (T('z'), ModifierKeys::commandModifier, 0)) { undo(); } else if (key == KeyPress (T('y'), ModifierKeys::commandModifier, 0) || key == KeyPress (T('z'), ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0)) { redo(); } else if (key == KeyPress (T('a'), ModifierKeys::commandModifier, 0)) { selectAll(); } else if (key == KeyPress::tabKey || key.getTextCharacter() == '\t') { insertTabAtCaret(); } else if (key == KeyPress::returnKey) { newTransaction(); insertTextAtCaret (document.getNewLineCharacters()); } else if (key.isKeyCode (KeyPress::escapeKey)) { newTransaction(); } else if (key.getTextCharacter() >= ' ') { insertTextAtCaret (String::charToString (key.getTextCharacter())); } else { return false; } return true; }
void H19::processCharacter(char ch) { // mask off the high bit just in case, the real H19 would not have it set. ch &= 0x7f; if (mode_m == Normal) { switch (ch) { case ascii::NUL: case ascii::SOH: case ascii::STX: case ascii::ETX: case ascii::EOT: case ascii::ENQ: case ascii::ACK: case ascii::VT: case ascii::FF: case ascii::SO: case ascii::SI: case ascii::DLE: case ascii::DC1: case ascii::DC2: case ascii::DC3: case ascii::DC4: case ascii::NAK: case ascii::SYN: case ascii::ETB: case ascii::EM: case ascii::SUB: case ascii::FS: case ascii::GS: case ascii::RS: case ascii::US: case ascii::DEL: // From manual, these characters are not processed by the terminal break; case ascii::BEL: // Rings the bell. /// \todo - implement ringing bell. consoleLog("<BEL>"); break; case ascii::BS: // Backspace consoleLog("<BS>"); processBS(); break; case ascii::HT: // Horizontal Tab consoleLog("<TAB>"); processTAB(); break; case ascii::LF: // Line Feed processLF(); if (autoCR_m) { processCR(); } consoleLog("\n"); break; case ascii::CR: // Carriage Return processCR(); if (autoLF_m) { processLF(); } break; case ascii::CAN: // Cancel. break; case ascii::ESC: // Escape mode_m = Escape; consoleLog("<ESC>"); break; default: // if Printable character display it. #if CONSOLE_LOG fprintf(console_out, "%c", ch); #endif displayCharacter(ch); break; } } else if (mode_m == Escape) { // Assume we go back to Normal, so only the few that don't need to set the mode. mode_m = Normal; switch (ch) { case ascii::CAN: // CAN - Cancel // return to Normal mode, already set. break; case ascii::ESC: // Escape // From the ROM listing, stay in this mode. mode_m = Escape; break; // Cursor Functions case 'H': // Cursor Home posX_m = posY_m = 0; updated_m = true; break; case 'C': // Cursor Forward cursorForward(); break; case 'D': // Cursor Backward processBS(); // same processing as cursor backward break; case 'B': // Cursor Down cursorDown(); break; case 'A': // Cursor Up cursorUp(); break; case 'I': // Reverse Index reverseIndex(); break; case 'n': // Cursor Position Report cursorPositionReport(); break; case 'j': // Save cursor position saveCursorPosition(); break; case 'k': // Restore cursor position restoreCursorPosition(); break; case 'Y': // Direct Cursor Addressing mode_m = DCA_1; break; // Erase and Editing case 'E': // Clear Display clearDisplay(); break; case 'b': // Erase Beginning of Display eraseBOD(); break; case 'J': // Erase to End of Page eraseEOP(); break; case 'l': // Erase entire Line eraseEL(); break; case 'o': // Erase Beginning Of Line eraseBOL(); break; case 'K': // Erase To End Of Line eraseEOL(); break; case 'L': // Insert Line insertLine(); break; case 'M': // Delete Line deleteLine(); break; case 'N': // Delete Character deleteChar(); break; case '@': // Enter Insert Character Mode insertMode_m = true; break; case 'O': // Exit Insert Character Mode insertMode_m = false; break; // Configuration case 'z': // Reset To Power-Up Configuration reset(); break; case 'r': // Modify the Baud Rate /// \todo - determine if we should support this. debugss(ssH19, ERROR, "Error Unimplemented Modify Baud\n"); break; case 'x': // Set Mode mode_m = SetMode; break; case 'y': // Reset Mode mode_m = ResetMode; break; case '<': // Enter ANSI Mode /// \todo - implement ANSI mode. // ROM - just sets the mode debugss(ssH19, ERROR, "Error Entering ANSI mode - unsupported\n"); break; // Modes of operation case '[': // Enter Hold Screen Mode holdScreen_m = true; break; case '\\': // Exit Hold Screen Mode holdScreen_m = false; break; case 'p': // Enter Reverse Video Mode reverseVideo_m = true; break; case 'q': // Exit Reverse Video Mode reverseVideo_m = false; break; case 'F': // Enter Graphics Mode graphicMode_m = true; break; case 'G': // Exit Graphics Mode graphicMode_m = false; break; case 't': // Enter Keypad Shifted Mode keypadShifted_m = true; break; case 'u': // Exit Keypad Shifted Mode // ROM - just sets the mode keypadShifted_m = false; break; case '=': // Enter Alternate Keypad Mode // ROM - just sets the mode keypadShifted_m = true; break; case '>': // Exit Alternate Keypad Mode // ROM - just sets the mode keypadShifted_m = false; break; // Additional Functions case '}': // Keyboard Disable /// \todo - determine whether to do this. keyboardEnabled_m = false; break; case '{': // Keyboard Enable keyboardEnabled_m = true; break; case 'v': // Wrap Around at End Of Line wrapEOL_m = true; break; case 'w': // Discard At End Of Line wrapEOL_m = false; break; case 'Z': // Identify as VT52 (Data: ESC / K) debugss(ssH19, ERROR, "Identify request\n"); sendData(ascii::ESC); sendData('/'); sendData('K'); break; case ']': // Transmit 25th Line transmitLine25(); break; case '#': // Transmit Page transmitPage(); break; default: debugss(ssH19, WARNING, "Unhandled ESC: %d\n", ch); /// \todo - verify this is how the H19 ROM does it. break; } } else if (mode_m == SetMode) { mode_m = Normal; switch (ch) { case '1': // Enable 25th line // From the ROM, it erases line 25 on the enable, but here we erase on the disable. line25_m = true; break; case '2': // No key click keyClick_m = true; break; case '3': // Hold screen mode holdScreen_m = true; break; case '4': // Block Cursor cursorBlock_m = true; updated_m = true; break; case '5': // Cursor Off cursorOff_m = true; updated_m = true; break; case '6': // Keypad Shifted keypadShifted_m = true; break; case '7': // Alternate Keypad mode altKeypadMode_m = true; break; case '8': // Auto LF autoLF_m = true; break; case '9': // Auto CR autoCR_m = true; break; default: /// \todo Need to process ch as if none of this happened... debugss(ssH19, WARNING, "Invalid set Mode: %c\n", ch); break; } } else if (mode_m == ResetMode) { mode_m = Normal; switch (ch) { case '1': // Disable 25th line eraseLine(rowsMain_c); line25_m = false; updated_m = true; break; case '2': // key click keyClick_m = false; break; case '3': // Hold screen mode holdScreen_m = false; break; case '4': // Block Cursor cursorBlock_m = false; updated_m = true; break; case '5': // Cursor On cursorOff_m = false; updated_m = true; break; case '6': // Keypad Unshifted keypadShifted_m = false; break; case '7': // Exit Alternate Keypad mode altKeypadMode_m = false; break; case '8': // No Auto LF autoLF_m = false; break; case '9': // No Auto CR autoCR_m = false; break; default: /// \todo Need to process ch as if none of this happened... debugss(ssH19, WARNING, "Invalid reset Mode: %c\n", ch); break; } } else if (mode_m == DCA_1) { // From actual H19, once the line is specified, the cursor // immediately moves to that line, so no need to save the // position and wait for the entire command. /// \todo verify that this is the same on newer H19s. if (ch == ascii::CAN) { // cancel mode_m = Normal; } else { // \todo handle error conditions int pos = ch - 31; // verify valid Position if (((pos > 0) && (pos < (signed) rows_c)) || ((pos == (signed) rows_c) && (line25_m))) { posY_m = pos - 1; } else { /// \todo check to see how a real h19 handles this. debugss(ssH19, INFO, "DCA invalid Y: %d\n", pos); } mode_m = DCA_2; } } else if (mode_m == DCA_2) { if (ch == ascii::CAN) { // cancel mode_m = Normal; } else { int pos = ch - 31; if ((pos > 0) && (pos < 81)) { posX_m = pos - 1; } else { posX_m = (cols_c - 1); } updated_m = true; mode_m = Normal; } } }
void Engine::CursorUp () { cursorUp(); }