void Editable::onKeyPressed(const KeyEvent &e) { UIElement::onKeyPressed(e); if(e.isPrintable()) insertAtCursor(e.getCharacter()); else { size_t oldPos; switch(e.getKeyCode()) { case VK_DELETE: removeNext(); break; case VK_BACKSP: removeLast(); break; case VK_LEFT: if(_cursor > 0) moveCursor(-1); if(e.isShiftDown()) changeSelection(_cursor,_cursor + 1,DIR_LEFT); else if(_selStart != -1) clearSelection(); break; case VK_RIGHT: if(_cursor < _str.length()) moveCursor(1); if(e.isShiftDown()) changeSelection(_cursor,_cursor - 1,DIR_RIGHT); else if(_selStart != -1) clearSelection(); break; case VK_HOME: oldPos = _cursor; if(_cursor != 0) moveCursorTo(0); if(e.isShiftDown()) changeSelection(_cursor,oldPos,DIR_LEFT); else if(_selStart != -1) clearSelection(); break; case VK_END: oldPos = _cursor; if(_cursor != _str.length()) moveCursorTo(_str.length()); if(e.isShiftDown()) changeSelection(_cursor,oldPos,DIR_RIGHT); else if(_selStart != -1) clearSelection(); break; } } repaint(); }
void incrementCursor() { position++; if(position > SCREEN_WIDTH * SCREEN_HEIGHT - 1) scrollScreen(); else moveCursorTo(); }
void Editable::deleteSelection() { if(_selStart != -1) { _str.erase(_selStart,_selEnd - _selStart); makeDirty(true); moveCursorTo(_selStart); clearSelection(); } }
void Editable::onMouseReleased(const MouseEvent &e) { UIElement::onMouseReleased(e); if(_startSel) { moveCursorTo(getPosAt(e.getPos().x)); clearSelection(); repaint(); } _startSel = false; _selecting = false; }
void Editable::onMouseMoved(const MouseEvent &e) { UIElement::onMouseMoved(e); if(_selecting) { int pos = getPosAt(e.getPos().x); uchar dir = pos > (int)_cursor ? DIR_RIGHT : DIR_LEFT; changeSelection(pos,pos,dir); moveCursorTo(pos); repaint(); } }
void deleteChar() { if(position == 0) return; position--; moveCursorTo(); unsigned char* memory = (unsigned char*)VIDEO_MEMORY; *memory = ' '; *(memory + 1) = 15; }
void Minitel::moveCursorTo(byte location) { if (location == HOME || location == LINE_END || location == TOP_LEFT) { serialprint7(location); } else if (location == CENTER || location == TOP_RIGHT || location == BOTTOM_RIGHT || location == BOTTOM_LEFT) { if (location == CENTER) { moveCursorTo(20, 12); } else if (location == TOP_RIGHT) { moveCursorTo(40, 1); } else if (location == BOTTOM_RIGHT) { moveCursorTo(40, 24); } else if (location == BOTTOM_LEFT) { moveCursorTo(1, 24); } refreshSettings() ; } }
void Minitel::rect(byte c, int x, int y, int w, int h) { moveCursorTo(x, y); textByte(c); repeat(w); moveCursorTo(x, y+1); for (int i=0; i<h-2; i++) { textByte(c); moveCursor(DOWN); moveCursor(LEFT); } moveCursorTo(x+w, y+1); for (int i=0; i<h-2; i++) { textByte(c); moveCursor(DOWN); moveCursor(LEFT); } moveCursorTo(x, y+h-1); textByte(c); repeat(w); }
void FixtureMainTimingUI::mousePressEvent(QMouseEvent* ev) { m_bMousePressed = true; if(!m_bShiftPressed){ emit releaseCuesSelection(); } //Update Cursor int mouseX = ui->graphicsView->mapFromGlobal(QCursor::pos()).x(); int sceneWidth = ui->graphicsView->width(); if(0 < mouseX && mouseX < sceneWidth){ unsigned int newCursorPos = mouseX * m_iTimeSeen / sceneWidth + m_uiViewMinTime; emit moveCursorTo(newCursorPos); } //if(on cue): select/toggle //else: emit release cue }
void GEMapGrid::touch(int key_event, int type, GEMapCell *cell) { printf("KEY_EVENT %d\n", key_event); if (key_event != KEV_MOUSE_RIGHT) { switch (type) { case KEV_MOUSE_DOWN: selection.start = cell->map_position; selection.end = empty_cell_vector; break; case KEV_MOUSE_UP: selection.end = cell->map_position; select(selection); break; case KEV_MOUSE_OVER: printf("Mouse over\n"); moveCursorTo(cell); break; } } }
void Minitel::graphic(String s, int x, int y){ moveCursorTo(x, y); graphic(s); }
void Minitel::specialChar(byte c, int x, int y) { moveCursorTo(x, y); specialChar(c); }
void Minitel::text(String s, int x, int y, int orientation) { moveCursorTo(x, y); text(s, orientation); }
boolean Minitel::textChar(byte c, int x, int y) { moveCursorTo(x, y); return textChar(c); }
void setXY(unsigned short x, unsigned short y) { position = y * SCREEN_WIDTH + x; moveCursorTo(); }
void Minitel::clearLine(int y) { moveCursorTo(1, y); text(" ", 0, y, HORIZONTAL); }
void Minitel::textByte(byte b, int x, int y) { moveCursorTo(x, y); textByte(b); }
void GEMapGrid::moveCursorTo(GEMapCell *cell) { moveCursorTo(cell->map_position); }