示例#1
0
// repaint cells that have been changed from previous generation
void Pstable::repaint_changed()
{
    int rows = procview->procs.size();
    int cols = procview->cats.size();
    int left = leftCell(), right = lastColVisible();
    int top = topCell(), bottom = lastRowVisible();
    if(right >= cols) right = cols - 1;
    if(bottom >= rows) bottom = rows - 1;
    int far_right = right;
    if(leftmostchanged != -1 && right >= leftmostchanged)
	right = leftmostchanged - 1;
    for(int c = right + 1; c <= far_right; c++)
	updateHeading(c);
    for(int r = top; r <= bottom; r++) {
	for(int c = left; c <= right; c++) {
	    Category *cat = procview->cats[c];
	    Procinfo *p = procview->procs[r], *op = 0;
	    if(r >= procview->old_procs.size()
	       || (op = procview->old_procs[r], cat->compare(p, op) != 0)
	       || p->selected != op->selected) {
		updateCell(r, c);
	    }
	}
	// update all cells that have moved or changed width
	for(int c = right + 1; c <= far_right; c++)
	    updateCell(r, c);
    }
    if(leftmostchanged != -1)
	clearRight();
}
示例#2
0
void KFinderWin::setBranchVisible( KFinderItem* startItem )
{
  KFinderItem* curItem;
  int i1 = -1, i2 = -1;
  int branchLevel = -1;
  bool bFound = false;
  QListIterator<KFinderItem> it( itemList );
  //for ( ; it.current(); ++it )
  for ( curItem = finder->first(); curItem != 0; curItem = finder->next() )
  {
    if( bFound ){
      i2++;
      if( curItem->getLevel() <= branchLevel )
        break;
    }
    else {
      i1++;
      if( curItem == startItem ) {
	branchLevel = curItem->getLevel();
	i2 = i1;
	bFound = true;
      }    
    }
  }
  
  int lastRow = lastRowVisible();
  if( (i2 - i1) > lastRow - topCell() - 2 )
    setTopCell( i1 ? (i1 - 1) : i1 );
  else if( i2 > lastRow ) {
         int newTopCell = topCell() + ( i2 - lastRow );
         if( findRow(minViewY() + cellHeight() - 1) != topCell())
           newTopCell++;
         setTopCell( newTopCell );
       }
       else if( i1 < topCell() ) {
         int newTopCell = topCell() - ( topCell() - i1 );
	 if( newTopCell )
           newTopCell--;
         setTopCell( newTopCell );
       }	 
}
示例#3
0
// repaint cells that have been changed due to configuration change
void Pstable::repaint_statically_changed(int update_col)
{
    int rows = procview->procs.size();
    int cols = procview->cats.size();
    int right = lastColVisible(), left = right + 1;
    int top = topCell(), bottom = lastRowVisible();
    if(leftmostchanged == -1 || leftmostchanged > update_col)
	leftmostchanged = update_col;
    if(leftmostchanged != -1)
	left = leftmostchanged;
    if(right >= cols) right = cols - 1;
    if(bottom >= rows) bottom = rows - 1;
    for(int c = left; c <= right; c++)
	updateHeading(c);
    for(int r = top; r <= bottom; r++) {
	for(int c = left; c <= right; c++)
	    updateCell(r, c);
    }
    if(leftmostchanged != -1)
	clearRight();
}
示例#4
0
文件: htable.cpp 项目: pmattern/qps
void TableBody::timerEvent(QTimerEvent *)
{
    // timer not proved !
    return;
    // printf("timer\n");
    if (!autoscrolling)
        return;
    ////killTimers();
    if (scrolldir == UP)
    {
        int top = topCell();
        setTopCell((top > 1) ? top - 1 : 0);
        dragSelectTo(topCell());
    }
    else
    {
        setTopCell(topCell() + 1);
        int bottom = lastRowVisible();
        dragSelectTo((bottom < numRows()) ? bottom : numRows() - 1);
    }
    startTimer(scroll_delay);
}
/**
 * Query whether the text contents can fit one one page or needs scrolling.
 *
 * @return true if scrolling is needed to show all the contents.
 */
bool TextViewer::needScrolling() {
    return  lastRowVisible() != numLines() - 1;
}