webengine/webkitutils/HistoryProvider/HistoryView.cpp
branchRCL_3
changeset 93 79859ed3eea9
parent 84 800203832575
child 94 919f36ff910f
equal deleted inserted replaced
92:e1bea15f9a39 93:79859ed3eea9
    44 const int KFastScrollAnimFactorInc = 40;
    44 const int KFastScrollAnimFactorInc = 40;
    45 const int KMaxAnimFactor = 100;
    45 const int KMaxAnimFactor = 100;
    46 const int KMinAnimFactor = 0;
    46 const int KMinAnimFactor = 0;
    47 const int KMinimumScroll = 20;
    47 const int KMinimumScroll = 20;
    48 
    48 
    49 #define KCenterImageBorderColor TRgb(179,179,181)
    49 #define KCenterImageBorderColor KRgbRed
    50 #define KSideImageBorderColor KRgbBlack
    50 #define KSideImageBorderColor KRgbBlack
    51 #define KSideImageMaskColor TRgb(170, 170, 170)
       
    52 
    51 
    53 // ============================= LOCAL FUNCTIONS ===============================
    52 // ============================= LOCAL FUNCTIONS ===============================
    54 
    53 
    55 TBool animRepaint(TAny* aAny)
    54 TBool animRepaint(TAny* aAny)
    56 {
    55 {
   140     delete m_repaintTimer;
   139     delete m_repaintTimer;
   141     if (m_autoScrollPeriodic) {
   140     if (m_autoScrollPeriodic) {
   142         m_autoScrollPeriodic->Cancel();
   141         m_autoScrollPeriodic->Cancel();
   143         delete m_autoScrollPeriodic;
   142         delete m_autoScrollPeriodic;
   144     }
   143     }
   145     delete m_maskBitmap;
       
   146 }
   144 }
   147 
   145 
   148 bool HistoryView::calcRepaintRect()
   146 bool HistoryView::calcRepaintRect()
   149 {
   147 {
   150     if (m_resizeFactor == KMaxAnimFactor) {
   148     if (m_resizeFactor == KMaxAnimFactor) {
   265 //
   263 //
   266 void HistoryView::updateDisplay()
   264 void HistoryView::updateDisplay()
   267 {
   265 {
   268     m_bitmapContext->Clear();
   266     m_bitmapContext->Clear();
   269     m_bitmapContext->Reset();
   267     m_bitmapContext->Reset();
   270     
       
   271     m_bitmapContext->SetPenColor(TRgb(45,44,50));
       
   272     m_bitmapContext->SetPenStyle(CGraphicsContext::ESolidPen);
       
   273     m_bitmapContext->SetBrushColor(KRgbDarkGray);
       
   274     m_bitmapContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   275     m_bitmapContext->DrawRect(Rect());
       
   276 	m_bitmapContext->SetBrushStyle(CGraphicsContext::ENullBrush);
       
   277     m_bitmapContext->SetPenStyle(CGraphicsContext::ENullPen);
       
   278 	
       
   279 
   268 
   280     // updateDisplay something to the bitmap
   269     // updateDisplay something to the bitmap
   281     m_centerEntry = m_historyController->entryByIndex( m_centerPageIndex );
   270     m_centerEntry = m_historyController->entryByIndex( m_centerPageIndex );
   282     HistoryEntry* leftEntry = m_historyController->entryByIndex( m_centerPageIndex-1 );
   271     HistoryEntry* leftEntry = m_historyController->entryByIndex( m_centerPageIndex-1 );
   283     HistoryEntry* rightEntry = m_historyController->entryByIndex( m_centerPageIndex+1 );
   272     HistoryEntry* rightEntry = m_historyController->entryByIndex( m_centerPageIndex+1 );
   284     if (leftEntry) {
   273     if (leftEntry) {
   285         if (!leftEntry->thumbnail()) {
   274         if (!leftEntry->thumbnail()) {
   286             TRAP_IGNORE(leftEntry->constructThumbnailL());
   275             TRAP_IGNORE(leftEntry->constructThumbnailL());
   287         }
   276         }
   288         if (leftEntry->thumbnail()) {
   277         if (leftEntry->thumbnail()) {
   289             if(!m_maskBitmap) {
   278             m_bitmapContext->BitBlt( m_leftPlaceHolderRect.iTl, leftEntry->thumbnail(), TRect(TPoint(0,0), m_leftPlaceHolderRect.Size()) );
   290                 TSize maskBitmapSize(m_leftPlaceHolderRect.Size());
   279         }
   291                 TRAP_IGNORE(CreateMaskBitmapForLeftRightThumbnailL(maskBitmapSize, EGray256, KSideImageMaskColor));
   280         m_bitmapContext->SetPenColor( KSideImageBorderColor );
   292             }
   281         m_bitmapContext->DrawRect(m_leftPlaceHolderRect);
   293             if(m_maskBitmap) {
       
   294                 m_bitmapContext->BitBltMasked(m_leftPlaceHolderRect.iTl, leftEntry->thumbnail(), TRect(TPoint(0,0), m_leftPlaceHolderRect.Size()), m_maskBitmap, EFalse);
       
   295             }
       
   296             else {
       
   297                 //if failed to create a mask, just draw the left entry thumbnail.
       
   298                 m_bitmapContext->BitBlt( m_leftPlaceHolderRect.iTl, leftEntry->thumbnail(), TRect(TPoint(0,0), m_leftPlaceHolderRect.Size()) );
       
   299             }
       
   300         }
       
   301     }
   282     }
   302     // updateDisplay the next thumbnail
   283     // updateDisplay the next thumbnail
   303     if (rightEntry) {
   284     if (rightEntry) {
   304         if (!rightEntry->thumbnail()) {
   285         if (!rightEntry->thumbnail()) {
   305             TRAP_IGNORE(rightEntry->constructThumbnailL());
   286             TRAP_IGNORE(rightEntry->constructThumbnailL());
   306         }
   287         }
   307         if (rightEntry->thumbnail()) {
   288         if (rightEntry->thumbnail()) {
   308             if(!m_maskBitmap) {
   289             m_bitmapContext->BitBlt( m_rightPlaceHolderRect.iTl, rightEntry->thumbnail(), TRect(TPoint(0,0), m_rightPlaceHolderRect.Size()) );
   309                 TSize maskBitmapSize(m_rightPlaceHolderRect.Size());
   290         }
   310                 TRAP_IGNORE(CreateMaskBitmapForLeftRightThumbnailL(maskBitmapSize, EGray256, KSideImageMaskColor));
   291         m_bitmapContext->SetPenColor( KSideImageBorderColor );
   311             }
   292         m_bitmapContext->DrawRect(m_rightPlaceHolderRect);
   312             if(m_maskBitmap) {
       
   313                 m_bitmapContext->BitBltMasked(m_rightPlaceHolderRect.iTl, rightEntry->thumbnail(), TRect(TPoint(0,0), m_rightPlaceHolderRect.Size()), m_maskBitmap, EFalse);
       
   314             }
       
   315             else {
       
   316                 //if failed to create a mask, just draw the right entry thumbnail.
       
   317                 m_bitmapContext->BitBlt( m_rightPlaceHolderRect.iTl, rightEntry->thumbnail(), TRect(TPoint(0,0), m_rightPlaceHolderRect.Size()) );
       
   318             }
       
   319         }
       
   320     }
   293     }
   321     // updateDisplay the center thumbnail
   294     // updateDisplay the center thumbnail
   322     if (m_centerEntry ) {
   295     if (m_centerEntry ) {
   323         if (!m_centerEntry->thumbnail()) {
   296         if (!m_centerEntry->thumbnail()) {
   324             TRAP_IGNORE(m_centerEntry->constructThumbnailL());
   297             TRAP_IGNORE(m_centerEntry->constructThumbnailL());
   325         }
   298         }
   326         if (m_centerEntry->thumbnail()) {
   299         if (m_centerEntry->thumbnail()) {
   327             m_bitmapContext->SetBrushColor(KRgbWhite);
       
   328             m_bitmapContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   329             m_bitmapContext->DrawRect(m_centerPlaceHolderRect);    
       
   330             m_bitmapContext->SetBrushStyle(CGraphicsContext::ENullBrush);
       
   331             TSize bitSize = m_centerEntry->thumbnail()->SizeInPixels();
       
   332             m_bitmapContext->BitBlt( m_centerPlaceHolderRect.iTl, m_centerEntry->thumbnail(), TRect(TPoint(0,0), m_centerPlaceHolderRect.Size()) );
   300             m_bitmapContext->BitBlt( m_centerPlaceHolderRect.iTl, m_centerEntry->thumbnail(), TRect(TPoint(0,0), m_centerPlaceHolderRect.Size()) );
   333         }
   301         }
   334     }
   302     }
   335     
       
   336     //Draw border for center thumbnail
       
   337     m_bitmapContext->SetPenStyle( CGraphicsContext:: ESolidPen );
       
   338     m_bitmapContext->SetPenColor( KCenterImageBorderColor );
   303     m_bitmapContext->SetPenColor( KCenterImageBorderColor );
       
   304 
   339     m_bitmapContext->DrawRect( m_centerPlaceHolderRect );
   305     m_bitmapContext->DrawRect( m_centerPlaceHolderRect );
   340 
   306 
   341     // Reset Brush
   307     // Reset Brush
   342     m_bitmapContext->SetBrushColor(TRgb(255,255,255));
   308     m_bitmapContext->SetBrushColor(TRgb(255,255,255));
   343     m_bitmapContext->SetBrushStyle(CGraphicsContext::ENullBrush);
   309     m_bitmapContext->SetBrushStyle(CGraphicsContext::ENullBrush);
   344     m_bitmapContext->SetPenStyle(CGraphicsContext::ENullPen);
       
   345   // updateState(-1);
   310   // updateState(-1);
   346 }
   311 }
   347 
   312 
   348 // ----------------------------------------------------------------------------
   313 // ----------------------------------------------------------------------------
   349 // HistoryView::getCenterEntryTitle
   314 // HistoryView::getCenterEntryTitle
   839             m_historyController->historyCallback()->navigationStateChanged(TBrCtlDefs::EStateHistoryEnd, false);
   804             m_historyController->historyCallback()->navigationStateChanged(TBrCtlDefs::EStateHistoryEnd, false);
   840         }
   805         }
   841 
   806 
   842     }
   807     }
   843 }
   808 }
   844 
       
   845 void HistoryView::CreateMaskBitmapForLeftRightThumbnailL(TSize& aSize, TDisplayMode aDisplayMode, TRgb aRgb)
       
   846 {
       
   847     if(m_maskBitmap) {
       
   848         delete m_maskBitmap;
       
   849         m_maskBitmap = NULL;
       
   850     }
       
   851     m_maskBitmap = new (ELeave) CFbsBitmap();
       
   852     User::LeaveIfError(m_maskBitmap->Create(aSize, aDisplayMode));
       
   853     CFbsBitmapDevice* maskBitmapDevice = CFbsBitmapDevice::NewL(m_maskBitmap);
       
   854     CFbsBitGc* maskBitmapContext;
       
   855     User::LeaveIfError(maskBitmapDevice->CreateContext(maskBitmapContext));
       
   856     maskBitmapContext->SetPenStyle( CGraphicsContext::ENullPen );
       
   857     maskBitmapContext->SetBrushColor( aRgb );
       
   858     maskBitmapContext->SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   859     maskBitmapContext->DrawRect(TRect(TPoint(0,0), m_maskBitmap->SizeInPixels()));
       
   860     delete maskBitmapContext;
       
   861     delete maskBitmapDevice;
       
   862 }
       
   863 //  End of File
   809 //  End of File