Exemplo n.º 1
0
/**
 *  Inserts a input prompt at the end of the document
 */
void CommandLineInterpreter::insertInputPrompt()
{
  const int prevPromptLineIndex = m_currentPromptLineIndex;
  if(!text().endsWith("\n")) append("\n"); // If the text is already on a new line don't bother with another
  moveCursorToStartOfLastLine();
  m_currentPromptLineIndex = indexOfLastLine();
  // Order is important. Qscintilla tries to make the markers
  // follow the cursor so we have to add the new one
  // then restore the original
  markerAdd(m_currentPromptLineIndex, m_promptKey);
  markerAdd(prevPromptLineIndex, m_promptKey);
}
Exemplo n.º 2
0
/**
 * Set the marker state
 * @param enabled :: If true then the progress arrow is enabled
 */
void ScriptEditor::setMarkerState(bool enabled) {
    if (enabled) {
        setMarkerBackgroundColor(QColor("gray"), m_progressArrowKey);
        markerAdd(0, m_progressArrowKey);
    } else {
        markerDeleteAll();
    }
}
Exemplo n.º 3
0
void Buffer::toggleBookmark(int line) {
    if (line < 0) {
        line = lineFromPosition(currentPos());
    }
    if (markerGet(line) & (1 << Bookmark)) {
        markerDelete(line, Bookmark);
    } else {
        markerAdd(line, Bookmark);
    }
}
Exemplo n.º 4
0
void QSPEditor::onMarginClicked(int nmargin, int nline,
                                Qt::KeyboardModifiers modifiers)
{
    Q_UNUSED(nmargin);
    Q_UNUSED(modifiers);
    // Toggle marker for the line the margin was clicked on
    if (markersAtLine(nline) != 0 )
        markerDelete(nline, ARROW_MARKER_NUM);
    else
        markerAdd(nline, ARROW_MARKER_NUM);
}
Exemplo n.º 5
0
void SonicPiScintilla::setLineErrorMarker(int lineNumber){

  markerDeleteAll(-1);
  markerAdd(lineNumber, 8);

  // Perhaps consider a more manual way of returning this functionality:
  // int currlinenum, index;
  // getCursorPosition(&currlinenum, &index);
  // if (lineNumber != currlinenum) {
  //   setCursorPosition(lineNumber, 0);
  // }

}
Exemplo n.º 6
0
/**
 * Update the arrow marker to point to the correct line and colour it depending
 * on the error state
 * @param lineno :: The line to place the marker at. A negative number will
 * clear all markers
 * @param error :: If true, the marker will turn red
 */
void ScriptEditor::updateProgressMarker(int lineno, bool error) {
    m_currentExecLine = lineno;
    if (error) {
        setMarkerBackgroundColor(g_error_colour, m_progressArrowKey);
    } else {
        setMarkerBackgroundColor(g_success_colour, m_progressArrowKey);
    }
    markerDeleteAll();
    // Check the lineno actually exists, -1 means delete
    if (lineno <= 0 || lineno > this->lines())
        return;

    ensureLineVisible(lineno);
    markerAdd(m_currentExecLine - 1, m_progressArrowKey);
}
Exemplo n.º 7
0
void DocumentEditor::toggleBookmark(int margin_, int line_, Qt::KeyboardModifiers state_) {
	(void)margin_;
	(void)state_;
	if(markersAtLine(line_) & MARKER_BOOK_MASK) {
		for (int i = 0; i < _bookmarks.size(); i++) {
			int id = _bookmarks.at(i);
			int xline = markerLine(id);
			if (xline == line_) {
				markerDeleteHandle(id);
				_bookmarks.removeAt(i);
				i--;
			}
		}
		return;
	}
	int id = markerAdd(line_, MARKER_BOOK);
	_bookmarks.append(id);
}
Exemplo n.º 8
0
 void QSourceCodeWidget::MarkLine( int markerID, int lineno ){
     markerAdd( lineno-1, markerID );
 }