예제 #1
0
void SonicPiScintilla::newlineAndIndent() {
  int point_line, point_index, first_line;
  getCursorPosition(&point_line, &point_index);
  first_line = firstVisibleLine();

  std::string code = text().toStdString();

  // TODO: fix this:
  std::string id = "foobar";

  oscSender->bufferNewlineAndIndent(point_line, point_index, first_line, code, fileName.toStdString(), id);
}
예제 #2
0
void QScintillaWidget::setCursorPosition(int pLine, int pColumn)
{
    // Make sure that the line and column numbers make sense

    pLine = qMin(qMax(0, pLine), lines()-1);
    pColumn = qMin(qMax(0, pColumn), text(pLine).size()-1);

    // Make sure that the line is not within a folded block

    ensureLineVisible(pLine);

    // Center ourselves around the given line

    SendScintilla(SCI_LINESCROLL, 0, pLine-firstVisibleLine()-0.5*SendScintilla(SCI_LINESONSCREEN));

    // Set our cursor position

    QsciScintilla::setCursorPosition(pLine, pColumn);
}