Ejemplo n.º 1
0
	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();
	}
Ejemplo n.º 2
0
void incrementCursor()
{
	position++;
	if(position > SCREEN_WIDTH * SCREEN_HEIGHT - 1)
		scrollScreen();
	else
		moveCursorTo();
}
Ejemplo n.º 3
0
	void Editable::deleteSelection() {
		if(_selStart != -1) {
			_str.erase(_selStart,_selEnd - _selStart);
			makeDirty(true);
			moveCursorTo(_selStart);
			clearSelection();
		}
	}
Ejemplo n.º 4
0
	void Editable::onMouseReleased(const MouseEvent &e) {
		UIElement::onMouseReleased(e);
		if(_startSel) {
			moveCursorTo(getPosAt(e.getPos().x));
			clearSelection();
			repaint();
		}
		_startSel = false;
		_selecting = false;
	}
Ejemplo n.º 5
0
	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();
		}
	}
Ejemplo n.º 6
0
void deleteChar()
{
	if(position == 0)
		return;
	position--;
	moveCursorTo();
	unsigned char* memory = (unsigned char*)VIDEO_MEMORY;
	*memory = ' ';
	*(memory + 1) = 15;
}
Ejemplo n.º 7
0
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()  ;
  }
}
Ejemplo n.º 8
0
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
}
Ejemplo n.º 10
0
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;
    }
  }
}
Ejemplo n.º 11
0
void Minitel::graphic(String s, int x, int y){
  moveCursorTo(x, y);
  graphic(s); 
}
Ejemplo n.º 12
0
void Minitel::specialChar(byte c, int x, int y) {
  moveCursorTo(x, y);
  specialChar(c);
}
Ejemplo n.º 13
0
void Minitel::text(String s, int x, int y, int orientation) {
  moveCursorTo(x, y);
  text(s, orientation);
}
Ejemplo n.º 14
0
boolean Minitel::textChar(byte c, int x, int y) {
  moveCursorTo(x, y);
  return textChar(c);  
}
Ejemplo n.º 15
0
void setXY(unsigned short x, unsigned short y)
{
	position = y * SCREEN_WIDTH + x;
	moveCursorTo();
}
Ejemplo n.º 16
0
void Minitel::clearLine(int y) {
  moveCursorTo(1, y);
  text("                                        ", 0, y, HORIZONTAL); 
}
Ejemplo n.º 17
0
void Minitel::textByte(byte b, int x, int y) {
  moveCursorTo(x, y);
  textByte(b);  
}
Ejemplo n.º 18
0
void GEMapGrid::moveCursorTo(GEMapCell *cell)
{
  moveCursorTo(cell->map_position);
}