Logo Search packages:      
Sourcecode: kdeutils-kde4 version File versions  Download package

void KHEUI::KByteArrayView::updateChanged (  )  [protected]

repaints all the parts that are signed as changed

Definition at line 1412 of file kbytearrayview.cpp.

References BufferLayout, BufferRanges, KHE::KRange< T >::end(), KHE::KSection::fromWidth(), hasChanged(), KHEUI::KColumn::isVisible(), KHEUI::KColumnsView::lineHeight(), KHEUI::KDataLayout::noOfBytesPerLine(), KHEUI::KColumn::overlaps(), KHEUI::KDataColumn::preparePainting(), KHEUI::KDataRanges::resetChangedRanges(), KHE::KRange< T >::start(), KHEUI::KColumnsView::visibleHeight(), KHEUI::KColumnsView::visibleLines(), KHEUI::KColumnsView::visibleWidth(), KHE::KSection::width(), KHEUI::KColumnsView::xOffset(), and KHEUI::KColumnsView::yOffset().

Referenced by selectAll(), selectWord(), and setCursorPosition().

{
  KPixelXs Xs = KPixelXs::fromWidth( xOffset(), visibleWidth() );

  // collect affected buffer columns
  QList<KDataColumn*> DirtyColumns;

  KDataColumn *C = ValueColumn;
  while( true )
  {
    if( C->isVisible() && C->overlaps(Xs) )
    {
      DirtyColumns.append( C );
      C->preparePainting( Xs );
    }

    if( C == CharColumn )
      break;
    C = CharColumn;
  }

  // any colums to paint?
  if( DirtyColumns.size() > 0 )
  {
    KPixelYs Ys = KPixelYs::fromWidth( yOffset(), visibleHeight() );

    // calculate affected lines/indizes
    KHE::KSection FullPositions( 0, BufferLayout->noOfBytesPerLine()-1 );
    KCoordRange VisibleRange( FullPositions, visibleLines(Ys) );

    KCoordRange ChangedRange;
    // as there might be multiple selections on this line redo until no more is changed
    while( hasChanged(VisibleRange,&ChangedRange) )
    {
      KPixelY cy = ChangedRange.start().line() * lineHeight() - yOffset();

      QListIterator<KDataColumn*> it( DirtyColumns );
      // only one line?
      if( ChangedRange.start().line() == ChangedRange.end().line() )
      {
        while( it.hasNext() )
        {
          KPixelXs XPixels =
            it.next()->wideXPixelsOfPos( KHE::KSection(ChangedRange.start().pos(),ChangedRange.end().pos()) );

          viewport()->update( XPixels.start()-xOffset(), cy, XPixels.width(), lineHeight() );
        }
      }
      //
      else
      {
        // first line
        while( it.hasNext() )
        {
          KPixelXs XPixels =
            it.next()->wideXPixelsOfPos( KHE::KSection(ChangedRange.start().pos(),FullPositions.end()) );

          viewport()->update( XPixels.start()-xOffset(), cy, XPixels.width(), lineHeight() );
        }

        // at least one full line?
        for( int l = ChangedRange.start().line()+1; l < ChangedRange.end().line(); ++l )
        {
          cy += lineHeight();
          it.toFront();
          while( it.hasNext() )
          {
            KPixelXs XPixels =
              it.next()->wideXPixelsOfPos( FullPositions );

            viewport()->update( XPixels.start()-xOffset(), cy, XPixels.width(), lineHeight() );
          }
        }

        // last line
        cy += lineHeight();
        it.toFront();
        while( it.hasNext() )
        {
          KPixelXs XPixels =
            it.next()->wideXPixelsOfPos( KHE::KSection(FullPositions.start(),ChangedRange.end().pos()) );

          viewport()->update( XPixels.start()-xOffset(), cy, XPixels.width(), lineHeight() );
        }
      }

      // continue the search at the overnext index
      VisibleRange.setStart( ChangedRange.end()+2 );
      if( !VisibleRange.isValid() )
        break;
    }
  }

  BufferRanges->resetChangedRanges();
}


Generated by  Doxygen 1.6.0   Back to index