void RoboScintilla::updateLineNumbersMarginWidth()
    {
        int numberOfDigits = getNumberOfDigits(lines());
        _lineNumberMarginWidth = numberOfDigits * _lineNumberDigitWidth + rowNumberWidth;

        // If line numbers margin already displayed, update its width
        if (lineNumberMarginWidth()) {
            setMarginWidth(0, _lineNumberMarginWidth);
        }
    }
Esempio n. 2
0
void FastoScintilla::updateLineNumbersMarginWidth() {
  int numberOfDigits = getNumberOfDigits(lines());

  int tw = textWidth(QsciScintilla::STYLE_LINENUMBER, "0");
  lineNumberMarginWidth_ = numberOfDigits * tw + rowNumberWidth;

  // If line numbers margin already displayed, update its width
  if (lineNumberMarginWidth()) {
    setMarginWidth(0, lineNumberMarginWidth_);
  }
}
Esempio n. 3
0
/**
 * Converts the given location (row, column) to a spreadsheet cell reference i.e. A1
 */
CellReference *convertToCellReference(const MatrixLocation *location)
{
    CellReference *ref = malloc(sizeof(CellReference));

    char *colRef = malloc(sizeof(char) * getNumberOfDigits(location->col) + 1);
    sprintf(colRef, "%d", location->col + 1);

    // row ref + col ref + null terminator
    ref->cellReference = malloc(sizeof(char) * (1 + strlen(colRef) + 1) + 1);
    sprintf(ref->cellReference, "%c%s", (char)(location->row + ROW_TO_ASCII_OFFSET), colRef);
    free(colRef);

    return ref;
}