Exemple #1
0
Screen::Screen(int l, int c)
  : lines(l),
    columns(c),
    screenLines(new ImageLine[lines+1] ),
    _scrolledLines(0),
    _droppedLines(0),
    hist(new HistoryScrollNone()),
    cuX(0), cuY(0),
    cu_re(0),
    tmargin(0), bmargin(0),
    tabstops(0),
    sel_begin(0), sel_TL(0), sel_BR(0),
    sel_busy(false),
    columnmode(false),
    ef_fg(CharacterColor()), ef_bg(CharacterColor()), ef_re(0),
    sa_cuX(0), sa_cuY(0),
    sa_cu_re(0),
    lastPos(-1)
{
  lineProperties.resize(lines+1);
  for (int i=0;i<lines+1;i++)
          lineProperties[i]=LINE_DEFAULT;

  initTabStops();
  clearSelection();
  reset();
}
void Screen::resizeImage(int new_lines, int new_columns)
{
    if ((new_lines==lines) && (new_columns==columns)) return;

    if (cuY > new_lines-1)
    { // attempt to preserve focus and lines
        _bottomMargin = lines-1; //FIXME: margin lost
        for (int i = 0; i < cuY-(new_lines-1); i++)
        {
            addHistLine(); scrollUp(0,1);
        }
    }

    // create new screen lines and copy from old to new

    ImageLine* newScreenLines = new ImageLine[new_lines+1];
    for (int i=0; i < qMin(lines-1,new_lines+1) ;i++)
        newScreenLines[i]=screenLines[i];
    for (int i=lines;(i > 0) && (i<new_lines+1);i++)
        newScreenLines[i].resize( new_columns );

    lineProperties.resize(new_lines+1);
    for (int i=lines;(i > 0) && (i<new_lines+1);i++)
        lineProperties[i] = LINE_DEFAULT;

    clearSelection();

    delete[] screenLines;
    screenLines = newScreenLines;

    lines = new_lines;
    columns = new_columns;
    cuX = qMin(cuX,columns-1);
    cuY = qMin(cuY,lines-1);

    // FIXME: try to keep values, evtl.
    _topMargin=0;
    _bottomMargin=lines-1;
    initTabStops();
    clearSelection();
}
Screen::Screen(int l, int c)
    : lines(l),
    columns(c),
    screenLines(new ImageLine[lines+1] ),
    _scrolledLines(0),
    _droppedLines(0),
    history(new HistoryScrollNone()),
    cuX(0), cuY(0),
    currentRendition(0),
    _topMargin(0), _bottomMargin(0),
    selBegin(0), selTopLeft(0), selBottomRight(0),
    blockSelectionMode(false),
    effectiveForeground(CharacterColor()), effectiveBackground(CharacterColor()), effectiveRendition(0),
    lastPos(-1)
{
    lineProperties.resize(lines+1);
    for (int i=0;i<lines+1;i++)
        lineProperties[i]=LINE_DEFAULT;

    initTabStops();
    clearSelection();
    reset();
}